FIR2IR: expand type before getting nullability #KT-44803 Fixed
This commit is contained in:
@@ -105,9 +105,10 @@ class Fir2IrTypeConverter(
|
||||
if (annotations.any { it.classId == attributeAnnotation.classId }) continue
|
||||
typeAnnotations += callGenerator.convertToIrConstructorCall(attributeAnnotation) as? IrConstructorCall ?: continue
|
||||
}
|
||||
val expandedType = fullyExpandedType(session)
|
||||
IrSimpleTypeImpl(
|
||||
irSymbol, !typeContext.definitelyNotNull && this.isMarkedNullable,
|
||||
fullyExpandedType(session).typeArguments.map { it.toIrTypeArgument(typeContext) },
|
||||
irSymbol, !typeContext.definitelyNotNull && expandedType.isMarkedNullable,
|
||||
expandedType.typeArguments.map { it.toIrTypeArgument(typeContext) },
|
||||
typeAnnotations
|
||||
)
|
||||
}
|
||||
|
||||
+6
@@ -14846,6 +14846,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassBuilder.kt")
|
||||
public void testClassBuilder() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/ClassBuilder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConstValAccess.kt")
|
||||
public void testConstValAccess() throws Exception {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// FILE: ClassBuilder.java
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface ClassBuilder {
|
||||
void newMethod(@Nullable String[] exceptions);
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
typealias JvmMethodExceptionTypes = Array<out String?>?
|
||||
|
||||
class TestClassBuilder : ClassBuilder {
|
||||
override fun newMethod(exceptions: JvmMethodExceptionTypes) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val arr = arrayOf("OK")
|
||||
TestClassBuilder().newMethod(null)
|
||||
TestClassBuilder().newMethod(arr)
|
||||
return arr[0]
|
||||
}
|
||||
+6
@@ -14846,6 +14846,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassBuilder.kt")
|
||||
public void testClassBuilder() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/ClassBuilder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConstValAccess.kt")
|
||||
public void testConstValAccess() throws Exception {
|
||||
|
||||
+6
@@ -14846,6 +14846,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassBuilder.kt")
|
||||
public void testClassBuilder() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/ClassBuilder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConstValAccess.kt")
|
||||
public void testConstValAccess() throws Exception {
|
||||
|
||||
+5
@@ -12278,6 +12278,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("ClassBuilder.kt")
|
||||
public void testClassBuilder() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/ClassBuilder.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ConstValAccess.kt")
|
||||
public void testConstValAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/ConstValAccess.kt");
|
||||
|
||||
Reference in New Issue
Block a user