Add test for KT-41254

It was fixed along with #KT-41005
This commit is contained in:
Mikhail Zarechenskiy
2020-08-20 15:43:48 +03:00
parent a6f301e84a
commit ced151f3af
8 changed files with 49 additions and 0 deletions
@@ -12627,6 +12627,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inference/noCoercionToUniForNullableLambdaReturnType.kt");
}
@TestMetadata("noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt")
public void testNoCoercionToUnitWithEqualityConstraintForNullableReturnType() throws Exception {
runTest("compiler/testData/codegen/box/inference/noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt");
}
@TestMetadata("noNothingValueInsideSpecialCall.kt")
public void testNoNothingValueInsideSpecialCall() throws Exception {
runTest("compiler/testData/codegen/box/inference/noNothingValueInsideSpecialCall.kt");
@@ -0,0 +1,14 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Inv<T>(val x: T?)
fun <R> foo(f: () -> R?): Inv<R> {
val r = f()
if (r != null) throw Exception("fail, result is not null: $r")
return Inv(r)
}
fun box(): String {
val r: Inv<Unit> = foo { if (false) Unit else null }
return "OK"
}
@@ -13852,6 +13852,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/inference/noCoercionToUniForNullableLambdaReturnType.kt");
}
@TestMetadata("noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt")
public void testNoCoercionToUnitWithEqualityConstraintForNullableReturnType() throws Exception {
runTest("compiler/testData/codegen/box/inference/noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt");
}
@TestMetadata("noNothingValueInsideSpecialCall.kt")
public void testNoNothingValueInsideSpecialCall() throws Exception {
runTest("compiler/testData/codegen/box/inference/noNothingValueInsideSpecialCall.kt");
@@ -13852,6 +13852,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/inference/noCoercionToUniForNullableLambdaReturnType.kt");
}
@TestMetadata("noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt")
public void testNoCoercionToUnitWithEqualityConstraintForNullableReturnType() throws Exception {
runTest("compiler/testData/codegen/box/inference/noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt");
}
@TestMetadata("noNothingValueInsideSpecialCall.kt")
public void testNoNothingValueInsideSpecialCall() throws Exception {
runTest("compiler/testData/codegen/box/inference/noNothingValueInsideSpecialCall.kt");
@@ -12627,6 +12627,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/inference/noCoercionToUniForNullableLambdaReturnType.kt");
}
@TestMetadata("noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt")
public void testNoCoercionToUnitWithEqualityConstraintForNullableReturnType() throws Exception {
runTest("compiler/testData/codegen/box/inference/noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt");
}
@TestMetadata("noNothingValueInsideSpecialCall.kt")
public void testNoNothingValueInsideSpecialCall() throws Exception {
runTest("compiler/testData/codegen/box/inference/noNothingValueInsideSpecialCall.kt");
@@ -10807,6 +10807,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/inference/noCoercionToUniForNullableLambdaReturnType.kt");
}
@TestMetadata("noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt")
public void testNoCoercionToUnitWithEqualityConstraintForNullableReturnType() throws Exception {
runTest("compiler/testData/codegen/box/inference/noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt");
}
@TestMetadata("plusAssignInsideLambda.kt")
public void testPlusAssignInsideLambda() throws Exception {
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
@@ -10807,6 +10807,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inference/noCoercionToUniForNullableLambdaReturnType.kt");
}
@TestMetadata("noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt")
public void testNoCoercionToUnitWithEqualityConstraintForNullableReturnType() throws Exception {
runTest("compiler/testData/codegen/box/inference/noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt");
}
@TestMetadata("plusAssignInsideLambda.kt")
public void testPlusAssignInsideLambda() throws Exception {
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
@@ -10872,6 +10872,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inference/noCoercionToUniForNullableLambdaReturnType.kt");
}
@TestMetadata("noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt")
public void testNoCoercionToUnitWithEqualityConstraintForNullableReturnType() throws Exception {
runTest("compiler/testData/codegen/box/inference/noCoercionToUnitWithEqualityConstraintForNullableReturnType.kt");
}
@TestMetadata("plusAssignInsideLambda.kt")
public void testPlusAssignInsideLambda() throws Exception {
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");