[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
@@ -10,5 +10,5 @@ public class A<T> {
fun foo1(x: A<*>) = x.baz()
fun foo2(x: A<*>) {
x.baz() checkType { <!UNRESOLVED_REFERENCE!>_<!><Array<out A<*>>>() }
x.baz() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Array<out A<*>>>() }
}
@@ -1,14 +0,0 @@
// !WITH_NEW_INFERENCE
// !CHECK_TYPE
// SKIP_TXT
// FULL_JDK
import java.util.stream.Collectors
import java.util.stream.Stream
fun test(a: Stream<String>) {
a.collect(Collectors.toList()) checkType { <!UNRESOLVED_REFERENCE!>_<!><MutableList<String>>() }
// actually the inferred type is platform
a.collect(Collectors.toList()) checkType { <!UNRESOLVED_REFERENCE!>_<!><List<String?>>() }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !WITH_NEW_INFERENCE
// !CHECK_TYPE
// SKIP_TXT
@@ -9,8 +9,8 @@ public class A<E> {
// FILE: main.kt
fun test(x: List<Int>, y: List<String>) {
A("", x) checkType { <!UNRESOLVED_REFERENCE!>_<!><A<Any?>>() }
A("", y) checkType { <!UNRESOLVED_REFERENCE!>_<!><A<String?>>() }
A("", x) checkType { <!INAPPLICABLE_CANDIDATE!>_<!><A<Any?>>() }
A("", y) checkType { _<A<String?>>() }
<!INAPPLICABLE_CANDIDATE!>A<!><CharSequence, String>("", x)
A<CharSequence, String>("", y)
@@ -10,9 +10,9 @@ public class Outer<T> {
// FILE: main.kt
fun test(x: List<Int>, y: List<String>) {
Outer<Int>().Inner("", y, 1) checkType { <!UNRESOLVED_REFERENCE!>_<!><Outer<Int>.Inner<String>>() }
Outer<Int>().Inner("", y, 1) checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Outer<Int>.Inner<String>>() }
Outer<Int>().<!INAPPLICABLE_CANDIDATE!>Inner<!><CharSequence, String, Int>("", y, 1) <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Outer<Int>.Inner<CharSequence>>() }
Outer<Int>().Inner("", x, 1) checkType { <!UNRESOLVED_REFERENCE!>_<!><Outer<Int>.Inner<Any>>() }
Outer<Int>().Inner("", x, 1) checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Outer<Int>.Inner<Any>>() }
Outer<Int>().<!INAPPLICABLE_CANDIDATE!>Inner<!><CharSequence, String, Int>("", x, 1)
}
+2 -2
View File
@@ -14,6 +14,6 @@ class Foo<T>
fun main(foo1: Foo<Boolean>, foo2: Foo<String>) {
val x = object : Test() {} // FE exception is thrown here
x.with(foo1) checkType { <!UNRESOLVED_REFERENCE!>_<!><Boolean>() }
x.with(foo2) checkType { <!UNRESOLVED_REFERENCE!>_<!><String>() }
x.with(foo1) checkType { _<Boolean>() }
x.with(foo2) checkType { _<String>() }
}
@@ -19,6 +19,6 @@ class In<in F> {
}
fun test() {
A.foo().x() checkType { <!UNRESOLVED_REFERENCE!>_<!><Any?>() }
A.foo().x() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Any?>() }
A.bar().y(null)
}