KT-1996 Missing ABSTRACT_MEMBER_NOT_IMPLEMENTED when two supertypes contains same abstract member
===
trait Foo {
fun foo(): Unit
}
trait Bar {
fun foo(): Unit
}
class Baz : Foo, Bar // no error here
===
#KT-1996 fixed
This commit is contained in:
@@ -307,14 +307,19 @@ public class OverrideResolver {
|
||||
else {
|
||||
List<CallableMemberDescriptor> nonAbstractManyImpl = Lists.newArrayList();
|
||||
Set<CallableMemberDescriptor> filteredOverriddenDeclarations = OverridingUtil.filterOverrides(Sets.newHashSet(overriddenDeclarations));
|
||||
boolean allSuperAbstract = true;
|
||||
for (CallableMemberDescriptor overridden : filteredOverriddenDeclarations) {
|
||||
if (overridden.getModality() != Modality.ABSTRACT) {
|
||||
nonAbstractManyImpl.add(overridden);
|
||||
allSuperAbstract = false;
|
||||
}
|
||||
}
|
||||
if (nonAbstractManyImpl.size() > 1) {
|
||||
manyImpl.addAll(nonAbstractManyImpl);
|
||||
}
|
||||
else if (allSuperAbstract) {
|
||||
abstractNoImpl.addAll(overriddenDeclarations);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,5 +6,5 @@ trait Y {
|
||||
fun foo(a : Int = 1)
|
||||
}
|
||||
|
||||
class <!MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_WHEN_NO_EXPLICIT_OVERRIDE!>Z1<!> : X, Y {} // BUG
|
||||
object <!MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_WHEN_NO_EXPLICIT_OVERRIDE!>Z1O<!> : X, Y {} // BUG
|
||||
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED, MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_WHEN_NO_EXPLICIT_OVERRIDE!>Z1<!> : X, Y {} // BUG
|
||||
object <!ABSTRACT_MEMBER_NOT_IMPLEMENTED, MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_WHEN_NO_EXPLICIT_OVERRIDE!>Z1O<!> : X, Y {} // BUG
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// http://youtrack.jetbrains.com/issue/KT-1996
|
||||
|
||||
trait Foo {
|
||||
fun foo(): Unit
|
||||
}
|
||||
|
||||
trait Bar {
|
||||
fun foo(): Unit
|
||||
}
|
||||
|
||||
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>Baz<!> : Foo, Bar
|
||||
Reference in New Issue
Block a user