[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,28 +0,0 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// T is the immutable type
interface Builder<out T> {
fun build(): T
}
// T is the immutable type, U is the builder
interface Copyable<out T, out U : Builder<T>> {
fun builder(): U
}
fun <T : Copyable<T, U>, U : Builder<T>> T.copy(fn: U.() -> Unit): T = throw Exception()
open class Foo(val x: Int, val y: Int) : Copyable<Foo, Foo.FooBuilder> {
override fun builder(): FooBuilder = FooBuilder(x, y)
open class FooBuilder(var x: Int, var y: Int): Builder<Foo> {
override fun build(): Foo = Foo(x, y)
}
}
fun test() {
val foo1 = Foo(x = 1, y = 2)
val foo2 = foo1.copy { y = 3 } // this doesn't work
foo2 checkType { <!UNRESOLVED_REFERENCE!>_<!><Foo>() }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER
@@ -1,10 +0,0 @@
// !CHECK_TYPE
//KT-4420 Type inference with type projections
class Foo<T>
fun <T> Foo<T>.bar(): T = throw Exception()
fun main() {
val f: Foo<out String> = Foo()
f.bar() checkType { <!UNRESOLVED_REFERENCE!>_<!><String>() }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
//KT-4420 Type inference with type projections