File tree Expand file tree Collapse file tree 3 files changed +27
-11
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 3 files changed +27
-11
lines changed Original file line number Diff line number Diff line change @@ -161,18 +161,22 @@ class ReifyQuotes extends MacroTransformWithImplicits {
161161 */
162162 def tryHeal (tp : Type , pos : Position )(implicit ctx : Context ): Option [String ] = tp match {
163163 case tp : TypeRef =>
164- val reqType = defn.QuotedTypeType .appliedTo(tp)
165- val tag = ctx.typer.inferImplicitArg(reqType, pos)
166- tag.tpe match {
167- case fail : SearchFailureType =>
168- Some (i """
169- |
170- | The access would be accepted with the right type tag, but
171- | ${ctx.typer.missingArgMsg(tag, reqType, " " )}""" )
172- case _ =>
173- if (level > 0 ) // TODO do we need to find the tag for level 0?
164+ if (level == 0 ) {
165+ assert(ctx.owner.is(Macro ))
166+ None
167+ } else {
168+ val reqType = defn.QuotedTypeType .appliedTo(tp)
169+ val tag = ctx.typer.inferImplicitArg(reqType, pos)
170+ tag.tpe match {
171+ case fail : SearchFailureType =>
172+ Some (i """
173+ |
174+ | The access would be accepted with the right type tag, but
175+ | ${ctx.typer.missingArgMsg(tag, reqType, " " )}""" )
176+ case _ =>
174177 importedTags(tp) = nested(isQuote = false ).transform(tag)
175- None
178+ None
179+ }
176180 }
177181 case _ =>
178182 Some (" " )
Original file line number Diff line number Diff line change 1+ import scala .quoted ._
2+ object Macro {
3+ inline def ff [T ](x : T ): T = ~ impl('(x), ' [T ])
4+ def impl [T ](x : Expr [T ], t : Type [T ]): Expr [T ] = ' { (~ x): ~ t }
5+ }
Original file line number Diff line number Diff line change 1+ object Test {
2+ Macro .ff(3 )
3+
4+ def f [T ](x : T ) = {
5+ Macro .ff(x)
6+ }
7+ }
You can’t perform that action at this time.
0 commit comments