Skip to content

Commit 3f97379

Browse files
Merge pull request #10257 from dotty-staging/use-correct-quote-context
Use QuoteContext directly in asExprOf
2 parents ca216a8 + 97183f6 commit 3f97379

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

compiler/src/dotty/tools/dotc/quoted/QuoteContextImpl.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern
7979
end extension
8080

8181
extension [T](self: Tree)
82-
def asExprOf(using scala.quoted.Type[T])(using QuoteContext): scala.quoted.Expr[T] =
83-
self.asExpr.asExprOf[T]
82+
def asExprOf(using tp: scala.quoted.Type[T]): scala.quoted.Expr[T] =
83+
self.asExpr.asExprOf[T](using tp)(using QuoteContextImpl.this)
8484
end extension
8585

8686
end TreeMethodsImpl

library/src/scala/tasty/Reflection.scala

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
package scala.tasty
22

3-
import scala.quoted.QuoteContext
43
import scala.tasty.reflect._
54

6-
/** TASTy Reflect Interface.
7-
*
8-
*
9-
*/
10-
115
/** TASTy Reflect Interface.
126
*
137
* Provides all functionality related with AST based metaprogramming.
@@ -112,6 +106,7 @@ import scala.tasty.reflect._
112106
* ```
113107
*/
114108
trait Reflection { reflection =>
109+
// TODO: Move Reflection inside QuoteContext as it can never be instantiated outside a QuoteContext
115110

116111
//////////////
117112
// CONTEXTS //
@@ -169,9 +164,7 @@ trait Reflection { reflection =>
169164

170165
/** Convert this tree to an `quoted.Expr[T]` if the tree is a valid expression or throws */
171166
extension [T](self: Tree)
172-
// FIXME: remove QuoteContext from parameters
173-
// TODO: Move Reflection inside QuoteContext as it can never be instantiated outside a QuoteContext
174-
def asExprOf(using scala.quoted.Type[T])(using QuoteContext): scala.quoted.Expr[T]
167+
def asExprOf(using scala.quoted.Type[T]): scala.quoted.Expr[T]
175168
}
176169

177170
/** Tree representing a pacakage clause in the source code */

0 commit comments

Comments
 (0)