FIR: Fix test data for secondary constructor delegation calls

They appeared, after the changes in previous commits at
org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirExpressionsResolveTransformer#transformDelegatedConstructorCall

The idea is that dispatch receiver is available there in old FE, but additional
diagnostic should be reported on it (see KT-38813)

This change was not made intentionaly but it was the easiest way to
support new tower data elements structure and on the other side it's the
correct behavior as for old FE.

Also, if we once would prefer the previous behavior it's still not very
hard to support it
This commit is contained in:
Denis Zharkov
2020-05-07 10:10:33 +03:00
parent f71a56e742
commit 808355d817
17 changed files with 27 additions and 27 deletions
@@ -37,8 +37,8 @@ class A(
Companion.CONST,
Nested.CONST,
Interface.CONST,
<!UNRESOLVED_REFERENCE!>a<!>,
<!UNRESOLVED_REFERENCE!>b<!>()
a,
b()
)
class Nested {
@@ -22,8 +22,8 @@ class A : S {
Companion.CONST,
Nested.CONST,
Interface.CONST,
<!UNRESOLVED_REFERENCE!>a<!>,
<!UNRESOLVED_REFERENCE!>b<!>()
a,
b()
)
class Nested {
@@ -6,7 +6,7 @@ open class Base<T>(p: Any?) {
class D: Base<Int>("") {
inner class B : Base<String> {
constructor() : super(<!INAPPLICABLE_CANDIDATE!>foo1<!>(""))
constructor() : super(foo1(""))
constructor(x: Int) : super(foo1(1))
}
}
@@ -7,7 +7,7 @@ open class Base<T>(p: Any?) {
class D: Base<Int>(1) {
inner class B : Base<Int> {
constructor() : super(foo1(1))
constructor(x: Int) : super(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>(1))
constructor(x: Int) : super(this@B.foo1(1))
constructor(x: Int, y: Int) : super(this@D.foo1(1))
}
}
@@ -7,6 +7,6 @@ fun Base.foo() {
class B : Base {
constructor() : super(foo1())
constructor(x: Int) : super(this@foo.foo1())
constructor(x: Int, y: Int) : super(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>())
constructor(x: Int, y: Int) : super(this@B.foo1())
}
}
@@ -5,9 +5,9 @@ open class Base<T>(p: Any?) {
fun Base<Int>.foo() {
class B : Base<String> {
constructor() : super(<!INAPPLICABLE_CANDIDATE!>foo1<!>(""))
constructor() : super(foo1(""))
constructor(x: Int) : super(foo1(1))
constructor(x: Int, y: Int) : super(this@foo.foo1(12))
constructor(x: Int, y: Int, z: Int) : super(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>(""))
constructor(x: Int, y: Int, z: Int) : super(this@B.foo1(""))
}
}
@@ -7,5 +7,5 @@ class Outer {
constructor(x: Int)
constructor(x: Int, y: Int, z: Int = x + Inner().prop + this.Inner().prop) :
this(x + Inner().prop <!AMBIGUITY!>+<!> this.<!UNRESOLVED_REFERENCE!>Inner<!>().<!UNRESOLVED_REFERENCE!>prop<!>)
this(x + Inner().prop + this.Inner().prop)
}
@@ -7,9 +7,9 @@ class A {
constructor(x: () -> Int)
constructor() : this(
{
<!UNRESOLVED_REFERENCE!>foo<!>() +
this.<!UNRESOLVED_REFERENCE!>foo<!>() +
this@A.<!UNRESOLVED_REFERENCE!>foo<!>() +
<!UNRESOLVED_REFERENCE!>foobar<!>()
foo() +
this.foo() +
this@A.foo() +
foobar()
})
}
@@ -3,5 +3,5 @@ class A {
fun foo() = 1
constructor(x: Int)
constructor(x: Int, y: Int, z: Int = x + foo() + this.foo()) :
<!INAPPLICABLE_CANDIDATE!>this<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + this.<!UNRESOLVED_REFERENCE!>foo<!>())
this(x + foo() + this.foo())
}
@@ -6,7 +6,7 @@ class A {
fun foo() = 1
constructor(x: Any?)
constructor() : this(object {
fun bar() = <!UNRESOLVED_REFERENCE!>foo<!>() + this@A.<!UNRESOLVED_REFERENCE!>foo<!>() +
<!INAPPLICABLE_CANDIDATE!>foobar<!>() + super@A.<!UNRESOLVED_REFERENCE!>hashCode<!>()
fun bar() = foo() + this@A.foo() +
foobar() + super@A.hashCode()
})
}
@@ -4,8 +4,8 @@ class D : C {
constructor() : super(
{
val s = ""
<!UNRESOLVED_REFERENCE!>s<!>()
<!UNRESOLVED_REFERENCE!>""()<!>
s()
""()
42
}())
@@ -3,5 +3,5 @@ class A {
val prop = 1
constructor(x: Int)
constructor(x: Int, y: Int, z: Int = x + prop + this.prop) :
<!INAPPLICABLE_CANDIDATE!>this<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + this.<!UNRESOLVED_REFERENCE!>prop<!>)
this(x + prop + this.prop)
}
@@ -3,5 +3,5 @@ open class B(x: Int)
class A : B {
val prop = 1
constructor(x: Int, y: Int = x + prop + this.prop) :
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + this.<!UNRESOLVED_REFERENCE!>prop<!>)
super(x + prop + this.prop)
}
@@ -4,5 +4,5 @@ open class B(x: Int) {
}
class A : B {
constructor(x: Int, y: Int = x + foo() + this.foo() + super.foo()) :
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + this.<!UNRESOLVED_REFERENCE!>foo<!>() + super.foo())
super(x + foo() + this.foo() + super.foo())
}
@@ -5,5 +5,5 @@ open class B(x: Int) {
class A : B {
override fun foo() = 2
constructor(x: Int, y: Int = x + foo() + this.foo() + super.foo()) :
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + this.<!UNRESOLVED_REFERENCE!>foo<!>() + super.foo())
super(x + foo() + this.foo() + super.foo())
}
@@ -2,5 +2,5 @@
open class B(val prop: Int)
class A : B {
constructor(x: Int, y: Int = x + prop + this.prop + super.prop) :
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + this.<!UNRESOLVED_REFERENCE!>prop<!> + super.prop)
super(x + prop + this.prop + super.prop)
}
@@ -5,10 +5,10 @@ val A.prop: Int get() = 2
class A {
constructor(x: Int)
constructor() : <!INAPPLICABLE_CANDIDATE!>this<!>(
<!UNRESOLVED_REFERENCE!>foobar<!>() +
constructor() : this(
foobar() +
this.foobar() +
<!UNRESOLVED_REFERENCE!>prop<!> +
prop +
this.prop +
this@A.prop
)