fix a case of fake override of abstract and non-abstract function

===
open class Ccc() {
    fun foo() = 1
}

trait Ttt {
    fun foo(): Int
}

class Zzz() : Ccc(), Ttt // there must not be an error here
===

Reported by Andrey Breslav as a bug of Comparator implementation:

===
fun comparator<T>(f: (T, T) -> Int): Comparator<T> = object : Comparator<T>, Object() {
    override fun compare(o1: T, o2: T): Int = f(o1, o2)
}
===
This commit is contained in:
Stepan Koltsov
2012-02-13 23:34:01 +04:00
parent 37eb7d7e63
commit e3fdc5d595
2 changed files with 18 additions and 1 deletions
@@ -357,7 +357,15 @@ public class OverrideResolver {
abstractNoImpl.add(single);
}
} else {
manyImpl.addAll(overridenDeclarations);
List<CallableMemberDescriptor> nonAbstractManyImpl = Lists.newArrayList();
for (CallableMemberDescriptor overriden : overridenDeclarations) {
if (overriden.getModality() != Modality.ABSTRACT) {
nonAbstractManyImpl.add(overriden);
}
}
if (nonAbstractManyImpl.size() > 1) {
manyImpl.addAll(nonAbstractManyImpl);
}
}
}
}
@@ -0,0 +1,9 @@
open class Ccc() {
fun foo() = 1
}
trait Ttt {
fun foo(): Int
}
class Zzz() : Ccc(), Ttt