[FIR TEST]: add test with synthetic on Java getter overridden in Kotlin

This commit is contained in:
Mikhail Glukhikh
2019-11-29 17:20:57 +03:00
parent 88e260269f
commit ae62ccb76d
3 changed files with 40 additions and 0 deletions
@@ -0,0 +1,19 @@
// FILE: Base.java
public class Base {
public String getSomething() {
return "";
}
}
// FILE: Derived.kt
class Derived : Base() {
override fun getSomething(): String = "42"
}
fun test() {
val d = Derived()
val res1 = d.something // Should be Ok
val res2 = d.getSomething() // Should be Ok
}
@@ -0,0 +1,16 @@
FILE: Derived.kt
public final class Derived : R|Base| {
public constructor(): R|Derived| {
super<R|Base|>()
}
public final override fun getSomething(): R|kotlin/String| {
^getSomething String(42)
}
}
public final fun test(): R|kotlin/Unit| {
lval d: R|Derived| = R|/Derived.Derived|()
lval res1: R|ft<kotlin/String, kotlin/String?>!| = R|<local>/d|.R|/Base.something|
lval res2: R|kotlin/String| = R|<local>/d|.R|/Derived.getSomething|()
}
@@ -514,6 +514,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/resolve/testData/resolve/expresssions/outerObject.kt");
}
@TestMetadata("overriddenJavaGetter.kt")
public void testOverriddenJavaGetter() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/expresssions/overriddenJavaGetter.kt");
}
@TestMetadata("privateObjectLiteral.kt")
public void testPrivateObjectLiteral() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/expresssions/privateObjectLiteral.kt");