Fir2Ir, JVM IR: support flexible Array types loaded from Java
We don't have true flexible types in the IR, but we approximate it with internal type annotations, such as FlexibleNullability, FlexibleMutability, RawType. These annotations are then handled specially in JvmIrTypeSystemContext, which can construct a fake flexible type so that type checker on IR types would behave exactly as on frontend types. As shown in KT-63441, one instance of flexible types where flexibility was lost during conversion to IR is Java array/vararg types. It's necessary to support it so that IR fake overrides could be constructed correctly, because IR fake override checker requires parameter types to be equal. So this change introduces another internal type annotation, FlexibleArrayElementVariance, which is only applicable to types with classifier kotlin/Array, and which signifies that the annotated type `Array<X>` should rather be seen as `Array<X>..Array<out X>`. #KT-63441 Fixed #KT-63446 Fixed
This commit is contained in:
committed by
Space Team
parent
e98902ce74
commit
ee8d42532b
+25
@@ -25961,6 +25961,31 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notFoundClasses.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overrideWithArrayParameterType.kt")
|
||||
public void testOverrideWithArrayParameterType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overrideWithArrayParameterType2.kt")
|
||||
public void testOverrideWithArrayParameterType2() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterType2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overrideWithArrayParameterTypeNotNull.kt")
|
||||
public void testOverrideWithArrayParameterTypeNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/overrideWithArrayParameterTypeNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overrideWithGenericArrayParameterType.kt")
|
||||
public void testOverrideWithGenericArrayParameterType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/overrideWithGenericArrayParameterType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overrideWithVarargParameterType.kt")
|
||||
public void testOverrideWithVarargParameterType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/overrideWithVarargParameterType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("protectedField.kt")
|
||||
public void testProtectedField() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/protectedField.kt");
|
||||
|
||||
Reference in New Issue
Block a user