File tree 4 files changed +19
-3
lines changed
compiler/src/dotty/tools/dotc/transform 4 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -568,8 +568,7 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
568
568
quotation(quotedTree, tree)
569
569
case tree : TypeTree if tree.tpe.typeSymbol.isSplice =>
570
570
val splicedType = tree.tpe.stripTypeVar.asInstanceOf [TypeRef ].prefix.termSymbol
571
- if (levelOf.get(splicedType).contains(level)) tree
572
- else splice(ref(splicedType).select(tpnme.UNARY_~ ))
571
+ splice(ref(splicedType).select(tpnme.UNARY_~ ).withPos(tree.pos))
573
572
case tree : Select if tree.symbol.isSplice =>
574
573
splice(tree)
575
574
case tree : RefTree if isCaptured(tree.symbol, level) =>
Original file line number Diff line number Diff line change
1
+
2
+ import scala .quoted ._
3
+
4
+ object Test {
5
+ def loop [T ](x : Expr [T ])(implicit t : Type [T ]): Expr [T ] = ' {
6
+ val y : ~ t = ~ x
7
+ ~ loop( // error: inferred loop[~t] where T should be used
8
+ '(y)
9
+ )
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+
2
+ import scala .quoted ._
3
+
4
+ object Test {
5
+ def loop [T ](x : Expr [T ])(implicit t : Type [T ]): Expr [T ] = ' { val y = ~ x; ~ loop('(y)) }
6
+ }
Original file line number Diff line number Diff line change @@ -3,5 +3,5 @@ import scala.quoted._
3
3
4
4
object Test {
5
5
def loop [T ](x : Expr [T ])(implicit t : Type [T ]): Expr [T ] =
6
- ' { val y : ~ t = ~ x; ~ loop('(y)) }
6
+ ' { val y : T = ~ x; ~ loop('(y)) }
7
7
}
You can’t perform that action at this time.
0 commit comments