[NI] Remove Nothing result type restriction in most cases

Make Nothing as result type not suitable only for if, when, try and ?: special functions.
This commit is contained in:
Pavel Kirpichenkov
2019-12-23 12:28:39 +03:00
parent ae1630f376
commit a9391c8dfb
21 changed files with 172 additions and 41 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
// !WITH_NEW_INFERENCE
val test: Int = <!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>if (true) {
val test: Int = <!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>if (true) {
when (2) {
1 -> 1
else -> <!OI;NULL_FOR_NONNULL_TYPE!>null<!>
@@ -7,19 +7,19 @@ val test1: (String) -> Boolean =
val test2: (String) -> Boolean =
when {
true -> <!NI;TYPE_MISMATCH!>{{ true }}<!>
true -> {{ true }}
else -> null!!
}
val test3: (String) -> Boolean =
when {
true -> <!NI;TYPE_MISMATCH!>{ <!UNUSED_ANONYMOUS_PARAMETER!>s<!> -> true }<!>
true -> { <!UNUSED_ANONYMOUS_PARAMETER!>s<!> -> true }
else -> null!!
}
val test4: (String) -> Boolean =
when {
true -> <!NI;TYPE_MISMATCH!>{ <!OI;EXPECTED_PARAMETERS_NUMBER_MISMATCH!><!UNUSED_ANONYMOUS_PARAMETER!>s1<!>, <!OI;CANNOT_INFER_PARAMETER_TYPE, UNUSED_ANONYMOUS_PARAMETER!>s2<!><!> -> true }<!>
true -> <!NI;TYPE_MISMATCH!>{ <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!><!UNUSED_ANONYMOUS_PARAMETER!>s1<!>, <!CANNOT_INFER_PARAMETER_TYPE, UNUSED_ANONYMOUS_PARAMETER!>s2<!><!> -> true }<!>
else -> null!!
}
@@ -6,7 +6,7 @@ val <!OI;IMPLICIT_NOTHING_PROPERTY_TYPE!>test1<!> = when {
}
val test1a: () -> Boolean = when {
true -> <!NI;TYPE_MISMATCH!>{ { true } }<!>
true -> { { true } }
else -> TODO()
}
@@ -33,7 +33,7 @@ val <!OI;IMPLICIT_NOTHING_PROPERTY_TYPE!>test3<!> = when {
}
val test3a: () -> Boolean = when {
true -> <!NI;TYPE_MISMATCH!>{ { true } }<!>
true -> <!NI;TYPE_MISMATCH!>{ { true } }<!>
true -> { { true } }
true -> { { true } }
else -> TODO()
}