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 Nested {
val t = this@Outer.bar()
val s = super@Outer.bar()
val t = this@Outer.<!UNRESOLVED_REFERENCE!>bar<!>()
val s = super@Outer.<!UNRESOLVED_REFERENCE!>bar<!>()
inner class NestedInner {
val t = this@Outer.bar()
val s = super@Outer.bar()
val t = this@Outer.<!UNRESOLVED_REFERENCE!>bar<!>()
val s = super@Outer.<!UNRESOLVED_REFERENCE!>bar<!>()
}
}
@@ -19,4 +19,4 @@ class Outer : Trait {
val t = this@Outer.bar()
val s = super@Outer.bar()
}
}
}
@@ -7,8 +7,8 @@ class Outer {
class Nested {
fun f() = <!UNRESOLVED_REFERENCE!>function<!>()
fun g() = <!UNRESOLVED_REFERENCE!>property<!>
fun h() = this@Outer.function()
fun i() = this@Outer.property
fun h() = this@Outer.<!UNRESOLVED_REFERENCE!>function<!>()
fun i() = this@Outer.<!UNRESOLVED_REFERENCE!>property<!>
}
inner class Inner {
@@ -28,10 +28,10 @@ open class Base {
class Derived : Base() {
fun test(javaStaticInTypePosition: Classifier) {
method()
property
Classifier()
syntheticSam { }
<!UNRESOLVED_REFERENCE!>method<!>()
<!UNRESOLVED_REFERENCE!>property<!>
<!UNRESOLVED_REFERENCE!>Classifier<!>()
<!UNRESOLVED_REFERENCE!>syntheticSam<!> { }
// Instance members shouldn't be affected, but we check them, just in case
val y = instanceSyntheticProperty
@@ -45,4 +45,4 @@ class Derived : Base() {
class JavaStaticInSupertypeList : Classifier() {
}
}
}
@@ -28,10 +28,10 @@ open class Base {
class Derived : Base() {
fun test(javaStaticInTypePosition: Classifier) {
method()
property
Classifier()
syntheticSam { }
<!UNRESOLVED_REFERENCE!>method<!>()
<!UNRESOLVED_REFERENCE!>property<!>
<!UNRESOLVED_REFERENCE!>Classifier<!>()
<!UNRESOLVED_REFERENCE!>syntheticSam<!> { }
// Instance members shouldn't be affected, but we check them, just in case
val y = instanceSyntheticProperty
@@ -45,4 +45,4 @@ class Derived : Base() {
class JavaStaticInSupertypeList : Classifier() {
}
}
}
@@ -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
// !DIAGNOSTICS: -UNUSED_VARIABLE
@@ -76,8 +76,8 @@ class C : O.B() {
val b = <!UNRESOLVED_REFERENCE!>B<!>()
// DEPRECATED: Classifiers from companions of direct superclasses
val e = FromCompanionA()
val f = FromCompanionB()
val e = <!UNRESOLVED_REFERENCE!>FromCompanionA<!>()
val f = <!UNRESOLVED_REFERENCE!>FromCompanionB<!>()
// INVISIBLE: "cousin" supertypes themselves
val g = <!UNRESOLVED_REFERENCE!>Alpha<!>()
@@ -85,9 +85,9 @@ class C : O.B() {
val i = <!UNRESOLVED_REFERENCE!>Gamma<!>()
// DEPRECATED: classifiers from "cousin" superclasses
val k = FromAlpha()
val l = FromBeta()
val m = FromGamma()
val k = <!UNRESOLVED_REFERENCE!>FromAlpha<!>()
val l = <!UNRESOLVED_REFERENCE!>FromBeta<!>()
val m = <!UNRESOLVED_REFERENCE!>FromGamma<!>()
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
val o = <!UNRESOLVED_REFERENCE!>FromCompanionAlpha<!>()
@@ -95,5 +95,5 @@ class C : O.B() {
val q = <!UNRESOLVED_REFERENCE!>FromCompanionGamma<!>()
// DEPRECATED: Classifiers from supertypes of our own companion
val r = FromDelta()
}
val r = <!UNRESOLVED_REFERENCE!>FromDelta<!>()
}
@@ -33,9 +33,9 @@ class C: B(), A {
B.Companion.bar()
C.<!UNRESOLVED_REFERENCE!>bar<!>()
B_()
<!UNRESOLVED_REFERENCE!>B_<!>()
B.<!UNRESOLVED_REFERENCE!>B_<!>()
B.Companion.B_()
C.<!UNRESOLVED_REFERENCE!>B_<!>()
}
}
}
@@ -43,10 +43,10 @@ class D: C() {
C.<!UNRESOLVED_REFERENCE!>bar<!>()
D.<!UNRESOLVED_REFERENCE!>bar<!>()
B_()
<!UNRESOLVED_REFERENCE!>B_<!>()
B.<!UNRESOLVED_REFERENCE!>B_<!>()
B.Companion.B_()
C.<!UNRESOLVED_REFERENCE!>B_<!>()
D.<!UNRESOLVED_REFERENCE!>B_<!>()
}
}
}
@@ -30,7 +30,7 @@ class E: A() {
B().<!UNRESOLVED_REFERENCE!>bar<!>()
D()
C()
<!UNRESOLVED_REFERENCE!>C<!>()
}
object Z {
@@ -39,7 +39,7 @@ class E: A() {
B().<!UNRESOLVED_REFERENCE!>bar<!>()
D()
C()
<!UNRESOLVED_REFERENCE!>C<!>()
}
}
}
@@ -9,19 +9,19 @@ interface B {
}
class X: A {
val a: A_ = A_()
val a: A_ = <!UNRESOLVED_REFERENCE!>A_<!>()
val b: A.A_ = A.A_()
companion object {
val a: A_ = A_()
val a: A_ = <!UNRESOLVED_REFERENCE!>A_<!>()
}
}
class Y: B {
val a: B_ = B_()
val a: B_ = <!UNRESOLVED_REFERENCE!>B_<!>()
val b: B.B_ = B.B_()
companion object {
val b: B_ = B_()
val b: B_ = <!UNRESOLVED_REFERENCE!>B_<!>()
}
}
@@ -10,14 +10,14 @@ class C: A() {
val b: B = null!!
init {
B()
<!UNRESOLVED_REFERENCE!>B<!>()
}
object O {
val b: B = null!!
init {
B()
<!UNRESOLVED_REFERENCE!>B<!>()
}
}
@@ -25,7 +25,7 @@ class C: A() {
val b: B = null!!
init {
B()
<!UNRESOLVED_REFERENCE!>B<!>()
}
}
@@ -33,7 +33,7 @@ class C: A() {
val b: B = null!!
init {
B()
<!UNRESOLVED_REFERENCE!>B<!>()
}
}
}
}
@@ -28,7 +28,7 @@ open class A {
class Simple: A() {
init {
Y().A_Y()
Z().A_C_Z()
<!UNRESOLVED_REFERENCE!>Z<!>().<!UNRESOLVED_REFERENCE!>A_C_Z<!>()
}
}
@@ -86,10 +86,10 @@ class C: A() {
}
init {
Y().<!UNRESOLVED_REFERENCE!>C_C_Y<!>()
Y().A_Y()
Y().C_C_Y()
Y().<!UNRESOLVED_REFERENCE!>A_Y<!>()
Z().C_C_Z()
Z().<!UNRESOLVED_REFERENCE!>A_C_Z<!>()
}
}
}
@@ -42,6 +42,6 @@ class Y: C() {
init {
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!!
init {
A_S()
<!UNRESOLVED_REFERENCE!>A_S<!>()
A.A_S()
X.<!UNRESOLVED_REFERENCE!>A_S<!>()
}
@@ -35,7 +35,7 @@ class X: A {
val a_: A_S = null!!
init {
A_S()
<!UNRESOLVED_REFERENCE!>A_S<!>()
}
}
}
@@ -71,7 +71,7 @@ class Z: C() {
val b_s: B_S = null!!
init {
A_S()
<!UNRESOLVED_REFERENCE!>A_S<!>()
B_()
B_S()
}
@@ -82,7 +82,7 @@ class Z: C() {
val b_s: B_S = null!!
init {
A_S()
<!UNRESOLVED_REFERENCE!>A_S<!>()
B_()
B_S()
}
@@ -41,7 +41,7 @@ class X: D() {
D.<!UNRESOLVED_REFERENCE!>B_<!>()
X.<!UNRESOLVED_REFERENCE!>B_<!>()
A_S()
<!UNRESOLVED_REFERENCE!>A_S<!>()
A.A_S()
C.<!UNRESOLVED_REFERENCE!>A_S<!>()
D.<!UNRESOLVED_REFERENCE!>A_S<!>()
@@ -53,7 +53,7 @@ class X: D() {
D.<!UNRESOLVED_REFERENCE!>B_S<!>()
X.<!UNRESOLVED_REFERENCE!>B_S<!>()
E_S()
<!UNRESOLVED_REFERENCE!>E_S<!>()
E.E_S()
D.<!UNRESOLVED_REFERENCE!>E_S<!>()
X.<!UNRESOLVED_REFERENCE!>E_S<!>()
@@ -67,7 +67,7 @@ class Y: F() {
F.<!UNRESOLVED_REFERENCE!>B_<!>()
Y.<!UNRESOLVED_REFERENCE!>B_<!>()
A_S()
<!UNRESOLVED_REFERENCE!>A_S<!>()
F.<!UNRESOLVED_REFERENCE!>A_S<!>()
Y.<!UNRESOLVED_REFERENCE!>A_S<!>()
@@ -75,7 +75,7 @@ class Y: F() {
F.<!UNRESOLVED_REFERENCE!>B_S<!>()
Y.<!UNRESOLVED_REFERENCE!>B_S<!>()
E_S()
<!UNRESOLVED_REFERENCE!>E_S<!>()
F.<!UNRESOLVED_REFERENCE!>E_S<!>()
Y.<!UNRESOLVED_REFERENCE!>E_S<!>()
}
@@ -32,7 +32,7 @@ class B: A() {
X().A_X()
X().<!UNRESOLVED_REFERENCE!>T_X<!>()
Y().A_C_Y()
Y().<!UNRESOLVED_REFERENCE!>T_Y<!>()
Y().<!UNRESOLVED_REFERENCE!>A_C_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
// FILE: J.java
public class J {
@@ -18,20 +18,20 @@ open class A {
class B : J2() {
init {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
boo()
}
fun test2() {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
boo()
}
object O {
fun test() {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
boo()
}
@@ -39,13 +39,13 @@ class B : J2() {
companion object {
init {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
boo()
}
fun test() {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
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
// FILE: J.java
public class J {
@@ -13,30 +13,30 @@ open class A {
class B : A() {
init {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
}
fun test2() {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
}
object O {
fun test() {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
}
}
companion object {
init {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
}
fun test() {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
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
// FILE: J.java
public class J {
@@ -12,20 +12,20 @@ open class B : J() {
class A {
init {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
baz()
}
fun test1() {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
baz()
}
object O {
fun test() {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
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
// FILE: J.java
public class J {
@@ -7,18 +7,18 @@ public class J {
// FILE: test.kt
class A {
init {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
}
fun test1() {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
}
object O {
fun test() {
foo()
<!UNRESOLVED_REFERENCE!>foo<!>()
bar()
}
}