File tree 2 files changed +6
-1
lines changed
compiler/src/dotty/tools/dotc/core 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1137,6 +1137,10 @@ class Definitions {
1137
1137
def isErasedFunctionType (tp : Type )(implicit ctx : Context ) =
1138
1138
isFunctionType(tp) && tp.dealias.typeSymbol.name.isErasedFunction
1139
1139
1140
+ /** A whitelist of Scala-2 classes that are known to be pure */
1141
+ def isAssuredNoInits (sym : Symbol ) =
1142
+ (sym `eq` SomeClass ) || isTupleClass(sym)
1143
+
1140
1144
// ----- primitive value class machinery ------------------------------------------
1141
1145
1142
1146
/** This class would also be obviated by the implicit function type design */
Original file line number Diff line number Diff line change @@ -596,7 +596,8 @@ object SymDenotations {
596
596
* initaliazion code?
597
597
*/
598
598
def isNoInitsClass (implicit ctx : Context ) =
599
- isClass && asClass.baseClasses.forall(_.is(NoInits ))
599
+ isClass &&
600
+ (asClass.baseClasses.forall(_.is(NoInits )) || defn.isAssuredNoInits(symbol))
600
601
601
602
/** Is this a "real" method? A real method is a method which is:
602
603
* - not an accessor
You can’t perform that action at this time.
0 commit comments