File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import Names.{Name, TermName}
88import Constants .Constant
99
1010import Names .Name
11+ import config .Feature
1112
1213class TypeUtils :
1314 /** A decorator that provides methods on types
@@ -22,7 +23,11 @@ class TypeUtils:
2223 self.classSymbol.isPrimitiveValueClass
2324
2425 def isErasedClass (using Context ): Boolean =
25- self.underlyingClassRef(refinementOK = true ).typeSymbol.is(Flags .Erased )
26+ val cls = self.underlyingClassRef(refinementOK = true ).typeSymbol
27+ cls.is(Flags .Erased )
28+ && (cls != defn.SingletonClass || Feature .enabled(Feature .modularity))
29+ // Singleton counts as an erased class only under x.modularity
30+
2631
2732 /** Is this type a checked exception? This is the case if the type
2833 * derives from Exception but not from RuntimeException. According to
@@ -179,7 +184,7 @@ class TypeUtils:
179184 def isThisTypeOf (cls : Symbol )(using Context ) = self match
180185 case self : Types .ThisType => self.cls == cls
181186 case _ => false
182-
187+
183188 /** Strip all outer refinements off this type */
184189 def stripRefinement : Type = self match
185190 case self : RefinedOrRecType => self.parent.stripRefinement
You can’t perform that action at this time.
0 commit comments