[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,19 +0,0 @@
// !CHECK_TYPE
interface A<T>
fun <T> foo(a: A<T>, aN: A<T?>): T = throw Exception("$a $aN")
fun <T> doA(a: A<T>): T = throw Exception("$a")
fun test(a: A<Int>, aN: A<Int?>) {
val aa = doA(aN)
aa checkType { <!UNRESOLVED_REFERENCE!>_<!><Int?>() }
val nullable = foo(aN, aN)
//T = Int?, T? = Int? => T = Int?
nullable checkType { <!UNRESOLVED_REFERENCE!>_<!><Int?>() }
val notNullable = foo(a, aN)
//T = Int, T? = Int? => T = Int
notNullable checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
interface A<T>
@@ -15,7 +15,7 @@ fun test(out: Out<Int>, i: In<Int>, inv: A<Int>) {
// T? >: Int => T = Int
doT(1)
val r = doOut(out)
r checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
r checkType { _<Int>() }
// T? <: Int => error
<!INAPPLICABLE_CANDIDATE!>doIn<!>(i)
@@ -1,22 +0,0 @@
// !CHECK_TYPE
interface A<T>
interface Out<out T>
fun <T> foo(a: A<T>, o: Out<T?>): T = throw Exception("$a $o")
fun <T> doOut(o: Out<T?>): T = throw Exception("$o")
fun test(a: A<Int>, aN: A<Int?>, o: Out<Int?>) {
val out = doOut(o)
//T? >: Int? => T >: Int
out checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
val nullable = foo(aN, o)
//T = Int?, T? >: Int? => T = Int?
nullable checkType { <!UNRESOLVED_REFERENCE!>_<!><Int?>() }
val notNullable = foo(a, o)
//T = Int, T? >: Int? => T = Int
notNullable checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
interface A<T>
@@ -1,22 +0,0 @@
// !CHECK_TYPE
interface A<T>
interface In<in T>
fun <T> foo(a: A<T>, i: In<T>): T = throw Exception("$a $i")
fun <T> doIn(i: In<T?>): T = throw Exception("$i")
fun test(a: A<Int>, aN: A<Int?>, i: In<Int?>) {
val _in = doIn(i)
//T? <: Int? => T <: Int?
_in checkType { <!UNRESOLVED_REFERENCE!>_<!><Int?>() }
val notNullable = foo(a, i)
//T = Int, T? <: Int? => T = Int
notNullable checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
val nullable = foo(aN, i)
//T = Int?, T? <: Int? => T = Int?
nullable checkType { <!UNRESOLVED_REFERENCE!>_<!><Int?>() }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
interface A<T>