NI. Coerce return type of lambda function descriptor to Unit. #KT-30242 Fixed
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// ISSUE: KT-30242
|
||||
|
||||
class A
|
||||
|
||||
fun println(s: String = "") {}
|
||||
|
||||
fun foo(f: () -> Any) {}
|
||||
|
||||
fun test1(b: Boolean) {
|
||||
foo {
|
||||
if (b) {
|
||||
println("meh")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test2(b: Boolean) {
|
||||
foo {
|
||||
when {
|
||||
b -> println("meh")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test3(b: Boolean) {
|
||||
foo {
|
||||
<!INVALID_IF_AS_EXPRESSION!>if<!> (b) {
|
||||
return@foo A()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test4(b: Boolean) {
|
||||
foo {
|
||||
if (b) {
|
||||
return@foo println("meh")
|
||||
}
|
||||
|
||||
if (b) {
|
||||
println()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun bar(block: () -> String) {}
|
||||
|
||||
fun test_5(b: Boolean) {
|
||||
bar {
|
||||
<!NI;TYPE_MISMATCH, TYPE_MISMATCH!>if (b) {
|
||||
println("meh")
|
||||
}<!>
|
||||
}
|
||||
}
|
||||
|
||||
fun test_6(b: Boolean) {
|
||||
foo {
|
||||
if (b) {
|
||||
return@foo Unit
|
||||
}
|
||||
if (b) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun bar(/*0*/ block: () -> kotlin.String): kotlin.Unit
|
||||
public fun foo(/*0*/ f: () -> kotlin.Any): kotlin.Unit
|
||||
public fun println(/*0*/ s: kotlin.String = ...): kotlin.Unit
|
||||
public fun test1(/*0*/ b: kotlin.Boolean): kotlin.Unit
|
||||
public fun test2(/*0*/ b: kotlin.Boolean): kotlin.Unit
|
||||
public fun test3(/*0*/ b: kotlin.Boolean): kotlin.Unit
|
||||
public fun test4(/*0*/ b: kotlin.Boolean): kotlin.Unit
|
||||
public fun test_5(/*0*/ b: kotlin.Boolean): kotlin.Unit
|
||||
public fun test_6(/*0*/ b: kotlin.Boolean): kotlin.Unit
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user