File tree 3 files changed +21
-2
lines changed
compiler/src/dotty/tools/dotc/transform
3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -567,8 +567,9 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
567
567
case Quoted (quotedTree) =>
568
568
quotation(quotedTree, tree)
569
569
case tree : TypeTree if tree.tpe.typeSymbol.isSplice =>
570
- val splicedType = tree.tpe.asInstanceOf [TypeRef ].prefix.termSymbol
571
- splice(ref(splicedType).select(tpnme.UNARY_~ ))
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_~ ))
572
573
case tree : Select if tree.symbol.isSplice =>
573
574
splice(tree)
574
575
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[~ t]( // error
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 ] =
6
+ ' { val y : ~ t = ~ x; ~ loop('(y)) }
7
+ }
You can’t perform that action at this time.
0 commit comments