FIR: Fix test data after rewritten scope structure

Mostly, the semantics for statics/companions has been changed there
Fixed test data now is much closer to semantics of old FE
This commit is contained in:
Denis Zharkov
2020-05-07 13:06:30 +03:00
parent f64c12efac
commit f71a56e742
29 changed files with 77 additions and 362 deletions
@@ -6,12 +6,12 @@ interface Trait {
class Outer : Trait { class Outer : Trait {
class Nested { class Nested {
val t = this@Outer.bar() val t = this@Outer.<!UNRESOLVED_REFERENCE!>bar<!>()
val s = super@Outer.bar() val s = super@Outer.<!UNRESOLVED_REFERENCE!>bar<!>()
inner class NestedInner { inner class NestedInner {
val t = this@Outer.bar() val t = this@Outer.<!UNRESOLVED_REFERENCE!>bar<!>()
val s = super@Outer.bar() val s = super@Outer.<!UNRESOLVED_REFERENCE!>bar<!>()
} }
} }
@@ -7,8 +7,8 @@ class Outer {
class Nested { class Nested {
fun f() = <!UNRESOLVED_REFERENCE!>function<!>() fun f() = <!UNRESOLVED_REFERENCE!>function<!>()
fun g() = <!UNRESOLVED_REFERENCE!>property<!> fun g() = <!UNRESOLVED_REFERENCE!>property<!>
fun h() = this@Outer.function() fun h() = this@Outer.<!UNRESOLVED_REFERENCE!>function<!>()
fun i() = this@Outer.property fun i() = this@Outer.<!UNRESOLVED_REFERENCE!>property<!>
} }
inner class Inner { inner class Inner {
@@ -28,10 +28,10 @@ open class Base {
class Derived : Base() { class Derived : Base() {
fun test(javaStaticInTypePosition: Classifier) { fun test(javaStaticInTypePosition: Classifier) {
method() <!UNRESOLVED_REFERENCE!>method<!>()
property <!UNRESOLVED_REFERENCE!>property<!>
Classifier() <!UNRESOLVED_REFERENCE!>Classifier<!>()
syntheticSam { } <!UNRESOLVED_REFERENCE!>syntheticSam<!> { }
// Instance members shouldn't be affected, but we check them, just in case // Instance members shouldn't be affected, but we check them, just in case
val y = instanceSyntheticProperty val y = instanceSyntheticProperty
@@ -28,10 +28,10 @@ open class Base {
class Derived : Base() { class Derived : Base() {
fun test(javaStaticInTypePosition: Classifier) { fun test(javaStaticInTypePosition: Classifier) {
method() <!UNRESOLVED_REFERENCE!>method<!>()
property <!UNRESOLVED_REFERENCE!>property<!>
Classifier() <!UNRESOLVED_REFERENCE!>Classifier<!>()
syntheticSam { } <!UNRESOLVED_REFERENCE!>syntheticSam<!> { }
// Instance members shouldn't be affected, but we check them, just in case // Instance members shouldn't be affected, but we check them, just in case
val y = instanceSyntheticProperty val y = instanceSyntheticProperty
@@ -1,100 +0,0 @@
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// !DIAGNOSTICS: -UNUSED_VARIABLE
// See KT-21515 for a class diagram and details
// Object is to prevent accidental short-name import
object O {
open class Alpha {
class FromAlpha
companion object {
class FromCompanionAlpha
}
}
open class Beta : Alpha() {
class FromBeta
companion object {
class FromCompanionBeta
}
}
open class A {
class FromA
companion object : Beta() {
class FromCompanionA
}
}
//////////////////////////
open class FarAway {
class FromFarAway
}
open class Gamma {
class FromGamma
companion object : FarAway() {
class FromCompanionGamma
}
}
open class B : A() {
class FromB
companion object : Gamma() {
class FromCompanionB
}
}
}
///////////////////////////////
open class Delta {
class FromDelta
}
class C : O.B() {
companion object : Delta() {
class FromCompanionC
}
// VISIBLE: Classifiers from direct superclasses
val c = FromA()
val d = FromB()
// VISIBLE: Classifiers from our own companion
val n = FromCompanionC()
// INVISIBLE: direct superclasses themselves.
val a = <!UNRESOLVED_REFERENCE!>A<!>()
val b = <!UNRESOLVED_REFERENCE!>B<!>()
// DEPRECATED: Classifiers from companions of direct superclasses
val e = FromCompanionA()
val f = FromCompanionB()
// INVISIBLE: "cousin" supertypes themselves
val g = <!UNRESOLVED_REFERENCE!>Alpha<!>()
val h = <!UNRESOLVED_REFERENCE!>Beta<!>()
val i = <!UNRESOLVED_REFERENCE!>Gamma<!>()
// DEPRECATED: classifiers from "cousin" superclasses
val k = FromAlpha()
val l = FromBeta()
val m = FromGamma()
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
val o = <!UNRESOLVED_REFERENCE!>FromCompanionAlpha<!>()
val p = <!UNRESOLVED_REFERENCE!>FromCompanionBeta<!>()
val q = <!UNRESOLVED_REFERENCE!>FromCompanionGamma<!>()
// DEPRECATED: Classifiers from supertypes of our own companion
val r = FromDelta()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// !DIAGNOSTICS: -UNUSED_VARIABLE // !DIAGNOSTICS: -UNUSED_VARIABLE
@@ -76,8 +76,8 @@ class C : O.B() {
val b = <!UNRESOLVED_REFERENCE!>B<!>() val b = <!UNRESOLVED_REFERENCE!>B<!>()
// DEPRECATED: Classifiers from companions of direct superclasses // DEPRECATED: Classifiers from companions of direct superclasses
val e = FromCompanionA() val e = <!UNRESOLVED_REFERENCE!>FromCompanionA<!>()
val f = FromCompanionB() val f = <!UNRESOLVED_REFERENCE!>FromCompanionB<!>()
// INVISIBLE: "cousin" supertypes themselves // INVISIBLE: "cousin" supertypes themselves
val g = <!UNRESOLVED_REFERENCE!>Alpha<!>() val g = <!UNRESOLVED_REFERENCE!>Alpha<!>()
@@ -85,9 +85,9 @@ class C : O.B() {
val i = <!UNRESOLVED_REFERENCE!>Gamma<!>() val i = <!UNRESOLVED_REFERENCE!>Gamma<!>()
// DEPRECATED: classifiers from "cousin" superclasses // DEPRECATED: classifiers from "cousin" superclasses
val k = FromAlpha() val k = <!UNRESOLVED_REFERENCE!>FromAlpha<!>()
val l = FromBeta() val l = <!UNRESOLVED_REFERENCE!>FromBeta<!>()
val m = FromGamma() val m = <!UNRESOLVED_REFERENCE!>FromGamma<!>()
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses // INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
val o = <!UNRESOLVED_REFERENCE!>FromCompanionAlpha<!>() val o = <!UNRESOLVED_REFERENCE!>FromCompanionAlpha<!>()
@@ -95,5 +95,5 @@ class C : O.B() {
val q = <!UNRESOLVED_REFERENCE!>FromCompanionGamma<!>() val q = <!UNRESOLVED_REFERENCE!>FromCompanionGamma<!>()
// DEPRECATED: Classifiers from supertypes of our own companion // DEPRECATED: Classifiers from supertypes of our own companion
val r = FromDelta() val r = <!UNRESOLVED_REFERENCE!>FromDelta<!>()
} }
@@ -33,7 +33,7 @@ class C: B(), A {
B.Companion.bar() B.Companion.bar()
C.<!UNRESOLVED_REFERENCE!>bar<!>() C.<!UNRESOLVED_REFERENCE!>bar<!>()
B_() <!UNRESOLVED_REFERENCE!>B_<!>()
B.<!UNRESOLVED_REFERENCE!>B_<!>() B.<!UNRESOLVED_REFERENCE!>B_<!>()
B.Companion.B_() B.Companion.B_()
C.<!UNRESOLVED_REFERENCE!>B_<!>() C.<!UNRESOLVED_REFERENCE!>B_<!>()
@@ -43,7 +43,7 @@ class D: C() {
C.<!UNRESOLVED_REFERENCE!>bar<!>() C.<!UNRESOLVED_REFERENCE!>bar<!>()
D.<!UNRESOLVED_REFERENCE!>bar<!>() D.<!UNRESOLVED_REFERENCE!>bar<!>()
B_() <!UNRESOLVED_REFERENCE!>B_<!>()
B.<!UNRESOLVED_REFERENCE!>B_<!>() B.<!UNRESOLVED_REFERENCE!>B_<!>()
B.Companion.B_() B.Companion.B_()
C.<!UNRESOLVED_REFERENCE!>B_<!>() C.<!UNRESOLVED_REFERENCE!>B_<!>()
@@ -30,7 +30,7 @@ class E: A() {
B().<!UNRESOLVED_REFERENCE!>bar<!>() B().<!UNRESOLVED_REFERENCE!>bar<!>()
D() D()
C() <!UNRESOLVED_REFERENCE!>C<!>()
} }
object Z { object Z {
@@ -39,7 +39,7 @@ class E: A() {
B().<!UNRESOLVED_REFERENCE!>bar<!>() B().<!UNRESOLVED_REFERENCE!>bar<!>()
D() D()
C() <!UNRESOLVED_REFERENCE!>C<!>()
} }
} }
} }
@@ -9,19 +9,19 @@ interface B {
} }
class X: A { class X: A {
val a: A_ = A_() val a: A_ = <!UNRESOLVED_REFERENCE!>A_<!>()
val b: A.A_ = A.A_() val b: A.A_ = A.A_()
companion object { companion object {
val a: A_ = A_() val a: A_ = <!UNRESOLVED_REFERENCE!>A_<!>()
} }
} }
class Y: B { class Y: B {
val a: B_ = B_() val a: B_ = <!UNRESOLVED_REFERENCE!>B_<!>()
val b: B.B_ = B.B_() val b: B.B_ = B.B_()
companion object { companion object {
val b: B_ = B_() val b: B_ = <!UNRESOLVED_REFERENCE!>B_<!>()
} }
} }
@@ -10,14 +10,14 @@ class C: A() {
val b: B = null!! val b: B = null!!
init { init {
B() <!UNRESOLVED_REFERENCE!>B<!>()
} }
object O { object O {
val b: B = null!! val b: B = null!!
init { init {
B() <!UNRESOLVED_REFERENCE!>B<!>()
} }
} }
@@ -25,7 +25,7 @@ class C: A() {
val b: B = null!! val b: B = null!!
init { init {
B() <!UNRESOLVED_REFERENCE!>B<!>()
} }
} }
@@ -33,7 +33,7 @@ class C: A() {
val b: B = null!! val b: B = null!!
init { init {
B() <!UNRESOLVED_REFERENCE!>B<!>()
} }
} }
} }
@@ -28,7 +28,7 @@ open class A {
class Simple: A() { class Simple: A() {
init { init {
Y().A_Y() Y().A_Y()
Z().A_C_Z() <!UNRESOLVED_REFERENCE!>Z<!>().<!UNRESOLVED_REFERENCE!>A_C_Z<!>()
} }
} }
@@ -86,8 +86,8 @@ class C: A() {
} }
init { init {
Y().<!UNRESOLVED_REFERENCE!>C_C_Y<!>() Y().C_C_Y()
Y().A_Y() Y().<!UNRESOLVED_REFERENCE!>A_Y<!>()
Z().C_C_Z() Z().C_C_Z()
Z().<!UNRESOLVED_REFERENCE!>A_C_Z<!>() Z().<!UNRESOLVED_REFERENCE!>A_C_Z<!>()
@@ -42,6 +42,6 @@ class Y: C() {
init { init {
Y().A_Y() Y().A_Y()
Z().A_C_Z() <!UNRESOLVED_REFERENCE!>Z<!>().<!UNRESOLVED_REFERENCE!>A_C_Z<!>()
} }
} }
@@ -26,7 +26,7 @@ class X: A {
val a_s: A_S = null!! val a_s: A_S = null!!
init { init {
A_S() <!UNRESOLVED_REFERENCE!>A_S<!>()
A.A_S() A.A_S()
X.<!UNRESOLVED_REFERENCE!>A_S<!>() X.<!UNRESOLVED_REFERENCE!>A_S<!>()
} }
@@ -35,7 +35,7 @@ class X: A {
val a_: A_S = null!! val a_: A_S = null!!
init { init {
A_S() <!UNRESOLVED_REFERENCE!>A_S<!>()
} }
} }
} }
@@ -71,7 +71,7 @@ class Z: C() {
val b_s: B_S = null!! val b_s: B_S = null!!
init { init {
A_S() <!UNRESOLVED_REFERENCE!>A_S<!>()
B_() B_()
B_S() B_S()
} }
@@ -82,7 +82,7 @@ class Z: C() {
val b_s: B_S = null!! val b_s: B_S = null!!
init { init {
A_S() <!UNRESOLVED_REFERENCE!>A_S<!>()
B_() B_()
B_S() B_S()
} }
@@ -41,7 +41,7 @@ class X: D() {
D.<!UNRESOLVED_REFERENCE!>B_<!>() D.<!UNRESOLVED_REFERENCE!>B_<!>()
X.<!UNRESOLVED_REFERENCE!>B_<!>() X.<!UNRESOLVED_REFERENCE!>B_<!>()
A_S() <!UNRESOLVED_REFERENCE!>A_S<!>()
A.A_S() A.A_S()
C.<!UNRESOLVED_REFERENCE!>A_S<!>() C.<!UNRESOLVED_REFERENCE!>A_S<!>()
D.<!UNRESOLVED_REFERENCE!>A_S<!>() D.<!UNRESOLVED_REFERENCE!>A_S<!>()
@@ -53,7 +53,7 @@ class X: D() {
D.<!UNRESOLVED_REFERENCE!>B_S<!>() D.<!UNRESOLVED_REFERENCE!>B_S<!>()
X.<!UNRESOLVED_REFERENCE!>B_S<!>() X.<!UNRESOLVED_REFERENCE!>B_S<!>()
E_S() <!UNRESOLVED_REFERENCE!>E_S<!>()
E.E_S() E.E_S()
D.<!UNRESOLVED_REFERENCE!>E_S<!>() D.<!UNRESOLVED_REFERENCE!>E_S<!>()
X.<!UNRESOLVED_REFERENCE!>E_S<!>() X.<!UNRESOLVED_REFERENCE!>E_S<!>()
@@ -67,7 +67,7 @@ class Y: F() {
F.<!UNRESOLVED_REFERENCE!>B_<!>() F.<!UNRESOLVED_REFERENCE!>B_<!>()
Y.<!UNRESOLVED_REFERENCE!>B_<!>() Y.<!UNRESOLVED_REFERENCE!>B_<!>()
A_S() <!UNRESOLVED_REFERENCE!>A_S<!>()
F.<!UNRESOLVED_REFERENCE!>A_S<!>() F.<!UNRESOLVED_REFERENCE!>A_S<!>()
Y.<!UNRESOLVED_REFERENCE!>A_S<!>() Y.<!UNRESOLVED_REFERENCE!>A_S<!>()
@@ -75,7 +75,7 @@ class Y: F() {
F.<!UNRESOLVED_REFERENCE!>B_S<!>() F.<!UNRESOLVED_REFERENCE!>B_S<!>()
Y.<!UNRESOLVED_REFERENCE!>B_S<!>() Y.<!UNRESOLVED_REFERENCE!>B_S<!>()
E_S() <!UNRESOLVED_REFERENCE!>E_S<!>()
F.<!UNRESOLVED_REFERENCE!>E_S<!>() F.<!UNRESOLVED_REFERENCE!>E_S<!>()
Y.<!UNRESOLVED_REFERENCE!>E_S<!>() Y.<!UNRESOLVED_REFERENCE!>E_S<!>()
} }
@@ -32,7 +32,7 @@ class B: A() {
X().A_X() X().A_X()
X().<!UNRESOLVED_REFERENCE!>T_X<!>() X().<!UNRESOLVED_REFERENCE!>T_X<!>()
Y().A_C_Y() Y().<!UNRESOLVED_REFERENCE!>A_C_Y<!>()
Y().<!UNRESOLVED_REFERENCE!>T_Y<!>() Y().T_Y()
} }
} }
@@ -1,55 +0,0 @@
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// FILE: J.java
public class J {
public static void foo() {}
}
// FILE: J2.java
public class J2 extends A {
public static void boo() {}
}
// FILE: test.kt
open class A {
companion object : J() {
fun bar() {}
}
}
class B : J2() {
init {
foo()
bar()
boo()
}
fun test2() {
foo()
bar()
boo()
}
object O {
fun test() {
foo()
bar()
boo()
}
}
companion object {
init {
foo()
bar()
boo()
}
fun test() {
foo()
bar()
boo()
}
fun bar() {}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// FILE: J.java // FILE: J.java
public class J { public class J {
@@ -18,20 +18,20 @@ open class A {
class B : J2() { class B : J2() {
init { init {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
boo() boo()
} }
fun test2() { fun test2() {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
boo() boo()
} }
object O { object O {
fun test() { fun test() {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
boo() boo()
} }
@@ -39,13 +39,13 @@ class B : J2() {
companion object { companion object {
init { init {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
boo() boo()
} }
fun test() { fun test() {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
boo() boo()
} }
@@ -1,46 +0,0 @@
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// FILE: J.java
public class J {
public static void foo() {}
}
// FILE: test.kt
open class A {
companion object : J() {
fun bar() {}
}
}
class B : A() {
init {
foo()
bar()
}
fun test2() {
foo()
bar()
}
object O {
fun test() {
foo()
bar()
}
}
companion object {
init {
foo()
bar()
}
fun test() {
foo()
bar()
}
fun bar() {}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// FILE: J.java // FILE: J.java
public class J { public class J {
@@ -13,30 +13,30 @@ open class A {
class B : A() { class B : A() {
init { init {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
} }
fun test2() { fun test2() {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
} }
object O { object O {
fun test() { fun test() {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
} }
} }
companion object { companion object {
init { init {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
} }
fun test() { fun test() {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
} }
@@ -1,50 +0,0 @@
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// FILE: J.java
public class J {
public static void foo() {}
}
// FILE: test.kt
open class B : J() {
fun baz() {}
}
class A {
init {
foo()
bar()
baz()
}
fun test1() {
foo()
bar()
baz()
}
object O {
fun test() {
foo()
bar()
baz()
}
}
companion object : B() {
init {
foo()
bar()
baz()
}
fun test() {
foo()
bar()
baz()
}
fun bar() {}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// FILE: J.java // FILE: J.java
public class J { public class J {
@@ -12,20 +12,20 @@ open class B : J() {
class A { class A {
init { init {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
baz() baz()
} }
fun test1() { fun test1() {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
baz() baz()
} }
object O { object O {
fun test() { fun test() {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
baz() baz()
} }
@@ -1,39 +0,0 @@
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// FILE: J.java
public class J {
public static void foo() {}
}
// FILE: test.kt
class A {
init {
foo()
bar()
}
fun test1() {
foo()
bar()
}
object O {
fun test() {
foo()
bar()
}
}
companion object : J() {
init {
foo()
bar()
}
fun test() {
foo()
bar()
}
fun bar() {}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// FILE: J.java // FILE: J.java
public class J { public class J {
@@ -7,18 +7,18 @@ public class J {
// FILE: test.kt // FILE: test.kt
class A { class A {
init { init {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
} }
fun test1() { fun test1() {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
} }
object O { object O {
fun test() { fun test() {
foo() <!UNRESOLVED_REFERENCE!>foo<!>()
bar() bar()
} }
} }