File tree 1 file changed +6
-1
lines changed
compiler/src/dotty/tools/dotc/transform
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,12 @@ object SymUtils:
116
116
self.linkedClass.exists
117
117
&& ! self.is(Scala2x )
118
118
&& (
119
- // self is from source, or companion is a subtype of Sum
119
+ // If the sum type is compiled from source, and `self` is a "generic sum"
120
+ // then its companion object will become a sum mirror in `posttyper`. (This method
121
+ // can be called from `typer` when summoning a Mirror.)
122
+ // However if `self` is from a prior run then we should check that its companion subclasses `Mirror.Sum`.
123
+ // e.g. before Scala 3.1, hierarchical sum types were not considered "generic sums", so their
124
+ // companion would not cache the mirror. Companions from TASTy will already be typed as `Mirror.Sum`.
120
125
self.isDefinedInCurrentRun
121
126
|| self.linkedClass.isSubClass(defn.Mirror_SumClass )
122
127
)
You can’t perform that action at this time.
0 commit comments