[FIR-TEST] Add test with ambiguity on accidental override property
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* If koltin property hides some getter from java superclass this property should win in resolve
|
||||
*/
|
||||
|
||||
// FILE: A.java
|
||||
|
||||
public class A {
|
||||
public Executor getExecutor() {
|
||||
return new Executor();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
open class Executor
|
||||
class CommandExecutor : Executor()
|
||||
|
||||
class B : A() {
|
||||
val executor = CommandExecutor()
|
||||
|
||||
fun test() {
|
||||
// should be CommandExecutor
|
||||
val e = <!AMBIGUITY!>executor<!>
|
||||
}
|
||||
}
|
||||
|
||||
fun test(b: B) {
|
||||
// should be CommandExecutor
|
||||
b.<!AMBIGUITY!>executor<!>
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
FILE: main.kt
|
||||
public open class Executor : R|kotlin/Any| {
|
||||
public constructor(): R|Executor| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class CommandExecutor : R|Executor| {
|
||||
public constructor(): R|CommandExecutor| {
|
||||
super<R|Executor|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class B : R|A| {
|
||||
public constructor(): R|B| {
|
||||
super<R|A|>()
|
||||
}
|
||||
|
||||
public final val executor: R|CommandExecutor| = R|/CommandExecutor.CommandExecutor|()
|
||||
public get(): R|CommandExecutor|
|
||||
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval e: <ERROR TYPE REF: Ambiguity: executor, [/B.executor, /A.executor]> = <Ambiguity: executor, [/B.executor, /A.executor]>#
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(b: R|B|): R|kotlin/Unit| {
|
||||
R|<local>/b|.<Ambiguity: executor, [/B.executor, /A.executor]>#
|
||||
}
|
||||
+5
@@ -787,6 +787,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
public void testPropertyFromJavaPlusAssign() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/problems/propertyFromJavaPlusAssign.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticsVsNormalProperties.kt")
|
||||
public void testSyntheticsVsNormalProperties() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/problems/syntheticsVsNormalProperties.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/resolve/testData/resolve/references")
|
||||
|
||||
Reference in New Issue
Block a user