JS_IR: fix typecheck corner case
Consider `fun <E : I> foo(a: Any?) = a as? E`, where I is an interface. This check used to fail, because the `a == null` was missing, and the `isInterface` stdlib method crashes if the first argument is null. This change adds the null check. Also this change prettifies the instance check in case of type parameter left operand.
This commit is contained in:
committed by
Anton Bannykh
parent
9a971172c9
commit
d6fcde7316
+5
@@ -2821,6 +2821,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/casts/notIs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullableSafeCastToTypeParameterWithInterfaceUpperBound.kt")
|
||||
public void testNullableSafeCastToTypeParameterWithInterfaceUpperBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/casts/nullableSafeCastToTypeParameterWithInterfaceUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unitAsAny.kt")
|
||||
public void testUnitAsAny() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/casts/unitAsAny.kt");
|
||||
|
||||
Reference in New Issue
Block a user