Test for reporting clashes with multiple delegated methods
Verifies that the order in which traits are inherited is irrelevant
This commit is contained in:
@@ -219,6 +219,7 @@ public final class DelegationResolver<T extends CallableMemberDescriptor> {
|
||||
}
|
||||
|
||||
private static boolean haveSameSignatures(@NotNull CallableDescriptor memberOne, @NotNull CallableDescriptor memberTwo) {
|
||||
//isOverridableBy ignores return types
|
||||
return OverridingUtil.isOverridableBy(memberOne, memberTwo).getResult() == OVERRIDABLE;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
trait One {
|
||||
public fun foo(): Any?
|
||||
}
|
||||
trait Two {
|
||||
public fun foo(): String?
|
||||
}
|
||||
|
||||
trait Three {
|
||||
public fun foo(): String
|
||||
}
|
||||
|
||||
class <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>Test123<!>(val v1: One, val v2: Two, val v3: Three) : One by v1, Two by v2, Three by v3 { }
|
||||
class <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>Test132<!>(val v1: One, val v2: Two, val v3: Three) : One by v1, Three by v3, Two by v2 { }
|
||||
class <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>Test312<!>(val v1: One, val v2: Two, val v3: Three) : Three by v3, One by v1, Two by v2 { }
|
||||
class <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>Test321<!>(val v1: One, val v2: Two, val v3: Three) : Three by v3, Two by v2, One by v1 { }
|
||||
class <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>Test231<!>(val v1: One, val v2: Two, val v3: Three) : Two by v2, Three by v3, One by v1 { }
|
||||
class <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>Test213<!>(val v1: One, val v2: Two, val v3: Three) : Two by v2, One by v1, Three by v3 { }
|
||||
@@ -194,6 +194,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
||||
doTest("compiler/testData/diagnostics/tests/DelegationToJavaIface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Delegation_ClashingFunctions.kt")
|
||||
public void testDelegation_ClashingFunctions() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/Delegation_ClashingFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Delegation_Hierarchy.kt")
|
||||
public void testDelegation_Hierarchy() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/Delegation_Hierarchy.kt");
|
||||
|
||||
Reference in New Issue
Block a user