[FIR] Add NO_THIS & INSTANCE_ACCESS_BEFORE_SUPER_CALL

This commit is contained in:
Nick
2020-08-17 17:21:46 +03:00
parent 7e1c2cfd36
commit c8f8908a01
86 changed files with 526 additions and 219 deletions
@@ -6,7 +6,7 @@ open class Base<T>(p: Any?) {
class D: Base<Int>("") {
inner class B : Base<String> {
constructor() : super(foo1(""))
constructor() : super(<!INAPPLICABLE_CANDIDATE!>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.foo1(1))
constructor(x: Int) : super(<!UNRESOLVED_LABEL!>this@B<!>.<!UNRESOLVED_REFERENCE!>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.foo1())
constructor(x: Int, y: Int) : super(<!UNRESOLVED_LABEL!>this@B<!>.<!UNRESOLVED_REFERENCE!>foo1<!>())
}
}
@@ -5,9 +5,9 @@ open class Base<T>(p: Any?) {
fun Base<Int>.foo() {
class B : Base<String> {
constructor() : super(foo1(""))
constructor() : super(<!INAPPLICABLE_CANDIDATE!>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.foo1(""))
constructor(x: Int, y: Int, z: Int) : super(<!UNRESOLVED_LABEL!>this@B<!>.<!UNRESOLVED_REFERENCE!>foo1<!>(""))
}
}
@@ -6,6 +6,6 @@ class Outer {
}
constructor(x: Int)
constructor(x: Int, y: Int, z: Int = x + Inner().prop <!AMBIGUITY!>+<!> this.<!UNRESOLVED_REFERENCE!>Inner<!>().<!UNRESOLVED_REFERENCE!>prop<!>) :
this(x + Inner().prop + this.Inner().prop)
constructor(x: Int, y: Int, z: Int = x + Inner().prop <!AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>Inner<!>().<!UNRESOLVED_REFERENCE!>prop<!>) :
this(x + Inner().prop <!AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>Inner<!>().<!UNRESOLVED_REFERENCE!>prop<!>)
}
@@ -7,9 +7,9 @@ class A {
constructor(x: () -> Int)
constructor() : this(
{
foo() +
this.foo() +
this@A.foo() +
foobar()
<!UNRESOLVED_REFERENCE!>foo<!>() +
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>foo<!>() +
<!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>foo<!>() +
<!UNRESOLVED_REFERENCE!>foobar<!>()
})
}
@@ -2,6 +2,6 @@
class A {
fun foo() = 1
constructor(x: Int)
constructor(x: Int, y: Int, z: Int = x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + this.<!UNRESOLVED_REFERENCE!>foo<!>()) :
this(x + foo() + this.foo())
constructor(x: Int, y: Int, z: Int = x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>foo<!>()) :
<!INAPPLICABLE_CANDIDATE!>this<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>foo<!>())
}
@@ -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<!>() + <!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>foo<!>() +
<!INAPPLICABLE_CANDIDATE!>foobar<!>() + super@A.<!UNRESOLVED_REFERENCE!>hashCode<!>()
})
}
@@ -5,7 +5,7 @@ fun A.foobar() = 3
class A {
fun foo() = 1
constructor( x: Any = object {
fun bar() = <!UNRESOLVED_REFERENCE!>foo<!>() + this@A.<!UNRESOLVED_REFERENCE!>foo<!>() +
fun bar() = <!UNRESOLVED_REFERENCE!>foo<!>() + <!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>foo<!>() +
<!INAPPLICABLE_CANDIDATE!>foobar<!>()
})
}
@@ -4,8 +4,8 @@ class D : C {
constructor() : super(
{
val s = ""
s()
""()
<!UNRESOLVED_REFERENCE!>s<!>()
<!UNRESOLVED_REFERENCE!>""()<!>
42
}())
@@ -3,6 +3,6 @@ fun foo(x: A) = 1
class A {
constructor(x: Int)
constructor(x: Int, y: Int, z: Int = x + foo(this) + foo(this@A)) :
this(x + foo(this) + foo(this@A))
constructor(x: Int, y: Int, z: Int = x + foo(<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>) + foo(<!UNRESOLVED_LABEL!>this@A<!>)) :
this(x + foo(<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>) + foo(<!UNRESOLVED_LABEL!>this@A<!>))
}
@@ -2,6 +2,6 @@
class A {
val prop = 1
constructor(x: Int)
constructor(x: Int, y: Int, z: Int = x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + this.<!UNRESOLVED_REFERENCE!>prop<!>) :
this(x + prop + this.prop)
constructor(x: Int, y: Int, z: Int = x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>prop<!>) :
<!INAPPLICABLE_CANDIDATE!>this<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>prop<!>)
}
@@ -2,6 +2,6 @@
open class B(x: Int)
class A : B {
val prop = 1
constructor(x: Int, y: Int = x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + this.<!UNRESOLVED_REFERENCE!>prop<!>) :
super(x + prop + this.prop)
constructor(x: Int, y: Int = x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>prop<!>) :
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>prop<!>)
}
@@ -3,6 +3,6 @@ open class B(x: Int) {
fun foo() = 1
}
class A : B {
constructor(x: Int, y: Int = x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + this.<!UNRESOLVED_REFERENCE!>foo<!>() + super.<!UNRESOLVED_REFERENCE!>foo<!>()) :
super(x + foo() + this.foo() + super.foo())
constructor(x: Int, y: Int = x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>foo<!>() + super.<!UNRESOLVED_REFERENCE!>foo<!>()) :
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>foo<!>() + super.<!UNRESOLVED_REFERENCE!>foo<!>())
}
@@ -4,6 +4,6 @@ open class B(x: Int) {
}
class A : B {
override fun foo() = 2
constructor(x: Int, y: Int = x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + this.<!UNRESOLVED_REFERENCE!>foo<!>() + super.<!UNRESOLVED_REFERENCE!>foo<!>()) :
super(x + foo() + this.foo() + super.foo())
constructor(x: Int, y: Int = x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>foo<!>() + super.<!UNRESOLVED_REFERENCE!>foo<!>()) :
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>foo<!>() + super.<!UNRESOLVED_REFERENCE!>foo<!>())
}
@@ -1,6 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B(val prop: Int)
class A : B {
constructor(x: Int, y: Int = x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + this.<!UNRESOLVED_REFERENCE!>prop<!> + super.<!UNRESOLVED_REFERENCE!>prop<!>) :
super(x + prop + this.prop + super.prop)
constructor(x: Int, y: Int = x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>prop<!> + super.<!UNRESOLVED_REFERENCE!>prop<!>) :
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.<!UNRESOLVED_REFERENCE!>prop<!> + super.<!UNRESOLVED_REFERENCE!>prop<!>)
}
@@ -5,11 +5,11 @@ val A.prop: Int get() = 2
class A {
constructor(x: Int)
constructor() : this(
foobar() +
this.foobar() +
prop +
this.prop +
this@A.prop
constructor() : <!INAPPLICABLE_CANDIDATE!>this<!>(
<!UNRESOLVED_REFERENCE!>foobar<!>() +
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foobar() +
<!UNRESOLVED_REFERENCE!>prop<!> +
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop +
<!UNRESOLVED_LABEL!>this@A<!>.prop
)
}