@@ -674,6 +674,9 @@ trait Implicits { self: Typer =>
674674 EmptyTree
675675 }
676676
677+ /** Synthesize the tree for `'[T]` for an implicit `scala.quoted.Type[T]`.
678+ * `T` is deeply dealiassed to avoid references to local type aliases.
679+ */
677680 lazy val synthesizedTypeTag : SpecialHandler =
678681 (formal : Type , span : Span ) => implicit (ctx : Context ) => {
679682 def quotedType (t : Type ) = {
@@ -682,26 +685,11 @@ trait Implicits { self: Typer =>
682685 ref(defn.InternalQuoted_typeQuote ).appliedToType(t)
683686 }
684687 formal.argInfos match {
685- case arg :: Nil if ! arg.typeSymbol.is(Param ) =>
686- object bindFreeVars extends TypeMap {
687- var ok = true
688- def apply (t : Type ) = t match {
689- case t @ TypeRef (NoPrefix , _) =>
690- inferImplicit(defn.QuotedTypeType .appliedTo(t), EmptyTree , span) match {
691- case SearchSuccess (tag, _, _) if tag.tpe.isStable =>
692- tag.tpe.select(defn.QuotedType_splice )
693- case _ =>
694- ok = false
695- t
696- }
697- case _ => t
698- }
688+ case arg :: Nil =>
689+ val deepDealias = new TypeMap {
690+ def apply (tp : Type ): Type = mapOver(tp.dealias)
699691 }
700- val tag = bindFreeVars(arg)
701- if (bindFreeVars.ok) quotedType(tag)
702- else EmptyTree
703- case arg :: Nil if ctx.inInlineMethod =>
704- quotedType(arg)
692+ quotedType(deepDealias(arg))
705693 case _ =>
706694 EmptyTree
707695 }
0 commit comments