提交 5f3102bf 编写于 作者: M Mikhail Glukhikh

FIR2IR: expand type before getting nullability #KT-44803 Fixed

上级 791f5891
......@@ -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
)
}
......
......@@ -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 {
// 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]
}
\ No newline at end of file
......@@ -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 {
......@@ -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 {
......@@ -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");
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册