[FIR] Add equality constraint from expected type for some synthetic function calls
This fixes some cases where we infer some type variable inside one of the branches to Nothing instead of the expected type because Nothing appeared in some other branch. Specifically, we add an equality instead of a subtype constraint during completion of calls to synthetic functions for if/when, try and !!. We don't do it when the call contains a (possibly nested) elvis or is inside the RHS of an assignment. Otherwise, we would prevent some smart-casts. #KT-65882 Fixed
This commit is contained in:
committed by
Space Team
parent
eaef7122f6
commit
69a7bf7f68
Generated
+6
@@ -18117,6 +18117,12 @@ public class FirWasmJsCodegenBoxTestGenerated extends AbstractFirWasmJsCodegenBo
|
||||
runTest("compiler/testData/codegen/box/inference/kt49838.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65882.kt")
|
||||
public void testKt65882() {
|
||||
runTest("compiler/testData/codegen/box/inference/kt65882.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaWithStarReturn.kt")
|
||||
public void testLambdaWithStarReturn() {
|
||||
|
||||
Generated
+6
@@ -18117,6 +18117,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
|
||||
runTest("compiler/testData/codegen/box/inference/kt49838.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65882.kt")
|
||||
public void testKt65882() {
|
||||
runTest("compiler/testData/codegen/box/inference/kt65882.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaWithStarReturn.kt")
|
||||
public void testLambdaWithStarReturn() {
|
||||
|
||||
Reference in New Issue
Block a user