Skip to content

Commit b67b23f

Browse files
committed
More fixes
1 parent 4d32e4d commit b67b23f

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

compiler/src/dotty/tools/dotc/core/TypeOps.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
7171
idx += 1
7272
}
7373
throw new AssertionError(ex"$pre contains no matching argument for ${tparam.showLocated} ")
74-
case OrType(tp1, tp2) => argForParam(tp1, cls) | argForParam(tp2, cls)
75-
case AndType(tp1, tp2) => argForParam(tp1, cls) & argForParam(tp2, cls)
76-
case _ =>
74+
case OrType(tp1, tp2) => argForParam(tp1, tparam) | argForParam(tp2, tparam)
75+
case AndType(tp1, tp2) => argForParam(tp1, tparam) & argForParam(tp2, tparam)
76+
case base =>
7777
if (pre.termSymbol is Package) argForParam(pre.select(nme.PACKAGE), tparam)
78-
else throw new AssertionError(ex"$pre contains no matching argument for ${tparam.showLocated} ")
78+
else {
79+
// throw new AssertionError(ex"$pre contains no matching argument for ${tparam.showLocated}, base = $base") // DEBUG
80+
tp
81+
}
7982
}
8083
}
8184

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,6 +2182,8 @@ object Types {
21822182
*/
21832183
abstract case class SuperType(thistpe: Type, supertpe: Type) extends CachedProxyType with SingletonType {
21842184
override def underlying(implicit ctx: Context) = supertpe
2185+
override def superType(implicit ctx: Context) =
2186+
thistpe.baseType(supertpe.typeSymbol)
21852187
def derivedSuperType(thistpe: Type, supertpe: Type)(implicit ctx: Context) =
21862188
if ((thistpe eq this.thistpe) && (supertpe eq this.supertpe)) this
21872189
else SuperType(thistpe, supertpe)

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import scala.collection.{ mutable, immutable }
1313
import ast._
1414
import Trees._
1515
import TreeTransforms._
16+
import config.Printers.{checks, noPrinter}
1617
import util.DotClass
1718
import scala.util.{Try, Success, Failure}
1819
import config.{ScalaVersion, NoScalaVersion}
@@ -652,7 +653,13 @@ object RefChecks {
652653
// 4. Check that every defined member with an `override` modifier overrides some other member.
653654
for (member <- clazz.info.decls)
654655
if (member.isAnyOverride && !(clazz.thisType.baseClasses exists (hasMatchingSym(_, member)))) {
655-
// for (bc <- clazz.info.baseClasses.tail) Console.println("" + bc + " has " + bc.info.decl(member.name) + ":" + bc.info.decl(member.name).tpe);//DEBUG
656+
if (checks != noPrinter) {
657+
for (bc <- clazz.info.baseClasses.tail) {
658+
val sym = bc.info.decl(member.name).symbol
659+
if (sym.exists)
660+
checks.println(i"$bc has $sym: ${clazz.thisType.memberInfo(sym)}")
661+
}
662+
}
656663

657664
val nonMatching = clazz.info.member(member.name).altsWith(alt => alt.owner != clazz)
658665
nonMatching match {

tests/pos/points.scala renamed to tests/neg/points.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ class Point extends Comparable[Point] {
33
}
44

55
class ColoredPoint extends Point with Comparable[ColoredPoint] {
6-
override def compareTo(other: ColoredPoint): Int = ???
6+
override def compareTo(other: ColoredPoint): Int = ??? // error: overridden method has different signature
77
}
88

0 commit comments

Comments
 (0)