SLC: account for upperbounds when computing nullability of type parameter
This commit is contained in:
committed by
Ilya Kirillov
parent
e83819e682
commit
4859524115
+3
-7
@@ -149,13 +149,9 @@ internal fun KtAnalysisSession.getTypeNullability(ktType: KtType): NullabilityTy
|
|||||||
if (ktType.isUnit) return NullabilityType.NotNull
|
if (ktType.isUnit) return NullabilityType.NotNull
|
||||||
|
|
||||||
if (ktType is KtTypeParameterType) {
|
if (ktType is KtTypeParameterType) {
|
||||||
// TODO Make supertype checking
|
if (ktType.isMarkedNullable) return NullabilityType.Nullable
|
||||||
// val subtypeOfNullableSuperType = context.firRef.withFir(phase) {
|
val subtypeOfNullableSuperType = ktType.symbol.upperBounds.all { upperBound -> upperBound.canBeNull }
|
||||||
// it.session.typeCheckerContext.nullableAnyType().isSupertypeOf(it.session.typeCheckerContext, coneType)
|
return if (!subtypeOfNullableSuperType) NullabilityType.NotNull else NullabilityType.Unknown
|
||||||
// }
|
|
||||||
// if (!subtypeOfNullableSuperType) return NullabilityType.NotNull
|
|
||||||
|
|
||||||
return if (!ktType.isMarkedNullable) NullabilityType.Unknown else NullabilityType.NotNull
|
|
||||||
}
|
}
|
||||||
if (ktType !is KtClassType) return NullabilityType.NotNull
|
if (ktType !is KtClassType) return NullabilityType.NotNull
|
||||||
|
|
||||||
|
|||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
public abstract interface Generic /* Generic*/<N, NN> {
|
|
||||||
@org.jetbrains.annotations.Nullable()
|
|
||||||
public abstract N a1(@org.jetbrains.annotations.Nullable() N);// a1(N)
|
|
||||||
|
|
||||||
@org.jetbrains.annotations.Nullable()
|
|
||||||
public abstract NN b1(@org.jetbrains.annotations.Nullable() NN);// b1(NN)
|
|
||||||
|
|
||||||
public abstract N a(N);// a(N)
|
|
||||||
|
|
||||||
public abstract NN b(NN);// b(NN)
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user