File tree 1 file changed +7
-2
lines changed
compiler/src/dotty/tools/dotc/core
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}
8
8
import Constants .Constant
9
9
10
10
import Names .Name
11
+ import config .Feature
11
12
12
13
class TypeUtils :
13
14
/** A decorator that provides methods on types
@@ -22,7 +23,11 @@ class TypeUtils:
22
23
self.classSymbol.isPrimitiveValueClass
23
24
24
25
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
+
26
31
27
32
/** Is this type a checked exception? This is the case if the type
28
33
* derives from Exception but not from RuntimeException. According to
@@ -179,7 +184,7 @@ class TypeUtils:
179
184
def isThisTypeOf (cls : Symbol )(using Context ) = self match
180
185
case self : Types .ThisType => self.cls == cls
181
186
case _ => false
182
-
187
+
183
188
/** Strip all outer refinements off this type */
184
189
def stripRefinement : Type = self match
185
190
case self : RefinedOrRecType => self.parent.stripRefinement
You can’t perform that action at this time.
0 commit comments