Skip to content

Commit 423e5b2

Browse files
Backport "Remove dead code in Checking" to LTS (#20918)
Backports #19678 to the LTS branch. PR submitted by the release tooling. [skip ci]
2 parents b9e1386 + 8945521 commit 423e5b2

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,30 +1209,6 @@ trait Checking {
12091209
def checkDerivedValueClass(clazz: Symbol, stats: List[Tree])(using Context): Unit =
12101210
Checking.checkDerivedValueClass(clazz, stats)
12111211

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-
12361212
/** Check that case classes are not inherited by case classes.
12371213
*/
12381214
def checkCaseInheritance(parent: Symbol, caseCls: ClassSymbol, pos: SrcPos)(using Context): Unit =
@@ -1603,7 +1579,6 @@ trait NoChecking extends ReChecking {
16031579
override def checkParentCall(call: Tree, caller: ClassSymbol)(using Context): Unit = ()
16041580
override def checkSimpleKinded(tpt: Tree)(using Context): Tree = tpt
16051581
override def checkDerivedValueClass(clazz: Symbol, stats: List[Tree])(using Context): Unit = ()
1606-
override def checkTraitInheritance(parentSym: Symbol, cls: ClassSymbol, pos: SrcPos)(using Context): Unit = ()
16071582
override def checkCaseInheritance(parentSym: Symbol, caseCls: ClassSymbol, pos: SrcPos)(using Context): Unit = ()
16081583
override def checkNoForwardDependencies(vparams: List[ValDef])(using Context): Unit = ()
16091584
override def checkMembersOK(tp: Type, pos: SrcPos)(using Context): Type = tp

0 commit comments

Comments
 (0)