FIR: support type inference for assignments, fix related lambda inference
This commit is contained in:
@@ -5,9 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.resolve.calls
|
||||
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirWrappedArgumentExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeSymbol
|
||||
import org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzer
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage
|
||||
@@ -49,9 +47,8 @@ fun PostponedArgumentsAnalyzer.Context.addSubsystemFromExpression(expression: Fi
|
||||
}
|
||||
}
|
||||
|
||||
internal fun FirFunctionCall.candidate(): Candidate? {
|
||||
val callee = this.calleeReference
|
||||
return when (callee) {
|
||||
internal fun FirQualifiedAccess.candidate(): Candidate? {
|
||||
return when (val callee = this.calleeReference) {
|
||||
is FirNamedReferenceWithCandidate -> return callee.candidate
|
||||
else -> null
|
||||
}
|
||||
|
||||
+5
-4
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.resolve.calls
|
||||
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirStatement
|
||||
import org.jetbrains.kotlin.fir.expressions.FirWrappedArgumentExpression
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
@@ -92,7 +93,7 @@ class ConstraintSystemCompleter(val components: InferenceComponents) {
|
||||
fun complete(
|
||||
c: KotlinConstraintSystemCompleter.Context,
|
||||
completionMode: KotlinConstraintSystemCompleter.ConstraintSystemCompletionMode,
|
||||
topLevelAtoms: List<FirExpression>,
|
||||
topLevelAtoms: List<FirStatement>,
|
||||
candidateReturnType: ConeKotlinType,
|
||||
analyze: (PostponedResolvedAtomMarker) -> Unit
|
||||
) {
|
||||
@@ -159,7 +160,7 @@ class ConstraintSystemCompleter(val components: InferenceComponents) {
|
||||
|
||||
private fun analyzePostponeArgumentIfPossible(
|
||||
c: KotlinConstraintSystemCompleter.Context,
|
||||
topLevelAtoms: List<FirExpression>,
|
||||
topLevelAtoms: List<FirStatement>,
|
||||
analyze: (PostponedResolvedAtomMarker) -> Unit
|
||||
): Boolean {
|
||||
for (argument in getOrderedNotAnalyzedPostponedArguments(topLevelAtoms)) {
|
||||
@@ -171,8 +172,8 @@ class ConstraintSystemCompleter(val components: InferenceComponents) {
|
||||
return false
|
||||
}
|
||||
|
||||
private fun getOrderedNotAnalyzedPostponedArguments(topLevelAtoms: List<FirExpression>): List<PostponedResolvedAtomMarker> {
|
||||
fun FirExpression.process(to: MutableList<PostponedResolvedAtomMarker>) {
|
||||
private fun getOrderedNotAnalyzedPostponedArguments(topLevelAtoms: List<FirStatement>): List<PostponedResolvedAtomMarker> {
|
||||
fun FirStatement.process(to: MutableList<PostponedResolvedAtomMarker>) {
|
||||
when (this) {
|
||||
is FirFunctionCall -> {
|
||||
val candidate = (this.calleeReference as? FirNamedReferenceWithCandidate)?.candidate
|
||||
|
||||
+31
-14
@@ -198,7 +198,7 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn
|
||||
access.resultType = typeFromCallee(access)
|
||||
}
|
||||
|
||||
private fun <T> typeFromCallee(access: T): FirResolvedTypeRef where T : FirQualifiedAccess, T : FirExpression {
|
||||
private fun <T> typeFromCallee(access: T): FirResolvedTypeRef where T : FirQualifiedAccess {
|
||||
return when (val newCallee = access.calleeReference) {
|
||||
is FirErrorNamedReference ->
|
||||
FirErrorTypeRefImpl(session, access.psi, newCallee.errorReason)
|
||||
@@ -232,6 +232,12 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn
|
||||
error("WTF ! $symbol")
|
||||
}
|
||||
}
|
||||
is FirThisReference -> {
|
||||
val labelName = newCallee.labelName
|
||||
val types = if (labelName == null) labels.values() else labels[Name.identifier(labelName)]
|
||||
val type = types.lastOrNull() ?: ConeKotlinErrorType("Unresolved this@$labelName")
|
||||
FirResolvedTypeRefImpl(session, null, type, emptyList())
|
||||
}
|
||||
else -> error("Failed to extract type from: $newCallee")
|
||||
}
|
||||
}
|
||||
@@ -402,8 +408,15 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn
|
||||
variableAssignment: FirVariableAssignment,
|
||||
data: Any?
|
||||
): CompositeTransformResult<FirStatement> {
|
||||
val variableAssignment = variableAssignment.transformRValue(this, null)
|
||||
return transformCallee(variableAssignment).compose()
|
||||
val resolvedAssignment = transformCallee(variableAssignment)
|
||||
return if (resolvedAssignment is FirVariableAssignment) {
|
||||
val completeAssignment = completeTypeInference(resolvedAssignment, noExpectedType)
|
||||
val expectedType = typeFromCallee(completeAssignment)
|
||||
completeAssignment.transformRValue(this, expectedType).compose()
|
||||
} else {
|
||||
// This can happen in erroneous code only
|
||||
resolvedAssignment.compose()
|
||||
}
|
||||
}
|
||||
|
||||
override fun transformAnonymousFunction(anonymousFunction: FirAnonymousFunction, data: Any?): CompositeTransformResult<FirDeclaration> {
|
||||
@@ -592,13 +605,15 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn
|
||||
|
||||
data class LambdaResolution(val expectedReturnTypeRef: FirResolvedTypeRef?)
|
||||
|
||||
private fun completeTypeInference(functionCall: FirFunctionCall, expectedTypeRef: FirTypeRef?): FirFunctionCall {
|
||||
val typeRef = typeFromCallee(functionCall)
|
||||
private fun <T : FirQualifiedAccess> completeTypeInference(qualifiedAccess: T, expectedTypeRef: FirTypeRef?): T {
|
||||
val typeRef = typeFromCallee(qualifiedAccess)
|
||||
if (typeRef.type is ConeKotlinErrorType) {
|
||||
functionCall.resultType = typeRef
|
||||
return functionCall
|
||||
if (qualifiedAccess is FirExpression) {
|
||||
qualifiedAccess.resultType = typeRef
|
||||
}
|
||||
return qualifiedAccess
|
||||
}
|
||||
val candidate = functionCall.candidate() ?: return functionCall
|
||||
val candidate = qualifiedAccess.candidate() ?: return qualifiedAccess
|
||||
val initialSubstitutor = candidate.substitutor
|
||||
|
||||
val initialType = initialSubstitutor.substituteOrSelf(typeRef.type)
|
||||
@@ -637,16 +652,18 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
||||
val expectedReturnTypeRef = expectedReturnType?.let { lambdaArgument.returnTypeRef.resolvedTypeFromPrototype(it) }
|
||||
|
||||
val newLambdaExpression = lambdaArgument.copy(
|
||||
receiverTypeRef = receiverType?.let { lambdaArgument.receiverTypeRef!!.resolvedTypeFromPrototype(it) },
|
||||
valueParameters = lambdaArgument.valueParameters.mapIndexed { index, parameter ->
|
||||
parameter.transformReturnTypeRef(StoreType, parameter.returnTypeRef.resolvedTypeFromPrototype(parameters[index]))
|
||||
parameter
|
||||
} + listOfNotNull(itParam),
|
||||
returnTypeRef = lambdaArgument.returnTypeRef.resolvedTypeFromPrototype(rawReturnType)
|
||||
returnTypeRef = expectedReturnTypeRef ?: noExpectedType
|
||||
)
|
||||
|
||||
val expectedReturnTypeRef = expectedReturnType?.let { newLambdaExpression.returnTypeRef.resolvedTypeFromPrototype(it) }
|
||||
replacements[lambdaArgument] =
|
||||
newLambdaExpression.transformSingle(this@FirBodyResolveTransformer, LambdaResolution(expectedReturnTypeRef))
|
||||
|
||||
@@ -656,7 +673,7 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn
|
||||
|
||||
}, { it.resultType }, inferenceComponents)
|
||||
|
||||
completer.complete(candidate.system.asConstraintSystemCompleterContext(), completionMode, listOf(functionCall), initialType) {
|
||||
completer.complete(candidate.system.asConstraintSystemCompleterContext(), completionMode, listOf(qualifiedAccess), initialType) {
|
||||
analyzer.analyze(
|
||||
candidate.system.asPostponedArgumentsAnalyzerContext(),
|
||||
it
|
||||
@@ -664,18 +681,18 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn
|
||||
)
|
||||
}
|
||||
|
||||
functionCall.transformChildren(ReplaceInArguments, replacements.toMap())
|
||||
qualifiedAccess.transformChildren(ReplaceInArguments, replacements.toMap())
|
||||
|
||||
|
||||
if (completionMode == KotlinConstraintSystemCompleter.ConstraintSystemCompletionMode.FULL) {
|
||||
val finalSubstitutor =
|
||||
candidate.system.asReadOnlyStorage().buildAbstractResultingSubstitutor(inferenceComponents.ctx) as ConeSubstitutor
|
||||
return functionCall.transformSingle(
|
||||
return qualifiedAccess.transformSingle(
|
||||
FirCallCompleterTransformer(session, finalSubstitutor, jump),
|
||||
null
|
||||
)
|
||||
}
|
||||
return functionCall
|
||||
return qualifiedAccess
|
||||
}
|
||||
|
||||
override fun transformTryExpression(tryExpression: FirTryExpression, data: Any?): CompositeTransformResult<FirStatement> {
|
||||
|
||||
+32
-2
@@ -5,13 +5,13 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.resolve.transformers
|
||||
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.copy
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction
|
||||
import org.jetbrains.kotlin.fir.declarations.FirCallableMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirStatement
|
||||
import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment
|
||||
import org.jetbrains.kotlin.fir.references.FirResolvedCallableReferenceImpl
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.FirNamedReferenceWithCandidate
|
||||
import org.jetbrains.kotlin.fir.resolve.constructFunctionalTypeRef
|
||||
@@ -23,15 +23,45 @@ import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirResolvedTypeRefImpl
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirTypeProjectionWithVarianceImpl
|
||||
import org.jetbrains.kotlin.fir.visitors.CompositeTransformResult
|
||||
import org.jetbrains.kotlin.fir.visitors.FirTransformer
|
||||
import org.jetbrains.kotlin.fir.visitors.compose
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
object StoreCalleeReference : FirTransformer<FirResolvedCallableReference>() {
|
||||
override fun <E : FirElement> transformElement(element: E, data: FirResolvedCallableReference): CompositeTransformResult<E> {
|
||||
return element.compose()
|
||||
}
|
||||
|
||||
override fun transformResolvedCallableReference(
|
||||
resolvedCallableReference: FirResolvedCallableReference,
|
||||
data: FirResolvedCallableReference
|
||||
): CompositeTransformResult<FirNamedReference> {
|
||||
return data.compose()
|
||||
}
|
||||
}
|
||||
|
||||
class FirCallCompleterTransformer(
|
||||
val session: FirSession,
|
||||
private val finalSubstitutor: ConeSubstitutor,
|
||||
private val typeCalculator: ReturnTypeCalculator
|
||||
) : FirAbstractTreeTransformer() {
|
||||
|
||||
override fun transformVariableAssignment(
|
||||
variableAssignment: FirVariableAssignment,
|
||||
data: Nothing?
|
||||
): CompositeTransformResult<FirStatement> {
|
||||
val calleeReference = variableAssignment.calleeReference as? FirNamedReferenceWithCandidate
|
||||
?: return variableAssignment.compose()
|
||||
return variableAssignment.transformCalleeReference(
|
||||
StoreCalleeReference,
|
||||
FirResolvedCallableReferenceImpl(
|
||||
calleeReference.session,
|
||||
calleeReference.psi,
|
||||
calleeReference.name,
|
||||
calleeReference.coneSymbol
|
||||
)
|
||||
).compose()
|
||||
}
|
||||
|
||||
override fun transformFunctionCall(functionCall: FirFunctionCall, data: Nothing?): CompositeTransformResult<FirStatement> {
|
||||
val calleeReference = functionCall.calleeReference as? FirNamedReferenceWithCandidate ?: return functionCall.compose()
|
||||
|
||||
@@ -7,7 +7,14 @@ var b: MutableSet<String>? = null
|
||||
field = HashSet()
|
||||
}
|
||||
|
||||
var <T> MutableSet<T>.d: T? get() = null
|
||||
set(_) {}
|
||||
|
||||
fun <T> produce(): T = TODO()
|
||||
|
||||
fun foo() {
|
||||
var c: MutableSet<String>? = null
|
||||
c = HashSet()
|
||||
|
||||
c!!.d = produce()
|
||||
}
|
||||
+20
-2
@@ -4,9 +4,27 @@ FILE: hashSet.kt
|
||||
public final var b: R|kotlin/collections/MutableSet<kotlin/String>|? = Null(null)
|
||||
public get(): R|kotlin/collections/MutableSet<kotlin/String>|?
|
||||
public set(_: R|kotlin/collections/MutableSet<kotlin/String>|?): R|kotlin/Unit| {
|
||||
F|/b| = R|java/util/HashSet.HashSet|()
|
||||
F|/b| = R|java/util/HashSet.HashSet|<R|kotlin/String|>()
|
||||
}
|
||||
public final var <T> R|kotlin/collections/MutableSet<T>|.d: R|T|?
|
||||
public get(): R|T|? {
|
||||
^ Null(null)
|
||||
}
|
||||
public set(_: R|T|?): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <T> produce(): R|T| {
|
||||
^produce R|kotlin/TODO|()
|
||||
}
|
||||
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|<local>/c| = R|java/util/HashSet.HashSet|<R|kotlin/String|>()
|
||||
when (lval <bangbang>: R|kotlin/collections/MutableSet<kotlin/String>|? = R|<local>/c|) {
|
||||
==($subj$, Null(null)) -> {
|
||||
throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|()
|
||||
}
|
||||
else -> {
|
||||
R|<local>/<bangbang>|!
|
||||
}
|
||||
}
|
||||
.R|/d| = R|/produce|<R|T|?>()
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ FILE fqName:<root> fileName:/localDelegatedProperties.kt
|
||||
BLOCK_BODY
|
||||
VAR name:x type:IrErrorType [var]
|
||||
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=IrErrorType origin=null
|
||||
CONST Int type=kotlin.Int value=0
|
||||
CONST Int type=IrErrorType value=0
|
||||
VAR name:<unary> type:IrErrorType [val]
|
||||
GET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=IrErrorType origin=null
|
||||
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=IrErrorType origin=null
|
||||
ERROR_CALL 'Unresolved reference: <Ambiguity: inc, [kotlin/inc, kotlin/inc]>#' type=IrErrorType
|
||||
GET_VAR 'val <unary>: IrErrorType [val] declared in <root>.test2' type=IrErrorType origin=null
|
||||
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=IrErrorType origin=null
|
||||
CONST Int type=kotlin.Int value=1
|
||||
CONST Int type=IrErrorType value=1
|
||||
|
||||
@@ -47,25 +47,24 @@ FILE fqName:<root> fileName:/augmentedAssignment2.kt
|
||||
VAR name:a type:<root>.A [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.A' type=<root>.A origin=null
|
||||
SET_VAR 'val a: <root>.A [val] declared in <root>.testVariable' type=<root>.A origin=null
|
||||
CONST String type=kotlin.String value="+="
|
||||
CONST String type=<root>.A value="+="
|
||||
SET_VAR 'val a: <root>.A [val] declared in <root>.testVariable' type=<root>.A origin=null
|
||||
CONST String type=kotlin.String value="-="
|
||||
CONST String type=<root>.A value="-="
|
||||
SET_VAR 'val a: <root>.A [val] declared in <root>.testVariable' type=<root>.A origin=null
|
||||
CONST String type=kotlin.String value="*="
|
||||
CONST String type=<root>.A value="*="
|
||||
SET_VAR 'val a: <root>.A [val] declared in <root>.testVariable' type=<root>.A origin=null
|
||||
CONST String type=kotlin.String value="/="
|
||||
CONST String type=<root>.A value="/="
|
||||
SET_VAR 'val a: <root>.A [val] declared in <root>.testVariable' type=<root>.A origin=null
|
||||
CONST String type=kotlin.String value="*="
|
||||
CONST String type=<root>.A value="*="
|
||||
FUN name:testProperty visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:<root>.A visibility:public [final,static] ' type=<root>.A origin=null
|
||||
value: CONST String type=kotlin.String value="+="
|
||||
value: CONST String type=<root>.A value="+="
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:<root>.A visibility:public [final,static] ' type=<root>.A origin=null
|
||||
value: CONST String type=kotlin.String value="-="
|
||||
value: CONST String type=<root>.A value="-="
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:<root>.A visibility:public [final,static] ' type=<root>.A origin=null
|
||||
value: CONST String type=kotlin.String value="*="
|
||||
value: CONST String type=<root>.A value="*="
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:<root>.A visibility:public [final,static] ' type=<root>.A origin=null
|
||||
value: CONST String type=kotlin.String value="/="
|
||||
value: CONST String type=<root>.A value="/="
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:<root>.A visibility:public [final,static] ' type=<root>.A origin=null
|
||||
value: CONST String type=kotlin.String value="%="
|
||||
|
||||
value: CONST String type=<root>.A value="%="
|
||||
|
||||
+2
-2
@@ -38,11 +38,11 @@ FILE fqName:<root> fileName:/augmentedAssignmentWithExpression.kt
|
||||
VAR name:<complex-set> type:<root>.Host [val]
|
||||
CALL 'public final fun foo (): <root>.Host declared in <root>' type=<root>.Host origin=null
|
||||
SET_VAR 'val <complex-set>: <root>.Host [val] declared in <root>.test3' type=<root>.Host origin=null
|
||||
CONST Int type=kotlin.Int value=1
|
||||
CONST Int type=<root>.Host value=1
|
||||
FUN name:test4 visibility:public modality:FINAL <> (a:kotlin.Function0<<root>.Host>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<<root>.Host>
|
||||
BLOCK_BODY
|
||||
VAR name:<complex-set> type:IrErrorType [val]
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: a>#' type=IrErrorType
|
||||
SET_VAR 'val <complex-set>: IrErrorType [val] declared in <root>.test4' type=IrErrorType origin=null
|
||||
CONST Int type=kotlin.Int value=1
|
||||
CONST Int type=IrErrorType value=1
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ FILE fqName:<root> fileName:/kt16904.kt
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Test1
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:<root>.B visibility:public [final] ' type=<root>.B origin=null
|
||||
value: CONST Int type=kotlin.Int value=42
|
||||
value: CONST Int type=<root>.B value=42
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:public ' type=kotlin.Int origin=null
|
||||
value: CONST Int type=kotlin.Int value=42
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
|
||||
+5
-5
@@ -29,19 +29,19 @@ FILE fqName:<root> fileName:/kt30020.kt
|
||||
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 'x: <root>.X declared in <root>.test' type=<root>.X origin=null
|
||||
SET_VAR 'val <complex-set>: kotlin.collections.MutableList<kotlin.Any> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Any> origin=null
|
||||
CONST Int type=kotlin.Int value=2
|
||||
CONST Int type=kotlin.collections.MutableList<kotlin.Any> value=2
|
||||
VAR name:<complex-set> type:kotlin.collections.MutableList<kotlin.Int> [val]
|
||||
TYPE_OP type=kotlin.collections.MutableList<kotlin.Int> origin=CAST typeOperand=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.Any> origin=null
|
||||
$this: GET_VAR 'x: <root>.X declared in <root>.test' type=<root>.X origin=null
|
||||
SET_VAR 'val <complex-set>: kotlin.collections.MutableList<kotlin.Int> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Int> origin=null
|
||||
CONST Int type=kotlin.Int value=3
|
||||
CONST Int type=kotlin.collections.MutableList<kotlin.Int> value=3
|
||||
VAR name:<complex-set> type:kotlin.collections.MutableList<kotlin.Int> [val]
|
||||
TYPE_OP type=kotlin.collections.MutableList<kotlin.Int> origin=CAST typeOperand=kotlin.collections.MutableList<kotlin.Int>
|
||||
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 'x: <root>.X declared in <root>.test' type=<root>.X origin=null
|
||||
SET_VAR 'val <complex-set>: kotlin.collections.MutableList<kotlin.Int> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Int> origin=null
|
||||
CONST Int type=kotlin.Int value=4
|
||||
CONST Int type=kotlin.collections.MutableList<kotlin.Int> value=4
|
||||
VAR name:<complex-set> type:kotlin.collections.MutableList<kotlin.Any> [val]
|
||||
BLOCK type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
|
||||
VAR name:<bangbang> type:kotlin.collections.MutableList<kotlin.Any>? [val]
|
||||
@@ -58,7 +58,7 @@ FILE fqName:<root> fileName:/kt30020.kt
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val <bangbang>: kotlin.collections.MutableList<kotlin.Any>? [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Any>? origin=null
|
||||
SET_VAR 'val <complex-set>: kotlin.collections.MutableList<kotlin.Any> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Any> origin=null
|
||||
CONST Int type=kotlin.Int value=5
|
||||
CONST Int type=kotlin.collections.MutableList<kotlin.Any> value=5
|
||||
VAR name:<complex-set> type:kotlin.collections.MutableList<kotlin.Any> [val]
|
||||
BLOCK type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
|
||||
VAR name:<bangbang> type:kotlin.collections.MutableList<kotlin.Any> [val]
|
||||
@@ -75,7 +75,7 @@ FILE fqName:<root> fileName:/kt30020.kt
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val <bangbang>: kotlin.collections.MutableList<kotlin.Any> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Any> origin=null
|
||||
SET_VAR 'val <complex-set>: kotlin.collections.MutableList<kotlin.Any> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Any> origin=null
|
||||
CONST Int type=kotlin.Int value=6
|
||||
CONST Int type=kotlin.collections.MutableList<kotlin.Any> value=6
|
||||
FUN name:testExtensionReceiver visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: this#' type=IrErrorType
|
||||
|
||||
@@ -42,5 +42,4 @@ FILE fqName:<root> fileName:/safeAssignment.kt
|
||||
VALUE_PARAMETER name:nc index:0 type:<root>.C?
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public ' type=kotlin.Int origin=null
|
||||
value: CONST Int type=kotlin.Int value=42
|
||||
|
||||
value: CONST Int type=kotlin.Int? value=42
|
||||
|
||||
@@ -81,7 +81,7 @@ FILE fqName:<root> fileName:/safeCalls.kt
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.Ref?
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Int visibility:public ' type=kotlin.Int origin=null
|
||||
value: CONST Int type=kotlin.Int value=0
|
||||
value: CONST Int type=kotlin.Int? value=0
|
||||
FUN name:test5 visibility:public modality:FINAL <> (s:kotlin.String?) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:s index:0 type:kotlin.String?
|
||||
BLOCK_BODY
|
||||
|
||||
@@ -83,25 +83,25 @@ FILE fqName:<root> fileName:/multipleImplicitReceivers.kt
|
||||
VALUE_PARAMETER name:fooImpl index:0 type:<root>.IFoo
|
||||
VALUE_PARAMETER name:invokeImpl index:1 type:<root>.IInvoke
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun with (receiver: T of <uninitialized parent>, block: kotlin.Function1<T of <uninitialized parent>, R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
CALL 'public final fun with (receiver: T of <uninitialized parent>, block: kotlin.Function1<T of <uninitialized parent>, R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Unit origin=null
|
||||
receiver: GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.A
|
||||
block: BLOCK type=kotlin.Function2<<root>.A, <root>.A, kotlin.Nothing> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.A) returnType:kotlin.Nothing
|
||||
block: BLOCK type=kotlin.Function2<<root>.A, <root>.A, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.A) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:<root>.A
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun with (receiver: T of <uninitialized parent>, block: kotlin.Function1<T of <uninitialized parent>, R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
CALL 'public final fun with (receiver: T of <uninitialized parent>, block: kotlin.Function1<T of <uninitialized parent>, R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Unit origin=null
|
||||
receiver: GET_VAR 'fooImpl: <root>.IFoo declared in <root>.test' type=<root>.IFoo origin=null
|
||||
block: BLOCK type=kotlin.Function2<<root>.IFoo, <root>.IFoo, kotlin.Nothing> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.IFoo) returnType:kotlin.Nothing
|
||||
block: BLOCK type=kotlin.Function2<<root>.IFoo, <root>.IFoo, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.IFoo) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:<root>.IFoo
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun with (receiver: T of <uninitialized parent>, block: kotlin.Function1<T of <uninitialized parent>, R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
CALL 'public final fun with (receiver: T of <uninitialized parent>, block: kotlin.Function1<T of <uninitialized parent>, R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Unit origin=null
|
||||
receiver: GET_VAR 'invokeImpl: <root>.IInvoke declared in <root>.test' type=<root>.IInvoke origin=null
|
||||
block: BLOCK type=kotlin.Function2<<root>.IInvoke, <root>.IInvoke, kotlin.Nothing> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.IInvoke) returnType:kotlin.Nothing
|
||||
block: BLOCK type=kotlin.Function2<<root>.IInvoke, <root>.IInvoke, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.IInvoke) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:<root>.IInvoke
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: foo>#' type=IrErrorType
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (it: <root>.IInvoke): kotlin.Nothing declared in <root>.test.<anonymous>.<anonymous>' type=kotlin.Function2<<root>.IInvoke, <root>.IInvoke, kotlin.Nothing> origin=LAMBDA
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (it: <root>.IFoo): kotlin.Nothing declared in <root>.test.<anonymous>' type=kotlin.Function2<<root>.IFoo, <root>.IFoo, kotlin.Nothing> origin=LAMBDA
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (it: <root>.A): kotlin.Nothing declared in <root>.test' type=kotlin.Function2<<root>.A, <root>.A, kotlin.Nothing> origin=LAMBDA
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (it: <root>.IInvoke): kotlin.Unit declared in <root>.test.<anonymous>.<anonymous>' type=kotlin.Function2<<root>.IInvoke, <root>.IInvoke, kotlin.Unit> origin=LAMBDA
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (it: <root>.IFoo): kotlin.Unit declared in <root>.test.<anonymous>' type=kotlin.Function2<<root>.IFoo, <root>.IFoo, kotlin.Unit> origin=LAMBDA
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (it: <root>.A): kotlin.Unit declared in <root>.test' type=kotlin.Function2<<root>.A, <root>.A, kotlin.Unit> origin=LAMBDA
|
||||
|
||||
+24
-24
@@ -1,45 +1,45 @@
|
||||
FILE fqName:<root> fileName:/nonLocalReturn.kt
|
||||
FUN name:test0 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun run (block: kotlin.Function0<R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
block: BLOCK type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Nothing
|
||||
CALL 'public final fun run (block: kotlin.Function0<R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Unit origin=null
|
||||
block: BLOCK type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Nothing declared in <root>.test0'
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.test0'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (): kotlin.Nothing declared in <root>.test0' type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (): kotlin.Unit declared in <root>.test0' type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun run (block: kotlin.Function0<R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
block: BLOCK type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Nothing
|
||||
CALL 'public final fun run (block: kotlin.Function0<R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Unit origin=null
|
||||
block: BLOCK type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Nothing declared in <root>.test1'
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.test1'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (): kotlin.Nothing declared in <root>.test1' type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (): kotlin.Unit declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun run (block: kotlin.Function0<R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
block: BLOCK type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Nothing
|
||||
CALL 'public final fun run (block: kotlin.Function0<R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Unit origin=null
|
||||
block: BLOCK type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Nothing declared in <root>.test2'
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.test2'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (): kotlin.Nothing declared in <root>.test2' type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (): kotlin.Unit declared in <root>.test2' type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun run (block: kotlin.Function0<R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
block: BLOCK type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Nothing
|
||||
CALL 'public final fun run (block: kotlin.Function0<R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Unit origin=null
|
||||
block: BLOCK type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun run (block: kotlin.Function0<R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
block: BLOCK type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Nothing
|
||||
CALL 'public final fun run (block: kotlin.Function0<R of <uninitialized parent>>): R of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Unit origin=null
|
||||
block: BLOCK type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Nothing declared in <root>.test3.<anonymous>'
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.test3.<anonymous>'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (): kotlin.Nothing declared in <root>.test3.<anonymous>' type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (): kotlin.Nothing declared in <root>.test3' type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (): kotlin.Unit declared in <root>.test3.<anonymous>' type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUNCTION_REFERENCE 'local final fun <anonymous> (): kotlin.Unit declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN name:testLrmFoo1 visibility:public modality:FINAL <> (ints:kotlin.collections.List<kotlin.Int>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:ints index:0 type:kotlin.collections.List<kotlin.Int>
|
||||
BLOCK_BODY
|
||||
|
||||
Reference in New Issue
Block a user