In Java, ``` class J { String foo() { return "foo"; } } ``` In Scala, ``` class S extends J { override def foo(): Int = 42 } ``` Expected (`scalac`): ``` S.scala:6: error: overriding method foo in class J of type ()String; method foo has incompatible type override def foo(): Int = ??? ^ ``` Actual (`dotc`): Compilation succeeds The problem is in https://github.com/lampepfl/dotty/blob/master/compiler/src/dotty/tools/dotc/core/Types.scala#L871 Specifically, `this1.overrides(this1, matchLoosely = false)` should be `this1.overrides(that1, matchLoosely = false)`.