FIR2IR: add implicit NOT_NULL cast if needed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
eeda48e63e
commit
46cc01602e
+2
-2
@@ -5,8 +5,8 @@ FILE: jvm.kt
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final fun test(): R|kotlin/Unit| {
|
public final fun test(): R|kotlin/Unit| {
|
||||||
lval x: R|kotlin/String| = this@R|/User|.R|/Annotated.foo|(String(123))
|
lval x: R|@EnhancedNullability kotlin/String| = this@R|/User|.R|/Annotated.foo|(String(123))
|
||||||
lval y: R|kotlin/String| = this@R|/User|.R|/Annotated.foo|(Null(null))
|
lval y: R|@EnhancedNullability kotlin/String| = this@R|/User|.R|/Annotated.foo|(Null(null))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,18 @@ object CompilerConeAttributes {
|
|||||||
override fun toString(): String = "@NoInfer"
|
override fun toString(): String = "@NoInfer"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object EnhancedNullability : ConeAttribute<EnhancedNullability>() {
|
||||||
|
val ANNOTATION_CLASS_ID = ClassId(FqName("kotlin.jvm.internal"), Name.identifier("EnhancedNullability"))
|
||||||
|
|
||||||
|
override fun union(other: EnhancedNullability?): EnhancedNullability? = other
|
||||||
|
override fun intersect(other: EnhancedNullability?): EnhancedNullability? = this
|
||||||
|
override fun isSubtypeOf(other: EnhancedNullability?): Boolean = true
|
||||||
|
|
||||||
|
override val key: KClass<out EnhancedNullability> = EnhancedNullability::class
|
||||||
|
|
||||||
|
override fun toString(): String = "@EnhancedNullability"
|
||||||
|
}
|
||||||
|
|
||||||
object ExtensionFunctionType : ConeAttribute<ExtensionFunctionType>() {
|
object ExtensionFunctionType : ConeAttribute<ExtensionFunctionType>() {
|
||||||
val ANNOTATION_CLASS_ID = ClassId(FqName("kotlin"), Name.identifier("ExtensionFunctionType"))
|
val ANNOTATION_CLASS_ID = ClassId(FqName("kotlin"), Name.identifier("ExtensionFunctionType"))
|
||||||
|
|
||||||
@@ -62,8 +74,12 @@ object CompilerConeAttributes {
|
|||||||
|
|
||||||
val ConeAttributes.exact: CompilerConeAttributes.Exact? by ConeAttributes.attributeAccessor<CompilerConeAttributes.Exact>()
|
val ConeAttributes.exact: CompilerConeAttributes.Exact? by ConeAttributes.attributeAccessor<CompilerConeAttributes.Exact>()
|
||||||
val ConeAttributes.noInfer: CompilerConeAttributes.NoInfer? by ConeAttributes.attributeAccessor<CompilerConeAttributes.NoInfer>()
|
val ConeAttributes.noInfer: CompilerConeAttributes.NoInfer? by ConeAttributes.attributeAccessor<CompilerConeAttributes.NoInfer>()
|
||||||
|
val ConeAttributes.enhancedNullability: CompilerConeAttributes.EnhancedNullability? by ConeAttributes.attributeAccessor<CompilerConeAttributes.EnhancedNullability>()
|
||||||
val ConeAttributes.extensionFunctionType: CompilerConeAttributes.ExtensionFunctionType? by ConeAttributes.attributeAccessor<CompilerConeAttributes.ExtensionFunctionType>()
|
val ConeAttributes.extensionFunctionType: CompilerConeAttributes.ExtensionFunctionType? by ConeAttributes.attributeAccessor<CompilerConeAttributes.ExtensionFunctionType>()
|
||||||
val ConeAttributes.unsafeVarianceType: CompilerConeAttributes.UnsafeVariance? by ConeAttributes.attributeAccessor<CompilerConeAttributes.UnsafeVariance>()
|
val ConeAttributes.unsafeVarianceType: CompilerConeAttributes.UnsafeVariance? by ConeAttributes.attributeAccessor<CompilerConeAttributes.UnsafeVariance>()
|
||||||
|
|
||||||
|
val ConeKotlinType.hasEnhancedNullability: Boolean
|
||||||
|
get() = attributes.enhancedNullability != null
|
||||||
|
|
||||||
val ConeKotlinType.isExtensionFunctionType: Boolean
|
val ConeKotlinType.isExtensionFunctionType: Boolean
|
||||||
get() = attributes.extensionFunctionType != null
|
get() = attributes.extensionFunctionType != null
|
||||||
|
|||||||
@@ -87,8 +87,9 @@ class Fir2IrTypeConverter(
|
|||||||
firSymbol.toSymbol(session, classifierStorage, typeContext)
|
firSymbol.toSymbol(session, classifierStorage, typeContext)
|
||||||
}
|
}
|
||||||
val typeAnnotations: MutableList<IrConstructorCall> =
|
val typeAnnotations: MutableList<IrConstructorCall> =
|
||||||
if (attributes.extensionFunctionType == null) mutableListOf()
|
if (!isExtensionFunctionType) mutableListOf()
|
||||||
else mutableListOf(builtIns.extensionFunctionTypeAnnotationConstructorCall())
|
else mutableListOf(builtIns.extensionFunctionTypeAnnotationConstructorCall())
|
||||||
|
// TODO: Need to convert @EnhancedNullability ?
|
||||||
typeAnnotations += with(annotationGenerator) { annotations.toIrAnnotations() }
|
typeAnnotations += with(annotationGenerator) { annotations.toIrAnnotations() }
|
||||||
IrSimpleTypeImpl(
|
IrSimpleTypeImpl(
|
||||||
irSymbol, !typeContext.definitelyNotNull && this.isMarkedNullable,
|
irSymbol, !typeContext.definitelyNotNull && this.isMarkedNullable,
|
||||||
|
|||||||
@@ -542,7 +542,25 @@ class Fir2IrVisitor(
|
|||||||
expression.accept(this, null) as IrExpression
|
expression.accept(this, null) as IrExpression
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}.insertImplicitNotNullCastIfNeeded(expression)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun IrExpression.insertImplicitNotNullCastIfNeeded(expression: FirExpression): IrExpression {
|
||||||
|
if (this is IrTypeOperatorCall && this.operator == IrTypeOperator.IMPLICIT_NOTNULL) {
|
||||||
|
return this
|
||||||
}
|
}
|
||||||
|
// TODO: Other conditions to check?
|
||||||
|
if (expression.typeRef.coneTypeSafe<ConeKotlinType>()?.hasEnhancedNullability != true) {
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
return IrTypeOperatorCallImpl(
|
||||||
|
this.startOffset,
|
||||||
|
this.endOffset,
|
||||||
|
this.type,
|
||||||
|
IrTypeOperator.IMPLICIT_NOTNULL,
|
||||||
|
this.type,
|
||||||
|
this
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun convertToIrReceiverExpression(
|
private fun convertToIrReceiverExpression(
|
||||||
|
|||||||
@@ -61,10 +61,11 @@ internal val JavaClass.classKind: ClassKind
|
|||||||
|
|
||||||
internal fun ClassId.toConeKotlinType(
|
internal fun ClassId.toConeKotlinType(
|
||||||
typeArguments: Array<ConeTypeProjection>,
|
typeArguments: Array<ConeTypeProjection>,
|
||||||
isNullable: Boolean
|
isNullable: Boolean,
|
||||||
|
attributes: ConeAttributes = ConeAttributes.Empty
|
||||||
): ConeLookupTagBasedType {
|
): ConeLookupTagBasedType {
|
||||||
val lookupTag = ConeClassLikeLookupTagImpl(this)
|
val lookupTag = ConeClassLikeLookupTagImpl(this)
|
||||||
return ConeClassLikeTypeImpl(lookupTag, typeArguments, isNullable)
|
return ConeClassLikeTypeImpl(lookupTag, typeArguments, isNullable, attributes)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun FirTypeRef.toConeKotlinTypeProbablyFlexible(
|
internal fun FirTypeRef.toConeKotlinTypeProbablyFlexible(
|
||||||
@@ -110,11 +111,17 @@ internal fun JavaType?.toConeKotlinTypeWithoutEnhancement(
|
|||||||
session: FirSession,
|
session: FirSession,
|
||||||
javaTypeParameterStack: JavaTypeParameterStack,
|
javaTypeParameterStack: JavaTypeParameterStack,
|
||||||
forAnnotationValueParameter: Boolean = false,
|
forAnnotationValueParameter: Boolean = false,
|
||||||
isForSupertypes: Boolean = false
|
isForSupertypes: Boolean = false,
|
||||||
|
attributes: ConeAttributes = ConeAttributes.Empty
|
||||||
): ConeKotlinType {
|
): ConeKotlinType {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is JavaClassifierType -> {
|
is JavaClassifierType -> {
|
||||||
toConeKotlinTypeWithoutEnhancement(session, javaTypeParameterStack, forAnnotationValueParameter = forAnnotationValueParameter)
|
toConeKotlinTypeWithoutEnhancement(
|
||||||
|
session,
|
||||||
|
javaTypeParameterStack,
|
||||||
|
forAnnotationValueParameter = forAnnotationValueParameter,
|
||||||
|
attributes = attributes
|
||||||
|
)
|
||||||
}
|
}
|
||||||
is JavaPrimitiveType -> {
|
is JavaPrimitiveType -> {
|
||||||
val primitiveType = type
|
val primitiveType = type
|
||||||
@@ -124,14 +131,26 @@ internal fun JavaType?.toConeKotlinTypeWithoutEnhancement(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val classId = StandardClassIds.byName(kotlinPrimitiveName)
|
val classId = StandardClassIds.byName(kotlinPrimitiveName)
|
||||||
classId.toConeKotlinType(emptyArray(), isNullable = false)
|
classId.toConeKotlinType(emptyArray(), isNullable = false, attributes)
|
||||||
}
|
}
|
||||||
is JavaArrayType -> {
|
is JavaArrayType -> {
|
||||||
toConeKotlinTypeWithoutEnhancement(session, javaTypeParameterStack, forAnnotationValueParameter, isForSupertypes)
|
toConeKotlinTypeWithoutEnhancement(
|
||||||
}
|
session,
|
||||||
is JavaWildcardType -> bound?.toConeKotlinTypeWithoutEnhancement(session, javaTypeParameterStack, isForSupertypes = isForSupertypes) ?: run {
|
javaTypeParameterStack,
|
||||||
StandardClassIds.Any.toConeFlexibleType(emptyArray())
|
forAnnotationValueParameter,
|
||||||
|
isForSupertypes,
|
||||||
|
attributes = attributes
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
is JavaWildcardType ->
|
||||||
|
bound?.toConeKotlinTypeWithoutEnhancement(
|
||||||
|
session,
|
||||||
|
javaTypeParameterStack,
|
||||||
|
isForSupertypes = isForSupertypes,
|
||||||
|
attributes = attributes
|
||||||
|
) ?: run {
|
||||||
|
StandardClassIds.Any.toConeFlexibleType(emptyArray())
|
||||||
|
}
|
||||||
null -> {
|
null -> {
|
||||||
StandardClassIds.Any.toConeFlexibleType(emptyArray())
|
StandardClassIds.Any.toConeFlexibleType(emptyArray())
|
||||||
}
|
}
|
||||||
@@ -143,7 +162,8 @@ private fun JavaArrayType.toConeKotlinTypeWithoutEnhancement(
|
|||||||
session: FirSession,
|
session: FirSession,
|
||||||
javaTypeParameterStack: JavaTypeParameterStack,
|
javaTypeParameterStack: JavaTypeParameterStack,
|
||||||
forAnnotationValueParameter: Boolean = false,
|
forAnnotationValueParameter: Boolean = false,
|
||||||
isForSupertypes: Boolean
|
isForSupertypes: Boolean,
|
||||||
|
attributes: ConeAttributes = ConeAttributes.Empty
|
||||||
): ConeKotlinType {
|
): ConeKotlinType {
|
||||||
val componentType = componentType
|
val componentType = componentType
|
||||||
return if (componentType !is JavaPrimitiveType) {
|
return if (componentType !is JavaPrimitiveType) {
|
||||||
@@ -152,11 +172,12 @@ private fun JavaArrayType.toConeKotlinTypeWithoutEnhancement(
|
|||||||
session, javaTypeParameterStack, forAnnotationValueParameter, isForSupertypes
|
session, javaTypeParameterStack, forAnnotationValueParameter, isForSupertypes
|
||||||
)
|
)
|
||||||
if (forAnnotationValueParameter) {
|
if (forAnnotationValueParameter) {
|
||||||
classId.constructClassLikeType(arrayOf(argumentType), isNullable = false)
|
classId.constructClassLikeType(arrayOf(argumentType), isNullable = false, attributes = attributes)
|
||||||
} else {
|
} else {
|
||||||
classId.toConeFlexibleType(
|
classId.toConeFlexibleType(
|
||||||
arrayOf(argumentType),
|
arrayOf(argumentType),
|
||||||
typeArgumentsForUpper = arrayOf(ConeKotlinTypeProjectionOut(argumentType))
|
typeArgumentsForUpper = arrayOf(ConeKotlinTypeProjectionOut(argumentType)),
|
||||||
|
attributes = attributes
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -164,19 +185,20 @@ private fun JavaArrayType.toConeKotlinTypeWithoutEnhancement(
|
|||||||
val classId = StandardClassIds.byName(javaComponentName + "Array")
|
val classId = StandardClassIds.byName(javaComponentName + "Array")
|
||||||
|
|
||||||
if (forAnnotationValueParameter) {
|
if (forAnnotationValueParameter) {
|
||||||
classId.constructClassLikeType(emptyArray(), isNullable = false)
|
classId.constructClassLikeType(emptyArray(), isNullable = false, attributes = attributes)
|
||||||
} else {
|
} else {
|
||||||
classId.toConeFlexibleType(emptyArray())
|
classId.toConeFlexibleType(emptyArray(), attributes = attributes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ClassId.toConeFlexibleType(
|
private fun ClassId.toConeFlexibleType(
|
||||||
typeArguments: Array<ConeTypeProjection>,
|
typeArguments: Array<ConeTypeProjection>,
|
||||||
typeArgumentsForUpper: Array<ConeTypeProjection> = typeArguments
|
typeArgumentsForUpper: Array<ConeTypeProjection> = typeArguments,
|
||||||
|
attributes: ConeAttributes = ConeAttributes.Empty
|
||||||
) = ConeFlexibleType(
|
) = ConeFlexibleType(
|
||||||
toConeKotlinType(typeArguments, isNullable = false),
|
toConeKotlinType(typeArguments, isNullable = false, attributes),
|
||||||
toConeKotlinType(typeArgumentsForUpper, isNullable = true)
|
toConeKotlinType(typeArgumentsForUpper, isNullable = true, attributes)
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun JavaClassifierType.toConeKotlinTypeWithoutEnhancement(
|
private fun JavaClassifierType.toConeKotlinTypeWithoutEnhancement(
|
||||||
@@ -184,7 +206,8 @@ private fun JavaClassifierType.toConeKotlinTypeWithoutEnhancement(
|
|||||||
javaTypeParameterStack: JavaTypeParameterStack,
|
javaTypeParameterStack: JavaTypeParameterStack,
|
||||||
forTypeParameterBounds: Boolean = false,
|
forTypeParameterBounds: Boolean = false,
|
||||||
isForSupertypes: Boolean = false,
|
isForSupertypes: Boolean = false,
|
||||||
forAnnotationValueParameter: Boolean = false
|
forAnnotationValueParameter: Boolean = false,
|
||||||
|
attributes: ConeAttributes = ConeAttributes.Empty
|
||||||
): ConeKotlinType {
|
): ConeKotlinType {
|
||||||
val lowerBound = toConeKotlinTypeForFlexibleBound(
|
val lowerBound = toConeKotlinTypeForFlexibleBound(
|
||||||
session,
|
session,
|
||||||
@@ -192,7 +215,8 @@ private fun JavaClassifierType.toConeKotlinTypeWithoutEnhancement(
|
|||||||
isLowerBound = true,
|
isLowerBound = true,
|
||||||
forTypeParameterBounds,
|
forTypeParameterBounds,
|
||||||
isForSupertypes,
|
isForSupertypes,
|
||||||
forAnnotationValueParameter = forAnnotationValueParameter
|
forAnnotationValueParameter = forAnnotationValueParameter,
|
||||||
|
attributes = attributes
|
||||||
)
|
)
|
||||||
if (forAnnotationValueParameter) {
|
if (forAnnotationValueParameter) {
|
||||||
return lowerBound
|
return lowerBound
|
||||||
@@ -205,7 +229,8 @@ private fun JavaClassifierType.toConeKotlinTypeWithoutEnhancement(
|
|||||||
forTypeParameterBounds,
|
forTypeParameterBounds,
|
||||||
isForSupertypes,
|
isForSupertypes,
|
||||||
lowerBound,
|
lowerBound,
|
||||||
forAnnotationValueParameter = forAnnotationValueParameter
|
forAnnotationValueParameter = forAnnotationValueParameter,
|
||||||
|
attributes = attributes
|
||||||
)
|
)
|
||||||
|
|
||||||
return if (isRaw) ConeRawType(lowerBound, upperBound) else ConeFlexibleType(lowerBound, upperBound)
|
return if (isRaw) ConeRawType(lowerBound, upperBound) else ConeFlexibleType(lowerBound, upperBound)
|
||||||
@@ -308,7 +333,8 @@ private fun JavaClassifierType.toConeKotlinTypeForFlexibleBound(
|
|||||||
forTypeParameterBounds: Boolean,
|
forTypeParameterBounds: Boolean,
|
||||||
isForSupertypes: Boolean,
|
isForSupertypes: Boolean,
|
||||||
lowerBound: ConeLookupTagBasedType? = null,
|
lowerBound: ConeLookupTagBasedType? = null,
|
||||||
forAnnotationValueParameter: Boolean = false
|
forAnnotationValueParameter: Boolean = false,
|
||||||
|
attributes: ConeAttributes = ConeAttributes.Empty
|
||||||
): ConeLookupTagBasedType {
|
): ConeLookupTagBasedType {
|
||||||
return when (val classifier = classifier) {
|
return when (val classifier = classifier) {
|
||||||
is JavaClass -> {
|
is JavaClass -> {
|
||||||
@@ -357,7 +383,7 @@ private fun JavaClassifierType.toConeKotlinTypeForFlexibleBound(
|
|||||||
}
|
}
|
||||||
|
|
||||||
lookupTag.constructClassType(
|
lookupTag.constructClassType(
|
||||||
mappedTypeArguments.toTypedArray(), isNullable = !isLowerBound
|
mappedTypeArguments.toTypedArray(), isNullable = !isLowerBound, attributes
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is JavaTypeParameter -> {
|
is JavaTypeParameter -> {
|
||||||
|
|||||||
+9
-2
@@ -42,6 +42,8 @@ internal class EnhancementSignatureParts(
|
|||||||
) {
|
) {
|
||||||
private val isForVarargParameter get() = typeContainer.safeAs<FirValueParameter>()?.isVararg == true
|
private val isForVarargParameter get() = typeContainer.safeAs<FirValueParameter>()?.isVararg == true
|
||||||
|
|
||||||
|
private val attributesCache = mutableMapOf<FirTypeRef?, ConeAttributes>().withDefault { ConeAttributes.Empty }
|
||||||
|
|
||||||
private fun ConeKotlinType.toFqNameUnsafe(): FqNameUnsafe? =
|
private fun ConeKotlinType.toFqNameUnsafe(): FqNameUnsafe? =
|
||||||
((this as? ConeLookupTagBasedType)?.lookupTag as? ConeClassLikeLookupTag)?.classId?.asSingleFqName()?.toUnsafe()
|
((this as? ConeLookupTagBasedType)?.lookupTag as? ConeClassLikeLookupTag)?.classId?.asSingleFqName()?.toUnsafe()
|
||||||
|
|
||||||
@@ -62,7 +64,8 @@ internal class EnhancementSignatureParts(
|
|||||||
val typeWithoutEnhancement = current.type.toConeKotlinTypeWithoutEnhancement(
|
val typeWithoutEnhancement = current.type.toConeKotlinTypeWithoutEnhancement(
|
||||||
session,
|
session,
|
||||||
javaTypeParameterStack,
|
javaTypeParameterStack,
|
||||||
forAnnotationValueParameter
|
forAnnotationValueParameter,
|
||||||
|
attributes = attributesCache.getValue(current)
|
||||||
)
|
)
|
||||||
val containsFunctionN = typeWithoutEnhancement.contains {
|
val containsFunctionN = typeWithoutEnhancement.contains {
|
||||||
if (it is ConeClassErrorType) false
|
if (it is ConeClassErrorType) false
|
||||||
@@ -204,7 +207,11 @@ internal class EnhancementSignatureParts(
|
|||||||
else
|
else
|
||||||
defaultQualifiersForType
|
defaultQualifiersForType
|
||||||
|
|
||||||
val nullabilityInfo = composedAnnotation.extractNullability(typeQualifierResolver, javaTypeEnhancementState)
|
val nullabilityInfo = composedAnnotation.extractNullability(typeQualifierResolver, javaTypeEnhancementState).also {
|
||||||
|
if (it?.qualifier == NullabilityQualifier.NOT_NULL) {
|
||||||
|
attributesCache[this] = composedAnnotation.computeTypeAttributesForJavaType()
|
||||||
|
}
|
||||||
|
}
|
||||||
?: defaultTypeQualifier?.nullabilityQualifier?.let { nullability ->
|
?: defaultTypeQualifier?.nullabilityQualifier?.let { nullability ->
|
||||||
NullabilityQualifierWithMigrationStatus(
|
NullabilityQualifierWithMigrationStatus(
|
||||||
nullability.qualifier,
|
nullability.qualifier,
|
||||||
|
|||||||
@@ -13,14 +13,11 @@ import org.jetbrains.kotlin.fir.declarations.*
|
|||||||
import org.jetbrains.kotlin.fir.expressions.*
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
import org.jetbrains.kotlin.fir.expressions.builder.buildConstExpression
|
import org.jetbrains.kotlin.fir.expressions.builder.buildConstExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.builder.buildQualifiedAccessExpression
|
import org.jetbrains.kotlin.fir.expressions.builder.buildQualifiedAccessExpression
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirCallableMemberDeclaration
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirEnumEntry
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirConstExpression
|
import org.jetbrains.kotlin.fir.expressions.FirConstExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||||
import org.jetbrains.kotlin.fir.java.JavaTypeParameterStack
|
|
||||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
|
import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
|
||||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaField
|
import org.jetbrains.kotlin.fir.java.declarations.FirJavaField
|
||||||
import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference
|
import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference
|
||||||
@@ -327,3 +324,11 @@ internal fun FirValueParameter.getDefaultValueFromAnnotation(): AnnotationDefaul
|
|||||||
private val DEFAULT_VALUE_ID = ClassId.topLevel(DEFAULT_VALUE_FQ_NAME)
|
private val DEFAULT_VALUE_ID = ClassId.topLevel(DEFAULT_VALUE_FQ_NAME)
|
||||||
private val DEFAULT_NULL_ID = ClassId.topLevel(DEFAULT_NULL_FQ_NAME)
|
private val DEFAULT_NULL_ID = ClassId.topLevel(DEFAULT_NULL_FQ_NAME)
|
||||||
|
|
||||||
|
internal fun List<FirAnnotationCall>.computeTypeAttributesForJavaType(): ConeAttributes =
|
||||||
|
computeTypeAttributes { classId ->
|
||||||
|
when (classId) {
|
||||||
|
CompilerConeAttributes.EnhancedNullability.ANNOTATION_CLASS_ID -> add(CompilerConeAttributes.EnhancedNullability)
|
||||||
|
// TODO: Need to handle others too? E.g., COMPATQUAL_NONNULL_ANNOTATION_ID
|
||||||
|
in NOT_NULL_ANNOTATION_IDS -> add(CompilerConeAttributes.EnhancedNullability)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ private fun FirAnnotationCall.extractNullabilityTypeFromArgument(): NullabilityQ
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val NULLABLE_ANNOTATION_IDS = NULLABLE_ANNOTATIONS.map { ClassId.topLevel(it) }
|
private val NULLABLE_ANNOTATION_IDS = NULLABLE_ANNOTATIONS.map { ClassId.topLevel(it) }
|
||||||
private val NOT_NULL_ANNOTATION_IDS = NOT_NULL_ANNOTATIONS.map { ClassId.topLevel(it) }
|
val NOT_NULL_ANNOTATION_IDS = NOT_NULL_ANNOTATIONS.map { ClassId.topLevel(it) }
|
||||||
private val JAVAX_NONNULL_ANNOTATION_ID = ClassId.topLevel(JAVAX_NONNULL_ANNOTATION)
|
private val JAVAX_NONNULL_ANNOTATION_ID = ClassId.topLevel(JAVAX_NONNULL_ANNOTATION)
|
||||||
private val COMPATQUAL_NULLABLE_ANNOTATION_ID = ClassId.topLevel(COMPATQUAL_NULLABLE_ANNOTATION)
|
private val COMPATQUAL_NULLABLE_ANNOTATION_ID = ClassId.topLevel(COMPATQUAL_NULLABLE_ANNOTATION)
|
||||||
private val COMPATQUAL_NONNULL_ANNOTATION_ID = ClassId.topLevel(COMPATQUAL_NONNULL_ANNOTATION)
|
private val COMPATQUAL_NONNULL_ANNOTATION_ID = ClassId.topLevel(COMPATQUAL_NONNULL_ANNOTATION)
|
||||||
|
|||||||
@@ -87,16 +87,19 @@ fun ConeClassLikeType.toConstKind(): FirConstKind<*>? = when (lookupTag.classId)
|
|||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun List<FirAnnotationCall>.computeTypeAttributes(): ConeAttributes {
|
fun List<FirAnnotationCall>.computeTypeAttributes(
|
||||||
|
additionalProcessor: MutableList<ConeAttribute<*>>.(ClassId) -> Unit = {}
|
||||||
|
): ConeAttributes {
|
||||||
if (this.isEmpty()) return ConeAttributes.Empty
|
if (this.isEmpty()) return ConeAttributes.Empty
|
||||||
val attributes = mutableListOf<ConeAttribute<*>>()
|
val attributes = mutableListOf<ConeAttribute<*>>()
|
||||||
for (annotation in this) {
|
for (annotation in this) {
|
||||||
val type = annotation.annotationTypeRef.coneTypeSafe<ConeClassLikeType>() ?: continue
|
val type = annotation.annotationTypeRef.coneTypeSafe<ConeClassLikeType>() ?: continue
|
||||||
when (type.lookupTag.classId) {
|
when (val classId = type.lookupTag.classId) {
|
||||||
CompilerConeAttributes.Exact.ANNOTATION_CLASS_ID -> attributes += CompilerConeAttributes.Exact
|
CompilerConeAttributes.Exact.ANNOTATION_CLASS_ID -> attributes += CompilerConeAttributes.Exact
|
||||||
CompilerConeAttributes.NoInfer.ANNOTATION_CLASS_ID -> attributes += CompilerConeAttributes.NoInfer
|
CompilerConeAttributes.NoInfer.ANNOTATION_CLASS_ID -> attributes += CompilerConeAttributes.NoInfer
|
||||||
CompilerConeAttributes.ExtensionFunctionType.ANNOTATION_CLASS_ID -> attributes += CompilerConeAttributes.ExtensionFunctionType
|
CompilerConeAttributes.ExtensionFunctionType.ANNOTATION_CLASS_ID -> attributes += CompilerConeAttributes.ExtensionFunctionType
|
||||||
CompilerConeAttributes.UnsafeVariance.ANNOTATION_CLASS_ID -> attributes += CompilerConeAttributes.UnsafeVariance
|
CompilerConeAttributes.UnsafeVariance.ANNOTATION_CLASS_ID -> attributes += CompilerConeAttributes.UnsafeVariance
|
||||||
|
else -> additionalProcessor.invoke(attributes, classId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ConeAttributes.create(attributes)
|
return ConeAttributes.create(attributes)
|
||||||
|
|||||||
@@ -27,14 +27,16 @@ fun ConeClassifierLookupTag.constructType(
|
|||||||
fun ConeClassLikeLookupTag.constructClassType(
|
fun ConeClassLikeLookupTag.constructClassType(
|
||||||
typeArguments: Array<out ConeTypeProjection>,
|
typeArguments: Array<out ConeTypeProjection>,
|
||||||
isNullable: Boolean,
|
isNullable: Boolean,
|
||||||
|
attributes: ConeAttributes = ConeAttributes.Empty
|
||||||
): ConeClassLikeType {
|
): ConeClassLikeType {
|
||||||
return ConeClassLikeTypeImpl(this, typeArguments, isNullable)
|
return ConeClassLikeTypeImpl(this, typeArguments, isNullable, attributes)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ClassId.constructClassLikeType(
|
fun ClassId.constructClassLikeType(
|
||||||
typeArguments: Array<out ConeTypeProjection>,
|
typeArguments: Array<out ConeTypeProjection>,
|
||||||
isNullable: Boolean,
|
isNullable: Boolean,
|
||||||
|
attributes: ConeAttributes = ConeAttributes.Empty
|
||||||
): ConeClassLikeType {
|
): ConeClassLikeType {
|
||||||
return ConeClassLikeTypeImpl(ConeClassLikeLookupTagImpl(this), typeArguments, isNullable)
|
return ConeClassLikeTypeImpl(ConeClassLikeLookupTagImpl(this), typeArguments, isNullable, attributes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// FILE: box.kt
|
// FILE: box.kt
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// FILE: inLambdaReturnWithExpectedType.kt
|
// FILE: inLambdaReturnWithExpectedType.kt
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// FILE: box.kt
|
// FILE: box.kt
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// FILE: box.kt
|
// FILE: box.kt
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// FILE: box.kt
|
// FILE: box.kt
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// FILE: box.kt
|
// FILE: box.kt
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// FILE: box.kt
|
// FILE: box.kt
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
// FILE: nnStringVsT.kt
|
// FILE: nnStringVsT.kt
|
||||||
fun <T> useT(fn: () -> T) = fn()
|
fun <T> useT(fn: () -> T) = fn()
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
// FILE: nnStringVsTAny.kt
|
// FILE: nnStringVsTAny.kt
|
||||||
fun <T : Any> useTAny(fn: () -> T) = fn()
|
fun <T : Any> useTAny(fn: () -> T) = fn()
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// FILE: nnStringVsTConstrained.kt
|
// FILE: nnStringVsTConstrained.kt
|
||||||
fun <T> useTConstrained(xs: Array<T>, fn: () -> T) = fn()
|
fun <T> useTConstrained(xs: Array<T>, fn: () -> T) = fn()
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// FILE: nnStringVsTXArray.kt
|
// FILE: nnStringVsTXArray.kt
|
||||||
fun <T> useTX(x: T, fn: () -> T) = fn()
|
fun <T> useTX(x: T, fn: () -> T) = fn()
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// FILE: nnStringVsTXString.kt
|
// FILE: nnStringVsTXString.kt
|
||||||
fun <T> useTX(x: T, fn: () -> T) = fn()
|
fun <T> useTX(x: T, fn: () -> T) = fn()
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.NO_UNIFIED_NULL_CHECKS
|
// KOTLIN_CONFIGURATION_FLAGS: +JVM.NO_UNIFIED_NULL_CHECKS
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// FILE: A.java
|
// FILE: A.java
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// FILE: A.java
|
// FILE: A.java
|
||||||
|
|
||||||
|
|||||||
+3
@@ -1,4 +1,7 @@
|
|||||||
// FILE: test/CallableDescriptor.java
|
// FILE: test/CallableDescriptor.java
|
||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
// Here FIR adds implicit NOT_NULL cast for `origin`, resulting in an assertion being added,
|
||||||
|
// which is the correct (yet mismatching) behavior, according to https://youtrack.jetbrains.com/issue/KT-35656
|
||||||
|
|
||||||
// JVM_IR:
|
// JVM_IR:
|
||||||
// Here in 'original in emptySet<D>()' T = '@EnhancedNullability CallableDescriptor' is inferred for 'Iterable<T>.contains(T)'.
|
// Here in 'original in emptySet<D>()' T = '@EnhancedNullability CallableDescriptor' is inferred for 'Iterable<T>.contains(T)'.
|
||||||
|
|||||||
+18
-14
@@ -44,13 +44,15 @@ FILE fqName:<root> fileName:/nullCheckOnGenericLambdaReturn.kt
|
|||||||
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.String
|
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.String declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.String declared in <root>'
|
||||||
CALL 'public final fun checkT <T> (fn: kotlin.Function0<T of <root>.checkT>): T of <root>.checkT declared in <root>' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
<T>: kotlin.String
|
CALL 'public final fun checkT <T> (fn: kotlin.Function0<T of <root>.checkT>): T of <root>.checkT declared in <root>' type=kotlin.String origin=null
|
||||||
fn: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
|
<T>: kotlin.String
|
||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
fn: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
|
||||||
BLOCK_BODY
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
||||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.test2'
|
BLOCK_BODY
|
||||||
CALL 'public open fun nnFoo (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.test2'
|
||||||
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun nnFoo (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.String?
|
FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.String?
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun test3 (): kotlin.String? declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun test3 (): kotlin.String? declared in <root>'
|
||||||
@@ -64,10 +66,12 @@ FILE fqName:<root> fileName:/nullCheckOnGenericLambdaReturn.kt
|
|||||||
FUN name:test4 visibility:public modality:FINAL <> () returnType:kotlin.String
|
FUN name:test4 visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun test4 (): kotlin.String declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun test4 (): kotlin.String declared in <root>'
|
||||||
CALL 'public final fun checkTAny <T> (fn: kotlin.Function0<T of <root>.checkTAny>): T of <root>.checkTAny declared in <root>' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
<T>: kotlin.String
|
CALL 'public final fun checkTAny <T> (fn: kotlin.Function0<T of <root>.checkTAny>): T of <root>.checkTAny declared in <root>' type=kotlin.String origin=null
|
||||||
fn: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
|
<T>: kotlin.String
|
||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
fn: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
|
||||||
BLOCK_BODY
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
||||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.test4'
|
BLOCK_BODY
|
||||||
CALL 'public open fun nnFoo (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.test4'
|
||||||
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun nnFoo (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
|
|||||||
@@ -85,4 +85,5 @@ FILE fqName:<root> fileName:/nullCheckOnLambdaReturn.kt
|
|||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Any?
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Any?
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Any? declared in <root>.test6'
|
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Any? declared in <root>.test6'
|
||||||
CALL 'public open fun nnFoo (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun nnFoo (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
|
|||||||
+4
-3
@@ -9,6 +9,7 @@ FILE fqName:<root> fileName:/typeParametersInImplicitCast.kt
|
|||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.collections.List<kotlin.Any?>
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.collections.List<kotlin.Any?>
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.collections.List<kotlin.Any?> declared in <root>.problematic'
|
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.collections.List<kotlin.Any?> declared in <root>.problematic'
|
||||||
CALL 'public/*package*/ open fun id <T> (v: kotlin.collections.List<T of <root>.ListId.id?>?): kotlin.collections.List<T of <root>.ListId.id?> declared in <root>.ListId' type=kotlin.collections.List<kotlin.Any?> origin=null
|
TYPE_OP type=kotlin.collections.List<kotlin.Any?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<kotlin.Any?>
|
||||||
<T>: kotlin.Any?
|
CALL 'public/*package*/ open fun id <T> (v: kotlin.collections.List<T of <root>.ListId.id?>?): kotlin.collections.List<T of <root>.ListId.id?> declared in <root>.ListId' type=kotlin.collections.List<kotlin.Any?> origin=null
|
||||||
v: ERROR_CALL 'Unresolved reference: <Unresolved name: it>#' type=IrErrorType
|
<T>: kotlin.Any?
|
||||||
|
v: ERROR_CALL 'Unresolved reference: <Unresolved name: it>#' type=IrErrorType
|
||||||
|
|||||||
@@ -5,19 +5,23 @@ FILE fqName:<root> fileName:/enhancedNullability.kt
|
|||||||
FUN name:testUse visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
FUN name:testUse visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
CALL 'public final fun use (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
CALL 'public final fun use (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||||
s: CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
s: TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
FUN name:testLocalVal visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
FUN name:testLocalVal visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
VAR name:local type:kotlin.String [val]
|
VAR name:local type:kotlin.String [val]
|
||||||
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
FUN name:testReturnValue visibility:public modality:FINAL <> () returnType:kotlin.String
|
FUN name:testReturnValue visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun testReturnValue (): kotlin.String declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun testReturnValue (): kotlin.String declared in <root>'
|
||||||
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
PROPERTY name:testGlobalVal visibility:public modality:FINAL [val]
|
PROPERTY name:testGlobalVal visibility:public modality:FINAL [val]
|
||||||
FIELD PROPERTY_BACKING_FIELD name:testGlobalVal type:kotlin.String visibility:private [final,static]
|
FIELD PROPERTY_BACKING_FIELD name:testGlobalVal type:kotlin.String visibility:private [final,static]
|
||||||
EXPRESSION_BODY
|
EXPRESSION_BODY
|
||||||
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testGlobalVal> visibility:public modality:FINAL <> () returnType:kotlin.String
|
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testGlobalVal> visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||||
correspondingProperty: PROPERTY name:testGlobalVal visibility:public modality:FINAL [val]
|
correspondingProperty: PROPERTY name:testGlobalVal visibility:public modality:FINAL [val]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
@@ -28,13 +32,15 @@ FILE fqName:<root> fileName:/enhancedNullability.kt
|
|||||||
correspondingProperty: PROPERTY name:testGlobalValGetter visibility:public modality:FINAL [val]
|
correspondingProperty: PROPERTY name:testGlobalValGetter visibility:public modality:FINAL [val]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun <get-testGlobalValGetter> (): kotlin.String declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun <get-testGlobalValGetter> (): kotlin.String declared in <root>'
|
||||||
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
FUN name:testJUse visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
FUN name:testJUse visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
CALL 'public open fun use (s: kotlin.String): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
CALL 'public open fun use (s: kotlin.String): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
||||||
s: CALL 'public open fun nullString (): kotlin.String? declared in <root>.J' type=kotlin.String? origin=null
|
s: CALL 'public open fun nullString (): kotlin.String? declared in <root>.J' type=kotlin.String? origin=null
|
||||||
CALL 'public open fun use (s: kotlin.String): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
CALL 'public open fun use (s: kotlin.String): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
||||||
s: CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
s: TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
FUN name:testLocalVarUse visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
FUN name:testLocalVarUse visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
VAR name:ns type:kotlin.String? [val]
|
VAR name:ns type:kotlin.String? [val]
|
||||||
@@ -42,6 +48,8 @@ FILE fqName:<root> fileName:/enhancedNullability.kt
|
|||||||
CALL 'public open fun use (s: kotlin.String): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
CALL 'public open fun use (s: kotlin.String): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
||||||
s: GET_VAR 'val ns: kotlin.String? [val] declared in <root>.testLocalVarUse' type=kotlin.String? origin=null
|
s: GET_VAR 'val ns: kotlin.String? [val] declared in <root>.testLocalVarUse' type=kotlin.String? origin=null
|
||||||
VAR name:nns type:kotlin.String [val]
|
VAR name:nns type:kotlin.String [val]
|
||||||
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
CALL 'public open fun use (s: kotlin.String): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
CALL 'public open fun use (s: kotlin.String): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
||||||
s: GET_VAR 'val nns: kotlin.String [val] declared in <root>.testLocalVarUse' type=kotlin.String origin=null
|
s: TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
GET_VAR 'val nns: kotlin.String [val] declared in <root>.testLocalVarUse' type=kotlin.String origin=null
|
||||||
|
|||||||
Vendored
+2
-1
@@ -118,7 +118,8 @@ FILE fqName:<root> fileName:/enhancedNullabilityInDestructuringAssignment.kt
|
|||||||
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.P [val]
|
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.P [val]
|
||||||
CALL 'public open fun notNullP (): <root>.P declared in <root>.J' type=<root>.P origin=null
|
TYPE_OP type=<root>.P origin=IMPLICIT_NOTNULL typeOperand=<root>.P
|
||||||
|
CALL 'public open fun notNullP (): <root>.P declared in <root>.J' type=<root>.P origin=null
|
||||||
VAR name:x type:kotlin.Int [val]
|
VAR name:x type:kotlin.Int [val]
|
||||||
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>.P' type=kotlin.Int origin=null
|
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>.P' type=kotlin.Int origin=null
|
||||||
$this: GET_VAR 'val tmp_0: <root>.P [val] declared in <root>.test1' type=<root>.P origin=null
|
$this: GET_VAR 'val tmp_0: <root>.P [val] declared in <root>.test1' type=<root>.P origin=null
|
||||||
|
|||||||
+2
-1
@@ -15,4 +15,5 @@ FILE fqName:<root> fileName:/nnStringVsT.kt
|
|||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.testNoNullCheck'
|
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.testNoNullCheck'
|
||||||
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
|
|||||||
Vendored
+2
-1
@@ -15,4 +15,5 @@ FILE fqName:<root> fileName:/nnStringVsTAny.kt
|
|||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.testNoNullCheck'
|
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.testNoNullCheck'
|
||||||
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
|
|||||||
Vendored
+2
-1
@@ -18,4 +18,5 @@ FILE fqName:<root> fileName:/nnStringVsTConstrained.kt
|
|||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.testWithNullCheck'
|
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.testWithNullCheck'
|
||||||
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
|
|||||||
Vendored
+2
-1
@@ -18,4 +18,5 @@ FILE fqName:<root> fileName:/nnStringVsTXArray.kt
|
|||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:java.io.Serializable
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:java.io.Serializable
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): java.io.Serializable declared in <root>.testWithNullCheck'
|
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): java.io.Serializable declared in <root>.testWithNullCheck'
|
||||||
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
|
|||||||
Vendored
+2
-1
@@ -17,4 +17,5 @@ FILE fqName:<root> fileName:/nnStringVsTXString.kt
|
|||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.testWithNullCheck'
|
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.testWithNullCheck'
|
||||||
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||||
|
CALL 'public open fun notNullString (): kotlin.String declared in <root>.J' type=kotlin.String origin=null
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
public open class ModalityOfFakeOverrides : R|java/util/AbstractList<ft<kotlin/String, kotlin/String?>!>| {
|
public open class ModalityOfFakeOverrides : R|java/util/AbstractList<ft<kotlin/String, kotlin/String?>!>| {
|
||||||
@R|java/lang/Override|() @R|org/jetbrains/annotations/NotNull|() public open operator fun get(index: R|kotlin/Int|): R|kotlin/String|
|
@R|java/lang/Override|() @R|org/jetbrains/annotations/NotNull|() public open operator fun get(index: R|kotlin/Int|): R|@EnhancedNullability kotlin/String|
|
||||||
|
|
||||||
@R|java/lang/Override|() public open fun size(): R|kotlin/Int|
|
@R|java/lang/Override|() public open fun size(): R|kotlin/Int|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
public abstract interface LoadIterableWithNullability<T : R|ft<kotlin/Any, kotlin/Any?>!|> : R|kotlin/Any| {
|
public abstract interface LoadIterableWithNullability<T : R|ft<kotlin/Any, kotlin/Any?>!|> : R|kotlin/Any| {
|
||||||
@R|org/jetbrains/annotations/NotNull|() @R|kotlin/annotations/jvm/Mutable|() public abstract fun getIterable(): R|kotlin/collections/MutableIterable<ft<T, T?>!>|
|
@R|org/jetbrains/annotations/NotNull|() @R|kotlin/annotations/jvm/Mutable|() public abstract fun getIterable(): R|@EnhancedNullability kotlin/collections/MutableIterable<ft<T, T?>!>|
|
||||||
|
|
||||||
public abstract fun setIterable(@R|kotlin/annotations/jvm/Mutable|() @R|org/jetbrains/annotations/NotNull|() Iterable: R|kotlin/collections/MutableIterable<ft<T, T?>!>|): R|kotlin/Unit|
|
public abstract fun setIterable(@R|kotlin/annotations/jvm/Mutable|() @R|org/jetbrains/annotations/NotNull|() Iterable: R|@EnhancedNullability kotlin/collections/MutableIterable<ft<T, T?>!>|): R|kotlin/Unit|
|
||||||
|
|
||||||
@R|org/jetbrains/annotations/NotNull|() @R|kotlin/annotations/jvm/ReadOnly|() public abstract fun getReadOnlyIterable(): R|kotlin/collections/Iterable<ft<T, T?>!>|
|
@R|org/jetbrains/annotations/NotNull|() @R|kotlin/annotations/jvm/ReadOnly|() public abstract fun getReadOnlyIterable(): R|kotlin/collections/Iterable<ft<T, T?>!>|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
public abstract interface ReadOnlyExtendsWildcard : R|kotlin/Any| {
|
public abstract interface ReadOnlyExtendsWildcard : R|kotlin/Any| {
|
||||||
public abstract fun bar(): R|kotlin/Unit|
|
public abstract fun bar(): R|kotlin/Unit|
|
||||||
|
|
||||||
public abstract fun foo(@R|kotlin/annotations/jvm/ReadOnly|() x: R|ft<kotlin/collections/List<out ft<kotlin/CharSequence, kotlin/CharSequence?>!>, kotlin/collections/List<out ft<kotlin/CharSequence, kotlin/CharSequence?>!>?>!|, @R|org/jetbrains/annotations/NotNull|() y: R|kotlin/Comparable<in ft<kotlin/String, kotlin/String?>!>|): R|kotlin/Unit|
|
public abstract fun foo(@R|kotlin/annotations/jvm/ReadOnly|() x: R|ft<kotlin/collections/List<out ft<kotlin/CharSequence, kotlin/CharSequence?>!>, kotlin/collections/List<out ft<kotlin/CharSequence, kotlin/CharSequence?>!>?>!|, @R|org/jetbrains/annotations/NotNull|() y: R|@EnhancedNullability kotlin/Comparable<in ft<kotlin/String, kotlin/String?>!>|): R|kotlin/Unit|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
public open class NotNullField : R|kotlin/Any| {
|
public open class NotNullField : R|kotlin/Any| {
|
||||||
@R|org/jetbrains/annotations/NotNull|() public open field hi: R|kotlin/String|
|
@R|org/jetbrains/annotations/NotNull|() public open field hi: R|@EnhancedNullability kotlin/String|
|
||||||
|
|
||||||
public constructor(): R|test/NotNullField|
|
public constructor(): R|test/NotNullField|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
public open class NotNullIntArray : R|kotlin/Any| {
|
public open class NotNullIntArray : R|kotlin/Any| {
|
||||||
@R|org/jetbrains/annotations/NotNull|() public open fun hi(): R|kotlin/IntArray|
|
@R|org/jetbrains/annotations/NotNull|() public open fun hi(): R|@EnhancedNullability kotlin/IntArray|
|
||||||
|
|
||||||
public constructor(): R|test/NotNullIntArray|
|
public constructor(): R|test/NotNullIntArray|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
public open class NotNullMethod : R|kotlin/Any| {
|
public open class NotNullMethod : R|kotlin/Any| {
|
||||||
@R|org/jetbrains/annotations/NotNull|() public open fun hi(): R|kotlin/String|
|
@R|org/jetbrains/annotations/NotNull|() public open fun hi(): R|@EnhancedNullability kotlin/String|
|
||||||
|
|
||||||
public constructor(): R|test/NotNullMethod|
|
public constructor(): R|test/NotNullMethod|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
public open class NotNullObjectArray : R|kotlin/Any| {
|
public open class NotNullObjectArray : R|kotlin/Any| {
|
||||||
@R|org/jetbrains/annotations/NotNull|() public open fun hi(): R|ft<kotlin/Array<ft<kotlin/Any, kotlin/Any?>!>, kotlin/Array<out ft<kotlin/Any, kotlin/Any?>!>>|
|
@R|org/jetbrains/annotations/NotNull|() public open fun hi(): R|ft<@EnhancedNullability kotlin/Array<ft<kotlin/Any, kotlin/Any?>!>, kotlin/Array<out ft<kotlin/Any, kotlin/Any?>!>>|
|
||||||
|
|
||||||
public constructor(): R|test/NotNullObjectArray|
|
public constructor(): R|test/NotNullObjectArray|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
public open class NotNullParameter : R|kotlin/Any| {
|
public open class NotNullParameter : R|kotlin/Any| {
|
||||||
public open fun hi(@R|org/jetbrains/annotations/NotNull|() param: R|kotlin/String|): R|kotlin/Unit|
|
public open fun hi(@R|org/jetbrains/annotations/NotNull|() param: R|@EnhancedNullability kotlin/String|): R|kotlin/Unit|
|
||||||
|
|
||||||
public constructor(): R|test/NotNullParameter|
|
public constructor(): R|test/NotNullParameter|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
public open class ConstructorWithAnnotations : R|kotlin/Any| {
|
public open class ConstructorWithAnnotations : R|kotlin/Any| {
|
||||||
public constructor(r: R|ft<java/lang/Runnable, java/lang/Runnable?>!|, @R|org/jetbrains/annotations/NotNull|() s: R|kotlin/String|): R|test/ConstructorWithAnnotations|
|
public constructor(r: R|ft<java/lang/Runnable, java/lang/Runnable?>!|, @R|org/jetbrains/annotations/NotNull|() s: R|@EnhancedNullability kotlin/String|): R|test/ConstructorWithAnnotations|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user