[FIR] Fix missing receiver type if anonymous function without label

This commit is contained in:
simon.ogorodnik
2020-04-07 23:43:42 +03:00
parent d2fd377605
commit f573719cc1
143 changed files with 249 additions and 766 deletions
@@ -1,13 +0,0 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class ClassA {
fun method1() = this
fun String.method2() {
method1() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
this.method1() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
}
}
fun String.method1() = this
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
@@ -1,20 +0,0 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
enum class Foo {
FOO;
companion object {
fun valueOf(something: String) = 2
fun values() = 1
}
}
fun test() {
Foo.values() checkType { <!UNRESOLVED_REFERENCE!>_<!><Array<Foo>>() }
Foo.Companion.values() checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
Foo.valueOf("") checkType { <!UNRESOLVED_REFERENCE!>_<!><Foo>() }
Foo.Companion.valueOf("") checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
@@ -1,16 +0,0 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class A
fun A.foo() = this
fun test(a: A) {
fun A.foo() = 3
a.foo() checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
with(a) {
foo() checkType { _<Int>() }
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
@@ -9,7 +9,7 @@ class A {
fun test(a: A) {
fun A.foo() = 4
a.foo() checkType { <!UNRESOLVED_REFERENCE!>_<!><A>() }
a.foo() checkType { _<A>() }
with(a) {
foo() checkType { _<A>() }
@@ -1,19 +0,0 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
// FILE: A.java
public class A {
public static void foo() {}
}
// FILE: 1.kt
class C {
fun foo() = this
inner class B : A() {
fun test() {
foo() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Unit>() }
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
@@ -6,5 +6,5 @@ operator fun A.component1(): String = ""
fun test(a: A) {
val (b) = a
b checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
b checkType { _<Int>() }
}
@@ -1,29 +0,0 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
// FILE: A.java
public class A {
public A getFoo() { return 3; }
}
// FILE: 1.kt
private val A.foo: Int get() = 4
fun test(a: A) {
a.foo checkType { <!UNRESOLVED_REFERENCE!>_<!><A>() }
with(a) {
foo checkType { _<A>() }
}
}
class B {
private val A.foo: B get() = this@B
fun test(a: A) {
a.foo checkType { <!INAPPLICABLE_CANDIDATE!>_<!><A>() }
with(a) {
foo checkType { _<A>() }
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE