Skip to content

Commit cc00cbb

Browse files
committed
Simplify synthetization of scala.quoted.Type
1 parent 6c1edfa commit cc00cbb

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

compiler/src/dotty/tools/dotc/typer/Synthesizer.scala

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,18 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
4848
case _ => EmptyTree
4949
end synthesizedClassTag
5050

51-
/** Synthesize the tree for `'[T]` for an implicit `scala.quoted.Type[T]`.
51+
/** Synthesize the tree for `scala.quoted.Type[T]` for an implicit `scala.quoted.Type[T]`.
5252
* `T` is deeply dealiased to avoid references to local type aliases.
5353
*/
5454
val synthesizedTypeTag: SpecialHandler = (formal, span) =>
55-
def quotedType(t: Type) =
56-
val qctx = ctx.typer.inferImplicitArg(defn.QuoteContextClass.typeRef, span)
57-
qctx.tpe match
58-
case tpe: Implicits.SearchFailureType => report.error(tpe.msg, ctx.source.atSpan(span))
59-
case _ =>
60-
ref(defn.QuotedTypeModule_apply).appliedToType(t).select(nme.apply).appliedTo(qctx)
61-
formal.argInfos match
62-
case arg :: Nil =>
63-
val deepDealias = new TypeMap:
64-
def apply(tp: Type): Type = mapOver(tp.dealias)
65-
quotedType(deepDealias(arg))
55+
val qctx = ctx.typer.inferImplicitArg(defn.QuoteContextClass.typeRef, span)
56+
qctx.tpe match
57+
case tpe: Implicits.SearchFailureType => report.error(tpe.msg, ctx.source.atSpan(span))
6658
case _ =>
67-
EmptyTree
59+
val deepDealias = new TypeMap:
60+
def apply(tp: Type): Type = mapOver(tp.dealias)
61+
val t = deepDealias(formal.select(tpnme.spliceType))
62+
ref(defn.QuotedTypeModule_apply).appliedToType(t).select(nme.apply).appliedTo(qctx)
6863
end synthesizedTypeTag
6964

7065
val synthesizedTupleFunction: SpecialHandler = (formal, span) =>

0 commit comments

Comments
 (0)