Rework nullability in IR

This commit is contained in:
Pavel Kunyavskiy
2022-03-18 13:40:20 +03:00
committed by Space
parent 000165b12b
commit 7ba4d9e1f0
108 changed files with 1679 additions and 469 deletions
@@ -321,7 +321,6 @@ class Fir2IrImplicitCastInserter(
internal fun implicitCastOrExpression(original: IrExpression, castType: IrType): IrExpression {
val originalNotNull = original.type.makeNotNull()
if (originalNotNull == castType.makeNotNull()) return original
if (castType is IrDefinitelyNotNullType && originalNotNull == castType.original.makeNotNull()) return original
return implicitCast(original, castType)
}
@@ -358,7 +357,7 @@ class Fir2IrImplicitCastInserter(
val classId = it.symbol.owner.parentAsClass.classId
classId == StandardClassIds.Annotations.EnhancedNullability ||
classId == StandardClassIds.Annotations.FlexibleNullability
}.withHasQuestionMark(false)
}.makeNotNull()
return IrTypeOperatorCallImpl(
original.startOffset,
original.endOffset,
@@ -20,10 +20,10 @@ import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.IrTypeArgument
import org.jetbrains.kotlin.ir.types.IrTypeProjection
import org.jetbrains.kotlin.ir.types.impl.IrDefinitelyNotNullTypeImpl
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.types.impl.IrStarProjectionImpl
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
import org.jetbrains.kotlin.ir.types.makeNotNull
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.StandardClassIds
import org.jetbrains.kotlin.name.StandardClassIds.Annotations.ExtensionFunctionType
@@ -190,7 +190,7 @@ class Fir2IrTypeConverter(
}
}
is ConeDefinitelyNotNullType -> {
IrDefinitelyNotNullTypeImpl(null, original.toIrType(typeContext))
original.toIrType(typeContext).makeNotNull()
}
is ConeIntersectionType -> {
// TODO: add intersectionTypeApproximation
@@ -69,7 +69,7 @@ class IrBuiltInsOverFir(
}
override val anyClass: IrClassSymbol get() = any.klass
override val anyType: IrType get() = any.type
override val anyNType by lazy { anyType.withHasQuestionMark(true) }
override val anyNType by lazy { anyType.makeNullable() }
private val number by createClass(kotlinIrPackage, IdSignatureValues.number, build = { modality = Modality.ABSTRACT }) {
configureSuperTypes()
@@ -84,7 +84,7 @@ class IrBuiltInsOverFir(
private val nothing by createClass(kotlinIrPackage, IdSignatureValues.nothing)
override val nothingClass: IrClassSymbol get() = nothing.klass
override val nothingType: IrType get() = nothing.type
override val nothingNType: IrType by lazy { nothingType.withHasQuestionMark(true) }
override val nothingNType: IrType by lazy { nothingType.makeNullable() }
private val unit by createClass(kotlinIrPackage, IdSignatureValues.unit, build = { kind = ClassKind.OBJECT; modality = Modality.FINAL })
override val unitClass: IrClassSymbol get() = unit.klass
@@ -401,7 +401,7 @@ class IrBuiltInsOverFir(
createFunction(
fqName, "CHECK_NOT_NULL",
IrSimpleTypeImpl(typeParameter.symbol, hasQuestionMark = false, emptyList(), emptyList()),
IrSimpleTypeImpl(typeParameter.symbol, SimpleTypeNullability.DEFINITELY_NOT_NULL, emptyList(), emptyList()),
arrayOf("" to IrSimpleTypeImpl(typeParameter.symbol, hasQuestionMark = true, emptyList(), emptyList())),
origin = BUILTIN_OPERATOR
).also {
@@ -471,7 +471,7 @@ class IrBuiltInsOverFir(
override val extensionStringPlus: IrSimpleFunctionSymbol by lazy {
findFunctions(kotlinPackage, OperatorNameConventions.PLUS).single { function ->
val isStringExtension =
function.owner.extensionReceiverParameter?.let { receiver -> receiver.type == stringType.withHasQuestionMark(true) }
function.owner.extensionReceiverParameter?.let { receiver -> receiver.type == stringType.makeNullable() }
?: false
isStringExtension && function.owner.valueParameters.size == 1 && function.owner.valueParameters[0].type == anyNType
}
@@ -359,7 +359,7 @@ internal class AdapterGenerator(
reifiedVarargElementType = adaptedType.getArgumentTypeAt(index)
reifiedVarargType = IrSimpleTypeImpl(
parameterType.classifier,
parameterType.hasQuestionMark,
parameterType.nullability,
listOf(makeTypeProjection(reifiedVarargElementType, Variance.OUT_VARIANCE)),
parameterType.annotations,
parameterType.abbreviation
@@ -18,10 +18,8 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.classifierOrFail
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.types.isDoubleOrFloatWithoutNullability
import org.jetbrains.kotlin.ir.util.getSimpleFunction
internal class OperatorExpressionGenerator(
@@ -173,19 +171,14 @@ internal class OperatorExpressionGenerator(
if (noImplicitCast && !isDoubleOrFloatWithoutNullability && irExpression.operator == IrTypeOperator.IMPLICIT_CAST) {
return irExpression.argument
} else {
val simpleType = irExpression.type as? IrSimpleType
val expressionType = irExpression.type
if (isDoubleOrFloatWithoutNullability &&
isOriginalNullable &&
simpleType?.hasQuestionMark == false
expressionType is IrSimpleType &&
!expressionType.isNullable()
) {
// Make it compatible with IR lowering
val nullableDoubleOrFloatType = IrSimpleTypeImpl(
simpleType.classifier,
true,
simpleType.arguments,
simpleType.annotations,
simpleType.abbreviation
)
val nullableDoubleOrFloatType = expressionType.makeNullable()
return IrTypeOperatorCallImpl(
irExpression.startOffset,
irExpression.endOffset,
@@ -329,13 +329,13 @@ fun IrType.remapTypeParameters(
target.typeParameters[classifier.index]
else
classifier
IrSimpleTypeImpl(newClassifier.symbol, hasQuestionMark, arguments, annotations)
IrSimpleTypeImpl(newClassifier.symbol, nullability, arguments, annotations)
}
classifier is IrClass ->
IrSimpleTypeImpl(
classifier.symbol,
hasQuestionMark,
nullability,
arguments.map {
when (it) {
is IrTypeProjection -> makeTypeProjection(
@@ -335,7 +335,7 @@ abstract class AbstractSuspendFunctionsLowering<C : CommonBackendContext>(val co
val constructor = coroutine.coroutineConstructor
generateCoroutineStart(coroutine.stateMachineFunction,
irCallConstructor(constructor.symbol, irFunction.typeParameters.map {
IrSimpleTypeImpl(it.symbol, true, emptyList(), emptyList())
it.defaultType.makeNullable()
}).apply {
val functionParameters = irFunction.explicitParameters
functionParameters.forEachIndexed { index, argument ->
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.ir.builders.*
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.transformStatement
import org.jetbrains.kotlin.ir.types.SimpleTypeNullability
import org.jetbrains.kotlin.ir.types.extractTypeParameters
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.util.*
@@ -293,7 +294,7 @@ class InlineClassLowering(val context: CommonBackendContext) {
val typeParameters = extractTypeParameters(function.parentAsClass) + function.typeParameters
for ((index, typeParameter) in typeParameters.withIndex()) {
putTypeArgument(index, IrSimpleTypeImpl(typeParameter.symbol, false, emptyList(), emptyList()))
putTypeArgument(index, IrSimpleTypeImpl(typeParameter.symbol, SimpleTypeNullability.NOT_SPECIFIED, emptyList(), emptyList()))
}
}
)
@@ -98,16 +98,13 @@ internal class DeepCopyIrTreeWithSymbolsForInliner(
erasedParameters.remove(classifier)
return if (type.hasQuestionMark) erasedUpperBound.makeNullable() else erasedUpperBound
return erasedUpperBound.mergeNullability(type)
}
if (substitutedType is IrDynamicType) return substitutedType
if (substitutedType is IrSimpleType) {
return substitutedType.buildSimpleType {
kotlinType = null
hasQuestionMark = type.hasQuestionMark or substitutedType.isMarkedNullable()
}
return substitutedType.mergeNullability(type)
}
return type.buildSimpleType {
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrGetObjectValueImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrWhileLoopImpl
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.SimpleTypeNullability
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.name.Name
@@ -43,7 +44,7 @@ fun IrBuilderWithScope.irContinue(loop: IrLoop) =
IrContinueImpl(startOffset, endOffset, context.irBuiltIns.nothingType, loop)
fun IrBuilderWithScope.irGetObject(classSymbol: IrClassSymbol) =
IrGetObjectValueImpl(startOffset, endOffset, IrSimpleTypeImpl(classSymbol, false, emptyList(), emptyList()), classSymbol)
IrGetObjectValueImpl(startOffset, endOffset, IrSimpleTypeImpl(classSymbol, SimpleTypeNullability.NOT_SPECIFIED, emptyList(), emptyList()), classSymbol)
// Also adds created variable into building block
fun <T : IrElement> IrStatementsBuilder<T>.createTmpVariable(
@@ -95,10 +95,7 @@ fun IrType.substitute(substitutionMap: Map<IrTypeParameterSymbol, IrType>): IrTy
substitutionMap[classifier]?.let { substitutedType ->
// Add nullability and annotations from original type
return substitutedType
.withHasQuestionMark(
hasQuestionMark ||
substitutedType is IrSimpleType && substitutedType.hasQuestionMark
)
.mergeNullability(this)
.addAnnotations(newAnnotations)
}
@@ -112,7 +109,7 @@ fun IrType.substitute(substitutionMap: Map<IrTypeParameterSymbol, IrType>): IrTy
return IrSimpleTypeImpl(
classifier,
hasQuestionMark,
nullability,
newArguments,
newAnnotations
)
@@ -469,7 +469,7 @@ class ExportModelGenerator(
return ExportedType.ErrorType("NonSimpleType ${type.render()}")
val classifier = type.classifier
val isNullable = type.hasQuestionMark
val isMarkedNullable = type.isMarkedNullable()
val nonNullType = type.makeNotNull() as IrSimpleType
val exportedType = when {
@@ -528,7 +528,7 @@ class ExportModelGenerator(
else -> error("Unexpected classifier $classifier")
}
return exportedType.withNullability(isNullable)
return exportedType.withNullability(isMarkedNullable)
}
private fun IrClass.getExportableName(): String {
@@ -74,7 +74,7 @@ class ScriptRemoveReceiverLowering(val context: CommonBackendContext) : FileLowe
endOffset,
IrSimpleTypeImpl(
context.ir.symbols.functionN(newN),
(type as IrSimpleType).hasQuestionMark,
(type as IrSimpleType).nullability,
arguments,
type.annotations
),
@@ -111,7 +111,7 @@ class ScriptRemoveReceiverLowering(val context: CommonBackendContext) : FileLowe
endOffset,
IrSimpleTypeImpl(
(if (setter == null) getPropertyN(newN) else getMutablePropertyN(newN)),
(type as IrSimpleType).hasQuestionMark,
(type as IrSimpleType).nullability,
arguments,
type.annotations
),
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.ir.symbols.IrScriptSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
import org.jetbrains.kotlin.ir.util.getInlineClassUnderlyingType
import org.jetbrains.kotlin.ir.util.isEffectivelyExternal
import org.jetbrains.kotlin.js.backend.ast.JsNameRef
import org.jetbrains.kotlin.types.Variance
@@ -26,7 +25,11 @@ fun IrType.asString(): String = when (this) {
is IrDynamicType -> "dynamic"
is IrSimpleType ->
classifier.asString() +
(if (hasQuestionMark) "?" else "") +
when (nullability) {
SimpleTypeNullability.MARKED_NULLABLE -> "?"
SimpleTypeNullability.NOT_SPECIFIED -> ""
SimpleTypeNullability.DEFINITELY_NOT_NULL -> if (classifier is IrTypeParameterSymbol) " & Any" else ""
} +
(arguments.ifNotEmpty {
joinToString(separator = ",", prefix = "<", postfix = ">") { it.asString() }
} ?: "")
@@ -34,11 +34,8 @@ private val IrTypeParameter.erasedUpperBound: IrClass?
val IrType.erasedUpperBound: IrClass?
get() =
if (this is IrDefinitelyNotNullType)
this.original.erasedUpperBound
else
when (val classifier = classifierOrNull) {
is IrClassSymbol -> classifier.owner
is IrTypeParameterSymbol -> classifier.owner.erasedUpperBound
else -> throw IllegalStateException()
}
when (val classifier = classifierOrNull) {
is IrClassSymbol -> classifier.owner
is IrTypeParameterSymbol -> classifier.owner.erasedUpperBound
else -> throw IllegalStateException()
}
@@ -80,7 +80,7 @@ private fun JvmIrBuilder.normalizeArgument(expression: IrExpression): IrExpressi
// upcast to 'String?'
return irImplicitCast(expression, context.irBuiltIns.stringType.makeNullable())
}
if (type is IrSimpleType && !type.hasQuestionMark || type is IrDefinitelyNotNullType) {
if (!type.isNullable()) {
if (upperBound.isByte() || upperBound.isShort()) {
// Expression type is not null,
// T <: Byte || T <: Short =>
@@ -548,9 +548,7 @@ internal class LambdaMetafactoryArgumentsBuilder(
)
}
private fun computeParameterTypeAdaptationConstraint(adapteeType0: IrType, expectedType0: IrType): TypeAdaptationConstraint? {
val adapteeType = adapteeType0.unwrapDefinitelyNotNullType()
val expectedType = expectedType0.unwrapDefinitelyNotNullType()
private fun computeParameterTypeAdaptationConstraint(adapteeType: IrType, expectedType: IrType): TypeAdaptationConstraint? {
if (adapteeType !is IrSimpleType)
throw AssertionError("Simple type expected: ${adapteeType.render()}")
if (expectedType !is IrSimpleType)
@@ -582,7 +580,7 @@ internal class LambdaMetafactoryArgumentsBuilder(
// Inline classes mapped to non-null reference types are a special case because they can't be boxed trivially.
// TODO consider adding a special type annotation to force boxing on an inline class type regardless of its underlying type.
val underlyingAdapteeType = getInlineClassUnderlyingType(erasedAdapteeClass)
if (!underlyingAdapteeType.hasQuestionMark && !underlyingAdapteeType.isPrimitiveType()) {
if (!underlyingAdapteeType.isNullable() && !underlyingAdapteeType.isPrimitiveType()) {
return TypeAdaptationConstraint.CONFLICT
}
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.ir.IrBuiltIns
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.IrTypeSystemContext
import org.jetbrains.kotlin.ir.types.isMarkedNullable as irIsMarkedNullable
import org.jetbrains.kotlin.types.model.FlexibleTypeMarker
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
import org.jetbrains.kotlin.types.model.SimpleTypeMarker
@@ -35,5 +36,5 @@ class JvmIrTypeSystemContext(override val irBuiltIns: IrBuiltIns) : IrTypeSystem
}
override fun KotlinTypeMarker.isMarkedNullable(): Boolean =
this is IrSimpleType && !isWithFlexibleNullability() && hasQuestionMark
this is IrSimpleType && !isWithFlexibleNullability() && irIsMarkedNullable()
}
@@ -158,7 +158,7 @@ class MemoizedInlineClassReplacements(
parent = irClass
// We ignore type arguments here, since there is no good way to go from type arguments to types in the IR anyway.
val typeArgument =
IrSimpleTypeImpl(null, irClass.symbol, false, List(irClass.typeParameters.size) { IrStarProjectionImpl }, listOf())
IrSimpleTypeImpl(irClass.symbol, false, List(irClass.typeParameters.size) { IrStarProjectionImpl }, listOf())
addValueParameter {
name = InlineClassDescriptorResolver.SPECIALIZED_EQUALS_FIRST_PARAMETER_NAME
type = typeArgument
@@ -9,12 +9,9 @@ import org.jetbrains.kotlin.backend.jvm.JvmSymbols
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.ir.IrBuiltIns
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.classFqName
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.IrStarProjectionImpl
import org.jetbrains.kotlin.ir.types.impl.buildSimpleType
import org.jetbrains.kotlin.ir.types.removeAnnotations
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
import org.jetbrains.kotlin.ir.util.hasAnnotation
import org.jetbrains.kotlin.ir.util.render
@@ -35,7 +32,7 @@ private class IrJvmFlexibleTypeImpl(
) : IrJvmFlexibleType {
override val lowerBound: IrSimpleType
get() = irType.buildSimpleType {
if (nullability) hasQuestionMark = false
if (this@IrJvmFlexibleTypeImpl.nullability) nullability = SimpleTypeNullability.NOT_SPECIFIED
// No change in classifier is needed for mutability because type's classifier is set to the lower bound anyway
// (see TypeTranslator.translateType).
kotlinType = null
@@ -43,7 +40,7 @@ private class IrJvmFlexibleTypeImpl(
override val upperBound: IrSimpleType
get() = irType.buildSimpleType {
if (nullability) hasQuestionMark = true
if (this@IrJvmFlexibleTypeImpl.nullability) nullability = SimpleTypeNullability.MARKED_NULLABLE
if (mutability) {
val klass = classifier?.owner as? IrClass
?: error("Mutability-flexible type's classifier is not a class: ${irType.render()}")
@@ -19,7 +19,6 @@ import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.types.impl.IrStarProjectionImpl
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.ir.util.isLocal
import org.jetbrains.kotlin.ir.util.render
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
@@ -41,9 +40,9 @@ fun IrType.eraseTypeParameters(): IrType = when (this) {
when (val owner = classifier.owner) {
is IrScript -> {
assert(arguments.isEmpty()) { "Script can't be generic: " + owner.render() }
IrSimpleTypeImpl(classifier, hasQuestionMark, emptyList(), annotations)
IrSimpleTypeImpl(classifier, nullability, emptyList(), annotations)
}
is IrClass -> IrSimpleTypeImpl(classifier, hasQuestionMark, arguments.map { it.eraseTypeParameters() }, annotations)
is IrClass -> IrSimpleTypeImpl(classifier, nullability, arguments.map { it.eraseTypeParameters() }, annotations)
is IrTypeParameter -> {
val upperBound = owner.erasedUpperBound
IrSimpleTypeImpl(
@@ -56,8 +55,6 @@ fun IrType.eraseTypeParameters(): IrType = when (this) {
}
else -> error("Unknown IrSimpleType classifier kind: $owner")
}
is IrDefinitelyNotNullType ->
this.original.eraseTypeParameters()
is IrErrorType ->
this
else -> error("Unknown IrType kind: $this")
@@ -88,15 +85,12 @@ val IrTypeParameter.erasedUpperBound: IrClass
val IrType.erasedUpperBound: IrClass
get() =
if (this is IrDefinitelyNotNullType)
this.original.erasedUpperBound
else
when (val classifier = classifierOrNull) {
is IrClassSymbol -> classifier.owner
is IrTypeParameterSymbol -> classifier.owner.erasedUpperBound
is IrScriptSymbol -> classifier.owner.targetClass!!.owner
else -> error(render())
}
when (val classifier = classifierOrNull) {
is IrClassSymbol -> classifier.owner
is IrTypeParameterSymbol -> classifier.owner.erasedUpperBound
is IrScriptSymbol -> classifier.owner.targetClass!!.owner
else -> error(render())
}
/**
* Get the default null/0 value for the type.
@@ -111,7 +105,7 @@ fun IrType.defaultValue(startOffset: Int, endOffset: Int, context: JvmBackendCon
return classifier.owner.representativeUpperBound.defaultValue(startOffset, endOffset, context)
}
if (this !is IrSimpleType || hasQuestionMark || classOrNull?.owner?.isSingleFieldValueClass != true)
if (this !is IrSimpleType || this.isMarkedNullable() || classOrNull?.owner?.isSingleFieldValueClass != true)
return IrConstImpl.defaultValueForType(startOffset, endOffset, this)
val underlyingType = unboxInlineClass()
@@ -137,13 +131,13 @@ fun IrType.eraseToScope(visibleTypeParameters: Set<IrTypeParameter>): IrType {
return when (classifier) {
is IrClassSymbol ->
IrSimpleTypeImpl(
classifier, hasQuestionMark, arguments.map { it.eraseToScope(visibleTypeParameters) }, annotations
classifier, nullability, arguments.map { it.eraseToScope(visibleTypeParameters) }, annotations
)
is IrTypeParameterSymbol ->
if (classifier.owner in visibleTypeParameters)
this
else
upperBound.withHasQuestionMark(this.hasQuestionMark)
upperBound.mergeNullability(this)
else -> error("unknown IrType classifier kind: ${classifier.owner.render()}")
}
}
@@ -194,7 +194,11 @@ internal fun IrFunction.getArgsForMethodInvocation(
internal fun IrType.getOnlyName(): String {
if (this !is IrSimpleType) return this.render()
return (this.classifierOrFail.owner as IrDeclarationWithName).name.asString() + (if (this.hasQuestionMark) "?" else "")
return (this.classifierOrFail.owner as IrDeclarationWithName).name.asString() + when (nullability) {
SimpleTypeNullability.MARKED_NULLABLE -> "?"
SimpleTypeNullability.NOT_SPECIFIED -> ""
SimpleTypeNullability.DEFINITELY_NOT_NULL -> if (this.classifierOrNull is IrTypeParameterSymbol) " & Any" else ""
}
}
internal fun IrFieldAccessExpression.accessesTopLevelOrObjectField(): Boolean {
@@ -251,7 +255,7 @@ internal fun IrType.getTypeIfReified(getType: (IrClassifierSymbol) -> IrType): I
val owner = this.classifierOrNull?.owner
if (owner is IrTypeParameter && owner.isReified) {
return (getType(owner.symbol) as IrSimpleType)
.buildSimpleType { hasQuestionMark = this.hasQuestionMark || this@getTypeIfReified.hasQuestionMark }
.mergeNullability(this)
}
val newArguments = this.arguments.map {
@@ -261,7 +265,6 @@ internal fun IrType.getTypeIfReified(getType: (IrClassifierSymbol) -> IrType): I
type.getTypeIfReified(getType) as IrTypeArgument
}
return this.buildSimpleType {
hasQuestionMark = this.hasQuestionMark || this@getTypeIfReified.hasQuestionMark
arguments = newArguments
}
}
@@ -172,7 +172,7 @@ internal class Wrapper(val value: Any, override val irClass: IrClass, environmen
fun getStaticGetter(field: IrField): MethodHandle {
val jvmClass = field.parentAsClass.defaultType.getClass(true)
val returnType = field.type.let { it.getClass((it as IrSimpleType).hasQuestionMark) }
val returnType = field.type.let { it.getClass(it.isNullable()) }
return MethodHandles.lookup().findStaticGetter(jvmClass, field.name.asString(), returnType)
}
@@ -1131,12 +1131,13 @@ private fun getContainingDeclaration(declaration: IrDeclaration): DeclarationDes
fun IrType.toIrBasedKotlinType(): KotlinType = when (this) {
is IrSimpleType ->
makeKotlinType(classifier, arguments, hasQuestionMark)
is IrDefinitelyNotNullType -> {
val kotlinType = this.original.toIrBasedKotlinType()
DefinitelyNotNullType.makeDefinitelyNotNull(kotlinType.unwrap())
?: kotlinType
}
makeKotlinType(classifier, arguments, isMarkedNullable()).let {
if (classifier is IrTypeParameterSymbol && nullability == SimpleTypeNullability.DEFINITELY_NOT_NULL) {
DefinitelyNotNullType.makeDefinitelyNotNull(it.unwrap()) ?: it
} else {
it
}
}
else ->
throw AssertionError("Unexpected type: $this = ${this.render()}")
}
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeBuilder
@@ -186,14 +185,14 @@ class IrBuiltInsOverDescriptors(
val returnIrType = IrSimpleTypeBuilder().run {
classifier = typeParameterSymbol
kotlinType = returnKotlinType
hasQuestionMark = false
nullability = SimpleTypeNullability.DEFINITELY_NOT_NULL
buildSimpleType()
}
val valueIrType = IrSimpleTypeBuilder().run {
classifier = typeParameterSymbol
kotlinType = valueKotlinType
hasQuestionMark = true
nullability = SimpleTypeNullability.MARKED_NULLABLE
buildSimpleType()
}
@@ -232,7 +231,7 @@ class IrBuiltInsOverDescriptors(
val any = builtIns.anyType
override val anyType = any.toIrType()
override val anyClass = builtIns.any.toIrSymbol()
override val anyNType = anyType.withHasQuestionMark(true)
override val anyNType = anyType.makeNullable()
val bool = builtIns.booleanType
override val booleanType = bool.toIrType()
@@ -273,7 +272,7 @@ class IrBuiltInsOverDescriptors(
val nothing = builtIns.nothingType
override val nothingType = nothing.toIrType()
override val nothingClass = builtIns.nothing.toIrSymbol()
override val nothingNType = nothingType.withHasQuestionMark(true)
override val nothingNType = nothingType.makeNullable()
val unit = builtIns.unitType
override val unitType = unit.toIrType()
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.SimpleTypeNullability
import org.jetbrains.kotlin.ir.types.impl.*
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.name.FqName
@@ -329,7 +330,7 @@ class IrDescriptorBasedFunctionFactory(
return with(IrSimpleTypeBuilder()) {
classifier =
symbolTable.referenceClassifier(kotlinType.constructor.declarationDescriptor ?: error("No classifier for type $kotlinType"))
hasQuestionMark = kotlinType.isMarkedNullable
nullability = SimpleTypeNullability.fromHasQuestionMark(kotlinType.isMarkedNullable)
arguments = kotlinType.arguments.map {
if (it.isStarProjection) IrStarProjectionImpl
else makeTypeProjection(toIrType(it.type), it.projectionKind)
@@ -52,11 +52,7 @@ class DeepCopyIrTreeWithSymbolsForFakeOverrides(typeArguments: Map<IrTypeParamet
return when (val substitutedType = typeArguments[type.classifier]) {
is IrDynamicType -> substitutedType
is IrDefinitelyNotNullType -> substitutedType
is IrSimpleType -> substitutedType.buildSimpleType {
kotlinType = null
hasQuestionMark = type.hasQuestionMark or substitutedType.isMarkedNullable()
}
is IrSimpleType -> substitutedType.mergeNullability(type)
else -> type.buildSimpleType {
kotlinType = null
classifier = symbolRemapper.getReferencedClassifier(type.classifier)
@@ -32,15 +32,56 @@ abstract class IrErrorType(kotlinType: KotlinType?) : IrTypeBase(kotlinType)
abstract class IrDynamicType(kotlinType: KotlinType?) : IrTypeBase(kotlinType), DynamicTypeMarker
abstract class IrDefinitelyNotNullType(kotlinType: KotlinType?) : IrTypeBase(kotlinType), DefinitelyNotNullTypeMarker {
abstract val original: IrType
enum class SimpleTypeNullability {
MARKED_NULLABLE,
NOT_SPECIFIED,
DEFINITELY_NOT_NULL;
companion object {
fun fromHasQuestionMark(hasQuestionMark: Boolean) = if (hasQuestionMark) MARKED_NULLABLE else NOT_SPECIFIED
}
}
abstract class IrSimpleType(kotlinType: KotlinType?) : IrTypeBase(kotlinType), SimpleTypeMarker, TypeArgumentListMarker {
abstract val classifier: IrClassifierSymbol
abstract val hasQuestionMark: Boolean
/**
* If type is explicitly marked as nullable, [nullability] is [SimpleTypeNullability.MARKED_NULLABLE]
*
* If classifier is type parameter, not marked as nullable, but can store null values,
* if corresponding argument would be nullable, [nullability] is [SimpleTypeNullability.NOT_SPECIFIED]
*
* If type can't store null values, [nullability] is [SimpleTypeNullability.DEFINITELY_NOT_NULL]
*
* Direct usages of this property should be avoided in most cases. Use relevant util functions instead.
*
* In most cases one of following is needed:
*
* Use [IrType.isNullable] to check if null value is possible for this type
*
* Use [IrType.isMarkedNullable] to check if type is marked with question mark in code
*
* Use [IrType.mergeNullability] to apply nullability of type parameter to actual type argument in type substitutions
*
* Use [IrType.makeNotNull] or [IrType.makeNullable] to transfer nullability from one type to another
*/
abstract val nullability: SimpleTypeNullability
abstract val arguments: List<IrTypeArgument>
abstract val abbreviation: IrTypeAbbreviation?
/**
* This property was deprecated and replaced with [nullability] property.
*
* Anyway, in most cases one of utils function would be more suitable, than direct usage.
*
* Check [nullability] property documentation for details
*/
@Deprecated(
level = DeprecationLevel.WARNING,
message = "hasQuestionMark has ambiguous meaning. Use isNullable() or isMarkedNullable() instead.",
)
val hasQuestionMark: Boolean
get() = nullability == SimpleTypeNullability.MARKED_NULLABLE
}
interface IrTypeArgument : TypeArgumentMarker {
@@ -43,8 +43,6 @@ abstract class AbstractIrTypeSubstitutor(private val irBuiltIns: IrBuiltIns) : T
arguments = irType.arguments.map { substituteTypeArgument(it) }
buildSimpleType()
}
is IrDefinitelyNotNullType ->
IrDefinitelyNotNullTypeImpl(null, substituteType(irType.original))
is IrDynamicType,
is IrErrorType ->
irType
@@ -28,6 +28,9 @@ import org.jetbrains.kotlin.name.SpecialNames
import org.jetbrains.kotlin.types.TypeCheckerState
import org.jetbrains.kotlin.types.TypeSystemCommonBackendContext
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.ir.types.makeNotNull as irMakeNotNull
import org.jetbrains.kotlin.ir.types.makeNullable as irMakeNullable
import org.jetbrains.kotlin.ir.types.isMarkedNullable as irIsMarkedNullable
import org.jetbrains.kotlin.types.model.*
import org.jetbrains.kotlin.ir.types.isPrimitiveType as irTypePredicates_isPrimitiveType
@@ -71,20 +74,18 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
override fun SimpleTypeMarker.asDefinitelyNotNullType(): DefinitelyNotNullTypeMarker? = null
override fun SimpleTypeMarker.isMarkedNullable(): Boolean = this is IrSimpleType && hasQuestionMark
override fun SimpleTypeMarker.isMarkedNullable(): Boolean = this is IrSimpleType && this.irIsMarkedNullable()
override fun KotlinTypeMarker.isMarkedNullable(): Boolean = this is IrSimpleType && hasQuestionMark
override fun KotlinTypeMarker.isMarkedNullable(): Boolean = this is IrSimpleType && this.irIsMarkedNullable()
override fun SimpleTypeMarker.withNullability(nullable: Boolean): SimpleTypeMarker {
val simpleType = this as IrSimpleType
return if (simpleType.hasQuestionMark == nullable) simpleType
else simpleType.run { IrSimpleTypeImpl(classifier, nullable, arguments, annotations) }
return (if (nullable) simpleType.irMakeNullable() else simpleType.irMakeNotNull()) as IrSimpleType
}
override fun SimpleTypeMarker.typeConstructor(): TypeConstructorMarker = when (this) {
is IrCapturedType -> constructor
is IrSimpleType -> classifier
is IrDefinitelyNotNullType -> original.typeConstructor()
else -> error("Unknown type constructor")
}
@@ -290,7 +291,7 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
}
}
return IrSimpleTypeImpl(type.classifier, type.hasQuestionMark, newArguments, type.annotations)
return IrSimpleTypeImpl(type.classifier, type.nullability, newArguments, type.annotations)
}
override fun SimpleTypeMarker.asArgumentList() = this as IrSimpleType
@@ -341,7 +342,7 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
require(ourAnnotations?.size == attributes?.size)
return IrSimpleTypeImpl(
constructor as IrClassifierSymbol,
nullable,
if (nullable) SimpleTypeNullability.MARKED_NULLABLE else SimpleTypeNullability.DEFINITELY_NOT_NULL,
arguments.map { it as IrTypeArgument },
ourAnnotations ?: emptyList()
)
@@ -556,7 +557,7 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
error("Captured type is unsupported in IR")
override fun DefinitelyNotNullTypeMarker.original(): SimpleTypeMarker =
(this as IrDefinitelyNotNullType).original as IrSimpleType
error("DefinitelyNotNullTypeMarker.original() type is unsupported in IR")
override fun KotlinTypeMarker.makeDefinitelyNotNullOrNotNull(): KotlinTypeMarker {
error("makeDefinitelyNotNullOrNotNull is not supported in IR")
@@ -7,10 +7,7 @@ package org.jetbrains.kotlin.ir.types
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.ir.IrBuiltIns
import org.jetbrains.kotlin.ir.symbols.FqNameEqualityChecker
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
import org.jetbrains.kotlin.types.AbstractTypeChecker
@@ -37,10 +34,15 @@ fun IrType.isSubtypeOf(superType: IrType, typeSystem: IrTypeSystemContext): Bool
fun IrType.isNullable(): Boolean =
when (this) {
is IrDefinitelyNotNullType -> false
is IrSimpleType -> when (val classifier = classifier) {
is IrClassSymbol -> hasQuestionMark
is IrTypeParameterSymbol -> hasQuestionMark || classifier.owner.superTypes.any(IrType::isNullable)
is IrClassSymbol -> nullability == SimpleTypeNullability.MARKED_NULLABLE
is IrTypeParameterSymbol -> when (nullability) {
SimpleTypeNullability.MARKED_NULLABLE -> true
// here is a bug, there should be .all check (not .any),
// but fixing it is a breaking change, see KT-31545 for details
SimpleTypeNullability.NOT_SPECIFIED -> classifier.owner.superTypes.any(IrType::isNullable)
SimpleTypeNullability.DEFINITELY_NOT_NULL -> false
}
else -> error("Unsupported classifier: $classifier")
}
is IrDynamicType -> true
@@ -73,9 +75,3 @@ fun IrType.toArrayOrPrimitiveArrayType(irBuiltIns: IrBuiltIns): IrType =
} else {
irBuiltIns.arrayClass.typeWith(this)
}
fun IrType.unwrapDefinitelyNotNullType(): IrType =
if (this is IrDefinitelyNotNullType)
this.original.unwrapDefinitelyNotNullType()
else
this
@@ -1,31 +0,0 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.ir.types.impl
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.types.IrDefinitelyNotNullType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.Variance
class IrDefinitelyNotNullTypeImpl(
kotlinType: KotlinType?,
override val original: IrType,
) : IrDefinitelyNotNullType(kotlinType) {
override val annotations: List<IrConstructorCall>
get() = original.annotations
override val variance: Variance
get() = Variance.INVARIANT
override fun equals(other: Any?): Boolean =
other is IrDefinitelyNotNullType &&
this.original == other.original
override fun hashCode(): Int =
original.hashCode()
}
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.ir.types.impl
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.symbols.FqNameEqualityChecker
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.Variance
@@ -18,7 +19,7 @@ abstract class IrAbstractSimpleType(kotlinType: KotlinType?) : IrSimpleType(kotl
get() = Variance.INVARIANT
abstract override val classifier: IrClassifierSymbol
abstract override val hasQuestionMark: Boolean
abstract override val nullability: SimpleTypeNullability
abstract override val arguments: List<IrTypeArgument>
abstract override val annotations: List<IrConstructorCall>
abstract override val abbreviation: IrTypeAbbreviation?
@@ -26,12 +27,12 @@ abstract class IrAbstractSimpleType(kotlinType: KotlinType?) : IrSimpleType(kotl
override fun equals(other: Any?): Boolean =
other is IrAbstractSimpleType &&
FqNameEqualityChecker.areEqual(classifier, other.classifier) &&
hasQuestionMark == other.hasQuestionMark &&
nullability == other.nullability &&
arguments == other.arguments
override fun hashCode(): Int =
(FqNameEqualityChecker.getHashCode(classifier) * 31 +
hasQuestionMark.hashCode()) * 31 +
nullability.hashCode()) * 31 +
arguments.hashCode()
}
@@ -41,8 +42,8 @@ abstract class IrDelegatedSimpleType(kotlinType: KotlinType? = null) : IrAbstrac
override val classifier: IrClassifierSymbol
get() = delegate.classifier
override val hasQuestionMark: Boolean
get() = delegate.hasQuestionMark
override val nullability: SimpleTypeNullability
get() = delegate.nullability
override val arguments: List<IrTypeArgument>
get() = delegate.arguments
override val abbreviation: IrTypeAbbreviation?
@@ -54,25 +55,40 @@ abstract class IrDelegatedSimpleType(kotlinType: KotlinType? = null) : IrAbstrac
class IrSimpleTypeImpl(
kotlinType: KotlinType?,
override val classifier: IrClassifierSymbol,
override val hasQuestionMark: Boolean,
nullability: SimpleTypeNullability,
override val arguments: List<IrTypeArgument>,
override val annotations: List<IrConstructorCall>,
override val abbreviation: IrTypeAbbreviation? = null
) : IrAbstractSimpleType(kotlinType) {
override val nullability =
if (classifier !is IrTypeParameterSymbol && nullability == SimpleTypeNullability.NOT_SPECIFIED)
SimpleTypeNullability.DEFINITELY_NOT_NULL
else
nullability
constructor(
classifier: IrClassifierSymbol,
nullability: SimpleTypeNullability,
arguments: List<IrTypeArgument>,
annotations: List<IrConstructorCall>,
abbreviation: IrTypeAbbreviation? = null
) : this(null, classifier, nullability, arguments, annotations, abbreviation)
constructor(
classifier: IrClassifierSymbol,
hasQuestionMark: Boolean,
arguments: List<IrTypeArgument>,
annotations: List<IrConstructorCall>,
abbreviation: IrTypeAbbreviation? = null
) : this(null, classifier, hasQuestionMark, arguments, annotations, abbreviation)
) : this(null, classifier, SimpleTypeNullability.fromHasQuestionMark(hasQuestionMark), arguments, annotations, abbreviation)
}
class IrSimpleTypeBuilder {
var kotlinType: KotlinType? = null
var classifier: IrClassifierSymbol? = null
var hasQuestionMark = false
var nullability = SimpleTypeNullability.NOT_SPECIFIED
var arguments: List<IrTypeArgument> = emptyList()
var annotations: List<IrConstructorCall> = emptyList()
var abbreviation: IrTypeAbbreviation? = null
@@ -83,7 +99,7 @@ fun IrSimpleType.toBuilder() =
IrSimpleTypeBuilder().also { b ->
b.kotlinType = originalKotlinType
b.classifier = classifier
b.hasQuestionMark = hasQuestionMark
b.nullability = nullability
b.arguments = arguments
b.annotations = annotations
b.abbreviation = abbreviation
@@ -93,7 +109,7 @@ fun IrSimpleTypeBuilder.buildSimpleType() =
IrSimpleTypeImpl(
kotlinType,
classifier ?: throw AssertionError("Classifier not provided"),
hasQuestionMark,
nullability,
arguments,
annotations,
abbreviation
@@ -122,7 +138,6 @@ class IrTypeProjectionImpl internal constructor(
fun makeTypeProjection(type: IrType, variance: Variance): IrTypeProjection =
when {
type is IrCapturedType -> IrTypeProjectionImpl(type, variance)
type is IrDefinitelyNotNullType -> IrTypeProjectionImpl(type, variance)
type is IrTypeProjection && type.variance == variance -> type
type is IrSimpleType -> type.toBuilder().apply { this.variance = variance }.buildTypeProjection()
type is IrDynamicType -> IrDynamicTypeImpl(null, type.annotations, variance)
@@ -103,7 +103,7 @@ class IrCapturedType(
override val classifier: IrClassifierSymbol get() = error("Captured Type does not have a classifier")
override val arguments: List<IrTypeArgument> get() = emptyList()
override val abbreviation: IrTypeAbbreviation? get () = null
override val hasQuestionMark: Boolean get() = false
override val nullability: SimpleTypeNullability get() = SimpleTypeNullability.DEFINITELY_NOT_NULL
override val annotations: List<IrConstructorCall> get() = emptyList()
override fun equals(other: Any?): Boolean {
@@ -48,15 +48,15 @@ object IdSignatureValues {
@JvmField val sequence = IdSignature.CommonSignature("kotlin.sequences", "Sequence", null, 0)
}
private fun IrType.isNotNullClassType(signature: IdSignature.CommonSignature) = isClassType(signature, hasQuestionMark = false)
private fun IrType.isNullableClassType(signature: IdSignature.CommonSignature) = isClassType(signature, hasQuestionMark = true)
private fun IrType.isNotNullClassType(signature: IdSignature.CommonSignature) = isClassType(signature, nullable = false)
private fun IrType.isNullableClassType(signature: IdSignature.CommonSignature) = isClassType(signature, nullable = true)
fun getPublicSignature(packageFqName: FqName, name: String) =
IdSignature.CommonSignature(packageFqName.asString(), name, null, 0)
private fun IrType.isClassType(signature: IdSignature.CommonSignature, hasQuestionMark: Boolean? = null): Boolean {
private fun IrType.isClassType(signature: IdSignature.CommonSignature, nullable: Boolean? = null): Boolean {
if (this !is IrSimpleType) return false
if (hasQuestionMark != null && this.hasQuestionMark != hasQuestionMark) return false
if (nullable != null && this.isMarkedNullable() != nullable) return false
return signature == classifier.signature ||
classifier.owner.let { it is IrClass && it.hasFqNameEqualToSignature(signature) }
}
@@ -109,16 +109,16 @@ fun IrType.isCollection(): Boolean = isNotNullClassType(IdSignatureValues.collec
fun IrType.isNothing(): Boolean = isNotNullClassType(IdSignatureValues.nothing)
fun IrType.isNullableNothing(): Boolean = isNullableClassType(IdSignatureValues.nothing)
fun IrType.isPrimitiveType(hasQuestionMark: Boolean = false): Boolean =
this is IrSimpleType && hasQuestionMark == this.hasQuestionMark && getPrimitiveType() != null
fun IrType.isPrimitiveType(nullable: Boolean = false): Boolean =
nullable == this.isMarkedNullable() && getPrimitiveType() != null
fun IrType.isNullablePrimitiveType(): Boolean = isPrimitiveType(true)
fun IrType.getPrimitiveType(): PrimitiveType? =
getPrimitiveOrUnsignedType(idSignatureToPrimitiveType, shortNameToPrimitiveType)
fun IrType.isUnsignedType(hasQuestionMark: Boolean = false): Boolean =
this is IrSimpleType && hasQuestionMark == this.hasQuestionMark && getUnsignedType() != null
fun IrType.isUnsignedType(nullable: Boolean = false): Boolean =
nullable == this.isMarkedNullable() && getUnsignedType() != null
fun IrType.getUnsignedType(): UnsignedType? =
getPrimitiveOrUnsignedType(idSignatureToUnsignedType, shortNameToUnsignedType)
@@ -134,7 +134,8 @@ fun <T : Enum<T>> IrType.getPrimitiveOrUnsignedType(byIdSignature: Map<IdSignatu
return byShortName[klass.name]
}
fun IrType.isMarkedNullable() = (this as? IrSimpleType)?.hasQuestionMark ?: false
fun IrType.isMarkedNullable() = (this as? IrSimpleType)?.nullability == SimpleTypeNullability.MARKED_NULLABLE
fun IrSimpleType.isMarkedNullable() = nullability == SimpleTypeNullability.MARKED_NULLABLE
fun IrType.isUnit() = isNotNullClassType(IdSignatureValues.unit)
@@ -152,8 +153,8 @@ fun IrType.isFloat(): Boolean = isNotNullClassType(IdSignatureValues._float)
fun IrType.isDouble(): Boolean = isNotNullClassType(IdSignatureValues._double)
fun IrType.isNumber(): Boolean = isNotNullClassType(IdSignatureValues.number)
fun IrType.isDoubleOrFloatWithoutNullability(): Boolean {
return isClassType(IdSignatureValues._double, hasQuestionMark = null) ||
isClassType(IdSignatureValues._float, hasQuestionMark = null)
return isClassType(IdSignatureValues._double, nullable = null) ||
isClassType(IdSignatureValues._float, nullable = null)
}
fun IrType.isComparable(): Boolean = isNotNullClassType(IdSignatureValues.comparable)
@@ -170,9 +171,9 @@ fun IrType.isLongArray(): Boolean = isNotNullClassType(primitiveArrayTypesSignat
fun IrType.isFloatArray(): Boolean = isNotNullClassType(primitiveArrayTypesSignatures[PrimitiveType.FLOAT]!!)
fun IrType.isDoubleArray(): Boolean = isNotNullClassType(primitiveArrayTypesSignatures[PrimitiveType.DOUBLE]!!)
fun IrType.isClassType(fqName: FqNameUnsafe, hasQuestionMark: Boolean): Boolean {
fun IrType.isClassType(fqName: FqNameUnsafe, nullable: Boolean): Boolean {
if (this !is IrSimpleType) return false
if (this.hasQuestionMark != hasQuestionMark) return false
if (this.isMarkedNullable() != nullable) return false
return classifier.isClassWithFqName(fqName)
}
@@ -20,27 +20,29 @@ import org.jetbrains.kotlin.ir.types.impl.*
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.makeNotNullable
import org.jetbrains.kotlin.types.typeUtil.makeNullable
import org.jetbrains.kotlin.utils.addToStdlib.cast
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
fun IrType.withHasQuestionMark(newHasQuestionMark: Boolean): IrType =
private fun IrType.withNullability(newNullability: Boolean): IrType =
when (this) {
is IrSimpleType -> withHasQuestionMark(newHasQuestionMark)
is IrSimpleType -> withNullability(newNullability)
else -> this
}
fun IrSimpleType.withHasQuestionMark(newHasQuestionMark: Boolean): IrSimpleType =
if (this.hasQuestionMark == newHasQuestionMark)
private fun IrSimpleType.withNullability(newNullability: Boolean): IrSimpleType {
val requiredNullability = if (newNullability) SimpleTypeNullability.MARKED_NULLABLE else SimpleTypeNullability.DEFINITELY_NOT_NULL
return if (nullability == requiredNullability)
this
else
buildSimpleType {
hasQuestionMark = newHasQuestionMark
nullability = requiredNullability
kotlinType = originalKotlinType?.run {
if (newHasQuestionMark) makeNullable() else makeNotNullable()
if (newNullability) {
TypeUtils.makeNullable(this)
} else {
DefinitelyNotNullType.makeDefinitelyNotNull(this.unwrap()) ?: TypeUtils.makeNotNullable(this)
}
}
}
}
fun IrType.addAnnotations(newAnnotations: List<IrConstructorCall>): IrType =
if (newAnnotations.isEmpty())
@@ -86,7 +88,6 @@ val IrType.classifierOrFail: IrClassifierSymbol
val IrType.classifierOrNull: IrClassifierSymbol?
get() = when (this) {
is IrSimpleType -> classifier
is IrDefinitelyNotNullType -> original.classifierOrNull
else -> null
}
@@ -103,34 +104,18 @@ val IrType.classFqName: FqName?
val IrTypeArgument.typeOrNull: IrType? get() = (this as? IrTypeProjection)?.type
fun IrType.makeNotNull() =
if (this is IrSimpleType && this.hasQuestionMark) {
buildSimpleType {
kotlinType = originalKotlinType?.makeNotNullable()
hasQuestionMark = false
}
} else {
this
}
fun IrType.makeNotNull() = withNullability(false)
fun IrType.makeNullable(): IrType =
when (this) {
is IrSimpleType -> {
if (this.hasQuestionMark)
this
else
buildSimpleType {
kotlinType = originalKotlinType?.makeNullable()
hasQuestionMark = true
}
}
is IrDefinitelyNotNullType -> {
// '{ T & Any }?' => 'T?'
this.original.makeNullable()
}
else ->
this
fun IrType.makeNullable() = withNullability(true)
fun IrType.mergeNullability(other: IrType) = when (other) {
is IrSimpleType -> when (other.nullability) {
SimpleTypeNullability.MARKED_NULLABLE -> makeNullable()
SimpleTypeNullability.NOT_SPECIFIED -> this
SimpleTypeNullability.DEFINITELY_NOT_NULL -> makeNotNull()
}
else -> this
}
@ObsoleteDescriptorBasedAPI
fun IrType.toKotlinType(): KotlinType {
@@ -139,7 +124,7 @@ fun IrType.toKotlinType(): KotlinType {
}
return when (this) {
is IrSimpleType -> makeKotlinType(classifier, arguments, hasQuestionMark)
is IrSimpleType -> makeKotlinType(classifier, arguments, nullability == SimpleTypeNullability.MARKED_NULLABLE)
else -> TODO(toString())
}
}
@@ -181,7 +166,7 @@ val IrClassifierSymbol.defaultType: IrType
val IrTypeParameter.defaultType: IrType
get() = IrSimpleTypeImpl(
symbol,
hasQuestionMark = false,
SimpleTypeNullability.NOT_SPECIFIED,
arguments = emptyList(),
annotations = emptyList()
)
@@ -189,7 +174,7 @@ val IrTypeParameter.defaultType: IrType
val IrClassSymbol.starProjectedType: IrSimpleType
get() = IrSimpleTypeImpl(
this,
hasQuestionMark = false,
SimpleTypeNullability.NOT_SPECIFIED,
arguments = owner.typeConstructorParameters.map { IrStarProjectionImpl }.toList(),
annotations = emptyList()
)
@@ -230,13 +215,13 @@ fun IrClassifierSymbol.typeWith(vararg arguments: IrType): IrSimpleType = typeWi
fun IrClassifierSymbol.typeWith(arguments: List<IrType>): IrSimpleType =
IrSimpleTypeImpl(
this,
false,
SimpleTypeNullability.NOT_SPECIFIED,
arguments.map { makeTypeProjection(it, Variance.INVARIANT) },
emptyList()
)
fun IrClassifierSymbol.typeWithArguments(arguments: List<IrTypeArgument>): IrSimpleType =
IrSimpleTypeImpl(this, false, arguments, emptyList())
IrSimpleTypeImpl(this, SimpleTypeNullability.NOT_SPECIFIED, arguments, emptyList())
fun IrClass.typeWith(arguments: List<IrType>) = this.symbol.typeWith(arguments)
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.ir.util
import org.jetbrains.kotlin.ir.declarations.IrTypeParametersContainer
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.IrDefinitelyNotNullTypeImpl
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.types.impl.IrTypeAbbreviationImpl
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
@@ -29,11 +28,10 @@ class DeepCopyTypeRemapper(
override fun remapType(type: IrType): IrType {
return when (type) {
is IrDefinitelyNotNullType -> IrDefinitelyNotNullTypeImpl(null, remapType(type.original))
is IrSimpleType -> IrSimpleTypeImpl(
null,
symbolRemapper.getReferencedClassifier(type.classifier),
type.hasQuestionMark,
type.nullability,
type.arguments.map { remapTypeArgument(it) },
type.annotations.map { it.transform(deepCopy, null) as IrConstructorCall },
type.abbreviation?.remapTypeAbbreviation()
@@ -29,7 +29,7 @@ class IrTypeParameterRemapper(
IrSimpleTypeImpl(
null,
type.classifier.remap(),
type.hasQuestionMark,
type.nullability,
type.arguments.map { it.remap() },
type.annotations,
type.abbreviation?.remap()
@@ -12,10 +12,7 @@ import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeAliasSymbol
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.ReturnTypeIsNotInitializedException
import org.jetbrains.kotlin.ir.types.impl.originalKotlinType
@@ -113,9 +110,9 @@ class RenderIrElementVisitor(private val normalizeNames: Boolean = false, privat
is IrErrorType -> "IrErrorType(${if (verboseErrorTypes) originalKotlinType else null})"
is IrDefinitelyNotNullType -> "{${original.render()} & Any}"
is IrSimpleType -> buildTrimEnd {
val isDefinitelyNotNullType = classifier is IrTypeParameterSymbol && nullability == SimpleTypeNullability.DEFINITELY_NOT_NULL
if (isDefinitelyNotNullType) append("{")
append(classifier.renderClassifierFqn())
if (arguments.isNotEmpty()) {
append(
@@ -124,7 +121,9 @@ class RenderIrElementVisitor(private val normalizeNames: Boolean = false, privat
}
)
}
if (hasQuestionMark) {
if (isDefinitelyNotNullType) {
append(" & Any}")
} else if (isMarkedNullable()) {
append('?')
}
abbreviation?.let {
@@ -33,7 +33,7 @@ class SimpleTypeRemapper(
IrSimpleTypeImpl(
null,
symbol,
type.hasQuestionMark,
type.nullability,
arguments,
type.annotations,
type.abbreviation?.remapTypeAbbreviation()
@@ -17,9 +17,7 @@ import org.jetbrains.kotlin.ir.descriptors.IrBasedTypeParameterDescriptor
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.IrTypeAbbreviation
import org.jetbrains.kotlin.ir.types.IrTypeProjection
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.*
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithStarProjections
@@ -101,7 +99,7 @@ abstract class TypeTranslator(
approximatedType.isDynamic() ->
return IrDynamicTypeImpl(approximatedType, translateTypeAnnotations(approximatedType), variance)
supportDefinitelyNotNullTypes && approximatedType is DefinitelyNotNullType ->
return makeTypeProjection(IrDefinitelyNotNullTypeImpl(approximatedType, translateType(approximatedType.original)), variance)
return makeTypeProjection(translateType(approximatedType.original).makeNotNull(), variance)
}
val upperType = approximatedType.upperIfFlexible()
@@ -121,7 +119,7 @@ abstract class TypeTranslator(
return IrSimpleTypeBuilder().apply {
this.kotlinType = approximatedType
this.hasQuestionMark = upperType.isMarkedNullable
this.nullability = SimpleTypeNullability.fromHasQuestionMark(upperType.isMarkedNullable)
this.variance = variance
this.abbreviation = upperType.getAbbreviation()?.toIrTypeAbbreviation()
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.name.Name
@@ -422,14 +423,14 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
// TODO don't print `Any?` as upper bound?
printAnnotationsWithNoIndent()
when (this) {
is IrDefinitelyNotNullType -> {
p.printWithNoIndent("(")
original.printTypeWithNoIndent()
p.printWithNoIndent(" & Any)")
}
is IrSimpleType -> {
// TODO abbreviation
val dnn = classifier is IrTypeParameterSymbol && nullability == SimpleTypeNullability.DEFINITELY_NOT_NULL
if (dnn) {
p.printWithNoIndent("(")
}
p.printWithNoIndent((classifier.owner as IrDeclarationWithName).name.asString())
if (arguments.isNotEmpty()) {
@@ -442,7 +443,11 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
p.printWithNoIndent(">")
}
if (hasQuestionMark) p.printWithNoIndent("?")
if (dnn) {
p.printWithNoIndent(" & Any)")
}
if (isMarkedNullable()) p.printWithNoIndent("?")
}
is IrDynamicType ->
p.printWithNoIndent("dynamic")
@@ -80,7 +80,7 @@ message Actual {
// Note: IrTypeArgument [63..2 - IrType index | 1..0 - Variance]
// If x...xxx00 -> *
message IrSimpleType {
message IrSimpleTypeLegacy {
repeated IrConstructorCall annotation = 1;
required int64 classifier = 2;
required bool has_question_mark = 3;
@@ -88,6 +88,20 @@ message IrSimpleType {
optional IrTypeAbbreviation abbreviation = 5;
}
enum IrSimpleTypeNullability {
MARKED_NULLABLE = 0;
NOT_SPECIFIED = 1;
DEFINITELY_NOT_NULL = 2;
}
message IrSimpleType {
repeated IrConstructorCall annotation = 1;
required int64 classifier = 2;
optional IrSimpleTypeNullability nullability = 3 [default=NOT_SPECIFIED];
repeated int64 argument = 4 [packed=true]; // 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
optional IrTypeAbbreviation abbreviation = 5;
}
message IrTypeAbbreviation {
repeated IrConstructorCall annotation = 1;
required int64 type_alias = 2;
@@ -110,10 +124,11 @@ message IrErrorType {
message IrType {
oneof kind {
IrSimpleType simple = 1;
IrSimpleTypeLegacy legacySimple = 1;
IrDynamicType dynamic = 2;
IrErrorType error = 3;
IrDefinitelyNotNullType dnn = 4;
IrSimpleType simple = 5;
}
}
@@ -50,7 +50,9 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepr
import org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty as ProtoLocalDelegatedProperty
import org.jetbrains.kotlin.backend.common.serialization.proto.IrMultiFieldValueClassRepresentation as ProtoIrMultiFieldValueClassRepresentation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty as ProtoProperty
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability as ProtoSimpleTypeNullablity
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType as ProtoSimpleType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy as ProtoSimpleTypeLegacy
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement as ProtoStatement
import org.jetbrains.kotlin.backend.common.serialization.proto.IrType as ProtoType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation as ProtoTypeAbbreviation
@@ -110,6 +112,12 @@ class IrDeclarationDeserializer(
}
}
private fun deserializeSimpleTypeNullability(proto: ProtoSimpleTypeNullablity) = when (proto) {
ProtoSimpleTypeNullablity.MARKED_NULLABLE -> SimpleTypeNullability.MARKED_NULLABLE
ProtoSimpleTypeNullablity.NOT_SPECIFIED -> SimpleTypeNullability.NOT_SPECIFIED
ProtoSimpleTypeNullablity.DEFINITELY_NOT_NULL -> SimpleTypeNullability.DEFINITELY_NOT_NULL
}
private fun deserializeSimpleType(proto: ProtoSimpleType): IrSimpleType {
val symbol = checkSymbolType<IrClassifierSymbol>(deserializeIrSymbolAndRemap(proto.classifier))
@@ -119,7 +127,23 @@ class IrDeclarationDeserializer(
return IrSimpleTypeImpl(
null,
symbol,
proto.hasQuestionMark,
deserializeSimpleTypeNullability(proto.nullability),
arguments,
annotations,
if (proto.hasAbbreviation()) deserializeTypeAbbreviation(proto.abbreviation) else null
)
}
private fun deserializeLegacySimpleType(proto: ProtoSimpleTypeLegacy): IrSimpleType {
val symbol = checkSymbolType<IrClassifierSymbol>(deserializeIrSymbolAndRemap(proto.classifier))
val arguments = proto.argumentList.map { deserializeIrTypeArgument(it) }
val annotations = deserializeAnnotations(proto.annotationList)
return IrSimpleTypeImpl(
null,
symbol,
SimpleTypeNullability.fromHasQuestionMark(proto.hasQuestionMark),
arguments,
annotations,
if (proto.hasAbbreviation()) deserializeTypeAbbreviation(proto.abbreviation) else null
@@ -145,16 +169,17 @@ class IrDeclarationDeserializer(
return IrErrorTypeImpl(null, annotations, Variance.INVARIANT)
}
private fun deserializeDefinitelyNotNullType(proto: ProtoDefinitelyNotNullType): IrDefinitelyNotNullType {
private fun deserializeDefinitelyNotNullType(proto: ProtoDefinitelyNotNullType): IrSimpleType {
assert(proto.typesCount == 1) { "Only DefinitelyNotNull type is now supported" }
// TODO support general case of intersection type
return IrDefinitelyNotNullTypeImpl(null, deserializeIrType(proto.typesList[0]))
return deserializeIrType(proto.typesList[0]).makeNotNull() as IrSimpleType
}
private fun deserializeIrTypeData(proto: ProtoType): IrType {
return when (proto.kindCase) {
DNN -> deserializeDefinitelyNotNullType(proto.dnn)
SIMPLE -> deserializeSimpleType(proto.simple)
LEGACYSIMPLE -> deserializeLegacySimpleType(proto.legacySimple)
DYNAMIC -> deserializeDynamicType(proto.dynamic)
ERROR -> deserializeErrorType(proto.error)
else -> error("Unexpected IrType kind: ${proto.kindCase}")
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.backend.common.serialization.encodings.*
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.IrFileEntry
@@ -52,7 +53,6 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrContinue as ProtoContinue
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration as ProtoDeclaration
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase as ProtoDeclarationBase
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDefinitelyNotNullType as ProtoDefinitelyNotNullType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDelegatingConstructorCall as ProtoDelegatingConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDoWhile as ProtoDoWhile
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDynamicMemberExpression as ProtoDynamicMemberExpression
@@ -378,11 +378,19 @@ open class IrFileSerializer(
}
}
private fun serializeNullability(nullability: SimpleTypeNullability) = when (nullability) {
SimpleTypeNullability.MARKED_NULLABLE -> IrSimpleTypeNullability.MARKED_NULLABLE
SimpleTypeNullability.NOT_SPECIFIED -> IrSimpleTypeNullability.NOT_SPECIFIED
SimpleTypeNullability.DEFINITELY_NOT_NULL -> IrSimpleTypeNullability.DEFINITELY_NOT_NULL
}
private fun serializeSimpleType(type: IrSimpleType): ProtoSimpleType {
val proto = ProtoSimpleType.newBuilder()
.addAllAnnotation(serializeAnnotations(type.annotations))
.setClassifier(serializeIrSymbol(type.classifier))
.setHasQuestionMark(type.hasQuestionMark)
if (type.nullability != SimpleTypeNullability.NOT_SPECIFIED) {
proto.setNullability(serializeNullability(type.nullability))
}
type.abbreviation?.let { ta ->
proto.setAbbreviation(serializeIrTypeAbbreviation(ta))
}
@@ -411,17 +419,10 @@ open class IrFileSerializer(
.addAllAnnotation(serializeAnnotations(type.annotations))
.build()
private fun serializeDefinitelyNotNullType(type: IrDefinitelyNotNullType): ProtoDefinitelyNotNullType =
ProtoDefinitelyNotNullType.newBuilder()
.addTypes(serializeIrType(type.original))
// .addTypes(serializeIrType(kotlin.Any))
.build()
private fun serializeIrTypeData(type: IrType): ProtoType {
val proto = ProtoType.newBuilder()
when (type) {
is IrDefinitelyNotNullType ->
proto.dnn = serializeDefinitelyNotNullType(type)
is IrSimpleType ->
proto.simple = serializeSimpleType(type)
is IrDynamicType ->
@@ -437,7 +438,6 @@ open class IrFileSerializer(
SIMPLE,
DYNAMIC,
ERROR,
DEFINITELY_NOT_NULL
}
enum class IrTypeArgumentKind {
@@ -449,7 +449,7 @@ open class IrFileSerializer(
data class IrTypeKey(
val kind: IrTypeKind,
val classifier: IrClassifierSymbol?,
val hasQuestionMark: Boolean?,
val nullability: SimpleTypeNullability?,
val arguments: List<IrTypeArgumentKey>?,
val annotations: List<IrConstructorCall>,
val abbreviation: IrTypeAbbreviation?
@@ -463,17 +463,16 @@ open class IrFileSerializer(
private val IrType.toIrTypeKey: IrTypeKey
get() {
var type = this
val type = this
return IrTypeKey(
kind = when (this) {
is IrDefinitelyNotNullType -> IrTypeKind.DEFINITELY_NOT_NULL.also { type = original }
is IrSimpleType -> IrTypeKind.SIMPLE
is IrDynamicType -> IrTypeKind.DYNAMIC
is IrErrorType -> IrTypeKind.ERROR
else -> error("Unexpected IrType kind: $this")
},
classifier = type.classifierOrNull,
hasQuestionMark = (type as? IrSimpleType)?.hasQuestionMark,
nullability = (type as? IrSimpleType)?.nullability,
arguments = (type as? IrSimpleType)?.arguments?.map { it.toIrTypeArgumentKey },
annotations = type.annotations,
abbreviation = (type as? IrSimpleType)?.abbreviation
@@ -186,15 +186,12 @@ abstract class IrMangleComputer(protected val builder: StringBuilder, private va
}
}
if (type.hasQuestionMark) tBuilder.appendSignature(MangleConstant.Q_MARK)
//TODO
if (type.isMarkedNullable()) tBuilder.appendSignature(MangleConstant.Q_MARK)
mangleTypePlatformSpecific(type, tBuilder)
}
is IrDynamicType -> tBuilder.appendSignature(MangleConstant.DYNAMIC_MARK)
is IrDefinitelyNotNullType -> {
// TODO mangle DNN type differently from original simple type?
mangleType(tBuilder, type.original)
}
is IrErrorType -> tBuilder.appendSignature(MangleConstant.ERROR_MARK)
else -> error("Unexpected type $type")
}
@@ -67,8 +67,15 @@ public final class IrSimpleType extends
break;
}
case 24: {
bitField0_ |= 0x00000002;
hasQuestionMark_ = input.readBool();
int rawValue = input.readEnum();
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability value = org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability.valueOf(rawValue);
if (value == null) {
unknownFieldsCodedOutput.writeRawVarint32(tag);
unknownFieldsCodedOutput.writeRawVarint32(rawValue);
} else {
bitField0_ |= 0x00000002;
nullability_ = value;
}
break;
}
case 32: {
@@ -195,19 +202,19 @@ public final class IrSimpleType extends
return classifier_;
}
public static final int HAS_QUESTION_MARK_FIELD_NUMBER = 3;
private boolean hasQuestionMark_;
public static final int NULLABILITY_FIELD_NUMBER = 3;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability nullability_;
/**
* <code>required bool has_question_mark = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability nullability = 3 [default = NOT_SPECIFIED];</code>
*/
public boolean hasHasQuestionMark() {
public boolean hasNullability() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required bool has_question_mark = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability nullability = 3 [default = NOT_SPECIFIED];</code>
*/
public boolean getHasQuestionMark() {
return hasQuestionMark_;
public org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability getNullability() {
return nullability_;
}
public static final int ARGUMENT_FIELD_NUMBER = 4;
@@ -263,7 +270,7 @@ public final class IrSimpleType extends
private void initFields() {
annotation_ = java.util.Collections.emptyList();
classifier_ = 0L;
hasQuestionMark_ = false;
nullability_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability.NOT_SPECIFIED;
argument_ = java.util.Collections.emptyList();
abbreviation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation.getDefaultInstance();
}
@@ -277,10 +284,6 @@ public final class IrSimpleType extends
memoizedIsInitialized = 0;
return false;
}
if (!hasHasQuestionMark()) {
memoizedIsInitialized = 0;
return false;
}
for (int i = 0; i < getAnnotationCount(); i++) {
if (!getAnnotation(i).isInitialized()) {
memoizedIsInitialized = 0;
@@ -307,7 +310,7 @@ public final class IrSimpleType extends
output.writeInt64(2, classifier_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBool(3, hasQuestionMark_);
output.writeEnum(3, nullability_.getNumber());
}
if (getArgumentList().size() > 0) {
output.writeRawVarint32(34);
@@ -338,7 +341,7 @@ public final class IrSimpleType extends
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(3, hasQuestionMark_);
.computeEnumSize(3, nullability_.getNumber());
}
{
int dataSize = 0;
@@ -456,7 +459,7 @@ public final class IrSimpleType extends
bitField0_ = (bitField0_ & ~0x00000001);
classifier_ = 0L;
bitField0_ = (bitField0_ & ~0x00000002);
hasQuestionMark_ = false;
nullability_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability.NOT_SPECIFIED;
bitField0_ = (bitField0_ & ~0x00000004);
argument_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000008);
@@ -497,7 +500,7 @@ public final class IrSimpleType extends
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000002;
}
result.hasQuestionMark_ = hasQuestionMark_;
result.nullability_ = nullability_;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
argument_ = java.util.Collections.unmodifiableList(argument_);
bitField0_ = (bitField0_ & ~0x00000008);
@@ -526,8 +529,8 @@ public final class IrSimpleType extends
if (other.hasClassifier()) {
setClassifier(other.getClassifier());
}
if (other.hasHasQuestionMark()) {
setHasQuestionMark(other.getHasQuestionMark());
if (other.hasNullability()) {
setNullability(other.getNullability());
}
if (!other.argument_.isEmpty()) {
if (argument_.isEmpty()) {
@@ -552,10 +555,6 @@ public final class IrSimpleType extends
return false;
}
if (!hasHasQuestionMark()) {
return false;
}
for (int i = 0; i < getAnnotationCount(); i++) {
if (!getAnnotation(i).isInitialized()) {
@@ -747,34 +746,37 @@ public final class IrSimpleType extends
return this;
}
private boolean hasQuestionMark_ ;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability nullability_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability.NOT_SPECIFIED;
/**
* <code>required bool has_question_mark = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability nullability = 3 [default = NOT_SPECIFIED];</code>
*/
public boolean hasHasQuestionMark() {
public boolean hasNullability() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required bool has_question_mark = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability nullability = 3 [default = NOT_SPECIFIED];</code>
*/
public boolean getHasQuestionMark() {
return hasQuestionMark_;
public org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability getNullability() {
return nullability_;
}
/**
* <code>required bool has_question_mark = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability nullability = 3 [default = NOT_SPECIFIED];</code>
*/
public Builder setHasQuestionMark(boolean value) {
public Builder setNullability(org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
hasQuestionMark_ = value;
nullability_ = value;
return this;
}
/**
* <code>required bool has_question_mark = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability nullability = 3 [default = NOT_SPECIFIED];</code>
*/
public Builder clearHasQuestionMark() {
public Builder clearNullability() {
bitField0_ = (bitField0_ & ~0x00000004);
hasQuestionMark_ = false;
nullability_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability.NOT_SPECIFIED;
return this;
}
@@ -0,0 +1,945 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy}
*/
public final class IrSimpleTypeLegacy extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy)
IrSimpleTypeLegacyOrBuilder {
// Use IrSimpleTypeLegacy.newBuilder() to construct.
private IrSimpleTypeLegacy(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private IrSimpleTypeLegacy(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final IrSimpleTypeLegacy defaultInstance;
public static IrSimpleTypeLegacy getDefaultInstance() {
return defaultInstance;
}
public IrSimpleTypeLegacy getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private IrSimpleTypeLegacy(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
org.jetbrains.kotlin.protobuf.ByteString.Output unknownFieldsOutput =
org.jetbrains.kotlin.protobuf.ByteString.newOutput();
org.jetbrains.kotlin.protobuf.CodedOutputStream unknownFieldsCodedOutput =
org.jetbrains.kotlin.protobuf.CodedOutputStream.newInstance(
unknownFieldsOutput, 1);
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFieldsCodedOutput,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
annotation_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall>();
mutable_bitField0_ |= 0x00000001;
}
annotation_.add(input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall.PARSER, extensionRegistry));
break;
}
case 16: {
bitField0_ |= 0x00000001;
classifier_ = input.readInt64();
break;
}
case 24: {
bitField0_ |= 0x00000002;
hasQuestionMark_ = input.readBool();
break;
}
case 32: {
if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
argument_ = new java.util.ArrayList<java.lang.Long>();
mutable_bitField0_ |= 0x00000008;
}
argument_.add(input.readInt64());
break;
}
case 34: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000008) == 0x00000008) && input.getBytesUntilLimit() > 0) {
argument_ = new java.util.ArrayList<java.lang.Long>();
mutable_bitField0_ |= 0x00000008;
}
while (input.getBytesUntilLimit() > 0) {
argument_.add(input.readInt64());
}
input.popLimit(limit);
break;
}
case 42: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation.Builder subBuilder = null;
if (((bitField0_ & 0x00000004) == 0x00000004)) {
subBuilder = abbreviation_.toBuilder();
}
abbreviation_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(abbreviation_);
abbreviation_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000004;
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
annotation_ = java.util.Collections.unmodifiableList(annotation_);
}
if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
argument_ = java.util.Collections.unmodifiableList(argument_);
}
try {
unknownFieldsCodedOutput.flush();
} catch (java.io.IOException e) {
// Should not happen
} finally {
unknownFields = unknownFieldsOutput.toByteString();
}
makeExtensionsImmutable();
}
}
public static org.jetbrains.kotlin.protobuf.Parser<IrSimpleTypeLegacy> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<IrSimpleTypeLegacy>() {
public IrSimpleTypeLegacy parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new IrSimpleTypeLegacy(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<IrSimpleTypeLegacy> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int ANNOTATION_FIELD_NUMBER = 1;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall> annotation_;
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall> getAnnotationList() {
return annotation_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public java.util.List<? extends org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCallOrBuilder>
getAnnotationOrBuilderList() {
return annotation_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public int getAnnotationCount() {
return annotation_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall getAnnotation(int index) {
return annotation_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCallOrBuilder getAnnotationOrBuilder(
int index) {
return annotation_.get(index);
}
public static final int CLASSIFIER_FIELD_NUMBER = 2;
private long classifier_;
/**
* <code>required int64 classifier = 2;</code>
*/
public boolean hasClassifier() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int64 classifier = 2;</code>
*/
public long getClassifier() {
return classifier_;
}
public static final int HAS_QUESTION_MARK_FIELD_NUMBER = 3;
private boolean hasQuestionMark_;
/**
* <code>required bool has_question_mark = 3;</code>
*/
public boolean hasHasQuestionMark() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required bool has_question_mark = 3;</code>
*/
public boolean getHasQuestionMark() {
return hasQuestionMark_;
}
public static final int ARGUMENT_FIELD_NUMBER = 4;
private java.util.List<java.lang.Long> argument_;
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
public java.util.List<java.lang.Long>
getArgumentList() {
return argument_;
}
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
public int getArgumentCount() {
return argument_.size();
}
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
public long getArgument(int index) {
return argument_.get(index);
}
private int argumentMemoizedSerializedSize = -1;
public static final int ABBREVIATION_FIELD_NUMBER = 5;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation abbreviation_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation abbreviation = 5;</code>
*/
public boolean hasAbbreviation() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation abbreviation = 5;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation getAbbreviation() {
return abbreviation_;
}
private void initFields() {
annotation_ = java.util.Collections.emptyList();
classifier_ = 0L;
hasQuestionMark_ = false;
argument_ = java.util.Collections.emptyList();
abbreviation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasClassifier()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasHasQuestionMark()) {
memoizedIsInitialized = 0;
return false;
}
for (int i = 0; i < getAnnotationCount(); i++) {
if (!getAnnotation(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasAbbreviation()) {
if (!getAbbreviation().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < annotation_.size(); i++) {
output.writeMessage(1, annotation_.get(i));
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt64(2, classifier_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBool(3, hasQuestionMark_);
}
if (getArgumentList().size() > 0) {
output.writeRawVarint32(34);
output.writeRawVarint32(argumentMemoizedSerializedSize);
}
for (int i = 0; i < argument_.size(); i++) {
output.writeInt64NoTag(argument_.get(i));
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeMessage(5, abbreviation_);
}
output.writeRawBytes(unknownFields);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < annotation_.size(); i++) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(1, annotation_.get(i));
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt64Size(2, classifier_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(3, hasQuestionMark_);
}
{
int dataSize = 0;
for (int i = 0; i < argument_.size(); i++) {
dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt64SizeNoTag(argument_.get(i));
}
size += dataSize;
if (!getArgumentList().isEmpty()) {
size += 1;
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
argumentMemoizedSerializedSize = dataSize;
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(5, abbreviation_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy parseFrom(
byte[] data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy parseFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy parseDelimitedFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy)
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacyOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
annotation_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
classifier_ = 0L;
bitField0_ = (bitField0_ & ~0x00000002);
hasQuestionMark_ = false;
bitField0_ = (bitField0_ & ~0x00000004);
argument_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000008);
abbreviation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000010);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy build() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy result = new org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
annotation_ = java.util.Collections.unmodifiableList(annotation_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.annotation_ = annotation_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000001;
}
result.classifier_ = classifier_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000002;
}
result.hasQuestionMark_ = hasQuestionMark_;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
argument_ = java.util.Collections.unmodifiableList(argument_);
bitField0_ = (bitField0_ & ~0x00000008);
}
result.argument_ = argument_;
if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
to_bitField0_ |= 0x00000004;
}
result.abbreviation_ = abbreviation_;
result.bitField0_ = to_bitField0_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy.getDefaultInstance()) return this;
if (!other.annotation_.isEmpty()) {
if (annotation_.isEmpty()) {
annotation_ = other.annotation_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureAnnotationIsMutable();
annotation_.addAll(other.annotation_);
}
}
if (other.hasClassifier()) {
setClassifier(other.getClassifier());
}
if (other.hasHasQuestionMark()) {
setHasQuestionMark(other.getHasQuestionMark());
}
if (!other.argument_.isEmpty()) {
if (argument_.isEmpty()) {
argument_ = other.argument_;
bitField0_ = (bitField0_ & ~0x00000008);
} else {
ensureArgumentIsMutable();
argument_.addAll(other.argument_);
}
}
if (other.hasAbbreviation()) {
mergeAbbreviation(other.getAbbreviation());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
}
public final boolean isInitialized() {
if (!hasClassifier()) {
return false;
}
if (!hasHasQuestionMark()) {
return false;
}
for (int i = 0; i < getAnnotationCount(); i++) {
if (!getAnnotation(i).isInitialized()) {
return false;
}
}
if (hasAbbreviation()) {
if (!getAbbreviation().isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall> annotation_ =
java.util.Collections.emptyList();
private void ensureAnnotationIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
annotation_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall>(annotation_);
bitField0_ |= 0x00000001;
}
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall> getAnnotationList() {
return java.util.Collections.unmodifiableList(annotation_);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public int getAnnotationCount() {
return annotation_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall getAnnotation(int index) {
return annotation_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public Builder setAnnotation(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall value) {
if (value == null) {
throw new NullPointerException();
}
ensureAnnotationIsMutable();
annotation_.set(index, value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public Builder setAnnotation(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall.Builder builderForValue) {
ensureAnnotationIsMutable();
annotation_.set(index, builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public Builder addAnnotation(org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall value) {
if (value == null) {
throw new NullPointerException();
}
ensureAnnotationIsMutable();
annotation_.add(value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public Builder addAnnotation(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall value) {
if (value == null) {
throw new NullPointerException();
}
ensureAnnotationIsMutable();
annotation_.add(index, value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public Builder addAnnotation(
org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall.Builder builderForValue) {
ensureAnnotationIsMutable();
annotation_.add(builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public Builder addAnnotation(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall.Builder builderForValue) {
ensureAnnotationIsMutable();
annotation_.add(index, builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public Builder addAllAnnotation(
java.lang.Iterable<? extends org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall> values) {
ensureAnnotationIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, annotation_);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public Builder clearAnnotation() {
annotation_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
public Builder removeAnnotation(int index) {
ensureAnnotationIsMutable();
annotation_.remove(index);
return this;
}
private long classifier_ ;
/**
* <code>required int64 classifier = 2;</code>
*/
public boolean hasClassifier() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int64 classifier = 2;</code>
*/
public long getClassifier() {
return classifier_;
}
/**
* <code>required int64 classifier = 2;</code>
*/
public Builder setClassifier(long value) {
bitField0_ |= 0x00000002;
classifier_ = value;
return this;
}
/**
* <code>required int64 classifier = 2;</code>
*/
public Builder clearClassifier() {
bitField0_ = (bitField0_ & ~0x00000002);
classifier_ = 0L;
return this;
}
private boolean hasQuestionMark_ ;
/**
* <code>required bool has_question_mark = 3;</code>
*/
public boolean hasHasQuestionMark() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required bool has_question_mark = 3;</code>
*/
public boolean getHasQuestionMark() {
return hasQuestionMark_;
}
/**
* <code>required bool has_question_mark = 3;</code>
*/
public Builder setHasQuestionMark(boolean value) {
bitField0_ |= 0x00000004;
hasQuestionMark_ = value;
return this;
}
/**
* <code>required bool has_question_mark = 3;</code>
*/
public Builder clearHasQuestionMark() {
bitField0_ = (bitField0_ & ~0x00000004);
hasQuestionMark_ = false;
return this;
}
private java.util.List<java.lang.Long> argument_ = java.util.Collections.emptyList();
private void ensureArgumentIsMutable() {
if (!((bitField0_ & 0x00000008) == 0x00000008)) {
argument_ = new java.util.ArrayList<java.lang.Long>(argument_);
bitField0_ |= 0x00000008;
}
}
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
public java.util.List<java.lang.Long>
getArgumentList() {
return java.util.Collections.unmodifiableList(argument_);
}
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
public int getArgumentCount() {
return argument_.size();
}
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
public long getArgument(int index) {
return argument_.get(index);
}
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
public Builder setArgument(
int index, long value) {
ensureArgumentIsMutable();
argument_.set(index, value);
return this;
}
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
public Builder addArgument(long value) {
ensureArgumentIsMutable();
argument_.add(value);
return this;
}
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
public Builder addAllArgument(
java.lang.Iterable<? extends java.lang.Long> values) {
ensureArgumentIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, argument_);
return this;
}
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
public Builder clearArgument() {
argument_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation abbreviation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation.getDefaultInstance();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation abbreviation = 5;</code>
*/
public boolean hasAbbreviation() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation abbreviation = 5;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation getAbbreviation() {
return abbreviation_;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation abbreviation = 5;</code>
*/
public Builder setAbbreviation(org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation value) {
if (value == null) {
throw new NullPointerException();
}
abbreviation_ = value;
bitField0_ |= 0x00000010;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation abbreviation = 5;</code>
*/
public Builder setAbbreviation(
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation.Builder builderForValue) {
abbreviation_ = builderForValue.build();
bitField0_ |= 0x00000010;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation abbreviation = 5;</code>
*/
public Builder mergeAbbreviation(org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation value) {
if (((bitField0_ & 0x00000010) == 0x00000010) &&
abbreviation_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation.getDefaultInstance()) {
abbreviation_ =
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation.newBuilder(abbreviation_).mergeFrom(value).buildPartial();
} else {
abbreviation_ = value;
}
bitField0_ |= 0x00000010;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation abbreviation = 5;</code>
*/
public Builder clearAbbreviation() {
abbreviation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000010);
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy)
}
static {
defaultInstance = new IrSimpleTypeLegacy(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy)
}
@@ -0,0 +1,75 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface IrSimpleTypeLegacyOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall>
getAnnotationList();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall getAnnotation(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 1;</code>
*/
int getAnnotationCount();
/**
* <code>required int64 classifier = 2;</code>
*/
boolean hasClassifier();
/**
* <code>required int64 classifier = 2;</code>
*/
long getClassifier();
/**
* <code>required bool has_question_mark = 3;</code>
*/
boolean hasHasQuestionMark();
/**
* <code>required bool has_question_mark = 3;</code>
*/
boolean getHasQuestionMark();
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
java.util.List<java.lang.Long> getArgumentList();
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
int getArgumentCount();
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
*
* <pre>
* 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
* </pre>
*/
long getArgument(int index);
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation abbreviation = 5;</code>
*/
boolean hasAbbreviation();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation abbreviation = 5;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation getAbbreviation();
}
@@ -0,0 +1,69 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf enum {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability}
*/
public enum IrSimpleTypeNullability
implements org.jetbrains.kotlin.protobuf.Internal.EnumLite {
/**
* <code>MARKED_NULLABLE = 0;</code>
*/
MARKED_NULLABLE(0, 0),
/**
* <code>NOT_SPECIFIED = 1;</code>
*/
NOT_SPECIFIED(1, 1),
/**
* <code>DEFINITELY_NOT_NULL = 2;</code>
*/
DEFINITELY_NOT_NULL(2, 2),
;
/**
* <code>MARKED_NULLABLE = 0;</code>
*/
public static final int MARKED_NULLABLE_VALUE = 0;
/**
* <code>NOT_SPECIFIED = 1;</code>
*/
public static final int NOT_SPECIFIED_VALUE = 1;
/**
* <code>DEFINITELY_NOT_NULL = 2;</code>
*/
public static final int DEFINITELY_NOT_NULL_VALUE = 2;
public final int getNumber() { return value; }
public static IrSimpleTypeNullability valueOf(int value) {
switch (value) {
case 0: return MARKED_NULLABLE;
case 1: return NOT_SPECIFIED;
case 2: return DEFINITELY_NOT_NULL;
default: return null;
}
}
public static org.jetbrains.kotlin.protobuf.Internal.EnumLiteMap<IrSimpleTypeNullability>
internalGetValueMap() {
return internalValueMap;
}
private static org.jetbrains.kotlin.protobuf.Internal.EnumLiteMap<IrSimpleTypeNullability>
internalValueMap =
new org.jetbrains.kotlin.protobuf.Internal.EnumLiteMap<IrSimpleTypeNullability>() {
public IrSimpleTypeNullability findValueByNumber(int number) {
return IrSimpleTypeNullability.valueOf(number);
}
};
private final int value;
private IrSimpleTypeNullability(int index, int value) {
this.value = value;
}
// @@protoc_insertion_point(enum_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability)
}
@@ -31,13 +31,13 @@ public interface IrSimpleTypeOrBuilder extends
long getClassifier();
/**
* <code>required bool has_question_mark = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability nullability = 3 [default = NOT_SPECIFIED];</code>
*/
boolean hasHasQuestionMark();
boolean hasNullability();
/**
* <code>required bool has_question_mark = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability nullability = 3 [default = NOT_SPECIFIED];</code>
*/
boolean getHasQuestionMark();
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeNullability getNullability();
/**
* <code>repeated int64 argument = 4 [packed = true];</code>
@@ -54,13 +54,13 @@ public final class IrType extends
break;
}
case 10: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.Builder subBuilder = null;
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy.Builder subBuilder = null;
if (kindCase_ == 1) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_).toBuilder();
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy) kind_).toBuilder();
}
kind_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.PARSER, extensionRegistry);
kind_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_);
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy) kind_);
kind_ = subBuilder.buildPartial();
}
kindCase_ = 1;
@@ -105,6 +105,19 @@ public final class IrType extends
kindCase_ = 4;
break;
}
case 42: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.Builder subBuilder = null;
if (kindCase_ == 5) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_).toBuilder();
}
kind_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_);
kind_ = subBuilder.buildPartial();
}
kindCase_ = 5;
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -143,10 +156,11 @@ public final class IrType extends
private java.lang.Object kind_;
public enum KindCase
implements org.jetbrains.kotlin.protobuf.Internal.EnumLite {
SIMPLE(1),
LEGACYSIMPLE(1),
DYNAMIC(2),
ERROR(3),
DNN(4),
SIMPLE(5),
KIND_NOT_SET(0);
private int value = 0;
private KindCase(int value) {
@@ -154,10 +168,11 @@ public final class IrType extends
}
public static KindCase valueOf(int value) {
switch (value) {
case 1: return SIMPLE;
case 1: return LEGACYSIMPLE;
case 2: return DYNAMIC;
case 3: return ERROR;
case 4: return DNN;
case 5: return SIMPLE;
case 0: return KIND_NOT_SET;
default: throw new java.lang.IllegalArgumentException(
"Value is undefined for this oneof enum.");
@@ -174,21 +189,21 @@ public final class IrType extends
kindCase_);
}
public static final int SIMPLE_FIELD_NUMBER = 1;
public static final int LEGACYSIMPLE_FIELD_NUMBER = 1;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 1;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy legacySimple = 1;</code>
*/
public boolean hasSimple() {
public boolean hasLegacySimple() {
return kindCase_ == 1;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 1;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy legacySimple = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType getSimple() {
public org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy getLegacySimple() {
if (kindCase_ == 1) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_;
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy) kind_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.getDefaultInstance();
return org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy.getDefaultInstance();
}
public static final int DYNAMIC_FIELD_NUMBER = 2;
@@ -242,6 +257,23 @@ public final class IrType extends
return org.jetbrains.kotlin.backend.common.serialization.proto.IrDefinitelyNotNullType.getDefaultInstance();
}
public static final int SIMPLE_FIELD_NUMBER = 5;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 5;</code>
*/
public boolean hasSimple() {
return kindCase_ == 5;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 5;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType getSimple() {
if (kindCase_ == 5) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.getDefaultInstance();
}
private void initFields() {
}
private byte memoizedIsInitialized = -1;
@@ -250,8 +282,8 @@ public final class IrType extends
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (hasSimple()) {
if (!getSimple().isInitialized()) {
if (hasLegacySimple()) {
if (!getLegacySimple().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
@@ -268,6 +300,12 @@ public final class IrType extends
return false;
}
}
if (hasSimple()) {
if (!getSimple().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
@@ -276,7 +314,7 @@ public final class IrType extends
throws java.io.IOException {
getSerializedSize();
if (kindCase_ == 1) {
output.writeMessage(1, (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_);
output.writeMessage(1, (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy) kind_);
}
if (kindCase_ == 2) {
output.writeMessage(2, (org.jetbrains.kotlin.backend.common.serialization.proto.IrDynamicType) kind_);
@@ -287,6 +325,9 @@ public final class IrType extends
if (kindCase_ == 4) {
output.writeMessage(4, (org.jetbrains.kotlin.backend.common.serialization.proto.IrDefinitelyNotNullType) kind_);
}
if (kindCase_ == 5) {
output.writeMessage(5, (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_);
}
output.writeRawBytes(unknownFields);
}
@@ -298,7 +339,7 @@ public final class IrType extends
size = 0;
if (kindCase_ == 1) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(1, (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_);
.computeMessageSize(1, (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy) kind_);
}
if (kindCase_ == 2) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -312,6 +353,10 @@ public final class IrType extends
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(4, (org.jetbrains.kotlin.backend.common.serialization.proto.IrDefinitelyNotNullType) kind_);
}
if (kindCase_ == 5) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(5, (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
@@ -443,6 +488,9 @@ public final class IrType extends
if (kindCase_ == 4) {
result.kind_ = kind_;
}
if (kindCase_ == 5) {
result.kind_ = kind_;
}
result.bitField0_ = to_bitField0_;
result.kindCase_ = kindCase_;
return result;
@@ -451,8 +499,8 @@ public final class IrType extends
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.IrType other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.IrType.getDefaultInstance()) return this;
switch (other.getKindCase()) {
case SIMPLE: {
mergeSimple(other.getSimple());
case LEGACYSIMPLE: {
mergeLegacySimple(other.getLegacySimple());
break;
}
case DYNAMIC: {
@@ -467,6 +515,10 @@ public final class IrType extends
mergeDnn(other.getDnn());
break;
}
case SIMPLE: {
mergeSimple(other.getSimple());
break;
}
case KIND_NOT_SET: {
break;
}
@@ -477,8 +529,8 @@ public final class IrType extends
}
public final boolean isInitialized() {
if (hasSimple()) {
if (!getSimple().isInitialized()) {
if (hasLegacySimple()) {
if (!getLegacySimple().isInitialized()) {
return false;
}
@@ -495,6 +547,12 @@ public final class IrType extends
return false;
}
}
if (hasSimple()) {
if (!getSimple().isInitialized()) {
return false;
}
}
return true;
}
@@ -532,24 +590,24 @@ public final class IrType extends
private int bitField0_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 1;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy legacySimple = 1;</code>
*/
public boolean hasSimple() {
public boolean hasLegacySimple() {
return kindCase_ == 1;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 1;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy legacySimple = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType getSimple() {
public org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy getLegacySimple() {
if (kindCase_ == 1) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_;
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy) kind_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.getDefaultInstance();
return org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 1;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy legacySimple = 1;</code>
*/
public Builder setSimple(org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType value) {
public Builder setLegacySimple(org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy value) {
if (value == null) {
throw new NullPointerException();
}
@@ -559,22 +617,22 @@ public final class IrType extends
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 1;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy legacySimple = 1;</code>
*/
public Builder setSimple(
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.Builder builderForValue) {
public Builder setLegacySimple(
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy.Builder builderForValue) {
kind_ = builderForValue.build();
kindCase_ = 1;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 1;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy legacySimple = 1;</code>
*/
public Builder mergeSimple(org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType value) {
public Builder mergeLegacySimple(org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy value) {
if (kindCase_ == 1 &&
kind_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.getDefaultInstance()) {
kind_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_)
kind_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy.getDefaultInstance()) {
kind_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy) kind_)
.mergeFrom(value).buildPartial();
} else {
kind_ = value;
@@ -584,9 +642,9 @@ public final class IrType extends
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 1;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy legacySimple = 1;</code>
*/
public Builder clearSimple() {
public Builder clearLegacySimple() {
if (kindCase_ == 1) {
kindCase_ = 0;
kind_ = null;
@@ -787,6 +845,70 @@ public final class IrType extends
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 5;</code>
*/
public boolean hasSimple() {
return kindCase_ == 5;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 5;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType getSimple() {
if (kindCase_ == 5) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 5;</code>
*/
public Builder setSimple(org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType value) {
if (value == null) {
throw new NullPointerException();
}
kind_ = value;
kindCase_ = 5;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 5;</code>
*/
public Builder setSimple(
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.Builder builderForValue) {
kind_ = builderForValue.build();
kindCase_ = 5;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 5;</code>
*/
public Builder mergeSimple(org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType value) {
if (kindCase_ == 5 &&
kind_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.getDefaultInstance()) {
kind_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType) kind_)
.mergeFrom(value).buildPartial();
} else {
kind_ = value;
}
kindCase_ = 5;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 5;</code>
*/
public Builder clearSimple() {
if (kindCase_ == 5) {
kindCase_ = 0;
kind_ = null;
}
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrType)
}
@@ -8,13 +8,13 @@ public interface IrTypeOrBuilder extends
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 1;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy legacySimple = 1;</code>
*/
boolean hasSimple();
boolean hasLegacySimple();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 1;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy legacySimple = 1;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType getSimple();
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleTypeLegacy getLegacySimple();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrDynamicType dynamic = 2;</code>
@@ -42,4 +42,13 @@ public interface IrTypeOrBuilder extends
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrDefinitelyNotNullType dnn = 4;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrDefinitelyNotNullType getDnn();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 5;</code>
*/
boolean hasSimple();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType simple = 5;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType getSimple();
}
@@ -42,7 +42,7 @@ FILE fqName:foo fileName:/main.kt
$this: VALUE_PARAMETER name:<this> type:foo.Derived
BLOCK_BODY
CALL 'public open fun set (p0: @[FlexibleNullability] kotlin.Any?, p1: @[FlexibleNullability] kotlin.Any?): kotlin.Unit [operator] declared in java.lang.reflect.Field' type=kotlin.Unit origin=null
$this: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=java.lang.reflect.Field origin=EXCLEXCL
$this: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=java.lang.reflect.Field origin=EXCLEXCL
<T0>: java.lang.reflect.Field
arg0: CALL 'public final fun <get-javaField> (): java.lang.reflect.Field? declared in kotlin.reflect.jvm.ReflectJvmMapping' type=java.lang.reflect.Field? origin=GET_PROPERTY
$receiver: PROPERTY_REFERENCE 'protected/*protected and package*/ open a: @[FlexibleNullability] foo.A? [var]' field='FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:a type:@[FlexibleNullability] foo.A? visibility:protected/*protected and package*/' getter='protected/*protected and package*/ open fun <get-a> (): @[FlexibleNullability] foo.A? declared in foo.Derived' setter='protected/*protected and package*/ open fun <set-a> (<set-?>: @[FlexibleNullability] foo.A?): kotlin.Unit declared in foo.Derived' type=kotlin.reflect.KMutableProperty1<foo.Derived, @[FlexibleNullability] foo.A?> origin=null
@@ -42,7 +42,7 @@ FILE fqName:foo fileName:/main.kt
$this: VALUE_PARAMETER name:<this> type:foo.Derived
BLOCK_BODY
CALL 'public open fun set (p0: @[FlexibleNullability] kotlin.Any?, p1: @[FlexibleNullability] kotlin.Any?): kotlin.Unit [operator] declared in java.lang.reflect.Field' type=kotlin.Unit origin=EQ
$this: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=java.lang.reflect.Field origin=EXCLEXCL
$this: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=java.lang.reflect.Field origin=EXCLEXCL
<T0>: java.lang.reflect.Field
arg0: CALL 'public final fun <get-javaField> (): java.lang.reflect.Field? declared in kotlin.reflect.jvm.ReflectJvmMapping' type=java.lang.reflect.Field? origin=GET_PROPERTY
$receiver: PROPERTY_REFERENCE 'protected/*protected and package*/ final a [fake_override,var]' field='FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:a type:@[FlexibleNullability] foo.A? visibility:protected/*protected and package*/' getter=null setter=null type=kotlin.reflect.KMutableProperty1<foo.Derived, @[FlexibleNullability] foo.A?> origin=null
@@ -3,6 +3,6 @@ FILE fqName:<root> fileName:/dynamicExclExclOperator.kt
VALUE_PARAMETER name:d index:0 type:dynamic
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (d: dynamic): dynamic declared in <root>'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=dynamic origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=dynamic origin=EXCLEXCL
<T0>: dynamic
arg0: GET_VAR 'd: dynamic declared in <root>.test' type=dynamic origin=null
@@ -78,4 +78,3 @@ value class TestInline {
}
}
@@ -29,4 +29,3 @@ value class Test {
}
}
@@ -58,4 +58,3 @@ fun box(): String {
}
return "OK"
}
@@ -97,4 +97,3 @@ fun test() {
}
)
}
@@ -106,4 +106,3 @@ value class InlineMutableSet : MutableSet<IT> {
}
}
@@ -3,14 +3,14 @@ FILE fqName:<root> fileName:/bangbang.kt
VALUE_PARAMETER name:a index:0 type:kotlin.Any?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test1 (a: kotlin.Any?): kotlin.Any declared in <root>'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Any origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Any origin=EXCLEXCL
<T0>: kotlin.Any
arg0: GET_VAR 'a: kotlin.Any? declared in <root>.test1' type=kotlin.Any? origin=null
FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Any?) returnType:kotlin.Int
VALUE_PARAMETER name:a index:0 type:kotlin.Any?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test2 (a: kotlin.Any?): kotlin.Int declared in <root>'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Int origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Int origin=EXCLEXCL
<T0>: kotlin.Int
arg0: BLOCK type=kotlin.Int? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Any? [val]
@@ -30,8 +30,8 @@ FILE fqName:<root> fileName:/bangbang.kt
VALUE_PARAMETER name:a index:0 type:X of <root>.test3
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test3 <X> (a: X of <root>.test3): {X of <root>.test3 & Any} declared in <root>'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type={X of <root>.test3 & Any} origin=EXCLEXCL
<T0>: X of <root>.test3
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type={X of <root>.test3 & Any} origin=EXCLEXCL
<T0>: {X of <root>.test3 & Any}
arg0: GET_VAR 'a: X of <root>.test3 declared in <root>.test3' type=X of <root>.test3 origin=null
FUN name:useString visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit
VALUE_PARAMETER name:s index:0 type:kotlin.String
@@ -45,7 +45,7 @@ FILE fqName:<root> fileName:/bangbang.kt
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String?
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=X of <root>.test4 origin=null
then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
<T0>: kotlin.String
arg0: TYPE_OP type=kotlin.String? origin=IMPLICIT_CAST typeOperand=kotlin.String?
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=X of <root>.test4 origin=null
@@ -54,7 +54,7 @@ FILE fqName:<root> fileName:/bangbang.kt
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String?
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=X of <root>.test4 origin=null
then: CALL 'public final fun useString (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
s: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
s: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
<T0>: kotlin.String
arg0: TYPE_OP type=kotlin.String? origin=IMPLICIT_CAST typeOperand=kotlin.String?
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=X of <root>.test4 origin=null
@@ -13,7 +13,7 @@ fun test2(a: Any?): Int {
}
fun <X : Any?> test3(a: X): (X & Any) {
return CHECK_NOT_NULL<X>(arg0 = a)
return CHECK_NOT_NULL<(X & Any)>(arg0 = a)
}
fun useString(s: String) {
@@ -27,4 +27,3 @@ fun <X : Any?> test4(a: X) {
a is String? -> useString(s = CHECK_NOT_NULL<String>(arg0 = a /*as String? */))
}
}
+5 -5
View File
@@ -3,14 +3,14 @@ FILE fqName:<root> fileName:/bangbang.kt
VALUE_PARAMETER name:a index:0 type:kotlin.Any?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test1 (a: kotlin.Any?): kotlin.Any declared in <root>'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Any origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Any origin=EXCLEXCL
<T0>: kotlin.Any
arg0: GET_VAR 'a: kotlin.Any? declared in <root>.test1' type=kotlin.Any? origin=null
FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Any?) returnType:kotlin.Int
VALUE_PARAMETER name:a index:0 type:kotlin.Any?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test2 (a: kotlin.Any?): kotlin.Int declared in <root>'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Int origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Int origin=EXCLEXCL
<T0>: kotlin.Int
arg0: BLOCK type=kotlin.Int? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Any? [val]
@@ -30,7 +30,7 @@ FILE fqName:<root> fileName:/bangbang.kt
VALUE_PARAMETER name:a index:0 type:X of <root>.test3
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test3 <X> (a: X of <root>.test3): {X of <root>.test3 & Any} declared in <root>'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=X of <root>.test3 origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=X of <root>.test3 origin=EXCLEXCL
<T0>: X of <root>.test3
arg0: GET_VAR 'a: X of <root>.test3 declared in <root>.test3' type=X of <root>.test3 origin=null
FUN name:useString visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit
@@ -45,7 +45,7 @@ FILE fqName:<root> fileName:/bangbang.kt
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String?
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=X of <root>.test4 origin=null
then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=X of <root>.test4 origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=X of <root>.test4 origin=EXCLEXCL
<T0>: X of <root>.test4
arg0: GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=X of <root>.test4 origin=null
WHEN type=kotlin.Unit origin=IF
@@ -54,6 +54,6 @@ FILE fqName:<root> fileName:/bangbang.kt
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=X of <root>.test4 origin=null
then: CALL 'public final fun useString (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
s: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=X of <root>.test4 origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=X of <root>.test4 origin=EXCLEXCL
<T0>: X of <root>.test4
arg0: GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=X of <root>.test4 origin=null
@@ -27,4 +27,3 @@ fun <X : Any?> test4(a: X) {
a is String? -> useString(s = CHECK_NOT_NULL<X>(arg0 = a) /*as String */)
}
}
@@ -5,14 +5,14 @@ FILE fqName:<root> fileName:/exclExclOnPlatformType.kt
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun use (a: kotlin.Any): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
a: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
a: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
<T0>: kotlin.String
arg0: CALL 'public open fun get (): T of java.lang.ref.WeakReference? [fake_override,operator] declared in java.lang.ref.WeakReference' type=kotlin.String? origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> (p0: @[FlexibleNullability] T of java.lang.ref.WeakReference?) declared in java.lang.ref.WeakReference' type=java.lang.ref.WeakReference<@[FlexibleNullability] kotlin.String?> origin=null
<class: T>: @[FlexibleNullability] kotlin.String?
p0: CONST String type=kotlin.String value=""
CALL 'public final fun use (a: kotlin.Any): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
a: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
a: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
<T0>: @[FlexibleNullability] kotlin.String
arg0: CALL 'public open fun getProperty (p0: @[FlexibleNullability] kotlin.String?): @[FlexibleNullability] kotlin.String? declared in java.lang.System' type=@[FlexibleNullability] kotlin.String? origin=null
p0: CONST String type=kotlin.String value="abc"
@@ -5,14 +5,14 @@ FILE fqName:<root> fileName:/exclExclOnPlatformType.kt
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun use (a: kotlin.Any): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
a: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
a: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
<T0>: kotlin.String
arg0: CALL 'public open fun get (): @[EnhancedNullability] T of java.lang.ref.WeakReference? [fake_override] declared in java.lang.ref.WeakReference' type=@[EnhancedNullability] kotlin.String? origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> (p0: @[FlexibleNullability] T of java.lang.ref.WeakReference?) declared in java.lang.ref.WeakReference' type=java.lang.ref.WeakReference<@[FlexibleNullability] kotlin.String?> origin=null
<class: T>: @[FlexibleNullability] kotlin.String?
p0: CONST String type=kotlin.String value=""
CALL 'public final fun use (a: kotlin.Any): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
a: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
a: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
<T0>: kotlin.String
arg0: CALL 'public open fun getProperty (p0: @[FlexibleNullability] kotlin.String?): @[FlexibleNullability] kotlin.String? declared in java.lang.System' type=@[FlexibleNullability] kotlin.String? origin=null
p0: CONST String type=kotlin.String value="abc"
@@ -5,4 +5,3 @@ fun test() {
use(a = CHECK_NOT_NULL<String>(arg0 = WeakReference<@FlexibleNullability String?>(p0 = "").get()))
use(a = CHECK_NOT_NULL<String>(arg0 = getProperty(p0 = "abc")))
}
@@ -9,7 +9,7 @@ FILE fqName:<root> fileName:/eqeqRhsConditionPossiblyAffectingLhs.kt
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double
GET_VAR 'x: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
then: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Nothing origin=EXCLEXCL
then: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Nothing origin=EXCLEXCL
<T0>: kotlin.Nothing
arg0: CONST Null type=kotlin.Nothing? value=null
BRANCH
@@ -65,7 +65,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.Function0<kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1' type=kotlin.reflect.KFunction1<kotlin.Function0<kotlin.Unit>, <root>.KRunnable> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -78,7 +78,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1a'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.Function0<kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1a.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1a' type=kotlin.reflect.KFunction1<kotlin.Function0<kotlin.Unit>, <root>.KRunnable> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -91,7 +91,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1b'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.Function0<kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1b.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1b' type=kotlin.reflect.KFunction1<kotlin.Function0<kotlin.Unit>, <root>.KRunnable> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -104,7 +104,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2'
TYPE_OP type=<root>.KSupplier<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KSupplier<kotlin.String>
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.String> origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.String> origin=EXCLEXCL
<T0>: kotlin.Function0<kotlin.String>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.String> declared in <root>.test2.KSupplier' type=kotlin.Function0<kotlin.String> origin=null
FUNCTION_REFERENCE 'local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2' type=kotlin.reflect.KFunction1<kotlin.Function0<kotlin.String>, <root>.KSupplier<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -117,7 +117,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2a'
TYPE_OP type=<root>.KSupplier<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KSupplier<kotlin.String>
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.String> origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.String> origin=EXCLEXCL
<T0>: kotlin.Function0<kotlin.String>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.String> declared in <root>.test2a.KSupplier' type=kotlin.Function0<kotlin.String> origin=null
FUNCTION_REFERENCE 'local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2a' type=kotlin.reflect.KFunction1<kotlin.Function0<kotlin.String>, <root>.KSupplier<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -130,7 +130,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3'
TYPE_OP type=<root>.KConsumer<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KConsumer<kotlin.String>
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.Function1<kotlin.String, kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function1<kotlin.String, kotlin.Unit> declared in <root>.test3.KConsumer' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3' type=kotlin.reflect.KFunction1<kotlin.Function1<kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -143,7 +143,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3a'
TYPE_OP type=<root>.KConsumer<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KConsumer<kotlin.String>
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.Function1<kotlin.String, kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function1<kotlin.String, kotlin.Unit> declared in <root>.test3a.KConsumer' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3a' type=kotlin.reflect.KFunction1<kotlin.Function1<kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -156,7 +156,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3b'
TYPE_OP type=<root>.KConsumer<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KConsumer<kotlin.String>
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.Function1<kotlin.String, kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function1<kotlin.String, kotlin.Unit> declared in <root>.test3b.KConsumer' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3b' type=kotlin.reflect.KFunction1<kotlin.Function1<kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -65,7 +65,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=null
<T0>: kotlin.Function0<kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function0<kotlin.Unit>, <root>.KRunnable> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -78,7 +78,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1a'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=null
<T0>: kotlin.Function0<kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1a.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1a' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function0<kotlin.Unit>, <root>.KRunnable> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -91,7 +91,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1b'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=null
<T0>: kotlin.Function0<kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1b.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1b' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function0<kotlin.Unit>, <root>.KRunnable> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -104,7 +104,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2'
TYPE_OP type=<root>.KSupplier<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KSupplier<kotlin.String>
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.String> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.String> origin=null
<T0>: kotlin.Function0<kotlin.String>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.String> declared in <root>.test2.KSupplier' type=kotlin.Function0<kotlin.String> origin=null
FUNCTION_REFERENCE 'local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function0<kotlin.String>, <root>.KSupplier<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -117,7 +117,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2a'
TYPE_OP type=<root>.KSupplier<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KSupplier<kotlin.String>
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.String> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.String> origin=null
<T0>: kotlin.Function0<kotlin.String>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.String> declared in <root>.test2a.KSupplier' type=kotlin.Function0<kotlin.String> origin=null
FUNCTION_REFERENCE 'local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2a' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function0<kotlin.String>, <root>.KSupplier<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -130,7 +130,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3'
TYPE_OP type=<root>.KConsumer<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KConsumer<kotlin.String>
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
<T0>: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> declared in <root>.test3.KConsumer' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -143,7 +143,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3a'
TYPE_OP type=<root>.KConsumer<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KConsumer<kotlin.String>
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
<T0>: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> declared in <root>.test3a.KConsumer' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3a' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -156,7 +156,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3b'
TYPE_OP type=<root>.KConsumer<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KConsumer<kotlin.String>
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
<T0>: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> declared in <root>.test3b.KConsumer' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3b' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -95,4 +95,3 @@ fun test3b(): KFunction<KConsumer<String>> {
::KConsumer
}
}
@@ -31,4 +31,3 @@ fun <T : S?, S : Any?> test5(x: T, fn: Function1<S, Unit>) {
EQEQ(arg0 = x, arg1 = null).not() -> fn.invoke(p1 = x)
}
}
+2 -2
View File
@@ -48,7 +48,7 @@ FILE fqName:<root> fileName:/kt30020.kt
element: CONST Int type=kotlin.Int value=4
CALL 'public final fun plusAssign <T> (element: T of kotlin.collections.CollectionsKt.plusAssign): kotlin.Unit [inline,operator] declared in kotlin.collections.CollectionsKt' type=kotlin.Unit origin=null
<T>: kotlin.Int
$receiver: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
$receiver: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
<T0>: kotlin.collections.MutableList<kotlin.Any>
arg0: BLOCK type=kotlin.collections.MutableList<kotlin.Any>? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.X? [val]
@@ -66,7 +66,7 @@ FILE fqName:<root> fileName:/kt30020.kt
element: CONST Int type=kotlin.Int value=5
CALL 'public final fun plusAssign <T> (element: T of kotlin.collections.CollectionsKt.plusAssign): kotlin.Unit [inline,operator] declared in kotlin.collections.CollectionsKt' type=kotlin.Unit origin=null
<T>: kotlin.Int
$receiver: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
$receiver: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
<T0>: kotlin.collections.MutableList<kotlin.Any>
arg0: BLOCK type=kotlin.collections.MutableList<kotlin.Any>? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:<root>.X? [val]
+2 -2
View File
@@ -51,7 +51,7 @@ FILE fqName:<root> fileName:/kt30020.kt
element: CONST Int type=kotlin.Int value=4
CALL 'public final fun plusAssign <T> (element: T of kotlin.collections.CollectionsKt.plusAssign): kotlin.Unit [inline,operator] declared in kotlin.collections.CollectionsKt' type=kotlin.Unit origin=PLUSEQ
<T>: kotlin.Int
$receiver: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
$receiver: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
<T0>: kotlin.collections.MutableList<kotlin.Any>
arg0: BLOCK type=kotlin.collections.MutableList<kotlin.Any>? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:<root>.X? [val]
@@ -69,7 +69,7 @@ FILE fqName:<root> fileName:/kt30020.kt
element: CONST Int type=kotlin.Int value=5
CALL 'public final fun plusAssign <T> (element: T of kotlin.collections.CollectionsKt.plusAssign): kotlin.Unit [inline,operator] declared in kotlin.collections.CollectionsKt' type=kotlin.Unit origin=PLUSEQ
<T>: kotlin.Int
$receiver: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
$receiver: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
<T0>: kotlin.collections.MutableList<kotlin.Any>
arg0: BLOCK type=kotlin.collections.MutableList<kotlin.Any>? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:<root>.X? [val]
+1 -1
View File
@@ -4,6 +4,6 @@ FILE fqName:<root> fileName:/kt36963.kt
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction0<kotlin.Unit>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (): kotlin.reflect.KFunction0<kotlin.Unit> declared in <root>'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.reflect.KFunction0<kotlin.Unit>
arg0: FUNCTION_REFERENCE 'public final fun foo (): kotlin.Unit declared in <root>' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null reflectionTarget=<same>
+1 -1
View File
@@ -3,7 +3,7 @@ FILE fqName:<root> fileName:/kt44993.kt
VALUE_PARAMETER name:r index:0 type:<root>.KotlinBox<<root>.JavaBox>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun f (r: <root>.KotlinBox<<root>.JavaBox>): kotlin.String declared in <root>'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
<T0>: kotlin.String
arg0: BLOCK type=@[FlexibleNullability] kotlin.String? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.JavaBox? [val]
@@ -21,4 +21,3 @@ fun test5(x: Boolean): Boolean {
fun test6(): Boolean {
return true.not()
}
@@ -76,14 +76,14 @@ FILE fqName:<root> fileName:/AbstractMutableMap.kt
VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] K of <root>.MyMap, in @[EnhancedNullability] V of <root>.MyMap, out @[EnhancedNullability] V of <root>.MyMap>
FUN FAKE_OVERRIDE name:merge visibility:public modality:OPEN <> ($this:kotlin.collections.MutableMap<K of kotlin.collections.MutableMap, V of kotlin.collections.MutableMap>, p0:@[EnhancedNullability] K of <root>.MyMap, p1:@[EnhancedNullability] V of <root>.MyMap, p2:@[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] V of <root>.MyMap, in @[EnhancedNullability] V of <root>.MyMap, out V of <root>.MyMap?>) returnType:V of <root>.MyMap? [fake_override]
overridden:
public open fun merge (p0: @[EnhancedNullability] K of kotlin.collections.AbstractMutableMap, p1: @[EnhancedNullability] {@[EnhancedNullability] V of kotlin.collections.AbstractMutableMap & Any}, p2: @[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] {@[EnhancedNullability] V of kotlin.collections.AbstractMutableMap & Any}, in @[EnhancedNullability] {@[EnhancedNullability] V of kotlin.collections.AbstractMutableMap & Any}, out V of kotlin.collections.AbstractMutableMap?>): V of kotlin.collections.AbstractMutableMap? [fake_override] declared in kotlin.collections.AbstractMutableMap
public open fun merge (p0: @[EnhancedNullability] K of kotlin.collections.AbstractMutableMap, p1: @[EnhancedNullability] {V of kotlin.collections.AbstractMutableMap & Any}, p2: @[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] {V of kotlin.collections.AbstractMutableMap & Any}, in @[EnhancedNullability] {V of kotlin.collections.AbstractMutableMap & Any}, out V of kotlin.collections.AbstractMutableMap?>): V of kotlin.collections.AbstractMutableMap? [fake_override] declared in kotlin.collections.AbstractMutableMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.MutableMap<K of kotlin.collections.MutableMap, V of kotlin.collections.MutableMap>
VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] K of <root>.MyMap
VALUE_PARAMETER name:p1 index:1 type:@[EnhancedNullability] V of <root>.MyMap
VALUE_PARAMETER name:p2 index:2 type:@[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] V of <root>.MyMap, in @[EnhancedNullability] V of <root>.MyMap, out V of <root>.MyMap?>
FUN FAKE_OVERRIDE name:computeIfPresent visibility:public modality:OPEN <> ($this:kotlin.collections.MutableMap<K of kotlin.collections.MutableMap, V of kotlin.collections.MutableMap>, p0:@[EnhancedNullability] K of <root>.MyMap, p1:@[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] K of <root>.MyMap, in @[EnhancedNullability] V of <root>.MyMap, out V of <root>.MyMap?>) returnType:V of <root>.MyMap? [fake_override]
overridden:
public open fun computeIfPresent (p0: @[EnhancedNullability] K of kotlin.collections.AbstractMutableMap, p1: @[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] K of kotlin.collections.AbstractMutableMap, in @[EnhancedNullability] {@[EnhancedNullability] V of kotlin.collections.AbstractMutableMap & Any}, out V of kotlin.collections.AbstractMutableMap?>): V of kotlin.collections.AbstractMutableMap? [fake_override] declared in kotlin.collections.AbstractMutableMap
public open fun computeIfPresent (p0: @[EnhancedNullability] K of kotlin.collections.AbstractMutableMap, p1: @[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] K of kotlin.collections.AbstractMutableMap, in @[EnhancedNullability] {V of kotlin.collections.AbstractMutableMap & Any}, out V of kotlin.collections.AbstractMutableMap?>): V of kotlin.collections.AbstractMutableMap? [fake_override] declared in kotlin.collections.AbstractMutableMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.MutableMap<K of kotlin.collections.MutableMap, V of kotlin.collections.MutableMap>
VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] K of <root>.MyMap
VALUE_PARAMETER name:p1 index:1 type:@[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] K of <root>.MyMap, in @[EnhancedNullability] V of <root>.MyMap, out V of <root>.MyMap?>
@@ -96,7 +96,7 @@ FILE fqName:<root> fileName:/AnnotationLoader.kt
$this: VALUE_PARAMETER name:<this> type:<root>.AnnotationLoader.loadAnnotation.<no name provided>
BLOCK_BODY
VAR name:visitor type:<root>.Visitor [val]
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=<root>.Visitor origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=<root>.Visitor origin=EXCLEXCL
<T0>: <root>.Visitor
arg0: CALL 'public final fun loadAnnotation (): <root>.Visitor? declared in <root>.AnnotationLoader' type=<root>.Visitor? origin=null
$this: GET_VAR '<this>: <root>.AnnotationLoader declared in <root>.AnnotationLoader.loadAnnotation' type=<root>.AnnotationLoader origin=null
@@ -96,7 +96,7 @@ FILE fqName:<root> fileName:/AnnotationLoader.kt
$this: VALUE_PARAMETER name:<this> type:<root>.AnnotationLoader.loadAnnotation.<no name provided>
BLOCK_BODY
VAR name:visitor type:<root>.Visitor [val]
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=<root>.Visitor origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=<root>.Visitor origin=EXCLEXCL
<T0>: <root>.Visitor
arg0: CALL 'public final fun loadAnnotation (): <root>.Visitor? declared in <root>.AnnotationLoader' type=<root>.Visitor? origin=null
$this: GET_VAR '<this>: <root>.AnnotationLoader declared in <root>.AnnotationLoader.loadAnnotation' type=<root>.AnnotationLoader origin=null
@@ -61,7 +61,7 @@ FILE fqName:<root> fileName:/functionLiteralGenericSignature.kt
VALUE_PARAMETER name:l index:0 type:kotlin.collections.MutableList<kotlin.Double>
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <no name provided> (l: kotlin.collections.MutableList<kotlin.Double>): kotlin.collections.MutableList<kotlin.Int> declared in <root>.mutableListFun'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Nothing origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Nothing origin=EXCLEXCL
<T0>: kotlin.Nothing
arg0: CONST Null type=kotlin.Nothing? value=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-mutableListFun> visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>>
@@ -30,4 +30,3 @@ enum class ConfigurationParameter : Enum<ConfigurationParameter> {
fun valueOf(value: String): ConfigurationParameter /* Synthetic body for ENUM_VALUEOF */
}
@@ -62,4 +62,3 @@ var fn: Function1<A, Int>
get
set
@@ -8,4 +8,3 @@ suspend fun box() {
}
)
}
@@ -14,4 +14,3 @@ fun main() {
elvisLike<String>(x = "", y = "").<get-length>() /*~> Unit */
elvisLike<String?>(x = null, y = "").<get-length>() /*~> Unit */
}
@@ -30,7 +30,7 @@ FILE fqName:<root> fileName:/definitelyNonNullSAM.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo (): <root>.FIn<{S of <root>.Test & Any}> declared in <root>.Test'
TYPE_OP type=<root>.FIn<{S of <root>.Test & Any}> origin=SAM_CONVERSION typeOperand=<root>.FIn<{S of <root>.Test & Any}>
FUN_EXPR type=kotlin.Function1<@[ParameterName(name = 'x')] {@[ParameterName(name = 'x')] S of <root>.Test & Any}, kotlin.Unit> origin=LAMBDA
FUN_EXPR type=kotlin.Function1<@[ParameterName(name = 'x')] {S of <root>.Test & Any}, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (sx:{S of <root>.Test & Any}) returnType:kotlin.Unit
VALUE_PARAMETER name:sx index:0 type:{S of <root>.Test & Any}
BLOCK_BODY
@@ -9,7 +9,7 @@ FILE fqName:<root> fileName:/main.kt
VALUE_PARAMETER name:x index:0 type:T1 of <root>.B
FUN name:bar visibility:public modality:ABSTRACT <> ($this:<root>.B<T1 of <root>.B>, x:{T1 of <root>.B & Any}) returnType:{T1 of <root>.B & Any}
overridden:
public abstract fun bar (x: @[EnhancedNullability] {@[EnhancedNullability] T of <root>.A & Any}): @[EnhancedNullability] {@[EnhancedNullability] T of <root>.A & Any} declared in <root>.A
public abstract fun bar (x: @[EnhancedNullability] {T of <root>.A & Any}): @[EnhancedNullability] {T of <root>.A & Any} declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:<root>.B<T1 of <root>.B>
VALUE_PARAMETER name:x index:0 type:{T1 of <root>.B & Any}
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
@@ -42,8 +42,8 @@ FILE fqName:<root> fileName:/definitelyNotNullAsArgument.kt
BLOCK_BODY
CALL 'public abstract fun input (t: T of <root>.I): kotlin.Unit declared in <root>.I' type=kotlin.Unit origin=null
$this: GET_VAR 'i: <root>.I<in {T of <root>.qux & Any}> declared in <root>.qux' type=<root>.I<in {T of <root>.qux & Any}> origin=null
t: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type={T of <root>.qux & Any} origin=EXCLEXCL
<T0>: T of <root>.qux
t: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type={T of <root>.qux & Any} origin=EXCLEXCL
<T0>: {T of <root>.qux & Any}
arg0: GET_VAR 't: T of <root>.qux declared in <root>.qux' type=T of <root>.qux origin=null
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.I<{TT of <root>.C & Any}>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C<TT of <root>.C>
@@ -76,8 +76,8 @@ FILE fqName:<root> fileName:/definitelyNotNullAsArgument.kt
$this: VALUE_PARAMETER name:<this> type:<root>.C<TT of <root>.C>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun output (): {TT of <root>.C & Any} declared in <root>.C'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type={TT of <root>.C & Any} origin=EXCLEXCL
<T0>: TT of <root>.C
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type={TT of <root>.C & Any} origin=EXCLEXCL
<T0>: {TT of <root>.C & Any}
arg0: CALL 'public final fun <get-t> (): TT of <root>.C declared in <root>.C' type=TT of <root>.C origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.C<TT of <root>.C> declared in <root>.C.output' type=<root>.C<TT of <root>.C> origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
@@ -101,6 +101,6 @@ FILE fqName:<root> fileName:/definitelyNotNullAsArgument.kt
BLOCK_BODY
CALL 'public abstract fun input (t: T of <root>.I): kotlin.Unit declared in <root>.I' type=kotlin.Unit origin=null
$this: GET_VAR 'p2: T2 of <root>.foo2 declared in <root>.foo2' type=T2 of <root>.foo2 origin=null
t: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type={T1 of <root>.foo2 & Any} origin=EXCLEXCL
<T0>: T1 of <root>.foo2
t: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type={T1 of <root>.foo2 & Any} origin=EXCLEXCL
<T0>: {T1 of <root>.foo2 & Any}
arg0: GET_VAR 'p1: T1 of <root>.foo2 declared in <root>.foo2' type=T1 of <root>.foo2 origin=null
@@ -13,7 +13,7 @@ fun <T : Any?> bar(i: I<out (T & Any)>): (T & Any) {
}
fun <T : Any?> qux(t: T, i: I<in (T & Any)>) {
i.input(t = CHECK_NOT_NULL<T>(arg0 = t))
i.input(t = CHECK_NOT_NULL<(T & Any)>(arg0 = t))
}
class C<TT : Any?> : I<(TT & Any)> {
@@ -31,12 +31,11 @@ class C<TT : Any?> : I<(TT & Any)> {
}
override fun output(): (TT & Any) {
return CHECK_NOT_NULL<TT>(arg0 = <this>.<get-t>())
return CHECK_NOT_NULL<(TT & Any)>(arg0 = <this>.<get-t>())
}
}
fun <T1 : Any?, T2 : I<(T1 & Any)>> foo2(p1: T1, p2: T2) {
p2.input(t = CHECK_NOT_NULL<T1>(arg0 = p1))
p2.input(t = CHECK_NOT_NULL<(T1 & Any)>(arg0 = p1))
}
@@ -42,7 +42,7 @@ FILE fqName:<root> fileName:/definitelyNotNullAsArgument.kt
BLOCK_BODY
CALL 'public abstract fun input (t: T of <root>.I): kotlin.Unit declared in <root>.I' type=kotlin.Unit origin=null
$this: GET_VAR 'i: <root>.I<in {T of <root>.qux & Any}> declared in <root>.qux' type=<root>.I<in {T of <root>.qux & Any}> origin=null
t: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=T of <root>.qux origin=EXCLEXCL
t: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=T of <root>.qux origin=EXCLEXCL
<T0>: T of <root>.qux
arg0: GET_VAR 't: T of <root>.qux declared in <root>.qux' type=T of <root>.qux origin=null
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.I<{TT of <root>.C & Any}>]
@@ -76,7 +76,7 @@ FILE fqName:<root> fileName:/definitelyNotNullAsArgument.kt
$this: VALUE_PARAMETER name:<this> type:<root>.C<TT of <root>.C>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun output (): {TT of <root>.C & Any} declared in <root>.C'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=TT of <root>.C origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=TT of <root>.C origin=EXCLEXCL
<T0>: TT of <root>.C
arg0: CALL 'public final fun <get-t> (): TT of <root>.C declared in <root>.C' type=TT of <root>.C origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.C<TT of <root>.C> declared in <root>.C.output' type=<root>.C<TT of <root>.C> origin=null
@@ -102,6 +102,6 @@ FILE fqName:<root> fileName:/definitelyNotNullAsArgument.kt
CALL 'public abstract fun input (t: T of <root>.I): kotlin.Unit declared in <root>.I' type=kotlin.Unit origin=null
$this: TYPE_OP type=<root>.I<{T1 of <root>.foo2 & Any}> origin=IMPLICIT_CAST typeOperand=<root>.I<{T1 of <root>.foo2 & Any}>
GET_VAR 'p2: T2 of <root>.foo2 declared in <root>.foo2' type=T2 of <root>.foo2 origin=null
t: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=T1 of <root>.foo2 origin=EXCLEXCL
t: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=T1 of <root>.foo2 origin=EXCLEXCL
<T0>: T1 of <root>.foo2
arg0: GET_VAR 'p1: T1 of <root>.foo2 declared in <root>.foo2' type=T1 of <root>.foo2 origin=null
@@ -39,4 +39,3 @@ class C<TT : Any?> : I<(TT & Any)> {
fun <T1 : Any?, T2 : I<(T1 & Any)>> foo2(p1: T1, p2: T2) {
p2 /*as I<(T1 & Any)> */.input(t = CHECK_NOT_NULL<T1>(arg0 = p1))
}
@@ -34,4 +34,3 @@ fun testLocalVarUse() {
val nns: String = notNullString() /*!! String */
use(s = nns)
}
@@ -15,4 +15,3 @@ fun test(): String {
}
}
}
@@ -37,4 +37,3 @@ class Delegated : IFoo {
fun testReturnValue(): String {
return Delegated().foo()
}
@@ -8,4 +8,3 @@ fun testNullCheck() {
}
) /*~> Unit */
}
@@ -12,4 +12,3 @@ inline fun <reified T : CharSequence?> implicitAsFoo(x: Any): Int {
else -> x /*as (T & Any) */.<get-length>()
}
}
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.symbols.impl.*
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.SimpleTypeNullability
import org.jetbrains.kotlin.ir.types.classOrNull
import org.jetbrains.kotlin.ir.types.defaultType
import org.jetbrains.kotlin.ir.types.impl.*
@@ -289,7 +290,7 @@ internal class BuiltInFictitiousFunctionIrClassFactory(
val kotlinType = wrapped.unwrap()
return with(IrSimpleTypeBuilder()) {
classifier = symbolTable.referenceClassifier(kotlinType.constructor.declarationDescriptor ?: error("No classifier for type $kotlinType"))
hasQuestionMark = kotlinType.isMarkedNullable
nullability = SimpleTypeNullability.fromHasQuestionMark(kotlinType.isMarkedNullable)
arguments = kotlinType.arguments.map {
if (it.isStarProjection) IrStarProjectionImpl
else makeTypeProjection(toIrType(it.type), it.projectionKind)
@@ -23,9 +23,8 @@ import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
internal fun IrType.isCEnumType(): Boolean {
val simpleType = this as? IrSimpleType ?: return false
if (simpleType.hasQuestionMark) return false
val enumClass = simpleType.classifier.owner as? IrClass ?: return false
if (isNullable()) return false
val enumClass = classOrNull?.owner ?: return false
if (!enumClass.isEnumClass) return false
return enumClass.superTypes
@@ -53,11 +52,10 @@ internal fun IrSimpleFunction.objCReturnsRetained() = hasCCallAnnotation("Return
internal fun IrClass.getCStructSpelling(): String? =
getAnnotationArgumentValue(FqName("kotlinx.cinterop.internal.CStruct"), "spelling")
internal fun IrType.isTypeOfNullLiteral(): Boolean = this is IrSimpleType && hasQuestionMark
&& classifier.isClassWithFqName(StandardNames.FqNames.nothing)
internal fun IrType.isTypeOfNullLiteral(): Boolean = isNullableNothing()
internal fun IrType.isVector(): Boolean {
if (this is IrSimpleType && !this.hasQuestionMark) {
if (this is IrSimpleType && !this.isNullable()) {
return classifier.isClassWithFqName(KonanFqNames.Vector128.toUnsafe())
}
return false
@@ -1515,8 +1515,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
!this.isChar()
}
private fun IrType.isUnsignedInteger(): Boolean =
this is IrSimpleType && !this.hasQuestionMark &&
private fun IrType.isUnsignedInteger(): Boolean = !isNullable() &&
UnsignedType.values().any { it.classId == this.getClass()?.descriptor?.classId }
private fun evaluateIntegerCoercion(value: IrTypeOperatorCall): LLVMValueRef {

Some files were not shown because too many files have changed in this diff Show More