Files
kotlin-fork/compiler/testData/diagnostics/tests/regressions/kt442.jet
T
Stepan Koltsov 07ff53d456 add trailing newlines to test files
otherwise I have to rollback dozens of files after using sed that follows conventions
2012-03-12 22:54:14 +04:00

32 lines
612 B
Plaintext

// KT-442 Type inference fails on with()
fun <T> funny(f : () -> T) : T = f()
fun testFunny() {
val <!UNUSED_VARIABLE!>a<!> : Int = funny {1}
}
fun <T> funny2(<!UNUSED_PARAMETER!>f<!> : (t : T) -> T) : T {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun testFunny2() {
val <!UNUSED_VARIABLE!>a<!> : Int = funny2 {it}
}
fun box() : String {
return generic_invoker { it }
}
fun <T> generic_invoker(gen : (String) -> T) : T {
return gen("")
}
fun <T> T.with(f : T.() -> Unit) {
f()
}
fun main(args : Array<String>) {
val <!UNUSED_VARIABLE!>a<!> = 1 with {
plus(1)
}
}