@@ -9,7 +9,7 @@ import Types._, Flags._, Symbols._, Names._, StdNames._, Constants._
9
9
import TypeErasure .{erasure , hasStableErasure }
10
10
import Decorators ._
11
11
import ProtoTypes ._
12
- import Inferencing .fullyDefinedType
12
+ import Inferencing .{ fullyDefinedType , isFullyDefined }
13
13
import ast .untpd
14
14
import transform .SymUtils ._
15
15
import transform .TypeUtils ._
@@ -30,21 +30,23 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
30
30
val synthesizedClassTag : SpecialHandler = (formal, span) =>
31
31
formal.argInfos match
32
32
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
48
50
case _ => EmptyTreeNoError
49
51
end synthesizedClassTag
50
52
0 commit comments