[FIR-TEST] Add test with ambiguity on accidental override property

This commit is contained in:
Dmitriy Novozhilov
2019-11-14 13:31:16 +03:00
parent f43d77d422
commit 6f9e576502
3 changed files with 64 additions and 0 deletions
@@ -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<!>
}
@@ -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]>#
}
@@ -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")