[LC] Fixed light classes nullability for Kotlin 1.5

Fixed #KT-44472
This commit is contained in:
Igor Yakovlev
2021-04-15 19:14:39 +02:00
parent 63160293fb
commit e4870740e1
18 changed files with 54 additions and 64 deletions
@@ -83,7 +83,7 @@ internal class FirLightFieldForPropertySymbol(
modifiers.add(PsiModifier.VOLATILE)
}
val nullability = if (visibility != PsiModifier.PRIVATE && !(propertySymbol is KtKotlinPropertySymbol && propertySymbol.isLateInit))
val nullability = if (!(propertySymbol is KtKotlinPropertySymbol && propertySymbol.isLateInit))
propertySymbol.annotatedType.type.getTypeNullability(propertySymbol, FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE)
else NullabilityType.Unknown
@@ -26,7 +26,7 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
}
public void testAllFilesPresentInLightClasses() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true, "local", "compilationErrors", "ideRegression");
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^([^.]+)\\.kt$"), null, true, "local", "compilationErrors", "ideRegression", "script");
}
@TestMetadata("AnnotatedParameterInEnumConstructor.kt")
@@ -178,7 +178,7 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
}
public void testAllFilesPresentInDelegation() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/delegation"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/delegation"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("Function.kt")
@@ -201,7 +201,7 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
}
public void testAllFilesPresentInFacades() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/facades"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/facades"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("AllPrivate.kt")
@@ -234,7 +234,7 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
}
public void testAllFilesPresentInNullabilityAnnotations() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/nullabilityAnnotations"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/nullabilityAnnotations"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("Class.kt")
@@ -337,7 +337,7 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
}
public void testAllFilesPresentInObject() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/object"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/object"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("SimpleObject.kt")
@@ -355,7 +355,7 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
}
public void testAllFilesPresentInPublicField() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/publicField"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/publicField"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("CompanionObject.kt")
@@ -368,27 +368,4 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
runTest("compiler/testData/asJava/lightClasses/publicField/Simple.kt");
}
}
@TestMetadata("compiler/testData/asJava/lightClasses/script")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Script extends AbstractIdeCompiledLightClassTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInScript() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/lightClasses/script"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true);
}
@TestMetadata("HelloWorld.kts")
public void testHelloWorld() throws Exception {
runTest("compiler/testData/asJava/lightClasses/script/HelloWorld.kts");
}
@TestMetadata("InnerClasses.kts")
public void testInnerClasses() throws Exception {
runTest("compiler/testData/asJava/lightClasses/script/InnerClasses.kts");
}
}
}