@@ -1209,30 +1209,6 @@ trait Checking {
1209
1209
def checkDerivedValueClass (clazz : Symbol , stats : List [Tree ])(using Context ): Unit =
1210
1210
Checking .checkDerivedValueClass(clazz, stats)
1211
1211
1212
- /** Given a parent `parent` of a class `cls`, if `parent` is a trait check that
1213
- * the superclass of `cls` derived from the superclass of `parent`.
1214
- *
1215
- * An exception is made if `cls` extends `Any`, and `parent` is `java.io.Serializable`
1216
- * or `java.lang.Comparable`. These two classes are treated by Scala as universal
1217
- * traits. E.g. the following is OK:
1218
- *
1219
- * ... extends Any with java.io.Serializable
1220
- *
1221
- * The standard library relies on this idiom.
1222
- */
1223
- def checkTraitInheritance (parent : Symbol , cls : ClassSymbol , pos : SrcPos )(using Context ): Unit =
1224
- parent match {
1225
- case parent : ClassSymbol if parent.is(Trait ) =>
1226
- val psuper = parent.superClass
1227
- val csuper = cls.superClass
1228
- val ok = csuper.derivesFrom(psuper) ||
1229
- parent.is(JavaDefined ) && csuper == defn.AnyClass &&
1230
- (parent == defn.JavaSerializableClass || parent == defn.ComparableClass )
1231
- if (! ok)
1232
- report.error(em " illegal trait inheritance: super $csuper does not derive from $parent's super $psuper" , pos)
1233
- case _ =>
1234
- }
1235
-
1236
1212
/** Check that case classes are not inherited by case classes.
1237
1213
*/
1238
1214
def checkCaseInheritance (parent : Symbol , caseCls : ClassSymbol , pos : SrcPos )(using Context ): Unit =
@@ -1603,7 +1579,6 @@ trait NoChecking extends ReChecking {
1603
1579
override def checkParentCall (call : Tree , caller : ClassSymbol )(using Context ): Unit = ()
1604
1580
override def checkSimpleKinded (tpt : Tree )(using Context ): Tree = tpt
1605
1581
override def checkDerivedValueClass (clazz : Symbol , stats : List [Tree ])(using Context ): Unit = ()
1606
- override def checkTraitInheritance (parentSym : Symbol , cls : ClassSymbol , pos : SrcPos )(using Context ): Unit = ()
1607
1582
override def checkCaseInheritance (parentSym : Symbol , caseCls : ClassSymbol , pos : SrcPos )(using Context ): Unit = ()
1608
1583
override def checkNoForwardDependencies (vparams : List [ValDef ])(using Context ): Unit = ()
1609
1584
override def checkMembersOK (tp : Type , pos : SrcPos )(using Context ): Type = tp
0 commit comments