[FIR] Don't provide receiver as value in delegated constructor call
This commit is contained in:
@@ -6,5 +6,5 @@ class B : A {
|
||||
override fun f() {}
|
||||
class C : A by this {}
|
||||
class D(val x : B = this)
|
||||
class E : <!INAPPLICABLE_CANDIDATE!>P<!>(this)
|
||||
class E : P(this)
|
||||
}
|
||||
@@ -37,8 +37,8 @@ class A(
|
||||
Companion.CONST,
|
||||
Nested.CONST,
|
||||
Interface.CONST,
|
||||
a,
|
||||
b()
|
||||
<!UNRESOLVED_REFERENCE!>a<!>,
|
||||
<!UNRESOLVED_REFERENCE!>b<!>()
|
||||
)
|
||||
|
||||
class Nested {
|
||||
|
||||
Vendored
-8
@@ -1,8 +0,0 @@
|
||||
open class S(val a: Any, val b: Any, val c: Any) {}
|
||||
|
||||
object A : S(prop1, prop2, func()) {
|
||||
val prop1 = 1
|
||||
val prop2: Int
|
||||
get() = 1
|
||||
fun func() {}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
open class S(val a: Any, val b: Any, val c: Any) {}
|
||||
|
||||
object A : S(<!UNRESOLVED_REFERENCE!>prop1<!>, <!UNRESOLVED_REFERENCE!>prop2<!>, <!UNRESOLVED_REFERENCE!>func<!>()) {
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ class A : S (
|
||||
Companion.CONST,
|
||||
Nested.CONST,
|
||||
Interface.CONST,
|
||||
a,
|
||||
b()
|
||||
<!UNRESOLVED_REFERENCE!>a<!>,
|
||||
<!UNRESOLVED_REFERENCE!>b<!>()
|
||||
) {
|
||||
|
||||
class Nested {
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ class A : S {
|
||||
Companion.CONST,
|
||||
Nested.CONST,
|
||||
Interface.CONST,
|
||||
a,
|
||||
b()
|
||||
<!UNRESOLVED_REFERENCE!>a<!>,
|
||||
<!UNRESOLVED_REFERENCE!>b<!>()
|
||||
)
|
||||
|
||||
class Nested {
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.HashMap
|
||||
|
||||
//KT-250 Incorrect variable resolve in constructor arguments of superclass
|
||||
open class A(val x: Int)
|
||||
class B(y: Int) : A(x) //x is resolved as a property in a, so no error is generated
|
||||
class B(y: Int) : A(<!UNRESOLVED_REFERENCE!>x<!>) //x is resolved as a property in a, so no error is generated
|
||||
|
||||
//KT-617 Prohibit dollars in call to superclass constructors
|
||||
open class M(p: Int)
|
||||
@@ -29,9 +29,9 @@ abstract class TagWithText(name : String) : Tag(name) {
|
||||
open class BodyTag(name : String) : TagWithText(name) {
|
||||
}
|
||||
|
||||
class Body() : BodyTag(name) { // Must be an error!
|
||||
class Body() : BodyTag(<!UNRESOLVED_REFERENCE!>name<!>) { // Must be an error!
|
||||
}
|
||||
class Body1() : BodyTag(this.name) { // Must be an error!
|
||||
class Body1() : BodyTag(this.<!UNRESOLVED_REFERENCE!>name<!>) { // Must be an error!
|
||||
}
|
||||
|
||||
//more tests
|
||||
@@ -40,10 +40,10 @@ open class X(p: Int, r: Int) {
|
||||
val s = "s"
|
||||
}
|
||||
|
||||
class Y(i: Int) : X(i, rrr) {
|
||||
class Y(i: Int) : X(i, <!UNRESOLVED_REFERENCE!>rrr<!>) {
|
||||
val rrr = 3
|
||||
}
|
||||
|
||||
class Z(val i: Int) : <!INAPPLICABLE_CANDIDATE!>X<!>(s, x) {
|
||||
class Z(val i: Int) : X(<!UNRESOLVED_REFERENCE!>s<!>, <!UNRESOLVED_REFERENCE!>x<!>) {
|
||||
val x = 2
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ open class Base<T>(p: Any?) {
|
||||
|
||||
class D: Base<Int>("") {
|
||||
inner class B : Base<String> {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(""))
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(<!INAPPLICABLE_CANDIDATE!>foo1<!>(""))
|
||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(1))
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ open class Base<T>(p: Any?) {
|
||||
class D: Base<Int>(1) {
|
||||
inner class B : Base<Int> {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(1))
|
||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.foo1(1))
|
||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>(1))
|
||||
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@D.foo1(1))
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,6 +7,6 @@ fun Base.foo() {
|
||||
class B : Base {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1())
|
||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@foo.foo1())
|
||||
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.foo1())
|
||||
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>())
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ open class Base<T>(p: Any?) {
|
||||
|
||||
fun Base<Int>.foo() {
|
||||
class B : Base<String> {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(""))
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(<!INAPPLICABLE_CANDIDATE!>foo1<!>(""))
|
||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(1))
|
||||
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@foo.foo1(12))
|
||||
constructor(x: Int, y: Int, z: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.foo1(""))
|
||||
constructor(x: Int, y: Int, z: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>(""))
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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 + this.Inner().prop)
|
||||
this(x + Inner().prop <!AMBIGUITY!>+<!> this.<!UNRESOLVED_REFERENCE!>Inner<!>().<!UNRESOLVED_REFERENCE!>prop<!>)
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -7,9 +7,9 @@ class A {
|
||||
constructor(x: () -> Int)
|
||||
constructor() : this(
|
||||
{
|
||||
foo() +
|
||||
this.foo() +
|
||||
this@A.foo() +
|
||||
foobar()
|
||||
<!UNRESOLVED_REFERENCE!>foo<!>() +
|
||||
this.<!UNRESOLVED_REFERENCE!>foo<!>() +
|
||||
this@A.<!UNRESOLVED_REFERENCE!>foo<!>() +
|
||||
<!UNRESOLVED_REFERENCE!>foobar<!>()
|
||||
})
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -3,5 +3,5 @@ class A {
|
||||
fun foo() = 1
|
||||
constructor(x: Int)
|
||||
constructor(x: Int, y: Int, z: Int = x + foo() + this.foo()) :
|
||||
this(x + foo() + this.foo())
|
||||
<!INAPPLICABLE_CANDIDATE!>this<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + this.<!UNRESOLVED_REFERENCE!>foo<!>())
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ class A {
|
||||
fun foo() = 1
|
||||
constructor(x: Any?)
|
||||
constructor() : this(object {
|
||||
fun bar() = foo() + this@A.foo() +
|
||||
foobar() + super@A.hashCode()
|
||||
fun bar() = <!UNRESOLVED_REFERENCE!>foo<!>() + this@A.<!UNRESOLVED_REFERENCE!>foo<!>() +
|
||||
<!INAPPLICABLE_CANDIDATE!>foobar<!>() + super@A.hashCode()
|
||||
})
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -4,8 +4,8 @@ class D : C {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(
|
||||
{
|
||||
val s = ""
|
||||
s()
|
||||
""()
|
||||
<!UNRESOLVED_REFERENCE!>s<!>()
|
||||
<!UNRESOLVED_REFERENCE!>""()<!>
|
||||
42
|
||||
}())
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -3,5 +3,5 @@ class A {
|
||||
val prop = 1
|
||||
constructor(x: Int)
|
||||
constructor(x: Int, y: Int, z: Int = x + prop + this.prop) :
|
||||
this(x + prop + this.prop)
|
||||
<!INAPPLICABLE_CANDIDATE!>this<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + this.<!UNRESOLVED_REFERENCE!>prop<!>)
|
||||
}
|
||||
|
||||
+1
-1
@@ -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 + prop + this.prop)
|
||||
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + this.<!UNRESOLVED_REFERENCE!>prop<!>)
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -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 + foo() + this.foo() + super.foo())
|
||||
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + this.<!UNRESOLVED_REFERENCE!>foo<!>() + super.foo())
|
||||
}
|
||||
|
||||
+1
-1
@@ -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 + foo() + this.foo() + super.foo())
|
||||
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + this.<!UNRESOLVED_REFERENCE!>foo<!>() + super.foo())
|
||||
}
|
||||
|
||||
+1
-1
@@ -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 + prop + this.prop + super.prop)
|
||||
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + this.<!UNRESOLVED_REFERENCE!>prop<!> + super.prop)
|
||||
}
|
||||
|
||||
+3
-3
@@ -5,10 +5,10 @@ val A.prop: Int get() = 2
|
||||
|
||||
class A {
|
||||
constructor(x: Int)
|
||||
constructor() : this(
|
||||
foobar() +
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>this<!>(
|
||||
<!UNRESOLVED_REFERENCE!>foobar<!>() +
|
||||
this.foobar() +
|
||||
prop +
|
||||
<!UNRESOLVED_REFERENCE!>prop<!> +
|
||||
this.prop +
|
||||
this@A.prop
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user