Fix KT-10805 for 'when'.
This commit is contained in:
+1
-1
@@ -179,7 +179,7 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
|
||||
val entryExpression = whenEntry.expression ?: continue
|
||||
|
||||
val entryTypeInfo = BindingContextUtils.getRecordedTypeInfo(entryExpression, bindingContext) ?:
|
||||
throw AssertionError("When entry was not processed")
|
||||
continue
|
||||
val entryType = entryTypeInfo.type
|
||||
|
||||
val entryDataFlowInfo =
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
val <!IMPLICIT_NOTHING_PROPERTY_TYPE!>test1<!> = when {
|
||||
true -> { <!TYPE_MISMATCH!>{ true }<!> }
|
||||
else -> TODO()
|
||||
}
|
||||
|
||||
val test1a: () -> Boolean = when {
|
||||
true -> { { true } }
|
||||
else -> TODO()
|
||||
}
|
||||
|
||||
val <!IMPLICIT_NOTHING_PROPERTY_TYPE!>test2<!> = when {
|
||||
true -> { <!TYPE_MISMATCH!>{ true }<!> }
|
||||
else -> when {
|
||||
true -> { <!TYPE_MISMATCH!>{ true }<!> }
|
||||
else -> TODO()
|
||||
}
|
||||
}
|
||||
|
||||
val test2a: () -> Boolean = when {
|
||||
true -> { { true } }
|
||||
else -> when {
|
||||
true -> { <!TYPE_MISMATCH!>{ true }<!> } // TODO
|
||||
else -> TODO()
|
||||
}
|
||||
}
|
||||
|
||||
val <!IMPLICIT_NOTHING_PROPERTY_TYPE!>test3<!> = when {
|
||||
true -> { <!TYPE_MISMATCH!>{ true }<!> }
|
||||
true -> { <!TYPE_MISMATCH!>{ true }<!> }
|
||||
else -> TODO()
|
||||
}
|
||||
|
||||
val test3a: () -> Boolean = when {
|
||||
true -> { { true } }
|
||||
true -> { { true } }
|
||||
else -> TODO()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package
|
||||
|
||||
public val test1: kotlin.Nothing
|
||||
public val test1a: () -> kotlin.Boolean
|
||||
public val test2: kotlin.Nothing
|
||||
public val test2a: () -> kotlin.Boolean
|
||||
public val test3: kotlin.Nothing
|
||||
public val test3a: () -> kotlin.Boolean
|
||||
@@ -18869,6 +18869,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/when/WhenTypeDisjunctions.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithNothingAndLambdas.kt")
|
||||
public void testWhenWithNothingAndLambdas() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/when/whenWithNothingAndLambdas.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user