@@ -9,7 +9,7 @@ import Types._, Flags._, Symbols._, Names._, StdNames._, Constants._
99import TypeErasure .{erasure , hasStableErasure }
1010import Decorators ._
1111import ProtoTypes ._
12- import Inferencing .fullyDefinedType
12+ import Inferencing .{ fullyDefinedType , isFullyDefined }
1313import ast .untpd
1414import transform .SymUtils ._
1515import transform .TypeUtils ._
@@ -30,21 +30,23 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
3030 val synthesizedClassTag : SpecialHandler = (formal, span) =>
3131 formal.argInfos match
3232 case arg :: Nil =>
33- fullyDefinedType(arg, " ClassTag argument" , span) match
34- case defn.ArrayOf (elemTp) =>
35- val etag = typer.inferImplicitArg(defn.ClassTagClass .typeRef.appliedTo(elemTp), span)
36- if etag.tpe.isError then EmptyTreeNoError else withNoErrors(etag.select(nme.wrap))
37- case tp if hasStableErasure(tp) && ! defn.isBottomClassAfterErasure(tp.typeSymbol) =>
38- val sym = tp.typeSymbol
39- val classTag = ref(defn.ClassTagModule )
40- val tag =
41- if defn.SpecialClassTagClasses .contains(sym) then
42- classTag.select(sym.name.toTermName)
43- else
44- val clsOfType = escapeJavaArray(erasure(tp))
45- classTag.select(nme.apply).appliedToType(tp).appliedTo(clsOf(clsOfType))
46- withNoErrors(tag.withSpan(span))
47- case tp => EmptyTreeNoError
33+ if isFullyDefined(arg, ForceDegree .all) then
34+ arg match
35+ case defn.ArrayOf (elemTp) =>
36+ val etag = typer.inferImplicitArg(defn.ClassTagClass .typeRef.appliedTo(elemTp), span)
37+ if etag.tpe.isError then EmptyTreeNoError else withNoErrors(etag.select(nme.wrap))
38+ case tp if hasStableErasure(tp) && ! defn.isBottomClassAfterErasure(tp.typeSymbol) =>
39+ val sym = tp.typeSymbol
40+ val classTag = ref(defn.ClassTagModule )
41+ val tag =
42+ if defn.SpecialClassTagClasses .contains(sym) then
43+ classTag.select(sym.name.toTermName)
44+ else
45+ val clsOfType = escapeJavaArray(erasure(tp))
46+ classTag.select(nme.apply).appliedToType(tp).appliedTo(clsOf(clsOfType))
47+ withNoErrors(tag.withSpan(span))
48+ case tp => EmptyTreeNoError
49+ else EmptyTreeNoError
4850 case _ => EmptyTreeNoError
4951 end synthesizedClassTag
5052
0 commit comments