[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"),
|
FqName("_synthetic"),
|
||||||
Name.identifier("TRY_CALL")
|
Name.identifier("TRY_CALL")
|
||||||
)
|
)
|
||||||
|
val CHECK_NOT_NULL = CallableId(
|
||||||
|
FqName("_synthetic"),
|
||||||
|
Name.identifier("CHECK_NOT_NULL_CALL")
|
||||||
|
)
|
||||||
val ID = CallableId(
|
val ID = CallableId(
|
||||||
FqName("_synthetic"),
|
FqName("_synthetic"),
|
||||||
Name.identifier("ID_CALL")
|
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.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.*
|
import org.jetbrains.kotlin.ir.symbols.*
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.*
|
||||||
import org.jetbrains.kotlin.ir.types.classifierOrFail
|
|
||||||
import org.jetbrains.kotlin.ir.types.classifierOrNull
|
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrErrorTypeImpl
|
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.ir.util.*
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens
|
import org.jetbrains.kotlin.lexer.KtTokens
|
||||||
import org.jetbrains.kotlin.name.ClassId
|
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 {
|
override fun visitGetClassCall(getClassCall: FirGetClassCall, data: Any?): IrElement {
|
||||||
return getClassCall.convertWithOffsets { startOffset, endOffset ->
|
return getClassCall.convertWithOffsets { startOffset, endOffset ->
|
||||||
IrGetClassImpl(
|
IrGetClassImpl(
|
||||||
|
|||||||
+24
-19
@@ -306,28 +306,33 @@ class ExpressionsConverter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val operationToken = operationTokenName.getOperationSymbol()
|
val operationToken = operationTokenName.getOperationSymbol()
|
||||||
if (operationToken == EXCLEXCL) {
|
|
||||||
return argument.bangBangToWhen(null) { getAsFirExpression(this, it) }
|
|
||||||
}
|
|
||||||
|
|
||||||
val conventionCallName = operationToken.toUnaryName()
|
val conventionCallName = operationToken.toUnaryName()
|
||||||
return if (conventionCallName != null) {
|
return when {
|
||||||
if (operationToken in OperatorConventions.INCREMENT_OPERATIONS) {
|
operationToken == EXCLEXCL -> {
|
||||||
return generateIncrementOrDecrementBlock(
|
FirCheckNotNullCallImpl(null).apply {
|
||||||
null,
|
arguments += getAsFirExpression<FirExpression>(argument, "No operand")
|
||||||
argument,
|
}
|
||||||
callName = conventionCallName,
|
|
||||||
prefix = unaryExpression.tokenType == PREFIX_EXPRESSION
|
|
||||||
) { getAsFirExpression(this) }
|
|
||||||
}
|
}
|
||||||
FirFunctionCallImpl(null).apply {
|
conventionCallName != null -> {
|
||||||
calleeReference = FirSimpleNamedReference(null, conventionCallName, null)
|
if (operationToken in OperatorConventions.INCREMENT_OPERATIONS) {
|
||||||
explicitReceiver = getAsFirExpression(argument, "No operand")
|
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 {
|
else -> {
|
||||||
val firOperation = operationToken.toFirOperation()
|
val firOperation = operationToken.toFirOperation()
|
||||||
FirOperatorCallImpl(null, firOperation).apply {
|
FirOperatorCallImpl(null, firOperation).apply {
|
||||||
arguments += getAsFirExpression<FirExpression>(argument, "No operand")
|
arguments += getAsFirExpression<FirExpression>(argument, "No operand")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,18 +167,6 @@ abstract class BaseFirBuilder<T>(val session: FirSession, val context: Context =
|
|||||||
?: emptyList()
|
?: 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 {
|
fun FirAbstractLoop.configure(generateBlock: () -> FirBlock): FirAbstractLoop {
|
||||||
label = context.firLabels.pop()
|
label = context.firLabels.pop()
|
||||||
context.firLoops += this
|
context.firLoops += this
|
||||||
|
|||||||
@@ -1222,28 +1222,33 @@ class RawFirBuilder(session: FirSession, val stubMode: Boolean) : BaseFirBuilder
|
|||||||
override fun visitUnaryExpression(expression: KtUnaryExpression, data: Unit): FirElement {
|
override fun visitUnaryExpression(expression: KtUnaryExpression, data: Unit): FirElement {
|
||||||
val operationToken = expression.operationToken
|
val operationToken = expression.operationToken
|
||||||
val argument = expression.baseExpression
|
val argument = expression.baseExpression
|
||||||
if (operationToken == EXCLEXCL) {
|
|
||||||
return expression.baseExpression.bangBangToWhen(expression) { (this as KtExpression).toFirExpression(it) }
|
|
||||||
}
|
|
||||||
val conventionCallName = operationToken.toUnaryName()
|
val conventionCallName = operationToken.toUnaryName()
|
||||||
return if (conventionCallName != null) {
|
return when {
|
||||||
if (operationToken in OperatorConventions.INCREMENT_OPERATIONS) {
|
operationToken == EXCLEXCL -> {
|
||||||
return generateIncrementOrDecrementBlock(
|
FirCheckNotNullCallImpl(expression.toFirSourceElement()).apply {
|
||||||
expression, argument,
|
arguments += argument.toFirExpression("No operand")
|
||||||
callName = conventionCallName,
|
}
|
||||||
prefix = expression is KtPrefixExpression
|
|
||||||
) { (this as KtExpression).toFirExpression("Incorrect expression inside inc/dec") }
|
|
||||||
}
|
}
|
||||||
FirFunctionCallImpl(expression.toFirSourceElement()).apply {
|
conventionCallName != null -> {
|
||||||
calleeReference = FirSimpleNamedReference(
|
if (operationToken in OperatorConventions.INCREMENT_OPERATIONS) {
|
||||||
expression.operationReference.toFirSourceElement(), conventionCallName, null
|
return generateIncrementOrDecrementBlock(
|
||||||
)
|
expression, argument,
|
||||||
explicitReceiver = argument.toFirExpression("No operand")
|
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 {
|
else -> {
|
||||||
val firOperation = operationToken.toFirOperation()
|
val firOperation = operationToken.toFirOperation()
|
||||||
FirOperatorCallImpl(expression.toFirSourceElement(), firOperation).apply {
|
FirOperatorCallImpl(expression.toFirSourceElement(), firOperation).apply {
|
||||||
arguments += argument.toFirExpression("No operand")
|
arguments += argument.toFirExpression("No operand")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,5 @@ FILE: nullability.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
public? final? fun bang(arg: Int?): <implicit> {
|
public? final? fun bang(arg: Int?): <implicit> {
|
||||||
^bang when (lval <bangbang>: <implicit> = arg#) {
|
^bang arg#!!
|
||||||
==($subj$, Null(null)) -> {
|
|
||||||
throw KotlinNullPointerException#()
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
R|<local>/<bangbang>|
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.FirAnonymousFunctionImpl
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl
|
||||||
import org.jetbrains.kotlin.fir.expressions.*
|
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.FirFunctionCallImpl
|
||||||
import org.jetbrains.kotlin.fir.expressions.impl.FirTryExpressionImpl
|
import org.jetbrains.kotlin.fir.expressions.impl.FirTryExpressionImpl
|
||||||
import org.jetbrains.kotlin.fir.expressions.impl.FirWhenExpressionImpl
|
import org.jetbrains.kotlin.fir.expressions.impl.FirWhenExpressionImpl
|
||||||
@@ -119,4 +120,15 @@ fun FirTryExpression.copy(
|
|||||||
this@apply.catches.addAll(this@copy.catches)
|
this@apply.catches.addAll(this@copy.catches)
|
||||||
this.typeRef = resultType
|
this.typeRef = resultType
|
||||||
this.annotations += annotations
|
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?
|
typeProvider: (FirExpression) -> FirTypeRef?
|
||||||
) {
|
) {
|
||||||
return when (argument) {
|
return when (argument) {
|
||||||
is FirFunctionCall, is FirWhenExpression, is FirTryExpression -> resolveSubCallArgument(
|
is FirFunctionCall, is FirWhenExpression, is FirTryExpression, is FirCheckNotNullCall -> resolveSubCallArgument(
|
||||||
csBuilder,
|
csBuilder,
|
||||||
argument as FirResolvable,
|
argument as FirResolvable,
|
||||||
expectedType,
|
expectedType,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class CandidateFactory(
|
|||||||
|
|
||||||
fun PostponedArgumentsAnalyzer.Context.addSubsystemFromExpression(statement: FirStatement) {
|
fun PostponedArgumentsAnalyzer.Context.addSubsystemFromExpression(statement: FirStatement) {
|
||||||
when (statement) {
|
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()) }
|
(statement as FirResolvable).candidate()?.let { addOtherSystem(it.system.asReadOnlyStorage()) }
|
||||||
is FirWrappedArgumentExpression -> addSubsystemFromExpression(statement.expression)
|
is FirWrappedArgumentExpression -> addSubsystemFromExpression(statement.expression)
|
||||||
is FirBlock -> statement.returnExpressions().forEach { addSubsystemFromExpression(it) }
|
is FirBlock -> statement.returnExpressions().forEach { addSubsystemFromExpression(it) }
|
||||||
|
|||||||
@@ -246,6 +246,11 @@ class ConstraintSystemCompleter(val components: InferenceComponents) {
|
|||||||
catches.forEach { it.block.processAllContainingCallCandidates(processBlocks, processor) }
|
catches.forEach { it.block.processAllContainingCallCandidates(processBlocks, processor) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is FirCheckNotNullCall -> {
|
||||||
|
processCandidateIfApplicable(processor)
|
||||||
|
this.arguments.forEach { it.processAllContainingCallCandidates(processBlocks, processor) }
|
||||||
|
}
|
||||||
|
|
||||||
is FirQualifiedAccessExpression -> {
|
is FirQualifiedAccessExpression -> {
|
||||||
processCandidateIfApplicable(processor)
|
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.render
|
||||||
import org.jetbrains.kotlin.fir.resolve.calls.Candidate
|
import org.jetbrains.kotlin.fir.resolve.calls.Candidate
|
||||||
import org.jetbrains.kotlin.fir.resolve.calls.FirNamedReferenceWithCandidate
|
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.calls.isBuiltinFunctionalType
|
||||||
import org.jetbrains.kotlin.fir.resolve.constructFunctionalTypeRef
|
import org.jetbrains.kotlin.fir.resolve.constructFunctionalTypeRef
|
||||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||||
@@ -52,7 +51,6 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
): CompositeTransformResult<FirStatement> {
|
): CompositeTransformResult<FirStatement> {
|
||||||
val calleeReference =
|
val calleeReference =
|
||||||
qualifiedAccessExpression.calleeReference as? FirNamedReferenceWithCandidate ?: return qualifiedAccessExpression.compose()
|
qualifiedAccessExpression.calleeReference as? FirNamedReferenceWithCandidate ?: return qualifiedAccessExpression.compose()
|
||||||
calleeReference.candidate.substitutor
|
|
||||||
|
|
||||||
val candidateFir = calleeReference.candidateSymbol.phasedFir
|
val candidateFir = calleeReference.candidateSymbol.phasedFir
|
||||||
val typeRef = (candidateFir as? FirTypedDeclaration)?.let {
|
val typeRef = (candidateFir as? FirTypedDeclaration)?.let {
|
||||||
@@ -276,49 +274,38 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
return transformElement(block, data)
|
return transformElement(block, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun transformWhenExpression(whenExpression: FirWhenExpression, data: ExpectedArgumentType?): CompositeTransformResult<FirStatement> {
|
// Transformations for synthetic calls generated by FirSyntheticCallGenerator
|
||||||
val calleeReference = whenExpression.calleeReference as? FirNamedReferenceWithCandidate ?: return whenExpression.compose()
|
|
||||||
|
|
||||||
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)
|
val typeRef = typeCalculator.tryCalculateReturnType(declaration)
|
||||||
|
syntheticCall.replaceTypeRefWithSubstituted(calleeReference, typeRef)
|
||||||
|
|
||||||
whenExpression.resultType = typeRef.substituteTypeRef(subCandidate)
|
return (syntheticCall.transformCalleeReference(
|
||||||
|
|
||||||
return whenExpression.transformCalleeReference(
|
|
||||||
StoreCalleeReference,
|
StoreCalleeReference,
|
||||||
FirResolvedNamedReferenceImpl(
|
FirResolvedNamedReferenceImpl(
|
||||||
calleeReference.source,
|
calleeReference.source,
|
||||||
calleeReference.name,
|
calleeReference.name,
|
||||||
calleeReference.candidateSymbol
|
calleeReference.candidateSymbol
|
||||||
)
|
)
|
||||||
).compose()
|
) as D).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()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <T> transformConstExpression(
|
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.FirSimpleFunctionImpl
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirValueParameterImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirValueParameterImpl
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirCallableReferenceAccess
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
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.impl.FirFunctionCallImpl
|
import org.jetbrains.kotlin.fir.expressions.impl.FirFunctionCallImpl
|
||||||
import org.jetbrains.kotlin.fir.references.FirReference
|
import org.jetbrains.kotlin.fir.references.FirReference
|
||||||
import org.jetbrains.kotlin.fir.references.impl.FirStubReference
|
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.inference.FirCallCompleter
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirAbstractBodyResolveTransformer
|
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.transformers.body.resolve.resultType
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.withNullability
|
||||||
import org.jetbrains.kotlin.fir.symbols.CallableId
|
import org.jetbrains.kotlin.fir.symbols.CallableId
|
||||||
import org.jetbrains.kotlin.fir.symbols.SyntheticCallableId
|
import org.jetbrains.kotlin.fir.symbols.SyntheticCallableId
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||||
@@ -51,6 +49,7 @@ class FirSyntheticCallGenerator(
|
|||||||
private val whenSelectFunction: FirSimpleFunctionImpl = generateSyntheticSelectFunction(SyntheticCallableId.WHEN)
|
private val whenSelectFunction: FirSimpleFunctionImpl = generateSyntheticSelectFunction(SyntheticCallableId.WHEN)
|
||||||
private val trySelectFunction: FirSimpleFunctionImpl = generateSyntheticSelectFunction(SyntheticCallableId.TRY)
|
private val trySelectFunction: FirSimpleFunctionImpl = generateSyntheticSelectFunction(SyntheticCallableId.TRY)
|
||||||
private val idFunction: FirSimpleFunctionImpl = generateSyntheticSelectFunction(SyntheticCallableId.ID)
|
private val idFunction: FirSimpleFunctionImpl = generateSyntheticSelectFunction(SyntheticCallableId.ID)
|
||||||
|
private val checkNotNullFunction: FirSimpleFunctionImpl = generateSyntheticCheckNotNullFunction()
|
||||||
|
|
||||||
fun generateCalleeForWhenExpression(whenExpression: FirWhenExpression): FirWhenExpression? {
|
fun generateCalleeForWhenExpression(whenExpression: FirWhenExpression): FirWhenExpression? {
|
||||||
val stubReference = whenExpression.calleeReference
|
val stubReference = whenExpression.calleeReference
|
||||||
@@ -90,6 +89,19 @@ class FirSyntheticCallGenerator(
|
|||||||
return tryExpression.transformCalleeReference(UpdateReference, reference)
|
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(
|
fun resolveCallableReferenceWithSyntheticOuterCall(
|
||||||
callableReferenceAccess: FirCallableReferenceAccess,
|
callableReferenceAccess: FirCallableReferenceAccess,
|
||||||
expectedTypeRef: FirTypeRef?
|
expectedTypeRef: FirTypeRef?
|
||||||
@@ -140,12 +152,15 @@ class FirSyntheticCallGenerator(
|
|||||||
implicitReceiverStack = implicitReceiverStack
|
implicitReceiverStack = implicitReceiverStack
|
||||||
) { it.resultType }
|
) { 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 functionSymbol = FirSyntheticFunctionSymbol(callableId)
|
||||||
val typeParameterSymbol = FirTypeParameterSymbol()
|
val typeParameterSymbol = FirTypeParameterSymbol()
|
||||||
val typeParameter = FirTypeParameterImpl(null, session, Name.identifier("K"), typeParameterSymbol, Variance.INVARIANT, false).apply {
|
val typeParameter =
|
||||||
addDefaultBoundIfNecessary()
|
FirTypeParameterImpl(null, session, Name.identifier("K"), typeParameterSymbol, Variance.INVARIANT, false).apply {
|
||||||
}
|
addDefaultBoundIfNecessary()
|
||||||
|
}
|
||||||
|
|
||||||
val returnType = FirResolvedTypeRefImpl(null, ConeTypeParameterTypeImpl(typeParameterSymbol.toLookupTag(), false))
|
val returnType = FirResolvedTypeRefImpl(null, ConeTypeParameterTypeImpl(typeParameterSymbol.toLookupTag(), false))
|
||||||
|
|
||||||
@@ -154,7 +169,38 @@ class FirSyntheticCallGenerator(
|
|||||||
|
|
||||||
return generateMemberFunction(session, functionSymbol, callableId.callableName, typeArgument.typeRef).apply {
|
return generateMemberFunction(session, functionSymbol, callableId.callableName, typeArgument.typeRef).apply {
|
||||||
typeParameters += typeParameter
|
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)
|
return expressionsTransformer.transformTypeOperatorCall(typeOperatorCall, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun transformCheckNotNullCall(
|
||||||
|
checkNotNullCall: FirCheckNotNullCall,
|
||||||
|
data: ResolutionMode
|
||||||
|
): CompositeTransformResult<FirStatement> {
|
||||||
|
return expressionsTransformer.transformCheckNotNullCall(checkNotNullCall, data)
|
||||||
|
}
|
||||||
|
|
||||||
override fun transformBinaryLogicExpression(
|
override fun transformBinaryLogicExpression(
|
||||||
binaryLogicExpression: FirBinaryLogicExpression,
|
binaryLogicExpression: FirBinaryLogicExpression,
|
||||||
data: ResolutionMode
|
data: ResolutionMode
|
||||||
|
|||||||
+25
@@ -287,6 +287,31 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) :
|
|||||||
return resolved.transform(integerLiteralTypeApproximator, null)
|
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(
|
override fun transformBinaryLogicExpression(
|
||||||
binaryLogicExpression: FirBinaryLogicExpression,
|
binaryLogicExpression: FirBinaryLogicExpression,
|
||||||
data: ResolutionMode
|
data: ResolutionMode
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
fun <R> materialize(): R = <!UNRESOLVED_REFERENCE!>null!!<!>
|
fun <R> materialize(): R = null!!
|
||||||
|
|
||||||
fun test_1() {
|
fun test_1() {
|
||||||
<!UNRESOLVED_REFERENCE!>myRun<!> {
|
<!UNRESOLVED_REFERENCE!>myRun<!> {
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
FILE: lambdaInUnresolvedCall.kt
|
FILE: lambdaInUnresolvedCall.kt
|
||||||
public final fun <R> materialize(): R|R| {
|
public final fun <R> materialize(): R|R| {
|
||||||
^materialize when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
^materialize Null(null)!!
|
||||||
==($subj$, Null(null)) -> {
|
|
||||||
throw <Unresolved name: KotlinNullPointerException>#()
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
R|<local>/<bangbang>|
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public final fun test_1(): R|kotlin/Unit| {
|
public final fun test_1(): R|kotlin/Unit| {
|
||||||
<Unresolved name: myRun>#(<L> = myRun@fun <anonymous>(): R|kotlin/Int| {
|
<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)
|
open class A1(val x: String)
|
||||||
class B1 : A1(materialize())
|
class B1 : A1(materialize())
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
FILE: delegatingConstructorCall.kt
|
FILE: delegatingConstructorCall.kt
|
||||||
public final fun <K> materialize(): R|K| {
|
public final fun <K> materialize(): R|K| {
|
||||||
^materialize when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
^materialize Null(null)!!
|
||||||
==($subj$, Null(null)) -> {
|
|
||||||
throw <Unresolved name: KotlinNullPointerException>#()
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
R|<local>/<bangbang>|
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public open class A1 : R|kotlin/Any| {
|
public open class A1 : R|kotlin/Any| {
|
||||||
public constructor(x: R|kotlin/String|): R|A1| {
|
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
|
class Result
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,9 @@
|
|||||||
FILE: nestedClassNameClash.kt
|
FILE: nestedClassNameClash.kt
|
||||||
public final fun <T> listOf(): R|kotlin/collections/List<T>| {
|
public final fun <T> listOf(): R|kotlin/collections/List<T>| {
|
||||||
^listOf when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
^listOf Null(null)!!
|
||||||
==($subj$, Null(null)) -> {
|
|
||||||
throw <Unresolved name: KotlinNullPointerException>#()
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
R|<local>/<bangbang>|
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public final fun <T> materialize(): R|T| {
|
public final fun <T> materialize(): R|T| {
|
||||||
^materialize when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
^materialize Null(null)!!
|
||||||
==($subj$, Null(null)) -> {
|
|
||||||
throw <Unresolved name: KotlinNullPointerException>#()
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
R|<local>/<bangbang>|
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public final class Result : R|kotlin/Any| {
|
public final class Result : R|kotlin/Any| {
|
||||||
public constructor(): R|Result| {
|
public constructor(): R|Result| {
|
||||||
|
|||||||
+2
-18
@@ -9,28 +9,12 @@ FILE: inferenceFromCallableReferenceType.kt
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final fun baz(x: R|kotlin/String|): R|kotlin/Int| {
|
public final fun baz(x: R|kotlin/String|): R|kotlin/Int| {
|
||||||
^baz when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
^baz Null(null)!!
|
||||||
==($subj$, Null(null)) -> {
|
|
||||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
R|<local>/<bangbang>|
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||||
^bar when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
^bar Null(null)!!
|
||||||
==($subj$, Null(null)) -> {
|
|
||||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
R|<local>/<bangbang>|
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public final fun main(): R|kotlin/Unit| {
|
public final fun main(): R|kotlin/Unit| {
|
||||||
R|/foo|<R|kotlin/String|, R|kotlin/Int|>(::R|/bar|)
|
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| {
|
public final fun <T, E> baz(x: R|T|): R|E| {
|
||||||
^baz when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
^baz Null(null)!!
|
||||||
==($subj$, Null(null)) -> {
|
|
||||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
R|<local>/<bangbang>|
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public final fun <T, E> bar(x: R|T|): R|E| {
|
public final fun <T, E> bar(x: R|T|): R|E| {
|
||||||
^bar when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
^bar Null(null)!!
|
||||||
==($subj$, Null(null)) -> {
|
|
||||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
R|<local>/<bangbang>|
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public final fun main(): R|kotlin/Unit| {
|
public final fun main(): R|kotlin/Unit| {
|
||||||
R|/foo|(::R|/bar<kotlin/String, kotlin/Int>|)
|
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| {
|
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|) {
|
^A R|/A.A|(R|<local>/b|!!, R|<local>/flag|)
|
||||||
==($subj$, Null(null)) -> {
|
|
||||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
R|<local>/<bangbang>|
|
|
||||||
}
|
|
||||||
}
|
|
||||||
, R|<local>/flag|)
|
|
||||||
}
|
}
|
||||||
public final fun A(c: R|C|, flag: R|kotlin/Boolean| = Boolean(true)): R|A| {
|
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|)
|
^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| {
|
public final fun foo(): R|kotlin/Unit| {
|
||||||
lvar c: R|kotlin/collections/MutableSet<kotlin/String>?| = Null(null)
|
lvar c: R|kotlin/collections/MutableSet<kotlin/String>?| = Null(null)
|
||||||
R|<local>/c| = R|java/util/HashSet.HashSet|<R|kotlin/String|>()
|
R|<local>/c| = R|java/util/HashSet.HashSet|<R|kotlin/String|>()
|
||||||
when (lval <bangbang>: R|java/util/HashSet<kotlin/String>| = R|<local>/c|) {
|
R|<local>/c|!!.R|/d| = R|/produce|<R|T?|>()
|
||||||
==($subj$, Null(null)) -> {
|
|
||||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
R|<local>/<bangbang>|
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.R|/d| = R|/produce|<R|T?|>()
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
fun <T, R> T.also(block: () -> R): R {
|
fun <T, R> T.also(block: () -> R): R {
|
||||||
return <!UNRESOLVED_REFERENCE!>null!!<!>
|
return null!!
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(b: Boolean, a: Int) {
|
fun foo(b: Boolean, a: Int) {
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
FILE: whenAsReceiver.kt
|
FILE: whenAsReceiver.kt
|
||||||
public final fun <T, R> R|T|.also(block: R|() -> R|): R|R| {
|
public final fun <T, R> R|T|.also(block: R|() -> R|): R|R| {
|
||||||
^also when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
|
^also Null(null)!!
|
||||||
==($subj$, Null(null)) -> {
|
|
||||||
throw <Unresolved name: KotlinNullPointerException>#()
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
R|<local>/<bangbang>|
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public final fun foo(b: R|kotlin/Boolean|, a: R|kotlin/Int|): R|kotlin/Unit| {
|
public final fun foo(b: R|kotlin/Boolean|, a: R|kotlin/Int|): R|kotlin/Unit| {
|
||||||
lval x: R|kotlin/Int?| = when (R|<local>/b|) {
|
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.FirWhenBranch
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessWithoutCallee
|
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessWithoutCallee
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess
|
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.FirArrayOfCall
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirArraySetCall
|
import org.jetbrains.kotlin.fir.expressions.FirArraySetCall
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirClassReferenceExpression
|
import org.jetbrains.kotlin.fir.expressions.FirClassReferenceExpression
|
||||||
@@ -396,6 +397,10 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
|
|||||||
return transformElement(qualifiedAccess, data)
|
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> {
|
open fun transformArrayOfCall(arrayOfCall: FirArrayOfCall, data: D): CompositeTransformResult<FirStatement> {
|
||||||
return transformElement(arrayOfCall, data)
|
return transformElement(arrayOfCall, data)
|
||||||
}
|
}
|
||||||
@@ -844,6 +849,10 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
|
|||||||
return transformQualifiedAccess(qualifiedAccess, data)
|
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> {
|
final override fun visitArrayOfCall(arrayOfCall: FirArrayOfCall, data: D): CompositeTransformResult<FirStatement> {
|
||||||
return transformArrayOfCall(arrayOfCall, data)
|
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.FirWhenBranch
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessWithoutCallee
|
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessWithoutCallee
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess
|
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.FirArrayOfCall
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirArraySetCall
|
import org.jetbrains.kotlin.fir.expressions.FirArraySetCall
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirClassReferenceExpression
|
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 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 visitArrayOfCall(arrayOfCall: FirArrayOfCall, data: D): R = visitElement(arrayOfCall, data)
|
||||||
|
|
||||||
open fun visitArraySetCall(arraySetCall: FirArraySetCall, data: D): R = visitElement(arraySetCall, 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.FirWhenBranch
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessWithoutCallee
|
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessWithoutCallee
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess
|
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.FirArrayOfCall
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirArraySetCall
|
import org.jetbrains.kotlin.fir.expressions.FirArraySetCall
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirClassReferenceExpression
|
import org.jetbrains.kotlin.fir.expressions.FirClassReferenceExpression
|
||||||
@@ -394,6 +395,10 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
|
|||||||
visitElement(qualifiedAccess)
|
visitElement(qualifiedAccess)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open fun visitCheckNotNullCall(checkNotNullCall: FirCheckNotNullCall) {
|
||||||
|
visitElement(checkNotNullCall)
|
||||||
|
}
|
||||||
|
|
||||||
open fun visitArrayOfCall(arrayOfCall: FirArrayOfCall) {
|
open fun visitArrayOfCall(arrayOfCall: FirArrayOfCall) {
|
||||||
visitElement(arrayOfCall)
|
visitElement(arrayOfCall)
|
||||||
}
|
}
|
||||||
@@ -842,6 +847,10 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
|
|||||||
visitQualifiedAccess(qualifiedAccess)
|
visitQualifiedAccess(qualifiedAccess)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final override fun visitCheckNotNullCall(checkNotNullCall: FirCheckNotNullCall, data: Nothing?) {
|
||||||
|
visitCheckNotNullCall(checkNotNullCall)
|
||||||
|
}
|
||||||
|
|
||||||
final override fun visitArrayOfCall(arrayOfCall: FirArrayOfCall, data: Nothing?) {
|
final override fun visitArrayOfCall(arrayOfCall: FirArrayOfCall, data: Nothing?) {
|
||||||
visitArrayOfCall(arrayOfCall)
|
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) {
|
override fun visitCallableReferenceAccess(callableReferenceAccess: FirCallableReferenceAccess) {
|
||||||
callableReferenceAccess.annotations.renderAnnotations()
|
callableReferenceAccess.annotations.renderAnnotations()
|
||||||
callableReferenceAccess.explicitReceiver?.accept(this)
|
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 =
|
fun <T> FirConstExpressionImpl(source: FirSourceElement?, kind: FirConstKind<T>, value: T?, diagnostic: FirDiagnostic): FirExpression =
|
||||||
value?.let { FirConstExpressionImpl(source, kind, it) } ?: FirErrorExpressionImpl(source, diagnostic)
|
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? {
|
fun FirExpression.toResolvedCallableReference(): FirResolvedNamedReference? {
|
||||||
return (this as? FirQualifiedAccess)?.calleeReference as? FirResolvedNamedReference
|
return (this as? FirQualifiedAccess)?.calleeReference as? FirResolvedNamedReference
|
||||||
|
|||||||
+1
@@ -86,6 +86,7 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
|
|||||||
val whenBranch = element("WhenBranch", Expression)
|
val whenBranch = element("WhenBranch", Expression)
|
||||||
val qualifiedAccessWithoutCallee = element("QualifiedAccessWithoutCallee", Expression, statement)
|
val qualifiedAccessWithoutCallee = element("QualifiedAccessWithoutCallee", Expression, statement)
|
||||||
val qualifiedAccess = element("QualifiedAccess", Expression, qualifiedAccessWithoutCallee, resolvable)
|
val qualifiedAccess = element("QualifiedAccess", Expression, qualifiedAccessWithoutCallee, resolvable)
|
||||||
|
val checkNotNullCall = element("CheckNotNullCall", Expression, expression, call, resolvable)
|
||||||
|
|
||||||
val arrayOfCall = element("ArrayOfCall", Expression, expression, call)
|
val arrayOfCall = element("ArrayOfCall", Expression, expression, call)
|
||||||
val arraySetCall = element("ArraySetCall", Expression, qualifiedAccess, call)
|
val arraySetCall = element("ArraySetCall", Expression, qualifiedAccess, call)
|
||||||
|
|||||||
+5
@@ -245,6 +245,11 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
|||||||
defaultNoReceivers()
|
defaultNoReceivers()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl(checkNotNullCall) {
|
||||||
|
default("calleeReference", "FirStubReference()")
|
||||||
|
useTypes(stubReferenceType)
|
||||||
|
}
|
||||||
|
|
||||||
noImpl(expressionWithSmartcast)
|
noImpl(expressionWithSmartcast)
|
||||||
|
|
||||||
impl(getClassCall) {
|
impl(getClassCall) {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a1: Byte? = 1.plus(1)
|
val a1: Byte? = 1.plus(1)
|
||||||
val a2: Short? = 1.plus(1)
|
val a2: Short? = 1.plus(1)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a1: Byte? = 1 + 1
|
val a1: Byte? = 1 + 1
|
||||||
val a2: Short? = 1 + 1
|
val a2: Short? = 1 + 1
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
operator fun Int?.inc() = this!!.inc()
|
operator fun Int?.inc() = this!!.inc()
|
||||||
|
|
||||||
public fun box() : String {
|
public fun box() : String {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class Foo {
|
class Foo {
|
||||||
fun isOk() = true
|
fun isOk() = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class A() {
|
class A() {
|
||||||
fun action() = "OK"
|
fun action() = "OK"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
var flag = true
|
var flag = true
|
||||||
|
|
||||||
fun exit(): Nothing = null!!
|
fun exit(): Nothing = null!!
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
inline fun exit(): Nothing = null!!
|
inline fun exit(): Nothing = null!!
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
var flag = true
|
var flag = true
|
||||||
|
|
||||||
object Test {
|
object Test {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun exit(): Nothing = null!!
|
fun exit(): Nothing = null!!
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun exit(): Nothing = null!!
|
fun exit(): Nothing = null!!
|
||||||
|
|
||||||
var x = 0
|
var x = 0
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun <T> foo(t: T) {
|
fun <T> foo(t: T) {
|
||||||
t!!
|
t!!
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// FULL_JDK
|
// FULL_JDK
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun less1(a: Double, b: Double) = a.compareTo(b) == -1
|
fun less1(a: Double, b: Double) = a.compareTo(b) == -1
|
||||||
|
|
||||||
fun less2(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 equals1(a: Double, b: Double) = a.equals(b)
|
||||||
|
|
||||||
fun equals2(a: Double?, b: Double?) = a!!.equals(b!!)
|
fun equals2(a: Double?, b: Double?) = a!!.equals(b!!)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +ProperIeee754Comparisons
|
// !LANGUAGE: +ProperIeee754Comparisons
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
fun greater1(a: Double, b: Double) = a > b
|
fun greater1(a: Double, b: Double) = a > b
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +ProperIeee754Comparisons
|
// !LANGUAGE: +ProperIeee754Comparisons
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
fun greater1(a: Float, b: Float) = a > b
|
fun greater1(a: Float, b: Float) = a > b
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +ProperIeee754Comparisons
|
// !LANGUAGE: +ProperIeee754Comparisons
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
fun less1(a: Double, b: Double) = a < b
|
fun less1(a: Double, b: Double) = a < b
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +ProperIeee754Comparisons
|
// !LANGUAGE: +ProperIeee754Comparisons
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
fun less1(a: Float, b: Float) = a < b
|
fun less1(a: Float, b: Float) = a < b
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val plusZero: Double? = 0.0
|
val plusZero: Double? = 0.0
|
||||||
val minusZero: Double = -0.0
|
val minusZero: Double = -0.0
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
val p: Int? = 1;
|
val p: Int? = 1;
|
||||||
val z: Int? = 2;
|
val z: Int? = 2;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
val p: Int? = 1;
|
val p: Int? = 1;
|
||||||
val z: Int? = 2;
|
val z: Int? = 2;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class Shape(var result: String) {
|
class Shape(var result: String) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun foo(): Int? = 42
|
fun foo(): Int? = 42
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val c: Char? = '0'
|
val c: Char? = '0'
|
||||||
c!!.toInt()
|
c!!.toInt()
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val s: String? = "abc"
|
val s: String? = "abc"
|
||||||
val c = s?.get(0)!! - 'b'
|
val c = s?.get(0)!! - 'b'
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
try {
|
try {
|
||||||
if ((null as Int?)!! == 10) return "Fail #1"
|
if ((null as Int?)!! == 10) return "Fail #1"
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val c: Char? = 'a'
|
val c: Char? = 'a'
|
||||||
if (c!! - 'a' != 0) return "Fail c"
|
if (c!! - 'a' != 0) return "Fail c"
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
try {
|
try {
|
||||||
throw Throwable("OK", null)
|
throw Throwable("OK", null)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a1: Byte? = 1.unaryMinus()
|
val a1: Byte? = 1.unaryMinus()
|
||||||
val a2: Short? = 1.unaryMinus()
|
val a2: Short? = 1.unaryMinus()
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a1: Byte? = -1
|
val a1: Byte? = -1
|
||||||
val a2: Short? = -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?
|
VALUE_PARAMETER name:a index:0 type:kotlin.Any?
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun test1 (a: kotlin.Any?): kotlin.Any declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun test1 (a: kotlin.Any?): kotlin.Any declared in <root>'
|
||||||
BLOCK 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 declared in kotlin.internal.ir' type=kotlin.Any origin=EXCLEXCL
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Any? [val]
|
<T0>: kotlin.Any
|
||||||
GET_VAR 'a: kotlin.Any? declared in <root>.test1' type=kotlin.Any? origin=null
|
arg0: 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
|
|
||||||
FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Any?) returnType:kotlin.Int
|
FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Any?) returnType:kotlin.Int
|
||||||
VALUE_PARAMETER name:a index:0 type:kotlin.Any?
|
VALUE_PARAMETER name:a index:0 type:kotlin.Any?
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun test2 (a: kotlin.Any?): kotlin.Int declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun test2 (a: kotlin.Any?): kotlin.Int declared in <root>'
|
||||||
BLOCK 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 declared in kotlin.internal.ir' type=kotlin.Int origin=EXCLEXCL
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int? [val]
|
<T0>: kotlin.Int
|
||||||
CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int? origin=null
|
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
|
$this: GET_VAR 'a: kotlin.Any? declared in <root>.test2' type=kotlin.Any? origin=null
|
||||||
WHEN type=kotlin.Int origin=EXCLEXCL
|
FUN name:test3 visibility:public modality:FINAL <X> (a:X of <root>.test3) returnType:X of <root>.test3
|
||||||
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
|
|
||||||
TYPE_PARAMETER name:X index:0 variance: superTypes:[kotlin.Any?]
|
TYPE_PARAMETER name:X index:0 variance: superTypes:[kotlin.Any?]
|
||||||
VALUE_PARAMETER name:a index:0 type:X of <root>.test3
|
VALUE_PARAMETER name:a index:0 type:X of <root>.test3
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun test3 <X> (a: X of <root>.test3): kotlin.Any declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun test3 <X> (a: X of <root>.test3): X of <root>.test3 declared in <root>'
|
||||||
BLOCK 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 declared in kotlin.internal.ir' type=X of <root>.test3 origin=EXCLEXCL
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:X of <root>.test3 [val]
|
<T0>: X of <root>.test3
|
||||||
GET_VAR 'a: X of <root>.test3 declared in <root>.test3' type=X of <root>.test3 origin=null
|
arg0: 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
|
|
||||||
FUN name:useString visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit
|
FUN name:useString visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit
|
||||||
VALUE_PARAMETER name:s index:0 type:kotlin.String
|
VALUE_PARAMETER name:s index:0 type:kotlin.String
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
@@ -63,34 +33,14 @@ FILE fqName:<root> fileName:/bangbang.kt
|
|||||||
BRANCH
|
BRANCH
|
||||||
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String?
|
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
|
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
|
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
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.String? [val]
|
<T0>: kotlin.String
|
||||||
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=kotlin.String? origin=null
|
arg0: 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
|
|
||||||
WHEN type=kotlin.Unit origin=IF
|
WHEN type=kotlin.Unit origin=IF
|
||||||
BRANCH
|
BRANCH
|
||||||
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String?
|
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
|
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
|
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
|
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
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.String? [val]
|
<T0>: kotlin.String
|
||||||
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=kotlin.String? origin=null
|
arg0: 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
|
|
||||||
|
|||||||
+3
-13
@@ -9,19 +9,9 @@ FILE fqName:<root> fileName:/eqeqRhsConditionPossiblyAffectingLhs.kt
|
|||||||
BRANCH
|
BRANCH
|
||||||
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double
|
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
|
GET_VAR 'x: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
|
||||||
then: BLOCK 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 declared in kotlin.internal.ir' type=kotlin.Nothing origin=EXCLEXCL
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Nothing? [val]
|
<T0>: kotlin.Nothing
|
||||||
CONST Null type=kotlin.Nothing? value=null
|
arg0: 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
|
|
||||||
BRANCH
|
BRANCH
|
||||||
if: CONST Boolean type=kotlin.Boolean value=true
|
if: CONST Boolean type=kotlin.Boolean value=true
|
||||||
then: GET_VAR 'x: kotlin.Any declared in <root>.test' type=kotlin.Double origin=null
|
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
|
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
|
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
|
<T>: kotlin.Int
|
||||||
$receiver: BLOCK type=kotlin.collections.MutableList<kotlin.Int> 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 declared in kotlin.internal.ir' type=kotlin.collections.MutableList<kotlin.Int> origin=EXCLEXCL
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.collections.MutableList<kotlin.Int> [val]
|
<T0>: kotlin.collections.MutableList<kotlin.Int>
|
||||||
CALL 'public abstract fun <get-xs> (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Int> origin=null
|
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
|
$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
|
|
||||||
element: CONST Int type=kotlin.Int value=5
|
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
|
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
|
<T>: kotlin.Int
|
||||||
$receiver: BLOCK type=kotlin.collections.MutableList<kotlin.Int> 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 declared in kotlin.internal.ir' type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.collections.MutableList<kotlin.Any>? [val]
|
<T0>: kotlin.collections.MutableList<kotlin.Any>
|
||||||
CALL 'public abstract fun f (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Any>? origin=null
|
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
|
$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
|
|
||||||
element: CONST Int type=kotlin.Int value=6
|
element: CONST Int type=kotlin.Int value=6
|
||||||
FUN name:testExtensionReceiver visibility:public modality:FINAL <> ($receiver:kotlin.collections.MutableList<kotlin.Any>) returnType:kotlin.Unit
|
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>
|
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.MutableList<kotlin.Any>
|
||||||
|
|||||||
Reference in New Issue
Block a user