SLC: use fully expanded type when computing nullability
^KT-62757 fixed
This commit is contained in:
+4
-2
@@ -147,8 +147,10 @@ internal fun KtLightElement<*, *>.isOriginEquivalentTo(that: PsiElement?): Boole
|
||||
return kotlinOrigin?.isEquivalentTo(that) == true
|
||||
}
|
||||
|
||||
internal fun KtAnalysisSession.getTypeNullability(ktType: KtType): NullabilityType {
|
||||
if (ktType is KtClassErrorType) return NullabilityType.NotNull
|
||||
internal fun KtAnalysisSession.getTypeNullability(type: KtType): NullabilityType {
|
||||
if (type is KtClassErrorType) return NullabilityType.NotNull
|
||||
|
||||
val ktType = type.fullyExpandedType
|
||||
if (ktType.nullabilityType != NullabilityType.NotNull) return ktType.nullabilityType
|
||||
|
||||
if (ktType.isUnit) return NullabilityType.NotNull
|
||||
|
||||
+6
@@ -555,6 +555,12 @@ public class SymbolLightClassesByFqNameForLibraryTestGenerated extends AbstractS
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/Trait.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAlias.kt")
|
||||
public void testTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/typeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("UnitAsGenericArgument.kt")
|
||||
public void testUnitAsGenericArgument() throws Exception {
|
||||
|
||||
+6
@@ -555,6 +555,12 @@ public class SymbolLightClassesEqualityByFqNameForLibraryTestGenerated extends A
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/Trait.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAlias.kt")
|
||||
public void testTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/typeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("UnitAsGenericArgument.kt")
|
||||
public void testUnitAsGenericArgument() throws Exception {
|
||||
|
||||
+6
@@ -555,6 +555,12 @@ public class SymbolLightClassesParentingByFqNameForLibraryTestGenerated extends
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/Trait.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAlias.kt")
|
||||
public void testTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/typeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("UnitAsGenericArgument.kt")
|
||||
public void testUnitAsGenericArgument() throws Exception {
|
||||
|
||||
+6
@@ -727,6 +727,12 @@ public class SymbolLightClassesByFqNameForSourceTestGenerated extends AbstractSy
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/Trait.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAlias.kt")
|
||||
public void testTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/typeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("UnitAsGenericArgument.kt")
|
||||
public void testUnitAsGenericArgument() throws Exception {
|
||||
|
||||
+6
@@ -727,6 +727,12 @@ public class SymbolLightClassesEqualityByFqNameForSourceTestGenerated extends Ab
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/Trait.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAlias.kt")
|
||||
public void testTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/typeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("UnitAsGenericArgument.kt")
|
||||
public void testUnitAsGenericArgument() throws Exception {
|
||||
|
||||
+6
@@ -727,6 +727,12 @@ public class SymbolLightClassesParentingByFqNameForSourceTestGenerated extends A
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/Trait.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAlias.kt")
|
||||
public void testTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/typeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("UnitAsGenericArgument.kt")
|
||||
public void testUnitAsGenericArgument() throws Exception {
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
public final class TypeAliasKt /* TypeAliasKt*/ {
|
||||
public static final void foo(@org.jetbrains.annotations.Nullable() java.lang.String);// foo(java.lang.String)
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
// TypeAliasKt
|
||||
|
||||
typealias NullableString = String?
|
||||
|
||||
fun foo(ns: NullableString) {}
|
||||
+5
@@ -585,6 +585,11 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/Trait.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeAlias.kt")
|
||||
public void testTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/typeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("UnitAsGenericArgument.kt")
|
||||
public void testUnitAsGenericArgument() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/nullabilityAnnotations/UnitAsGenericArgument.kt");
|
||||
|
||||
Reference in New Issue
Block a user