[FIR] Add FirCheckNotNullCall converted to CHECK_NOT_NULL intrinsic
function call.
This commit is contained in:
committed by
Dmitriy Novozhilov
parent
6bc0fe121a
commit
692a83f7bb
@@ -17,6 +17,10 @@ object SyntheticCallableId {
|
||||
FqName("_synthetic"),
|
||||
Name.identifier("TRY_CALL")
|
||||
)
|
||||
val CHECK_NOT_NULL = CallableId(
|
||||
FqName("_synthetic"),
|
||||
Name.identifier("CHECK_NOT_NULL_CALL")
|
||||
)
|
||||
val ID = CallableId(
|
||||
FqName("_synthetic"),
|
||||
Name.identifier("ID_CALL")
|
||||
|
||||
@@ -45,11 +45,8 @@ import org.jetbrains.kotlin.ir.descriptors.WrappedValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.classifierOrFail
|
||||
import org.jetbrains.kotlin.ir.types.classifierOrNull
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrErrorTypeImpl
|
||||
import org.jetbrains.kotlin.ir.types.makeNullable
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
@@ -1289,6 +1286,20 @@ class Fir2IrVisitor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitCheckNotNullCall(checkNotNullCall: FirCheckNotNullCall, data: Any?): IrElement {
|
||||
return checkNotNullCall.convertWithOffsets { startOffset, endOffset ->
|
||||
IrCallImpl(
|
||||
startOffset, endOffset,
|
||||
checkNotNullCall.typeRef.toIrType(session, declarationStorage),
|
||||
irBuiltIns.checkNotNullSymbol,
|
||||
IrStatementOrigin.EXCLEXCL
|
||||
).apply {
|
||||
putTypeArgument(0, checkNotNullCall.argument.typeRef.toIrType(session, declarationStorage).makeNotNull())
|
||||
putValueArgument(0, checkNotNullCall.argument.toIrExpression())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitGetClassCall(getClassCall: FirGetClassCall, data: Any?): IrElement {
|
||||
return getClassCall.convertWithOffsets { startOffset, endOffset ->
|
||||
IrGetClassImpl(
|
||||
|
||||
+24
-19
@@ -306,28 +306,33 @@ class ExpressionsConverter(
|
||||
}
|
||||
|
||||
val operationToken = operationTokenName.getOperationSymbol()
|
||||
if (operationToken == EXCLEXCL) {
|
||||
return argument.bangBangToWhen(null) { getAsFirExpression(this, it) }
|
||||
}
|
||||
|
||||
val conventionCallName = operationToken.toUnaryName()
|
||||
return if (conventionCallName != null) {
|
||||
if (operationToken in OperatorConventions.INCREMENT_OPERATIONS) {
|
||||
return generateIncrementOrDecrementBlock(
|
||||
null,
|
||||
argument,
|
||||
callName = conventionCallName,
|
||||
prefix = unaryExpression.tokenType == PREFIX_EXPRESSION
|
||||
) { getAsFirExpression(this) }
|
||||
return when {
|
||||
operationToken == EXCLEXCL -> {
|
||||
FirCheckNotNullCallImpl(null).apply {
|
||||
arguments += getAsFirExpression<FirExpression>(argument, "No operand")
|
||||
}
|
||||
|
||||
}
|
||||
FirFunctionCallImpl(null).apply {
|
||||
calleeReference = FirSimpleNamedReference(null, conventionCallName, null)
|
||||
explicitReceiver = getAsFirExpression(argument, "No operand")
|
||||
conventionCallName != null -> {
|
||||
if (operationToken in OperatorConventions.INCREMENT_OPERATIONS) {
|
||||
return generateIncrementOrDecrementBlock(
|
||||
null,
|
||||
argument,
|
||||
callName = conventionCallName,
|
||||
prefix = unaryExpression.tokenType == PREFIX_EXPRESSION
|
||||
) { getAsFirExpression(this) }
|
||||
}
|
||||
FirFunctionCallImpl(null).apply {
|
||||
calleeReference = FirSimpleNamedReference(null, conventionCallName, null)
|
||||
explicitReceiver = getAsFirExpression(argument, "No operand")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val firOperation = operationToken.toFirOperation()
|
||||
FirOperatorCallImpl(null, firOperation).apply {
|
||||
arguments += getAsFirExpression<FirExpression>(argument, "No operand")
|
||||
else -> {
|
||||
val firOperation = operationToken.toFirOperation()
|
||||
FirOperatorCallImpl(null, firOperation).apply {
|
||||
arguments += getAsFirExpression<FirExpression>(argument, "No operand")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,18 +167,6 @@ abstract class BaseFirBuilder<T>(val session: FirSession, val context: Context =
|
||||
?: emptyList()
|
||||
}
|
||||
|
||||
fun T?.bangBangToWhen(parent: KtUnaryExpression?, convert: T?.(String) -> FirExpression): FirWhenExpression {
|
||||
val source = parent.getSourceOrNull()
|
||||
return this.convert("No operand").generateNotNullOrOther(
|
||||
session,
|
||||
FirThrowExpressionImpl(
|
||||
source, FirFunctionCallImpl(source).apply {
|
||||
calleeReference = FirSimpleNamedReference(source, KNPE, null)
|
||||
}
|
||||
), "bangbang", source
|
||||
)
|
||||
}
|
||||
|
||||
fun FirAbstractLoop.configure(generateBlock: () -> FirBlock): FirAbstractLoop {
|
||||
label = context.firLabels.pop()
|
||||
context.firLoops += this
|
||||
|
||||
@@ -1222,28 +1222,33 @@ class RawFirBuilder(session: FirSession, val stubMode: Boolean) : BaseFirBuilder
|
||||
override fun visitUnaryExpression(expression: KtUnaryExpression, data: Unit): FirElement {
|
||||
val operationToken = expression.operationToken
|
||||
val argument = expression.baseExpression
|
||||
if (operationToken == EXCLEXCL) {
|
||||
return expression.baseExpression.bangBangToWhen(expression) { (this as KtExpression).toFirExpression(it) }
|
||||
}
|
||||
val conventionCallName = operationToken.toUnaryName()
|
||||
return if (conventionCallName != null) {
|
||||
if (operationToken in OperatorConventions.INCREMENT_OPERATIONS) {
|
||||
return generateIncrementOrDecrementBlock(
|
||||
expression, argument,
|
||||
callName = conventionCallName,
|
||||
prefix = expression is KtPrefixExpression
|
||||
) { (this as KtExpression).toFirExpression("Incorrect expression inside inc/dec") }
|
||||
return when {
|
||||
operationToken == EXCLEXCL -> {
|
||||
FirCheckNotNullCallImpl(expression.toFirSourceElement()).apply {
|
||||
arguments += argument.toFirExpression("No operand")
|
||||
}
|
||||
}
|
||||
FirFunctionCallImpl(expression.toFirSourceElement()).apply {
|
||||
calleeReference = FirSimpleNamedReference(
|
||||
expression.operationReference.toFirSourceElement(), conventionCallName, null
|
||||
)
|
||||
explicitReceiver = argument.toFirExpression("No operand")
|
||||
conventionCallName != null -> {
|
||||
if (operationToken in OperatorConventions.INCREMENT_OPERATIONS) {
|
||||
return generateIncrementOrDecrementBlock(
|
||||
expression, argument,
|
||||
callName = conventionCallName,
|
||||
prefix = expression is KtPrefixExpression
|
||||
) { (this as KtExpression).toFirExpression("Incorrect expression inside inc/dec") }
|
||||
}
|
||||
FirFunctionCallImpl(expression.toFirSourceElement()).apply {
|
||||
calleeReference = FirSimpleNamedReference(
|
||||
expression.operationReference.toFirSourceElement(), conventionCallName, null
|
||||
)
|
||||
explicitReceiver = argument.toFirExpression("No operand")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val firOperation = operationToken.toFirOperation()
|
||||
FirOperatorCallImpl(expression.toFirSourceElement(), firOperation).apply {
|
||||
arguments += argument.toFirExpression("No operand")
|
||||
else -> {
|
||||
val firOperation = operationToken.toFirOperation()
|
||||
FirOperatorCallImpl(expression.toFirSourceElement(), firOperation).apply {
|
||||
arguments += argument.toFirExpression("No operand")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,5 @@ FILE: nullability.kt
|
||||
|
||||
}
|
||||
public? final? fun bang(arg: Int?): <implicit> {
|
||||
^bang when (lval <bangbang>: <implicit> = arg#) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw KotlinNullPointerException#()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|
|
||||
}
|
||||
}
|
||||
|
||||
^bang arg#!!
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirAnonymousFunctionImpl
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirCheckNotNullCallImpl
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirFunctionCallImpl
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirTryExpressionImpl
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirWhenExpressionImpl
|
||||
@@ -119,4 +120,15 @@ fun FirTryExpression.copy(
|
||||
this@apply.catches.addAll(this@copy.catches)
|
||||
this.typeRef = resultType
|
||||
this.annotations += annotations
|
||||
}
|
||||
|
||||
fun FirCheckNotNullCall.copy(
|
||||
resultType: FirTypeRef = this.typeRef,
|
||||
calleeReference: FirReference = this.calleeReference,
|
||||
annotations: List<FirAnnotationCall> = this.annotations
|
||||
): FirCheckNotNullCallImpl = FirCheckNotNullCallImpl(source).apply {
|
||||
this.calleeReference = calleeReference
|
||||
this@apply.arguments.addAll(this@copy.arguments)
|
||||
this.typeRef = resultType
|
||||
this.annotations += annotations
|
||||
}
|
||||
@@ -44,7 +44,7 @@ fun Candidate.resolveArgumentExpression(
|
||||
typeProvider: (FirExpression) -> FirTypeRef?
|
||||
) {
|
||||
return when (argument) {
|
||||
is FirFunctionCall, is FirWhenExpression, is FirTryExpression -> resolveSubCallArgument(
|
||||
is FirFunctionCall, is FirWhenExpression, is FirTryExpression, is FirCheckNotNullCall -> resolveSubCallArgument(
|
||||
csBuilder,
|
||||
argument as FirResolvable,
|
||||
expectedType,
|
||||
|
||||
@@ -44,7 +44,7 @@ class CandidateFactory(
|
||||
|
||||
fun PostponedArgumentsAnalyzer.Context.addSubsystemFromExpression(statement: FirStatement) {
|
||||
when (statement) {
|
||||
is FirFunctionCall, is FirQualifiedAccessExpression, is FirWhenExpression, is FirTryExpression, is FirCallableReferenceAccess ->
|
||||
is FirFunctionCall, is FirQualifiedAccessExpression, is FirWhenExpression, is FirTryExpression, is FirCheckNotNullCall, is FirCallableReferenceAccess ->
|
||||
(statement as FirResolvable).candidate()?.let { addOtherSystem(it.system.asReadOnlyStorage()) }
|
||||
is FirWrappedArgumentExpression -> addSubsystemFromExpression(statement.expression)
|
||||
is FirBlock -> statement.returnExpressions().forEach { addSubsystemFromExpression(it) }
|
||||
|
||||
@@ -246,6 +246,11 @@ class ConstraintSystemCompleter(val components: InferenceComponents) {
|
||||
catches.forEach { it.block.processAllContainingCallCandidates(processBlocks, processor) }
|
||||
}
|
||||
|
||||
is FirCheckNotNullCall -> {
|
||||
processCandidateIfApplicable(processor)
|
||||
this.arguments.forEach { it.processAllContainingCallCandidates(processBlocks, processor) }
|
||||
}
|
||||
|
||||
is FirQualifiedAccessExpression -> {
|
||||
processCandidateIfApplicable(processor)
|
||||
}
|
||||
|
||||
+20
-33
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.fir.references.impl.FirResolvedNamedReferenceImpl
|
||||
import org.jetbrains.kotlin.fir.render
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.Candidate
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.FirNamedReferenceWithCandidate
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.candidate
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.isBuiltinFunctionalType
|
||||
import org.jetbrains.kotlin.fir.resolve.constructFunctionalTypeRef
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
@@ -52,7 +51,6 @@ class FirCallCompletionResultsWriterTransformer(
|
||||
): CompositeTransformResult<FirStatement> {
|
||||
val calleeReference =
|
||||
qualifiedAccessExpression.calleeReference as? FirNamedReferenceWithCandidate ?: return qualifiedAccessExpression.compose()
|
||||
calleeReference.candidate.substitutor
|
||||
|
||||
val candidateFir = calleeReference.candidateSymbol.phasedFir
|
||||
val typeRef = (candidateFir as? FirTypedDeclaration)?.let {
|
||||
@@ -276,49 +274,38 @@ class FirCallCompletionResultsWriterTransformer(
|
||||
return transformElement(block, data)
|
||||
}
|
||||
|
||||
override fun transformWhenExpression(whenExpression: FirWhenExpression, data: ExpectedArgumentType?): CompositeTransformResult<FirStatement> {
|
||||
val calleeReference = whenExpression.calleeReference as? FirNamedReferenceWithCandidate ?: return whenExpression.compose()
|
||||
// Transformations for synthetic calls generated by FirSyntheticCallGenerator
|
||||
|
||||
val whenExpression = whenExpression.transformChildren(this, data?.getExpectedType(whenExpression)?.toExpectedType()) as FirWhenExpression
|
||||
override fun transformWhenExpression(whenExpression: FirWhenExpression, data: ExpectedArgumentType?) =
|
||||
transformSyntheticCall(whenExpression, data)
|
||||
|
||||
val declaration = whenExpression.candidate()?.symbol?.fir as? FirMemberFunction<*> ?: return whenExpression.compose()
|
||||
override fun transformTryExpression(tryExpression: FirTryExpression, data: ExpectedArgumentType?) =
|
||||
transformSyntheticCall(tryExpression, data)
|
||||
|
||||
val subCandidate = calleeReference.candidate
|
||||
override fun transformCheckNotNullCall(checkNotNullCall: FirCheckNotNullCall, data: ExpectedArgumentType?) =
|
||||
transformSyntheticCall(checkNotNullCall, data)
|
||||
|
||||
private inline fun <reified D> transformSyntheticCall(
|
||||
syntheticCall: D,
|
||||
data: ExpectedArgumentType?
|
||||
): CompositeTransformResult<FirStatement>
|
||||
where D : FirResolvable, D : FirExpression {
|
||||
val syntheticCall = syntheticCall.transformChildren(this, data?.getExpectedType(syntheticCall)?.toExpectedType()) as D
|
||||
val calleeReference = syntheticCall.calleeReference as? FirNamedReferenceWithCandidate ?: return syntheticCall.compose()
|
||||
|
||||
val declaration = calleeReference.candidate.symbol.fir as? FirMemberFunction<*> ?: return syntheticCall.compose()
|
||||
|
||||
val typeRef = typeCalculator.tryCalculateReturnType(declaration)
|
||||
syntheticCall.replaceTypeRefWithSubstituted(calleeReference, typeRef)
|
||||
|
||||
whenExpression.resultType = typeRef.substituteTypeRef(subCandidate)
|
||||
|
||||
return whenExpression.transformCalleeReference(
|
||||
return (syntheticCall.transformCalleeReference(
|
||||
StoreCalleeReference,
|
||||
FirResolvedNamedReferenceImpl(
|
||||
calleeReference.source,
|
||||
calleeReference.name,
|
||||
calleeReference.candidateSymbol
|
||||
)
|
||||
).compose()
|
||||
}
|
||||
|
||||
override fun transformTryExpression(tryExpression: FirTryExpression, data: ExpectedArgumentType?): CompositeTransformResult<FirStatement> {
|
||||
val calleeReference = tryExpression.calleeReference as? FirNamedReferenceWithCandidate ?: return tryExpression.compose()
|
||||
|
||||
val tryExpression = tryExpression.transformChildren(this, data) as FirTryExpression
|
||||
|
||||
val declaration = tryExpression.candidate()?.symbol?.fir as? FirMemberFunction<*> ?: return tryExpression.compose()
|
||||
|
||||
val subCandidate = calleeReference.candidate
|
||||
|
||||
val typeRef = typeCalculator.tryCalculateReturnType(declaration)
|
||||
|
||||
tryExpression.resultType = typeRef.substituteTypeRef(subCandidate)
|
||||
return tryExpression.transformCalleeReference(
|
||||
StoreCalleeReference,
|
||||
FirResolvedNamedReferenceImpl(
|
||||
calleeReference.source,
|
||||
calleeReference.name,
|
||||
calleeReference.candidateSymbol
|
||||
)
|
||||
).compose()
|
||||
) as D).compose()
|
||||
}
|
||||
|
||||
override fun <T> transformConstExpression(
|
||||
|
||||
+55
-9
@@ -16,10 +16,7 @@ import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirValueParameterImpl
|
||||
import org.jetbrains.kotlin.fir.expressions.FirCallableReferenceAccess
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirTryExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirWhenExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirFunctionCallImpl
|
||||
import org.jetbrains.kotlin.fir.references.FirReference
|
||||
import org.jetbrains.kotlin.fir.references.impl.FirStubReference
|
||||
@@ -28,6 +25,7 @@ import org.jetbrains.kotlin.fir.resolve.calls.*
|
||||
import org.jetbrains.kotlin.fir.resolve.inference.FirCallCompleter
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirAbstractBodyResolveTransformer
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.resultType
|
||||
import org.jetbrains.kotlin.fir.resolve.withNullability
|
||||
import org.jetbrains.kotlin.fir.symbols.CallableId
|
||||
import org.jetbrains.kotlin.fir.symbols.SyntheticCallableId
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
@@ -51,6 +49,7 @@ class FirSyntheticCallGenerator(
|
||||
private val whenSelectFunction: FirSimpleFunctionImpl = generateSyntheticSelectFunction(SyntheticCallableId.WHEN)
|
||||
private val trySelectFunction: FirSimpleFunctionImpl = generateSyntheticSelectFunction(SyntheticCallableId.TRY)
|
||||
private val idFunction: FirSimpleFunctionImpl = generateSyntheticSelectFunction(SyntheticCallableId.ID)
|
||||
private val checkNotNullFunction: FirSimpleFunctionImpl = generateSyntheticCheckNotNullFunction()
|
||||
|
||||
fun generateCalleeForWhenExpression(whenExpression: FirWhenExpression): FirWhenExpression? {
|
||||
val stubReference = whenExpression.calleeReference
|
||||
@@ -90,6 +89,19 @@ class FirSyntheticCallGenerator(
|
||||
return tryExpression.transformCalleeReference(UpdateReference, reference)
|
||||
}
|
||||
|
||||
fun generateCalleeForCheckNotNullCall(checkNotNullCall: FirCheckNotNullCall): FirCheckNotNullCall? {
|
||||
val stubReference = checkNotNullCall.calleeReference
|
||||
if (stubReference !is FirStubReference) return null
|
||||
|
||||
val reference = generateCalleeReferenceWithCandidate(
|
||||
checkNotNullFunction,
|
||||
checkNotNullCall.arguments,
|
||||
SyntheticCallableId.CHECK_NOT_NULL.callableName
|
||||
) ?: return null // TODO
|
||||
|
||||
return checkNotNullCall.transformCalleeReference(UpdateReference, reference)
|
||||
}
|
||||
|
||||
fun resolveCallableReferenceWithSyntheticOuterCall(
|
||||
callableReferenceAccess: FirCallableReferenceAccess,
|
||||
expectedTypeRef: FirTypeRef?
|
||||
@@ -140,12 +152,15 @@ class FirSyntheticCallGenerator(
|
||||
implicitReceiverStack = implicitReceiverStack
|
||||
) { it.resultType }
|
||||
|
||||
private fun generateSyntheticSelectFunction(callableId: CallableId, isVararg: Boolean = true): FirSimpleFunctionImpl {
|
||||
private fun generateSyntheticSelectFunction(callableId: CallableId): FirSimpleFunctionImpl {
|
||||
// Synthetic function signature:
|
||||
// fun <K> select(vararg values: K): K
|
||||
val functionSymbol = FirSyntheticFunctionSymbol(callableId)
|
||||
val typeParameterSymbol = FirTypeParameterSymbol()
|
||||
val typeParameter = FirTypeParameterImpl(null, session, Name.identifier("K"), typeParameterSymbol, Variance.INVARIANT, false).apply {
|
||||
addDefaultBoundIfNecessary()
|
||||
}
|
||||
val typeParameter =
|
||||
FirTypeParameterImpl(null, session, Name.identifier("K"), typeParameterSymbol, Variance.INVARIANT, false).apply {
|
||||
addDefaultBoundIfNecessary()
|
||||
}
|
||||
|
||||
val returnType = FirResolvedTypeRefImpl(null, ConeTypeParameterTypeImpl(typeParameterSymbol.toLookupTag(), false))
|
||||
|
||||
@@ -154,7 +169,38 @@ class FirSyntheticCallGenerator(
|
||||
|
||||
return generateMemberFunction(session, functionSymbol, callableId.callableName, typeArgument.typeRef).apply {
|
||||
typeParameters += typeParameter
|
||||
valueParameters += argumentType.toValueParameter(session, "branches", isVararg)
|
||||
valueParameters += argumentType.toValueParameter(session, "branches", isVararg = true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun generateSyntheticCheckNotNullFunction(): FirSimpleFunctionImpl {
|
||||
// Synthetic function signature:
|
||||
// fun <K> checkNotNull(arg: K?): K
|
||||
//
|
||||
// Note: The upper bound of `K` cannot be `Any` because of the following case:
|
||||
// fun <X> test(a: X) = a!!
|
||||
// `X` is not a subtype of `Any` and hence cannot satisfy `K` if it had an upper bound of `Any`.
|
||||
val functionSymbol = FirSyntheticFunctionSymbol(SyntheticCallableId.CHECK_NOT_NULL)
|
||||
val typeParameterSymbol = FirTypeParameterSymbol()
|
||||
val typeParameter =
|
||||
FirTypeParameterImpl(null, session, Name.identifier("K"), typeParameterSymbol, Variance.INVARIANT, false).apply {
|
||||
addDefaultBoundIfNecessary()
|
||||
}
|
||||
|
||||
val returnType = FirResolvedTypeRefImpl(null, ConeTypeParameterTypeImpl(typeParameterSymbol.toLookupTag(), false))
|
||||
|
||||
val argumentType =
|
||||
FirResolvedTypeRefImpl(null, returnType.coneTypeUnsafe<ConeKotlinType>().withNullability(ConeNullability.NULLABLE))
|
||||
val typeArgument = FirTypeProjectionWithVarianceImpl(null, returnType, Variance.INVARIANT)
|
||||
|
||||
return generateMemberFunction(
|
||||
session,
|
||||
functionSymbol,
|
||||
SyntheticCallableId.CHECK_NOT_NULL.callableName,
|
||||
typeArgument.typeRef
|
||||
).apply {
|
||||
typeParameters += typeParameter
|
||||
valueParameters += argumentType.toValueParameter(session, "arg")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
@@ -113,6 +113,13 @@ open class FirBodyResolveTransformer(
|
||||
return expressionsTransformer.transformTypeOperatorCall(typeOperatorCall, data)
|
||||
}
|
||||
|
||||
override fun transformCheckNotNullCall(
|
||||
checkNotNullCall: FirCheckNotNullCall,
|
||||
data: ResolutionMode
|
||||
): CompositeTransformResult<FirStatement> {
|
||||
return expressionsTransformer.transformCheckNotNullCall(checkNotNullCall, data)
|
||||
}
|
||||
|
||||
override fun transformBinaryLogicExpression(
|
||||
binaryLogicExpression: FirBinaryLogicExpression,
|
||||
data: ResolutionMode
|
||||
|
||||
+25
@@ -287,6 +287,31 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) :
|
||||
return resolved.transform(integerLiteralTypeApproximator, null)
|
||||
}
|
||||
|
||||
override fun transformCheckNotNullCall(
|
||||
checkNotNullCall: FirCheckNotNullCall,
|
||||
data: ResolutionMode
|
||||
): CompositeTransformResult<FirStatement> {
|
||||
// Resolve the return type of a call to the synthetic function with signature:
|
||||
// fun <K> checkNotNull(arg: K?): K
|
||||
// ...in order to get the not-nullable type of the argument.
|
||||
|
||||
if (checkNotNullCall.calleeReference is FirResolvedNamedReference && checkNotNullCall.resultType !is FirImplicitTypeRef) {
|
||||
return checkNotNullCall.compose()
|
||||
}
|
||||
|
||||
checkNotNullCall.transformArguments(transformer, ResolutionMode.ContextDependent)
|
||||
|
||||
val result = components.syntheticCallGenerator.generateCalleeForCheckNotNullCall(checkNotNullCall)?.let {
|
||||
callCompleter.completeCall(it, data.expectedType)
|
||||
} ?: run {
|
||||
checkNotNullCall.resultType =
|
||||
FirErrorTypeRefImpl(null, FirSimpleDiagnostic("Can't resolve !! operator call", DiagnosticKind.InferenceError))
|
||||
checkNotNullCall
|
||||
}
|
||||
// TODO: Data flow analysis
|
||||
return result.compose()
|
||||
}
|
||||
|
||||
override fun transformBinaryLogicExpression(
|
||||
binaryLogicExpression: FirBinaryLogicExpression,
|
||||
data: ResolutionMode
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun <R> materialize(): R = <!UNRESOLVED_REFERENCE!>null!!<!>
|
||||
fun <R> materialize(): R = null!!
|
||||
|
||||
fun test_1() {
|
||||
<!UNRESOLVED_REFERENCE!>myRun<!> {
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
FILE: lambdaInUnresolvedCall.kt
|
||||
public final fun <R> materialize(): R|R| {
|
||||
^materialize when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw <Unresolved name: KotlinNullPointerException>#()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|
|
||||
}
|
||||
}
|
||||
|
||||
^materialize Null(null)!!
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
<Unresolved name: myRun>#(<L> = myRun@fun <anonymous>(): R|kotlin/Int| {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun <K> materialize(): K = <!UNRESOLVED_REFERENCE!>null!!<!>
|
||||
fun <K> materialize(): K = null!!
|
||||
|
||||
open class A1(val x: String)
|
||||
class B1 : A1(materialize())
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
FILE: delegatingConstructorCall.kt
|
||||
public final fun <K> materialize(): R|K| {
|
||||
^materialize when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw <Unresolved name: KotlinNullPointerException>#()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|
|
||||
}
|
||||
}
|
||||
|
||||
^materialize Null(null)!!
|
||||
}
|
||||
public open class A1 : R|kotlin/Any| {
|
||||
public constructor(x: R|kotlin/String|): R|A1| {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
fun <T> listOf(): List<T> = <!UNRESOLVED_REFERENCE!>null!!<!>
|
||||
fun <T> listOf(): List<T> = null!!
|
||||
|
||||
fun <T> materialize(): T = <!UNRESOLVED_REFERENCE!>null!!<!>
|
||||
fun <T> materialize(): T = null!!
|
||||
|
||||
class Result
|
||||
|
||||
|
||||
@@ -1,25 +1,9 @@
|
||||
FILE: nestedClassNameClash.kt
|
||||
public final fun <T> listOf(): R|kotlin/collections/List<T>| {
|
||||
^listOf when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw <Unresolved name: KotlinNullPointerException>#()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|
|
||||
}
|
||||
}
|
||||
|
||||
^listOf Null(null)!!
|
||||
}
|
||||
public final fun <T> materialize(): R|T| {
|
||||
^materialize when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw <Unresolved name: KotlinNullPointerException>#()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|
|
||||
}
|
||||
}
|
||||
|
||||
^materialize Null(null)!!
|
||||
}
|
||||
public final class Result : R|kotlin/Any| {
|
||||
public constructor(): R|Result| {
|
||||
|
||||
+2
-18
@@ -9,28 +9,12 @@ FILE: inferenceFromCallableReferenceType.kt
|
||||
}
|
||||
|
||||
public final fun baz(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
^baz when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|
|
||||
}
|
||||
}
|
||||
|
||||
^baz Null(null)!!
|
||||
}
|
||||
|
||||
}
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
^bar when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|
|
||||
}
|
||||
}
|
||||
|
||||
^bar Null(null)!!
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|<R|kotlin/String|, R|kotlin/Int|>(::R|/bar|)
|
||||
|
||||
Vendored
+2
-18
@@ -9,28 +9,12 @@ FILE: inferenceFromExpectedType.kt
|
||||
}
|
||||
|
||||
public final fun <T, E> baz(x: R|T|): R|E| {
|
||||
^baz when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|
|
||||
}
|
||||
}
|
||||
|
||||
^baz Null(null)!!
|
||||
}
|
||||
|
||||
}
|
||||
public final fun <T, E> bar(x: R|T|): R|E| {
|
||||
^bar when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|
|
||||
}
|
||||
}
|
||||
|
||||
^bar Null(null)!!
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|(::R|/bar<kotlin/String, kotlin/Int>|)
|
||||
|
||||
@@ -7,15 +7,7 @@ FILE: factoryFunctionOverloads.kt
|
||||
|
||||
}
|
||||
public final fun A(b: R|B?|, flag: R|kotlin/Boolean| = Boolean(true)): R|A| {
|
||||
^A R|/A.A|(when (lval <bangbang>: R|B?| = R|<local>/b|) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|
|
||||
}
|
||||
}
|
||||
, R|<local>/flag|)
|
||||
^A R|/A.A|(R|<local>/b|!!, R|<local>/flag|)
|
||||
}
|
||||
public final fun A(c: R|C|, flag: R|kotlin/Boolean| = Boolean(true)): R|A| {
|
||||
^A R|/A.A|(R|<local>/c|.R|/C.b|, R|<local>/flag|)
|
||||
|
||||
@@ -18,13 +18,5 @@ FILE: hashSet.kt
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
lvar c: R|kotlin/collections/MutableSet<kotlin/String>?| = Null(null)
|
||||
R|<local>/c| = R|java/util/HashSet.HashSet|<R|kotlin/String|>()
|
||||
when (lval <bangbang>: R|java/util/HashSet<kotlin/String>| = R|<local>/c|) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|
|
||||
}
|
||||
}
|
||||
.R|/d| = R|/produce|<R|T?|>()
|
||||
R|<local>/c|!!.R|/d| = R|/produce|<R|T?|>()
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fun <T, R> T.also(block: () -> R): R {
|
||||
return <!UNRESOLVED_REFERENCE!>null!!<!>
|
||||
return null!!
|
||||
}
|
||||
|
||||
fun foo(b: Boolean, a: Int) {
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
FILE: whenAsReceiver.kt
|
||||
public final fun <T, R> R|T|.also(block: R|() -> R|): R|R| {
|
||||
^also when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw <Unresolved name: KotlinNullPointerException>#()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|
|
||||
}
|
||||
}
|
||||
|
||||
^also Null(null)!!
|
||||
}
|
||||
public final fun foo(b: R|kotlin/Boolean|, a: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Int?| = when (R|<local>/b|) {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.fir.expressions
|
||||
|
||||
import org.jetbrains.kotlin.fir.FirPureAbstractElement
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.references.FirReference
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
*/
|
||||
|
||||
abstract class FirCheckNotNullCall : FirPureAbstractElement(), FirExpression, FirCall, FirResolvable {
|
||||
abstract override val source: FirSourceElement?
|
||||
abstract override val typeRef: FirTypeRef
|
||||
abstract override val annotations: List<FirAnnotationCall>
|
||||
abstract override val arguments: List<FirExpression>
|
||||
abstract override val calleeReference: FirReference
|
||||
|
||||
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitCheckNotNullCall(this, data)
|
||||
|
||||
abstract override fun <D> transformArguments(transformer: FirTransformer<D>, data: D): FirCheckNotNullCall
|
||||
|
||||
abstract override fun <D> transformCalleeReference(transformer: FirTransformer<D>, data: D): FirCheckNotNullCall
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.fir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirCheckNotNullCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.impl.FirAbstractAnnotatedElement
|
||||
import org.jetbrains.kotlin.fir.references.FirReference
|
||||
import org.jetbrains.kotlin.fir.references.impl.FirStubReference
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirImplicitTypeRefImpl
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
*/
|
||||
|
||||
class FirCheckNotNullCallImpl(
|
||||
override val source: FirSourceElement?
|
||||
) : FirCheckNotNullCall(), FirAbstractAnnotatedElement {
|
||||
override var typeRef: FirTypeRef = FirImplicitTypeRefImpl(null)
|
||||
override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
|
||||
override val arguments: MutableList<FirExpression> = mutableListOf()
|
||||
override var calleeReference: FirReference = FirStubReference()
|
||||
|
||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||
typeRef.accept(visitor, data)
|
||||
annotations.forEach { it.accept(visitor, data) }
|
||||
arguments.forEach { it.accept(visitor, data) }
|
||||
calleeReference.accept(visitor, data)
|
||||
}
|
||||
|
||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirCheckNotNullCallImpl {
|
||||
typeRef = typeRef.transformSingle(transformer, data)
|
||||
annotations.transformInplace(transformer, data)
|
||||
transformArguments(transformer, data)
|
||||
transformCalleeReference(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformArguments(transformer: FirTransformer<D>, data: D): FirCheckNotNullCallImpl {
|
||||
arguments.transformInplace(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformCalleeReference(transformer: FirTransformer<D>, data: D): FirCheckNotNullCallImpl {
|
||||
calleeReference = calleeReference.transformSingle(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun replaceTypeRef(newTypeRef: FirTypeRef) {
|
||||
typeRef = newTypeRef
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,7 @@ import org.jetbrains.kotlin.fir.expressions.FirWhenExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirWhenBranch
|
||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessWithoutCallee
|
||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess
|
||||
import org.jetbrains.kotlin.fir.expressions.FirCheckNotNullCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirArrayOfCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirArraySetCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirClassReferenceExpression
|
||||
@@ -396,6 +397,10 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
|
||||
return transformElement(qualifiedAccess, data)
|
||||
}
|
||||
|
||||
open fun transformCheckNotNullCall(checkNotNullCall: FirCheckNotNullCall, data: D): CompositeTransformResult<FirStatement> {
|
||||
return transformElement(checkNotNullCall, data)
|
||||
}
|
||||
|
||||
open fun transformArrayOfCall(arrayOfCall: FirArrayOfCall, data: D): CompositeTransformResult<FirStatement> {
|
||||
return transformElement(arrayOfCall, data)
|
||||
}
|
||||
@@ -844,6 +849,10 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
|
||||
return transformQualifiedAccess(qualifiedAccess, data)
|
||||
}
|
||||
|
||||
final override fun visitCheckNotNullCall(checkNotNullCall: FirCheckNotNullCall, data: D): CompositeTransformResult<FirStatement> {
|
||||
return transformCheckNotNullCall(checkNotNullCall, data)
|
||||
}
|
||||
|
||||
final override fun visitArrayOfCall(arrayOfCall: FirArrayOfCall, data: D): CompositeTransformResult<FirStatement> {
|
||||
return transformArrayOfCall(arrayOfCall, data)
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ import org.jetbrains.kotlin.fir.expressions.FirWhenExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirWhenBranch
|
||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessWithoutCallee
|
||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess
|
||||
import org.jetbrains.kotlin.fir.expressions.FirCheckNotNullCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirArrayOfCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirArraySetCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirClassReferenceExpression
|
||||
@@ -260,6 +261,8 @@ abstract class FirVisitor<out R, in D> {
|
||||
|
||||
open fun visitQualifiedAccess(qualifiedAccess: FirQualifiedAccess, data: D): R = visitElement(qualifiedAccess, data)
|
||||
|
||||
open fun visitCheckNotNullCall(checkNotNullCall: FirCheckNotNullCall, data: D): R = visitElement(checkNotNullCall, data)
|
||||
|
||||
open fun visitArrayOfCall(arrayOfCall: FirArrayOfCall, data: D): R = visitElement(arrayOfCall, data)
|
||||
|
||||
open fun visitArraySetCall(arraySetCall: FirArraySetCall, data: D): R = visitElement(arraySetCall, data)
|
||||
|
||||
@@ -73,6 +73,7 @@ import org.jetbrains.kotlin.fir.expressions.FirWhenExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirWhenBranch
|
||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessWithoutCallee
|
||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess
|
||||
import org.jetbrains.kotlin.fir.expressions.FirCheckNotNullCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirArrayOfCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirArraySetCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirClassReferenceExpression
|
||||
@@ -394,6 +395,10 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
|
||||
visitElement(qualifiedAccess)
|
||||
}
|
||||
|
||||
open fun visitCheckNotNullCall(checkNotNullCall: FirCheckNotNullCall) {
|
||||
visitElement(checkNotNullCall)
|
||||
}
|
||||
|
||||
open fun visitArrayOfCall(arrayOfCall: FirArrayOfCall) {
|
||||
visitElement(arrayOfCall)
|
||||
}
|
||||
@@ -842,6 +847,10 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
|
||||
visitQualifiedAccess(qualifiedAccess)
|
||||
}
|
||||
|
||||
final override fun visitCheckNotNullCall(checkNotNullCall: FirCheckNotNullCall, data: Nothing?) {
|
||||
visitCheckNotNullCall(checkNotNullCall)
|
||||
}
|
||||
|
||||
final override fun visitArrayOfCall(arrayOfCall: FirArrayOfCall, data: Nothing?) {
|
||||
visitArrayOfCall(arrayOfCall)
|
||||
}
|
||||
|
||||
@@ -923,6 +923,11 @@ class FirRenderer(builder: StringBuilder) : FirVisitorVoid() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitCheckNotNullCall(checkNotNullCall: FirCheckNotNullCall) {
|
||||
checkNotNullCall.argument.accept(this)
|
||||
print("!!")
|
||||
}
|
||||
|
||||
override fun visitCallableReferenceAccess(callableReferenceAccess: FirCallableReferenceAccess) {
|
||||
callableReferenceAccess.annotations.renderAnnotations()
|
||||
callableReferenceAccess.explicitReceiver?.accept(this)
|
||||
|
||||
@@ -26,7 +26,7 @@ inline val FirAnnotationCall.classId: ClassId?
|
||||
fun <T> FirConstExpressionImpl(source: FirSourceElement?, kind: FirConstKind<T>, value: T?, diagnostic: FirDiagnostic): FirExpression =
|
||||
value?.let { FirConstExpressionImpl(source, kind, it) } ?: FirErrorExpressionImpl(source, diagnostic)
|
||||
|
||||
inline val FirTypeOperatorCall.argument: FirExpression get() = arguments.first()
|
||||
inline val FirCall.argument: FirExpression get() = arguments.first()
|
||||
|
||||
fun FirExpression.toResolvedCallableReference(): FirResolvedNamedReference? {
|
||||
return (this as? FirQualifiedAccess)?.calleeReference as? FirResolvedNamedReference
|
||||
|
||||
+1
@@ -86,6 +86,7 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
|
||||
val whenBranch = element("WhenBranch", Expression)
|
||||
val qualifiedAccessWithoutCallee = element("QualifiedAccessWithoutCallee", Expression, statement)
|
||||
val qualifiedAccess = element("QualifiedAccess", Expression, qualifiedAccessWithoutCallee, resolvable)
|
||||
val checkNotNullCall = element("CheckNotNullCall", Expression, expression, call, resolvable)
|
||||
|
||||
val arrayOfCall = element("ArrayOfCall", Expression, expression, call)
|
||||
val arraySetCall = element("ArraySetCall", Expression, qualifiedAccess, call)
|
||||
|
||||
+5
@@ -245,6 +245,11 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
defaultNoReceivers()
|
||||
}
|
||||
|
||||
impl(checkNotNullCall) {
|
||||
default("calleeReference", "FirStubReference()")
|
||||
useTypes(stubReferenceType)
|
||||
}
|
||||
|
||||
noImpl(expressionWithSmartcast)
|
||||
|
||||
impl(getClassCall) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
val a1: Byte? = 1.plus(1)
|
||||
val a2: Short? = 1.plus(1)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
val a1: Byte? = 1 + 1
|
||||
val a2: Short? = 1 + 1
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
operator fun Int?.inc() = this!!.inc()
|
||||
|
||||
public fun box() : String {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
class Foo {
|
||||
fun isOk() = true
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
class A() {
|
||||
fun action() = "OK"
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
var flag = true
|
||||
|
||||
fun exit(): Nothing = null!!
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
inline fun exit(): Nothing = null!!
|
||||
|
||||
fun box(): String {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
var flag = true
|
||||
|
||||
object Test {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun exit(): Nothing = null!!
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun exit(): Nothing = null!!
|
||||
|
||||
var x = 0
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun <T> foo(t: T) {
|
||||
t!!
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// FULL_JDK
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun less1(a: Double, b: Double) = a.compareTo(b) == -1
|
||||
|
||||
fun less2(a: Double?, b: Double?) = a!!.compareTo(b!!) == -1
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun equals1(a: Double, b: Double) = a.equals(b)
|
||||
|
||||
fun equals2(a: Double?, b: Double?) = a!!.equals(b!!)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun greater1(a: Double, b: Double) = a > b
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun greater1(a: Float, b: Float) = a > b
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun less1(a: Double, b: Double) = a < b
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun less1(a: Float, b: Float) = a < b
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
val plusZero: Double? = 0.0
|
||||
val minusZero: Double = -0.0
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
val p: Int? = 1;
|
||||
val z: Int? = 2;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
val p: Int? = 1;
|
||||
val z: Int? = 2;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
class Shape(var result: String) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun foo(): Int? = 42
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
val c: Char? = '0'
|
||||
c!!.toInt()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
val s: String? = "abc"
|
||||
val c = s?.get(0)!! - 'b'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
try {
|
||||
if ((null as Int?)!! == 10) return "Fail #1"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
val c: Char? = 'a'
|
||||
if (c!! - 'a' != 0) return "Fail c"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
try {
|
||||
throw Throwable("OK", null)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
val a1: Byte? = 1.unaryMinus()
|
||||
val a2: Short? = 1.unaryMinus()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
val a1: Byte? = -1
|
||||
val a2: Short? = -1
|
||||
|
||||
+18
-68
@@ -3,55 +3,25 @@ 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>'
|
||||
BLOCK type=kotlin.Any origin=EXCLEXCL
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Any? [val]
|
||||
GET_VAR 'a: kotlin.Any? declared in <root>.test1' type=kotlin.Any? origin=null
|
||||
WHEN type=kotlin.Any origin=EXCLEXCL
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.test1' type=kotlin.Any? origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: THROW type=kotlin.Nothing
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: KotlinNullPointerException>#' type=IrErrorType
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.test1' type=kotlin.Any 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 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>'
|
||||
BLOCK type=kotlin.Int origin=EXCLEXCL
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int? [val]
|
||||
CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int? origin=null
|
||||
$this: GET_VAR 'a: kotlin.Any? declared in <root>.test2' type=kotlin.Any? origin=null
|
||||
WHEN type=kotlin.Int origin=EXCLEXCL
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_1: kotlin.Int? [val] declared in <root>.test2' type=kotlin.Int? origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: THROW type=kotlin.Nothing
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: KotlinNullPointerException>#' type=IrErrorType
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_1: kotlin.Int? [val] declared in <root>.test2' type=kotlin.Int origin=null
|
||||
FUN name:test3 visibility:public modality:FINAL <X> (a:X of <root>.test3) returnType:kotlin.Any
|
||||
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
|
||||
<T0>: kotlin.Int
|
||||
arg0: CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int? origin=null
|
||||
$this: GET_VAR 'a: kotlin.Any? declared in <root>.test2' type=kotlin.Any? origin=null
|
||||
FUN name:test3 visibility:public modality:FINAL <X> (a:X of <root>.test3) returnType:X of <root>.test3
|
||||
TYPE_PARAMETER name:X index:0 variance: superTypes:[kotlin.Any?]
|
||||
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): kotlin.Any declared in <root>'
|
||||
BLOCK type=kotlin.Any origin=EXCLEXCL
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:X of <root>.test3 [val]
|
||||
GET_VAR 'a: X of <root>.test3 declared in <root>.test3' type=X of <root>.test3 origin=null
|
||||
WHEN type=kotlin.Any origin=EXCLEXCL
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_2: X of <root>.test3 [val] declared in <root>.test3' type=X of <root>.test3 origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: THROW type=kotlin.Nothing
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: KotlinNullPointerException>#' type=IrErrorType
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_2: X of <root>.test3 [val] declared in <root>.test3' type=kotlin.Any origin=null
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 <X> (a: X of <root>.test3): X of <root>.test3 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
|
||||
<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
|
||||
VALUE_PARAMETER name:s index:0 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
@@ -63,34 +33,14 @@ FILE fqName:<root> fileName:/bangbang.kt
|
||||
BRANCH
|
||||
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: BLOCK type=kotlin.String origin=EXCLEXCL
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.String? [val]
|
||||
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=kotlin.String? origin=null
|
||||
WHEN type=kotlin.String origin=EXCLEXCL
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_3: kotlin.String? [val] declared in <root>.test4' type=kotlin.String? origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: THROW type=kotlin.Nothing
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: KotlinNullPointerException>#' type=IrErrorType
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_3: kotlin.String? [val] declared in <root>.test4' type=kotlin.String 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.String? origin=EXCLEXCL
|
||||
<T0>: kotlin.String
|
||||
arg0: GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=kotlin.String? origin=null
|
||||
WHEN type=kotlin.Unit origin=IF
|
||||
BRANCH
|
||||
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: BLOCK type=kotlin.String origin=EXCLEXCL
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.String? [val]
|
||||
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=kotlin.String? origin=null
|
||||
WHEN type=kotlin.String origin=EXCLEXCL
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_4: kotlin.String? [val] declared in <root>.test4' type=kotlin.String? origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: THROW type=kotlin.Nothing
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: KotlinNullPointerException>#' type=IrErrorType
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_4: kotlin.String? [val] declared in <root>.test4' type=kotlin.String 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
|
||||
<T0>: kotlin.String
|
||||
arg0: GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=kotlin.String? origin=null
|
||||
|
||||
+3
-13
@@ -9,19 +9,9 @@ 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: BLOCK type=kotlin.Nothing origin=EXCLEXCL
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Nothing? [val]
|
||||
CONST Null type=kotlin.Nothing? value=null
|
||||
WHEN type=kotlin.Nothing origin=EXCLEXCL
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_0: kotlin.Nothing? [val] declared in <root>.test' type=kotlin.Nothing? origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: THROW type=kotlin.Nothing
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: KotlinNullPointerException>#' type=IrErrorType
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_0: kotlin.Nothing? [val] declared in <root>.test' type=kotlin.Nothing 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
|
||||
<T0>: kotlin.Nothing
|
||||
arg0: CONST Null type=kotlin.Nothing? value=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'x: kotlin.Any declared in <root>.test' type=kotlin.Double origin=null
|
||||
|
||||
+8
-28
@@ -48,37 +48,17 @@ 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.plusAssign): kotlin.Unit [inline,operator] declared in kotlin.collections' type=kotlin.Unit origin=null
|
||||
<T>: kotlin.Int
|
||||
$receiver: BLOCK type=kotlin.collections.MutableList<kotlin.Int> origin=EXCLEXCL
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.collections.MutableList<kotlin.Int> [val]
|
||||
CALL 'public abstract fun <get-xs> (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Int> origin=null
|
||||
$this: GET_VAR 'nx: <root>.X? declared in <root>.test' type=<root>.X? origin=null
|
||||
WHEN type=kotlin.collections.MutableList<kotlin.Int> origin=EXCLEXCL
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_0: kotlin.collections.MutableList<kotlin.Int> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Int> origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: THROW type=kotlin.Nothing
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.KotlinNullPointerException' type=kotlin.KotlinNullPointerException origin=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_0: kotlin.collections.MutableList<kotlin.Int> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Int> origin=null
|
||||
$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.Int> origin=EXCLEXCL
|
||||
<T0>: kotlin.collections.MutableList<kotlin.Int>
|
||||
arg0: CALL 'public abstract fun <get-xs> (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Int> origin=null
|
||||
$this: GET_VAR 'nx: <root>.X? declared in <root>.test' type=<root>.X? origin=null
|
||||
element: CONST Int type=kotlin.Int value=5
|
||||
CALL 'public final fun plusAssign <T> (element: T of kotlin.collections.plusAssign): kotlin.Unit [inline,operator] declared in kotlin.collections' type=kotlin.Unit origin=null
|
||||
<T>: kotlin.Int
|
||||
$receiver: BLOCK type=kotlin.collections.MutableList<kotlin.Int> origin=EXCLEXCL
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.collections.MutableList<kotlin.Any>? [val]
|
||||
CALL 'public abstract fun f (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Any>? origin=null
|
||||
$this: GET_VAR 'nx: <root>.X? declared in <root>.test' type=<root>.X origin=null
|
||||
WHEN type=kotlin.collections.MutableList<kotlin.Int> origin=EXCLEXCL
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_1: kotlin.collections.MutableList<kotlin.Any>? [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Any>? origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: THROW type=kotlin.Nothing
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.KotlinNullPointerException' type=kotlin.KotlinNullPointerException origin=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_1: kotlin.collections.MutableList<kotlin.Any>? [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Int> origin=null
|
||||
$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
|
||||
<T0>: kotlin.collections.MutableList<kotlin.Any>
|
||||
arg0: CALL 'public abstract fun f (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Any>? origin=null
|
||||
$this: GET_VAR 'nx: <root>.X? declared in <root>.test' type=<root>.X? origin=null
|
||||
element: CONST Int type=kotlin.Int value=6
|
||||
FUN name:testExtensionReceiver visibility:public modality:FINAL <> ($receiver:kotlin.collections.MutableList<kotlin.Any>) returnType:kotlin.Unit
|
||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.MutableList<kotlin.Any>
|
||||
|
||||
Reference in New Issue
Block a user