Skip to content

Commit 3ac8fd8

Browse files
committed
Fix #4023: Ignore healed implicit tag at level 0
1 parent 2476cb4 commit 3ac8fd8

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class ReifyQuotes extends MacroTransformWithImplicits {
7777
*/
7878
private class Reifier(inQuote: Boolean, val outer: Reifier, val level: Int, levels: LevelInfo) extends ImplicitsTransformer {
7979
import levels._
80+
assert(level >= 0)
8081

8182
/** A nested reifier for a quote (if `isQuote = true`) or a splice (if not) */
8283
def nested(isQuote: Boolean): Reifier =
@@ -169,7 +170,8 @@ class ReifyQuotes extends MacroTransformWithImplicits {
169170
| The access would be accepted with the right type tag, but
170171
| ${ctx.typer.missingArgMsg(tag, reqType, "")}""")
171172
case _ =>
172-
importedTags(tp) = nested(isQuote = false).transform(tag)
173+
if (level > 0) // TODO do we need to find the tag for level 0?
174+
importedTags(tp) = nested(isQuote = false).transform(tag)
173175
None
174176
}
175177
case _ =>

tests/pos/i4023/Macro_1.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import scala.quoted._
2+
object Macro {
3+
inline def ff[T: Type](x: T): T = ~impl('(x))
4+
def impl[T](x: Expr[T]): Expr[T] = x
5+
}

tests/pos/i4023/Test_2.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
object Test {
2+
Macro.ff(3)
3+
}

0 commit comments

Comments
 (0)