[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
+2 -2
View File
@@ -10,14 +10,14 @@ enum class Color {
class MyColor(val x: <!UNRESOLVED_REFERENCE!>Color.RED<!>, y: <!UNRESOLVED_REFERENCE!>Color.RED<!>) : <!UNRESOLVED_REFERENCE!>Color.RED<!> {
var z: <!UNRESOLVED_REFERENCE!>Color.RED<!> = Color.RED
set(arg: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>Color.RED<!>) { z = arg }
set(arg: <!UNRESOLVED_REFERENCE!>Color.RED<!>) { z = arg }
fun foo(arg: <!UNRESOLVED_REFERENCE!>Color.RED<!>): <!UNRESOLVED_REFERENCE!>Color.RED<!> = arg
fun bar(): <!UNRESOLVED_REFERENCE!>Color.RED<!> {
class Local : <!UNRESOLVED_REFERENCE!>Color.RED<!>
fun local(arg: <!UNRESOLVED_REFERENCE!>Color.RED<!>): <!UNRESOLVED_REFERENCE!>Color.RED<!> = arg
val temp: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>Color.RED<!> = Color.RED
val temp: <!UNRESOLVED_REFERENCE!>Color.RED<!> = Color.RED
temp as? <!UNRESOLVED_REFERENCE!>Color.RED<!>
if (temp is <!UNRESOLVED_REFERENCE!>Color.RED<!>) {
return temp as <!UNRESOLVED_REFERENCE!>Color.RED<!>
@@ -1,3 +0,0 @@
open class A(val x: Any)
class B : A(this::class)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
open class A(val x: Any)
class B : A(<!NO_THIS!>this<!>::class)
@@ -3,7 +3,7 @@
interface B<T>
interface G<T>: B<T>
fun f(p: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>B<Foo><!>): Any {
fun f(p: <!UNRESOLVED_REFERENCE!>B<Foo><!>): Any {
val v = p as G
return checkSubtype<G<*>>(v)
}
@@ -2,7 +2,7 @@
class G<T>
fun foo(p: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>P<!>) {
fun foo(p: <!UNRESOLVED_REFERENCE!>P<!>) {
val v = p as G?
checkSubtype<G<*>>(v!!)
}
@@ -15,12 +15,12 @@ fun case_3() {
}
val x = object<T, K: Comparable<K>> {
fun test() = 10 as <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>T<!> // OK
fun test() = 10 as <!UNRESOLVED_REFERENCE!>T<!> // OK
}
fun case_4() {
val x = object<T> {
fun test() = 10 as <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>T<!>
fun test() = 10 as <!UNRESOLVED_REFERENCE!>T<!>
}
val y = x.test() // type y is T
@@ -15,12 +15,12 @@ fun case_3() {
}
val x = object<T, K: Comparable<K>> {
fun test() = 10 as <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>T<!> // OK
fun test() = 10 as <!UNRESOLVED_REFERENCE!>T<!> // OK
}
fun case_4() {
val x = object<T> {
fun test() = 10 as <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>T<!>
fun test() = 10 as <!UNRESOLVED_REFERENCE!>T<!>
}
val y = x.test() // type y is T
@@ -21,5 +21,5 @@ annotation class Bar(
annotation class Baz(
val a: IntArray = [null],
val b: IntArray = [1, null, 2],
val c: IntArray = [this]
val c: IntArray = [<!NO_THIS!>this<!>]
)
@@ -2,7 +2,7 @@
import kotlin.reflect.KProperty
val Int.a by Delegate(this)
val Int.a by Delegate(<!NO_THIS!>this<!>)
class A {
val Int.a by <!INAPPLICABLE_CANDIDATE!>Delegate<!>(this)
@@ -59,7 +59,7 @@ class MessageManager11<A> : <!UNRESOLVED_REFERENCE!>Message5<Message5<A>><!>() {
fun <T : <!UNRESOLVED_REFERENCE!>Message5<A><!>> execute() {}
}
data class MessageManager12(val x: Int) : <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>Message5<Message2><!>() {
data class MessageManager12(val x: Int) : <!UNRESOLVED_REFERENCE!>Message5<Message2><!>() {
fun <T : Message2> execute() {}
}
@@ -19,7 +19,7 @@ fun test1() {
}
}
fun test2(l: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>List<AA><!>) {
fun test2(l: <!UNRESOLVED_REFERENCE!>List<AA><!>) {
l.<!UNRESOLVED_REFERENCE!>map<!> {
<!UNRESOLVED_REFERENCE!>it<!>!!
}
@@ -3,6 +3,6 @@
fun <T> id(x: T) = x
fun <T> select(vararg x: T) = x[0]
val x1 = select(id { this }, fun Int.() = this)
val x2 = select(id { this + <!UNRESOLVED_REFERENCE!>it<!>.<!UNRESOLVED_REFERENCE!>inv<!>() }, fun Int.(x: Int) = this)
val x3 = select(id { this.<!UNRESOLVED_REFERENCE!>length<!> + <!UNRESOLVED_REFERENCE!>it<!>.<!UNRESOLVED_REFERENCE!>inv<!>() }, fun String.(x: Int) = length)
val x1 = select(id { <!NO_THIS!>this<!> }, fun Int.() = this)
val x2 = select(id { <!NO_THIS!>this<!> + <!UNRESOLVED_REFERENCE!>it<!>.<!UNRESOLVED_REFERENCE!>inv<!>() }, fun Int.(x: Int) = this)
val x3 = select(id { <!NO_THIS!>this<!>.<!UNRESOLVED_REFERENCE!>length<!> + <!UNRESOLVED_REFERENCE!>it<!>.<!UNRESOLVED_REFERENCE!>inv<!>() }, fun String.(x: Int) = length)
@@ -19,7 +19,7 @@ public class Foo {
// FILE: test.kt
fun test(e: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>ErrorType<!>) {
fun test(e: <!UNRESOLVED_REFERENCE!>ErrorType<!>) {
Foo.foo {
Sam.Result.<!INAPPLICABLE_CANDIDATE!>create<!>(e)
}
@@ -3,14 +3,14 @@
fun <T> select(vararg x: T) = x[0]
fun main() {
val x1: String.() -> String = if (true) {{ this }} else {{ this }}
val x2: String.() -> String = if (true) {{ -> this }} else {{ -> this }}
val x1: String.() -> String = if (true) {{ <!NO_THIS!>this<!> }} else {{ <!NO_THIS!>this<!> }}
val x2: String.() -> String = if (true) {{ -> <!NO_THIS!>this<!> }} else {{ -> <!NO_THIS!>this<!> }}
val x3: () -> String = if (true) {{ -> "this" }} else {{ -> "this" }}
val x4: String.() -> String = if (true) {{ str: String -> "this" }} else {{ str: String -> "this" }}
val x41: String.(String) -> String = if (true) {{ str: String, str2: String -> "this" }} else {{ str: String, str2: String -> "this" }}
val x42: String.(String) -> String = if (true) {{ str, str2 -> "this" }} else {{ str, str2 -> "this" }}
val x5: String.() -> String = if (true) {{ str -> "this" }} else {{ str -> "this" }}
val x6: String.() -> String = if (true) {{ str -> "this" }} else {{ "this" }}
val x7: String.() -> String = select({ -> this }, { -> this })
val x8: String.() -> String = select({ this }, { this })
val x7: String.() -> String = select({ -> <!NO_THIS!>this<!> }, { -> <!NO_THIS!>this<!> })
val x8: String.() -> String = select({ <!NO_THIS!>this<!> }, { <!NO_THIS!>this<!> })
}
@@ -6,11 +6,11 @@ interface Trait {
class Outer : Trait {
class Nested {
val t = this@Outer.<!UNRESOLVED_REFERENCE!>bar<!>()
val t = <!UNRESOLVED_LABEL!>this@Outer<!>.<!UNRESOLVED_REFERENCE!>bar<!>()
val s = super@Outer.<!UNRESOLVED_REFERENCE!>bar<!>()
inner class NestedInner {
val t = this@Outer.<!UNRESOLVED_REFERENCE!>bar<!>()
val t = <!UNRESOLVED_LABEL!>this@Outer<!>.<!UNRESOLVED_REFERENCE!>bar<!>()
val s = super@Outer.<!UNRESOLVED_REFERENCE!>bar<!>()
}
}
@@ -7,8 +7,8 @@ class Outer {
class Nested {
fun f() = <!UNRESOLVED_REFERENCE!>function<!>()
fun g() = <!UNRESOLVED_REFERENCE!>property<!>
fun h() = this@Outer.<!UNRESOLVED_REFERENCE!>function<!>()
fun i() = this@Outer.<!UNRESOLVED_REFERENCE!>property<!>
fun h() = <!UNRESOLVED_LABEL!>this@Outer<!>.<!UNRESOLVED_REFERENCE!>function<!>()
fun i() = <!UNRESOLVED_LABEL!>this@Outer<!>.<!UNRESOLVED_REFERENCE!>property<!>
}
inner class Inner {
@@ -1,17 +1,17 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
val funLit = lambda@ fun String.() {
val d1 = this@lambda
val d1 = <!UNRESOLVED_LABEL!>this@lambda<!>
}
fun test() {
val funLit = lambda@ fun String.(): String {
return this@lambda
return <!UNRESOLVED_LABEL!>this@lambda<!>
}
}
fun lambda() {
val funLit = lambda@ fun String.(): String {
return this@lambda
return <!UNRESOLVED_LABEL!>this@lambda<!>
}
}
@@ -4,10 +4,10 @@ interface Iterator<out T> {
fun <R> map(transform: (element: T) -> R) : Iterator<R> =
object : Iterator<R> {
override fun next() : R = transform(this@map.<!UNRESOLVED_REFERENCE!>next<!>())
override fun next() : R = transform(<!UNRESOLVED_LABEL!>this@map<!>.<!UNRESOLVED_REFERENCE!>next<!>())
override val hasNext : Boolean
// There's no 'this' associated with the map() function, only this of the Iterator class
get() = this@map.<!UNRESOLVED_REFERENCE!>hasNext<!>
get() = <!UNRESOLVED_LABEL!>this@map<!>.<!UNRESOLVED_REFERENCE!>hasNext<!>
}
}
@@ -39,8 +39,8 @@ class W4(val f: L2) {
fun test1() { // to extension lambda 0
val w10 = W1 { this } // oi+ ni+
val i10: E0 = id { this } // o1- ni+
val j10 = id<E0> { this } // oi+ ni+
val i10: E0 = id { <!NO_THIS!>this<!> } // o1- ni+
val j10 = id<E0> { <!NO_THIS!>this<!> } // oi+ ni+
val f10 = W1(fun Int.(): Int = this) // oi+ ni+
val g10: E0 = id(fun Int.(): Int = this) // oi+ ni+
@@ -60,28 +60,28 @@ fun test1() { // to extension lambda 0
fun test2() { // to extension lambda 1
val w20 = W2 { this + it.length } // oi+ ni+
val i20: E1 = id { this + <!UNRESOLVED_REFERENCE!>it<!>.<!UNRESOLVED_REFERENCE!>length<!> } // oi- ni+
val i20: E1 = id { <!NO_THIS!>this<!> + <!UNRESOLVED_REFERENCE!>it<!>.<!UNRESOLVED_REFERENCE!>length<!> } // oi- ni+
val w21 = W2 { this } // oi+ ni+
val i21: E1 = id { this } // oi- ni+
val i21: E1 = id { <!NO_THIS!>this<!> } // oi- ni+
val f21 = W2(fun Int.(String): Int = this) // oi+ ni+
val g21: E1 = id(fun Int.(String): Int = this) // oi+ ni+
val w22 = W2 { s -> this + s.length } // oi+ ni+
val i22: E1 = id { s -> this + s.<!UNRESOLVED_REFERENCE!>length<!> } // oi+ ni+
val i22: E1 = id { s -> <!NO_THIS!>this<!> + s.<!UNRESOLVED_REFERENCE!>length<!> } // oi+ ni+
val w23 = W2 { s -> s.length } // oi+ ni+
val i23: E1 = id { s -> s.<!UNRESOLVED_REFERENCE!>length<!> } // oi+ ni+
val w24 = W2 { s: String -> this + s.length } // oi+ ni+
val i24: E1 = id { s: String -> this + s.length } //oi- ni+
val i24: E1 = id { s: String -> <!NO_THIS!>this<!> + s.length } //oi- ni+
val w25 = W2 { s: String -> s.length } // oi+ ni+
val i25: E1 = id { s: String -> s.length } // oi- ni+
val w26 = W2(id { s: String -> this + s.length }) // oi- ni+
val w26a = W2(id { s -> this + s.<!UNRESOLVED_REFERENCE!>length<!> }) // oi+ ni+
val i26: E1 = id { s: String -> this + s.length } // oi- ni+
val i26a: E1 = id { s -> this + s.<!UNRESOLVED_REFERENCE!>length<!> } // oi+ ni+
val w26 = W2(id { s: String -> <!NO_THIS!>this<!> + s.length }) // oi- ni+
val w26a = W2(id { s -> <!NO_THIS!>this<!> + s.<!UNRESOLVED_REFERENCE!>length<!> }) // oi+ ni+
val i26: E1 = id { s: String -> <!NO_THIS!>this<!> + s.length } // oi- ni+
val i26a: E1 = id { s -> <!NO_THIS!>this<!> + s.<!UNRESOLVED_REFERENCE!>length<!> } // oi+ ni+
val e = E.VALUE
val w27 = <!INAPPLICABLE_CANDIDATE!>W2<!>(when (e) { E.VALUE -> { s: String -> this + s.length } }) // oi- ni+
val w27a = <!INAPPLICABLE_CANDIDATE!>W2<!>(when (e) { E.VALUE -> { s -> this + s.<!UNRESOLVED_REFERENCE!>length<!> } }) // oi+ ni+
val i27: E1 = when (e) { E.VALUE -> { s: String -> this + s.length } } // oi+ ni+
val i27a: E1 = when (e) { E.VALUE -> { s -> this + s.<!UNRESOLVED_REFERENCE!>length<!> } } // oi+ ni+
val w27 = <!INAPPLICABLE_CANDIDATE!>W2<!>(when (e) { E.VALUE -> { s: String -> <!NO_THIS!>this<!> + s.length } }) // oi- ni+
val w27a = <!INAPPLICABLE_CANDIDATE!>W2<!>(when (e) { E.VALUE -> { s -> <!NO_THIS!>this<!> + s.<!UNRESOLVED_REFERENCE!>length<!> } }) // oi+ ni+
val i27: E1 = when (e) { E.VALUE -> { s: String -> <!NO_THIS!>this<!> + s.length } } // oi+ ni+
val i27a: E1 = when (e) { E.VALUE -> { s -> <!NO_THIS!>this<!> + s.<!UNRESOLVED_REFERENCE!>length<!> } } // oi+ ni+
val w28 = <!INAPPLICABLE_CANDIDATE!>W2<!> { i: Int, s -> i <!AMBIGUITY!>+<!> s.<!UNRESOLVED_REFERENCE!>length<!> } // oi- ni-
val i28: E1 = id { i: Int, s -> i + s.length } // oi- ni-
@@ -1,10 +0,0 @@
interface A { fun f() }
open class P(val z: B)
class B : A {
override fun f() {}
class C : A by this {}
class D(val x : B = this)
class E : P(this)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface A { fun f() }
open class P(val z: B)
@@ -6,6 +6,6 @@ fun foo(i: Int, f: Int.()->Int) = i.f()
fun test1() {
<!AMBIGUITY!>foo<!>(1) { ->
this
<!NO_THIS!>this<!>
}
}
@@ -37,8 +37,8 @@ class A(
Companion.CONST,
Nested.CONST,
Interface.CONST,
a,
b()
<!UNRESOLVED_REFERENCE!>a<!>,
<!UNRESOLVED_REFERENCE!>b<!>()
)
class Nested {
@@ -22,8 +22,8 @@ class A : S {
Companion.CONST,
Nested.CONST,
Interface.CONST,
a,
b()
<!UNRESOLVED_REFERENCE!>a<!>,
<!UNRESOLVED_REFERENCE!>b<!>()
)
class Nested {
@@ -6,7 +6,7 @@ val <T> List<T>.length = <!UNRESOLVED_REFERENCE!>size<!>
val <T> List<T>.length1 : Int get() = size
val String.bd = this + "!"
val String.bd = <!NO_THIS!>this<!> + "!"
val String.bd1 : String get() = this + "!"
@@ -31,7 +31,7 @@ open class BodyTag(name : String) : TagWithText(name) {
class Body() : BodyTag(<!UNRESOLVED_REFERENCE!>name<!>) { // Must be an error!
}
class Body1() : BodyTag(this.<!UNRESOLVED_REFERENCE!>name<!>) { // Must be an error!
class Body1() : BodyTag(<!NO_THIS!>this<!>.<!UNRESOLVED_REFERENCE!>name<!>) { // Must be an error!
}
//more tests
@@ -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
)
}
@@ -2,7 +2,7 @@
class A() {
fun foo() : Unit {
this@A
this@a
<!UNRESOLVED_LABEL!>this@a<!>
this
}
@@ -11,7 +11,7 @@ class A(val a:Int) {
checkSubtype<A>(this@A)
}
val b: Double.() -> Unit = a@{ checkSubtype<Double>(this@a) + checkSubtype<Byte>(this@xx) }
val c = a@{ -> this@a + checkSubtype<Byte>(this@xx) }
val c = a@{ -> <!UNRESOLVED_LABEL!>this@a<!> + checkSubtype<Byte>(this@xx) }
return (a@{checkSubtype<Double>(this@a) + checkSubtype<Byte>(this@xx)})
}
}
@@ -3,6 +3,6 @@ interface Base {
}
val String.test: Base = object: Base {
override fun foo() {
this@test
<!UNRESOLVED_LABEL!>this@test<!>
}
}
@@ -1,4 +1,4 @@
fun foo1() : Unit {
this
this@a
<!NO_THIS!>this<!>
<!UNRESOLVED_LABEL!>this@a<!>
}
@@ -6,8 +6,8 @@ open class Base {
class Derived : Base()
fun test(x: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>Derived.Nested<!>) = x
fun test(x: <!UNRESOLVED_REFERENCE!>Derived.Nested<!>) = x
fun Base.testWithImplicitReceiver(x: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>Nested<!>) {
fun Base.testWithImplicitReceiver(x: <!UNRESOLVED_REFERENCE!>Nested<!>) {
val y: <!UNRESOLVED_REFERENCE!>Nested<!> = x
}
@@ -11,12 +11,12 @@ class Outer<T> {
typealias InnerAlias = Inner
typealias GenericInnerAlias<TT> = GenericInner<TT>
fun test1(x: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>NestedAlias<!>) = x
fun test2(x: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>GenericNestedAlias<Int><!>) = x
fun <T> test3(x: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>GenericNestedAlias<T><!>) = x
fun test4(x: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>InnerAlias<!>) = x
fun test5(x: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>GenericInnerAlias<Int><!>) = x
fun <T> test6(x: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>GenericInnerAlias<T><!>) = x
fun test1(x: <!UNRESOLVED_REFERENCE!>NestedAlias<!>) = x
fun test2(x: <!UNRESOLVED_REFERENCE!>GenericNestedAlias<Int><!>) = x
fun <T> test3(x: <!UNRESOLVED_REFERENCE!>GenericNestedAlias<T><!>) = x
fun test4(x: <!UNRESOLVED_REFERENCE!>InnerAlias<!>) = x
fun test5(x: <!UNRESOLVED_REFERENCE!>GenericInnerAlias<Int><!>) = x
fun <T> test6(x: <!UNRESOLVED_REFERENCE!>GenericInnerAlias<T><!>) = x
}
fun test1(x: Outer<Int>.NestedAlias) = x
fun <T> test2(x: Outer<T>.NestedAlias) = x
@@ -5,12 +5,12 @@ fun <T> emptyList(): List<T> = null!!
fun <T> foo() {
typealias LT = List<T>
val a: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>LT<!> = emptyList()
val a: <!UNRESOLVED_REFERENCE!>LT<!> = emptyList()
fun localFun(): <!UNRESOLVED_REFERENCE!>LT<!> {
typealias LLT = List<T>
val b: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>LLT<!> = a
val b: <!UNRESOLVED_REFERENCE!>LLT<!> = a
return b
}
@@ -4,8 +4,8 @@ class Cell<TC>(val x: TC)
fun <T> id(x: T): T {
typealias C = Cell<T>
class Local(val cell: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>C<!>)
class Local(val cell: <!UNRESOLVED_REFERENCE!>C<!>)
val cx = <!UNRESOLVED_REFERENCE!>C<!>(x)
val c: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>C<!> = Local(cx).cell
val c: <!UNRESOLVED_REFERENCE!>C<!> = Local(cx).cell
return c.<!UNRESOLVED_REFERENCE!>x<!>
}
@@ -6,8 +6,8 @@ class C {
typealias P2 = Pair<Int, Int>
fun p() = <!UNRESOLVED_REFERENCE!>P2<!>(1, 1)
fun first(p: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>P2<!>) = p.<!UNRESOLVED_REFERENCE!>x1<!>
fun second(p: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>P2<!>) = p.<!UNRESOLVED_REFERENCE!>x2<!>
fun first(p: <!UNRESOLVED_REFERENCE!>P2<!>) = p.<!UNRESOLVED_REFERENCE!>x1<!>
fun second(p: <!UNRESOLVED_REFERENCE!>P2<!>) = p.<!UNRESOLVED_REFERENCE!>x2<!>
}
val p1 = Pair(1, 1)
@@ -6,11 +6,11 @@ class C<T> {
typealias P2 = Pair<T, T>
typealias PT2<T2> = Pair<T, T2>
fun first(p: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>P2<!>) = p.<!UNRESOLVED_REFERENCE!>x1<!>
fun second(p: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>P2<!>) = p.<!UNRESOLVED_REFERENCE!>x2<!>
fun first(p: <!UNRESOLVED_REFERENCE!>P2<!>) = p.<!UNRESOLVED_REFERENCE!>x1<!>
fun second(p: <!UNRESOLVED_REFERENCE!>P2<!>) = p.<!UNRESOLVED_REFERENCE!>x2<!>
fun <T2> first2(p: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>PT2<T2><!>) = p.<!UNRESOLVED_REFERENCE!>x1<!>
fun <T2> second2(p: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>PT2<T2><!>) = p.<!UNRESOLVED_REFERENCE!>x2<!>
fun <T2> first2(p: <!UNRESOLVED_REFERENCE!>PT2<T2><!>) = p.<!UNRESOLVED_REFERENCE!>x1<!>
fun <T2> second2(p: <!UNRESOLVED_REFERENCE!>PT2<T2><!>) = p.<!UNRESOLVED_REFERENCE!>x2<!>
}
val p1 = Pair(1, 1)