[FIR] Add test for object inner class KT-37120
This commit is contained in:
committed by
Mikhail Glukhikh
parent
1ce96b7433
commit
401023a893
@@ -0,0 +1,149 @@
|
||||
// !CHECK_TYPE
|
||||
/*
|
||||
* UNEXPECTED BEHAVIOUR
|
||||
* ISSUES: KT-37120
|
||||
*/
|
||||
|
||||
val case1 = object : A {
|
||||
inner class Child(property: B) : Base(property) {
|
||||
fun Base.zoo() {
|
||||
val x = <!UNRESOLVED_REFERENCE!>property<!> //UNRESOLVED_REFERENCE
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
<!UNRESOLVED_REFERENCE!>baseFun<!>() //UNRESOLVED_REFERENCE
|
||||
val x = <!UNRESOLVED_REFERENCE!>property<!> //UNRESOLVED_REFERENCE
|
||||
<!UNRESOLVED_REFERENCE!>zoo<!>() //UNRESOLVED_REFERENCE
|
||||
hoo()
|
||||
}
|
||||
}
|
||||
fun Child.voo() {
|
||||
val x = <!UNRESOLVED_REFERENCE!>property<!> //UNRESOLVED_REFERENCE
|
||||
}
|
||||
|
||||
fun Base.hoo() {
|
||||
val x = <!UNRESOLVED_REFERENCE!>property<!> //UNRESOLVED_REFERENCE
|
||||
}
|
||||
|
||||
open inner class Base(/*protected*/ val property: B) {
|
||||
fun baseFun() {}
|
||||
}
|
||||
|
||||
fun caseForBase() {
|
||||
val base = Base(B())
|
||||
/*member of Base*/
|
||||
base.<!UNRESOLVED_REFERENCE!>baseFun<!>() //UNRESOLVED_REFERENCE
|
||||
base.<!UNRESOLVED_REFERENCE!>property<!> //UNRESOLVED_REFERENCE
|
||||
/*extensions*/
|
||||
base.hoo()
|
||||
}
|
||||
|
||||
fun caseForChild() {
|
||||
val child = Child(B())
|
||||
/*member of Base*/
|
||||
child.<!UNRESOLVED_REFERENCE!>baseFun<!>() //UNRESOLVED_REFERENCE
|
||||
child.<!UNRESOLVED_REFERENCE!>property<!> //UNRESOLVED_REFERENCE
|
||||
/*member of Child*/
|
||||
child.<!UNRESOLVED_REFERENCE!>foo<!>() //UNRESOLVED_REFERENCE
|
||||
/*extensions*/
|
||||
child.hoo()
|
||||
child.voo()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Case2() {
|
||||
val x = object : Base(B()) {
|
||||
fun Base.zoo() {
|
||||
val x = property
|
||||
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
baseFun()
|
||||
val x = property
|
||||
zoo()
|
||||
hoo()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun Base.hoo() {
|
||||
val x = property
|
||||
}
|
||||
|
||||
open inner class Base(/*protected*/ val property: B) {
|
||||
fun baseFun() {}
|
||||
}
|
||||
|
||||
fun caseForBase() {
|
||||
val base = Base(B())
|
||||
/*member of Base*/
|
||||
base.baseFun()
|
||||
base.property
|
||||
/*extensions*/
|
||||
base.hoo()
|
||||
}
|
||||
|
||||
fun caseForChild() {
|
||||
val child = x
|
||||
/*member of Base*/
|
||||
child.baseFun()
|
||||
child.property
|
||||
/*extensions*/
|
||||
child.hoo()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Case3() {
|
||||
val x = object : A {
|
||||
inner class Child(property: B) : Base(property) {
|
||||
fun Base.zoo() {
|
||||
val x = <!UNRESOLVED_REFERENCE!>property<!> //UNRESOLVED_REFERENCE
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
<!UNRESOLVED_REFERENCE!>baseFun<!>() //UNRESOLVED_REFERENCE
|
||||
val x = <!UNRESOLVED_REFERENCE!>property<!> //UNRESOLVED_REFERENCE
|
||||
zoo()
|
||||
hoo()
|
||||
}
|
||||
}
|
||||
|
||||
fun Child.voo() {
|
||||
val x = <!UNRESOLVED_REFERENCE!>property<!> //UNRESOLVED_REFERENCE
|
||||
}
|
||||
fun Base.hoo() {
|
||||
val x = <!UNRESOLVED_REFERENCE!>property<!> //UNRESOLVED_REFERENCE
|
||||
}
|
||||
|
||||
open inner class Base(/*protected*/ val property: B) {
|
||||
fun baseFun() {}
|
||||
}
|
||||
|
||||
fun caseForBase() {
|
||||
val base = Base(B())
|
||||
/*member of Base*/
|
||||
base.<!UNRESOLVED_REFERENCE!>baseFun<!>() //UNRESOLVED_REFERENCE
|
||||
base.<!UNRESOLVED_REFERENCE!>property<!> //UNRESOLVED_REFERENCE
|
||||
/*extensions*/
|
||||
base.hoo()
|
||||
}
|
||||
|
||||
fun caseForChild() {
|
||||
val child = Child(B())
|
||||
/*member of Base*/
|
||||
child.<!UNRESOLVED_REFERENCE!>baseFun<!>() //UNRESOLVED_REFERENCE
|
||||
child.<!UNRESOLVED_REFERENCE!>property<!> //UNRESOLVED_REFERENCE
|
||||
/*member of Child*/
|
||||
child.<!UNRESOLVED_REFERENCE!>foo<!>() //UNRESOLVED_REFERENCE
|
||||
/*extensions*/
|
||||
child.hoo()
|
||||
child.voo()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface A {}
|
||||
class B() {}
|
||||
@@ -0,0 +1,213 @@
|
||||
FILE: objectInnerClass.kt
|
||||
public final val case1: R|anonymous| = object : R|A| {
|
||||
private constructor(): R|kotlin/Any| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
local final inner class Child : R|ERROR CLASS: Symbol not found, for `Base`| {
|
||||
public constructor(property: R|B|): R|<anonymous>.Child| {
|
||||
super<R|ERROR CLASS: Symbol not found, for `Base`|>(R|<local>/property|)
|
||||
}
|
||||
|
||||
public final fun R|ERROR CLASS: Symbol not found, for `Base`|.zoo(): R|kotlin/Unit| {
|
||||
lval x: <ERROR TYPE REF: Unresolved name: property> = <Unresolved name: property>#
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
<Unresolved name: baseFun>#()
|
||||
lval x: <ERROR TYPE REF: Unresolved name: property> = <Unresolved name: property>#
|
||||
<Unresolved name: zoo>#()
|
||||
(this@R|/anonymous|, this@R|/<anonymous>.Child|).R|/anonymous.hoo|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final fun R|ERROR CLASS: Symbol not found, for `Child`|.voo(): R|kotlin/Unit| {
|
||||
lval x: <ERROR TYPE REF: Unresolved name: property> = <Unresolved name: property>#
|
||||
}
|
||||
|
||||
public final fun R|ERROR CLASS: Symbol not found, for `Base`|.hoo(): R|kotlin/Unit| {
|
||||
lval x: <ERROR TYPE REF: Unresolved name: property> = <Unresolved name: property>#
|
||||
}
|
||||
|
||||
local open inner class Base : R|kotlin/Any| {
|
||||
public constructor(property: R|B|): R|<anonymous>.Base| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val property: R|B| = R|<local>/property|
|
||||
public get(): R|B|
|
||||
|
||||
public final fun baseFun(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final fun caseForBase(): R|kotlin/Unit| {
|
||||
lval base: R|<anonymous>.Base| = this@R|/anonymous|.R|/<anonymous>.Base.Base|(R|/B.B|())
|
||||
R|<local>/base|.<Unresolved name: baseFun>#()
|
||||
R|<local>/base|.<Unresolved name: property>#
|
||||
(this@R|/anonymous|, R|<local>/base|).R|/anonymous.hoo|()
|
||||
}
|
||||
|
||||
public final fun caseForChild(): R|kotlin/Unit| {
|
||||
lval child: R|<anonymous>.Child| = this@R|/anonymous|.R|/<anonymous>.Child.Child|(R|/B.B|())
|
||||
R|<local>/child|.<Unresolved name: baseFun>#()
|
||||
R|<local>/child|.<Unresolved name: property>#
|
||||
R|<local>/child|.<Unresolved name: foo>#()
|
||||
(this@R|/anonymous|, R|<local>/child|).R|/anonymous.hoo|()
|
||||
(this@R|/anonymous|, R|<local>/child|).R|/anonymous.voo|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public get(): R|anonymous|
|
||||
public final class Case2 : R|kotlin/Any| {
|
||||
public constructor(): R|Case2| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|anonymous| = object : R|Case2.Base| {
|
||||
private constructor(): R|Case2.Base| {
|
||||
super<R|Case2.Base|>(R|/B.B|())
|
||||
}
|
||||
|
||||
public final fun R|Case2.Base|.zoo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|/anonymous.zoo|.R|/Case2.Base.property|
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
this@R|/anonymous|.R|/Case2.Base.baseFun|()
|
||||
lval x: R|B| = this@R|/anonymous|.R|/Case2.Base.property|
|
||||
this@R|/anonymous|.R|/anonymous.zoo|()
|
||||
(this@R|/Case2|, this@R|/anonymous|).R|/Case2.hoo|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public get(): R|anonymous|
|
||||
|
||||
public final fun R|Case2.Base|.hoo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|/Case2.hoo|.R|/Case2.Base.property|
|
||||
}
|
||||
|
||||
public open inner class Base : R|kotlin/Any| {
|
||||
public constructor(property: R|B|): R|Case2.Base| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val property: R|B| = R|<local>/property|
|
||||
public get(): R|B|
|
||||
|
||||
public final fun baseFun(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final fun caseForBase(): R|kotlin/Unit| {
|
||||
lval base: R|Case2.Base| = this@R|/Case2|.R|/Case2.Base.Base|(R|/B.B|())
|
||||
R|<local>/base|.R|/Case2.Base.baseFun|()
|
||||
R|<local>/base|.R|/Case2.Base.property|
|
||||
(this@R|/Case2|, R|<local>/base|).R|/Case2.hoo|()
|
||||
}
|
||||
|
||||
public final fun caseForChild(): R|kotlin/Unit| {
|
||||
lval child: R|anonymous| = this@R|/Case2|.R|/Case2.x|
|
||||
R|<local>/child|.R|/Case2.Base.baseFun|()
|
||||
R|<local>/child|.R|/Case2.Base.property|
|
||||
(this@R|/Case2|, R|<local>/child|).R|/Case2.hoo|()
|
||||
}
|
||||
|
||||
}
|
||||
public final class Case3 : R|kotlin/Any| {
|
||||
public constructor(): R|Case3| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|anonymous| = object : R|A| {
|
||||
private constructor(): R|kotlin/Any| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
local final inner class Child : R|ERROR CLASS: Symbol not found, for `Base`| {
|
||||
public constructor(property: R|B|): R|Case3.<anonymous>.Child| {
|
||||
super<R|ERROR CLASS: Symbol not found, for `Base`|>(R|<local>/property|)
|
||||
}
|
||||
|
||||
public final fun R|ERROR CLASS: Symbol not found, for `Base`|.zoo(): R|kotlin/Unit| {
|
||||
lval x: <ERROR TYPE REF: Unresolved name: property> = <Unresolved name: property>#
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
<Unresolved name: baseFun>#()
|
||||
lval x: <ERROR TYPE REF: Unresolved name: property> = <Unresolved name: property>#
|
||||
this@R|/Case3.<anonymous>.Child|.R|/Case3.<anonymous>.Child.zoo|()
|
||||
(this@R|/anonymous|, this@R|/Case3.<anonymous>.Child|).R|/anonymous.hoo|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final fun R|ERROR CLASS: Symbol not found, for `Child`|.voo(): R|kotlin/Unit| {
|
||||
lval x: <ERROR TYPE REF: Unresolved name: property> = <Unresolved name: property>#
|
||||
}
|
||||
|
||||
public final fun R|ERROR CLASS: Symbol not found, for `Base`|.hoo(): R|kotlin/Unit| {
|
||||
lval x: <ERROR TYPE REF: Unresolved name: property> = <Unresolved name: property>#
|
||||
}
|
||||
|
||||
local open inner class Base : R|kotlin/Any| {
|
||||
public constructor(property: R|B|): R|Case3.<anonymous>.Base| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val property: R|B| = R|<local>/property|
|
||||
public get(): R|B|
|
||||
|
||||
public final fun baseFun(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final fun caseForBase(): R|kotlin/Unit| {
|
||||
lval base: R|Case3.<anonymous>.Base| = R|/Case3.<anonymous>.Base.Base|(R|/B.B|())
|
||||
R|<local>/base|.<Unresolved name: baseFun>#()
|
||||
R|<local>/base|.<Unresolved name: property>#
|
||||
R|<local>/base|.R|/anonymous.hoo|()
|
||||
}
|
||||
|
||||
public final fun caseForChild(): R|kotlin/Unit| {
|
||||
lval child: R|Case3.<anonymous>.Child| = R|/Case3.<anonymous>.Child.Child|(R|/B.B|())
|
||||
R|<local>/child|.<Unresolved name: baseFun>#()
|
||||
R|<local>/child|.<Unresolved name: property>#
|
||||
R|<local>/child|.<Unresolved name: foo>#()
|
||||
R|<local>/child|.R|/anonymous.hoo|()
|
||||
R|<local>/child|.R|/anonymous.voo|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public get(): R|anonymous|
|
||||
|
||||
}
|
||||
public abstract interface A : R|kotlin/Any| {
|
||||
}
|
||||
public final class B : R|kotlin/Any| {
|
||||
public constructor(): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
FILE: CHECK_TYPE.kt
|
||||
public final fun <T> checkSubtype(t: R|T|): R|T| {
|
||||
^checkSubtype R|<local>/t|
|
||||
}
|
||||
public final class Inv<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|tests/_checkType/Inv<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun <E> R|tests/_checkType/Inv<E>|._(): R|kotlin/Unit| {
|
||||
}
|
||||
public final infix fun <T> R|T|.checkType(f: R|tests/_checkType/Inv<T>.() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
+5
@@ -268,6 +268,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/resolve/testData/resolve/NestedSuperType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectInnerClass.kt")
|
||||
public void testObjectInnerClass() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/objectInnerClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("problems2.kt")
|
||||
public void testProblems2() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/problems2.kt");
|
||||
|
||||
Generated
+5
@@ -268,6 +268,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/resolve/testData/resolve/NestedSuperType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectInnerClass.kt")
|
||||
public void testObjectInnerClass() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/objectInnerClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("problems2.kt")
|
||||
public void testProblems2() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/problems2.kt");
|
||||
|
||||
Reference in New Issue
Block a user