@@ -1250,30 +1250,6 @@ trait Checking {
1250
1250
def checkDerivedValueClass (clazz : Symbol , stats : List [Tree ])(using Context ): Unit =
1251
1251
Checking .checkDerivedValueClass(clazz, stats)
1252
1252
1253
- /** Given a parent `parent` of a class `cls`, if `parent` is a trait check that
1254
- * the superclass of `cls` derived from the superclass of `parent`.
1255
- *
1256
- * An exception is made if `cls` extends `Any`, and `parent` is `java.io.Serializable`
1257
- * or `java.lang.Comparable`. These two classes are treated by Scala as universal
1258
- * traits. E.g. the following is OK:
1259
- *
1260
- * ... extends Any with java.io.Serializable
1261
- *
1262
- * The standard library relies on this idiom.
1263
- */
1264
- def checkTraitInheritance (parent : Symbol , cls : ClassSymbol , pos : SrcPos )(using Context ): Unit =
1265
- parent match {
1266
- case parent : ClassSymbol if parent.is(Trait ) =>
1267
- val psuper = parent.superClass
1268
- val csuper = cls.superClass
1269
- val ok = csuper.derivesFrom(psuper) ||
1270
- parent.is(JavaDefined ) && csuper == defn.AnyClass &&
1271
- (parent == defn.JavaSerializableClass || parent == defn.ComparableClass )
1272
- if (! ok)
1273
- report.error(em " illegal trait inheritance: super $csuper does not derive from $parent's super $psuper" , pos)
1274
- case _ =>
1275
- }
1276
-
1277
1253
/** Check that case classes are not inherited by case classes.
1278
1254
*/
1279
1255
def checkCaseInheritance (parent : Symbol , caseCls : ClassSymbol , pos : SrcPos )(using Context ): Unit =
@@ -1650,7 +1626,6 @@ trait NoChecking extends ReChecking {
1650
1626
override def checkParentCall (call : Tree , caller : ClassSymbol )(using Context ): Unit = ()
1651
1627
override def checkSimpleKinded (tpt : Tree )(using Context ): Tree = tpt
1652
1628
override def checkDerivedValueClass (clazz : Symbol , stats : List [Tree ])(using Context ): Unit = ()
1653
- override def checkTraitInheritance (parentSym : Symbol , cls : ClassSymbol , pos : SrcPos )(using Context ): Unit = ()
1654
1629
override def checkCaseInheritance (parentSym : Symbol , caseCls : ClassSymbol , pos : SrcPos )(using Context ): Unit = ()
1655
1630
override def checkNoForwardDependencies (vparams : List [ValDef ])(using Context ): Unit = ()
1656
1631
override def checkMembersOK (tp : Type , pos : SrcPos )(using Context ): Type = tp
0 commit comments