KT-56840 [SLC] Don't mark primitive-backed types with @NotNull

This commit is contained in:
Pavel Mikhailovskii
2023-02-21 17:29:16 +00:00
committed by Space Team
parent bcb517d66b
commit d81170fbcc
10 changed files with 72 additions and 14 deletions
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.analysis.api.types.KtTypeNullability
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.builtins.functions.FunctionTypeKind
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.org.objectweb.asm.Type
public abstract class KtTypeInfoProvider : KtAnalysisSessionComponent() {
public abstract fun isFunctionalInterfaceType(type: KtType): Boolean
@@ -143,6 +144,16 @@ public interface KtTypeInfoProviderMixIn : KtAnalysisSessionMixIn {
return this.classId in DefaultTypeClassIds.PRIMITIVES
}
context(KtJvmTypeMapperMixIn)
public val KtType.isPrimitiveBacked: Boolean
get() = withValidityAssertion {
if (this !is KtNonErrorClassType) return false
return when (this.mapTypeToJvmType().sort) {
Type.BOOLEAN, Type.CHAR, Type.BYTE, Type.SHORT, Type.INT, Type.FLOAT, Type.LONG, Type.DOUBLE -> true
else -> false
}
}
public val KtType.defaultInitializer: String?
get() = withValidityAssertion {
when {