FIR2IR: provide correct origins for arithmetic operators
This commit is contained in:
@@ -17,19 +17,26 @@ import org.jetbrains.kotlin.fir.psi
|
||||
import org.jetbrains.kotlin.fir.references.FirReference
|
||||
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
||||
import org.jetbrains.kotlin.fir.references.FirThisReference
|
||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||
import org.jetbrains.kotlin.fir.references.impl.FirPropertyFromParameterResolvedNamedReference
|
||||
import org.jetbrains.kotlin.fir.resolve.*
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.SyntheticPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.AccessorSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstKind
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.ir.types.IrErrorType
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrErrorTypeImpl
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.KtForExpression
|
||||
import org.jetbrains.kotlin.psi.KtOperationReferenceExpression
|
||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffsetSkippingComments
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
|
||||
internal fun <T : IrElement> FirElement.convertWithOffsets(
|
||||
f: (startOffset: Int, endOffset: Int) -> T
|
||||
@@ -179,4 +186,33 @@ private fun FirTypeRef.collectCallableNamesFromThisAndSupertypes(
|
||||
internal tailrec fun FirCallableSymbol<*>.deepestOverriddenSymbol(): FirCallableSymbol<*> {
|
||||
val overriddenSymbol = overriddenSymbol ?: return this
|
||||
return overriddenSymbol.deepestOverriddenSymbol()
|
||||
}
|
||||
}
|
||||
|
||||
private val nameToOperationConventionOrigin = mutableMapOf(
|
||||
OperatorNameConventions.PLUS to IrStatementOrigin.PLUS,
|
||||
OperatorNameConventions.MINUS to IrStatementOrigin.MINUS,
|
||||
OperatorNameConventions.TIMES to IrStatementOrigin.MUL,
|
||||
OperatorNameConventions.DIV to IrStatementOrigin.DIV,
|
||||
OperatorNameConventions.MOD to IrStatementOrigin.PERC,
|
||||
OperatorNameConventions.REM to IrStatementOrigin.PERC,
|
||||
OperatorNameConventions.RANGE_TO to IrStatementOrigin.RANGE
|
||||
)
|
||||
|
||||
internal fun FirReference.statementOrigin(): IrStatementOrigin? {
|
||||
return when (this) {
|
||||
is FirPropertyFromParameterResolvedNamedReference -> IrStatementOrigin.INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
is FirResolvedNamedReference -> when (resolvedSymbol) {
|
||||
is AccessorSymbol, is SyntheticPropertySymbol -> IrStatementOrigin.GET_PROPERTY
|
||||
is FirNamedFunctionSymbol -> when {
|
||||
resolvedSymbol.callableId.isInvoke() -> IrStatementOrigin.INVOKE
|
||||
source.psi is KtForExpression && resolvedSymbol.callableId.isIteratorNext() -> IrStatementOrigin.FOR_LOOP_NEXT
|
||||
source.psi is KtForExpression && resolvedSymbol.callableId.isIteratorHasNext() -> IrStatementOrigin.FOR_LOOP_HAS_NEXT
|
||||
source.psi is KtForExpression && resolvedSymbol.callableId.isIterator() -> IrStatementOrigin.FOR_LOOP_ITERATOR
|
||||
source.psi is KtOperationReferenceExpression -> nameToOperationConventionOrigin[resolvedSymbol.callableId.callableName]
|
||||
else -> null
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,11 @@ import org.jetbrains.kotlin.fir.expressions.impl.FirUnitExpression
|
||||
import org.jetbrains.kotlin.fir.references.FirReference
|
||||
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
||||
import org.jetbrains.kotlin.fir.references.FirSuperReference
|
||||
import org.jetbrains.kotlin.fir.references.impl.FirPropertyFromParameterResolvedNamedReference
|
||||
import org.jetbrains.kotlin.fir.resolve.*
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.SyntheticPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.isIteratorNext
|
||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.IntegerLiteralTypeApproximationTransformer
|
||||
import org.jetbrains.kotlin.fir.scopes.impl.FirIntegerOperator
|
||||
import org.jetbrains.kotlin.fir.symbols.AccessorSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
@@ -472,24 +471,6 @@ class Fir2IrVisitor(
|
||||
})
|
||||
}
|
||||
|
||||
private fun FirReference.statementOrigin(): IrStatementOrigin? {
|
||||
return when (this) {
|
||||
is FirPropertyFromParameterResolvedNamedReference -> IrStatementOrigin.INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
is FirResolvedNamedReference -> when (resolvedSymbol) {
|
||||
is AccessorSymbol, is SyntheticPropertySymbol -> IrStatementOrigin.GET_PROPERTY
|
||||
is FirNamedFunctionSymbol -> when {
|
||||
resolvedSymbol.callableId.isInvoke() -> IrStatementOrigin.INVOKE
|
||||
source.psi is KtForExpression && resolvedSymbol.callableId.isIteratorNext() -> IrStatementOrigin.FOR_LOOP_NEXT
|
||||
source.psi is KtForExpression && resolvedSymbol.callableId.isIteratorHasNext() -> IrStatementOrigin.FOR_LOOP_HAS_NEXT
|
||||
source.psi is KtForExpression && resolvedSymbol.callableId.isIterator() -> IrStatementOrigin.FOR_LOOP_ITERATOR
|
||||
else -> null
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
private fun FirQualifiedAccess.toIrExpression(typeRef: FirTypeRef): IrExpression {
|
||||
val type = typeRef.toIrType()
|
||||
val symbol = calleeReference.toSymbol(declarationStorage)
|
||||
|
||||
@@ -24,7 +24,7 @@ FILE fqName:<root> fileName:/enumWithMultipleCtors.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A.Y
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun f (): kotlin.String declared in <root>.A.Y'
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS
|
||||
$this: CALL 'public open fun f (): kotlin.String declared in <root>.A' type=kotlin.String origin=null
|
||||
$this: GET_VAR '<this>: <root>.A.Y declared in <root>.A.Y.f' type=<root>.A.Y origin=null
|
||||
other: CONST String type=kotlin.String value="#Y"
|
||||
|
||||
@@ -68,7 +68,7 @@ FILE fqName:<root> fileName:/qualifiedSuperCalls.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.CBoth
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-bar> (): kotlin.Int declared in <root>.CBoth'
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||
$this: CALL 'public open fun <get-bar> (): kotlin.Int declared in <root>.ILeft' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: GET_VAR '<this>: <root>.CBoth declared in <root>.CBoth.<get-bar>' type=<root>.CBoth origin=null
|
||||
other: CALL 'public open fun <get-bar> (): kotlin.Int declared in <root>.IRight' type=kotlin.Int origin=GET_PROPERTY
|
||||
|
||||
@@ -20,8 +20,8 @@ FILE fqName:<root> fileName:/constValInitializers.kt
|
||||
PROPERTY name:I2 visibility:public modality:FINAL [const,val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:I2 type:kotlin.Int visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||
$this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||
$this: CALL 'public final fun <get-I0> (): kotlin.Int declared in <root>' type=kotlin.Int origin=GET_PROPERTY
|
||||
other: CALL 'public final fun <get-I1> (): kotlin.Int declared in <root>' type=kotlin.Int origin=GET_PROPERTY
|
||||
other: CALL 'public final fun <get-I1> (): kotlin.Int declared in <root>' type=kotlin.Int origin=GET_PROPERTY
|
||||
@@ -42,7 +42,7 @@ FILE fqName:<root> fileName:/constValInitializers.kt
|
||||
PROPERTY name:STR2 visibility:public modality:FINAL [const,val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:STR2 type:kotlin.String visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS
|
||||
$this: CONST String type=kotlin.String value="String"
|
||||
other: CONST String type=kotlin.String value="2"
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-STR2> visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||
@@ -53,7 +53,7 @@ FILE fqName:<root> fileName:/constValInitializers.kt
|
||||
PROPERTY name:STR3 visibility:public modality:FINAL [const,val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:STR3 type:kotlin.String visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS
|
||||
$this: CALL 'public final fun <get-STR1> (): kotlin.String declared in <root>' type=kotlin.String origin=GET_PROPERTY
|
||||
other: CALL 'public final fun <get-STR2> (): kotlin.String declared in <root>' type=kotlin.String origin=GET_PROPERTY
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-STR3> visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||
|
||||
@@ -187,7 +187,7 @@ FILE fqName:<root> fileName:/constructor.kt
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (x: kotlin.Int) [primary] declared in <root>.Test4'
|
||||
<T>: <none>
|
||||
x: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
x: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||
$this: GET_VAR 'x: kotlin.Int declared in <root>.Test4.<init>' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'y: kotlin.Int declared in <root>.Test4.<init>' type=kotlin.Int origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ FILE fqName:<root> fileName:/useNextParamInLambda.kt
|
||||
SET_VAR 'var result: kotlin.String [var] declared in <root>.box' type=kotlin.Unit origin=null
|
||||
CONST String type=kotlin.String value="OK"
|
||||
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS
|
||||
$this: CALL 'public final fun f (f1: kotlin.Function0<kotlin.String>, f2: kotlin.Function0<kotlin.String>): kotlin.String declared in <root>' type=kotlin.String origin=null
|
||||
f1: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ FILE fqName:<root> fileName:/differentReceivers.kt
|
||||
PROPERTY name:testOK visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:testOK type:kotlin.String visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS
|
||||
$this: CALL 'public final fun <get-testO> (): kotlin.String declared in <root>' type=kotlin.String origin=GET_PROPERTY
|
||||
other: CALL 'public final fun <get-testK> (): kotlin.String declared in <root>' type=kotlin.String origin=GET_PROPERTY
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testOK> visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ FILE fqName:<root> fileName:/localDifferentReceivers.kt
|
||||
VAR name:testO type:kotlin.String [val]
|
||||
VAR name:testK type:kotlin.String [val]
|
||||
VAR name:testOK type:kotlin.String [val]
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS
|
||||
$this: GET_VAR 'val testO: kotlin.String [val] declared in <root>.box' type=kotlin.String origin=null
|
||||
other: GET_VAR 'val testK: kotlin.String [val] declared in <root>.box' type=kotlin.String origin=null
|
||||
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ FILE fqName:<root> fileName:/memberExtension.kt
|
||||
VALUE_PARAMETER name:p index:1 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun getValue (receiver: kotlin.String, p: kotlin.Any): kotlin.String [operator] declared in <root>.Host.StringDelegate'
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS
|
||||
$this: GET_VAR 'receiver: kotlin.String declared in <root>.Host.StringDelegate.getValue' type=kotlin.String origin=null
|
||||
other: CALL 'public final fun <get-s> (): kotlin.String declared in <root>.Host.StringDelegate' type=kotlin.String origin=GET_PROPERTY
|
||||
$this: GET_VAR '<this>: <root>.Host.StringDelegate declared in <root>.Host.StringDelegate.getValue' type=<root>.Host.StringDelegate origin=null
|
||||
|
||||
@@ -16,8 +16,8 @@ FILE fqName:<root> fileName:/arrayAccess.kt
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.IntArray
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test (a: kotlin.IntArray): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||
$this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||
$this: CALL 'public final fun get (index: kotlin.Int): kotlin.Int [operator] declared in kotlin.IntArray' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'a: kotlin.IntArray declared in <root>.test' type=kotlin.IntArray origin=null
|
||||
index: CONST Int type=kotlin.Int value=0
|
||||
|
||||
@@ -45,7 +45,7 @@ FILE fqName:<root> fileName:/assignments.kt
|
||||
SET_VAR 'var x: kotlin.Int [var] declared in <root>.test1' type=kotlin.Unit origin=null
|
||||
CONST Int type=kotlin.Int value=1
|
||||
SET_VAR 'var x: kotlin.Int [var] declared in <root>.test1' type=kotlin.Unit origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||
$this: GET_VAR 'var x: kotlin.Int [var] declared in <root>.test1' type=kotlin.Int origin=null
|
||||
other: CONST Int type=kotlin.Int value=1
|
||||
FUN name:test2 visibility:public modality:FINAL <> (r:<root>.Ref) returnType:kotlin.Unit
|
||||
|
||||
Vendored
+1
-1
@@ -86,6 +86,6 @@ FILE fqName:test fileName:/boundInnerGenericConstructor.kt
|
||||
CONST String type=kotlin.String value="K"
|
||||
FUNCTION_REFERENCE 'public constructor <init> (a: T of test.Foo, b: P of test.Foo.Inner) [primary] declared in test.Foo.Inner' type=kotlin.reflect.KFunction2<T of test.Foo, kotlin.Any?, test.Foo.Inner<kotlin.Any?>> origin=null reflectionTarget=<same>
|
||||
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in test'
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin' type=kotlin.String origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin' type=kotlin.String origin=PLUS
|
||||
$receiver: ERROR_CALL 'Unresolved reference: <Unresolved name: a>#' type=IrErrorType
|
||||
other: ERROR_CALL 'Unresolved reference: <Unresolved name: b>#' type=IrErrorType
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ FILE fqName:<root> fileName:/for.kt
|
||||
BLOCK type=kotlin.Unit origin=FOR_LOOP
|
||||
VAR FOR_LOOP_ITERATOR name:tmp_3 type:kotlin.collections.IntIterator [val]
|
||||
CALL 'public open fun iterator (): kotlin.collections.IntIterator [operator] declared in kotlin.ranges.IntProgression' type=kotlin.collections.IntIterator origin=null
|
||||
$this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange [operator] declared in kotlin.Int' type=kotlin.ranges.IntRange origin=null
|
||||
$this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange [operator] declared in kotlin.Int' type=kotlin.ranges.IntRange origin=RANGE
|
||||
$this: CONST Int type=kotlin.Int value=1
|
||||
other: CONST Int type=kotlin.Int value=10
|
||||
WHILE label=null origin=FOR_LOOP_INNER_WHILE
|
||||
|
||||
@@ -83,7 +83,7 @@ FILE fqName:<root> fileName:/multipleThisReferences.kt
|
||||
PROPERTY name:xx visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:xx type:kotlin.Int visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||
$this: CALL 'public final fun <get-x> (): kotlin.Int declared in <root>.Outer.Inner' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: GET_VAR '<this>: <root>.Host.test.<no name provided> declared in <root>.Host.test.<no name provided>' type=<root>.Host.test.<no name provided> origin=null
|
||||
other: GET_VAR 'y: kotlin.Int declared in <root>.Host.<init>' type=kotlin.Int origin=null
|
||||
|
||||
@@ -9,7 +9,7 @@ FILE fqName:<root> fileName:/genericSamProjectedOut.kt
|
||||
VALUE_PARAMETER name:it index:0 type:kotlin.String?
|
||||
BLOCK_BODY
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public open fun plus (hello: example.Hello<A of example.SomeJavaClass?>?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=null
|
||||
CALL 'public open fun plus (hello: example.Hello<A of example.SomeJavaClass?>?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=PLUS
|
||||
$this: GET_VAR 'a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: FUN_EXPR type=kotlin.Function1<kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.String?) returnType:kotlin.Unit
|
||||
|
||||
@@ -31,6 +31,6 @@ FILE fqName:<root> fileName:/samConstructors.kt
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (a: kotlin.Int, b: kotlin.Int): kotlin.Int declared in <root>.test4'
|
||||
CALL 'public final fun minus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
CALL 'public final fun minus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MINUS
|
||||
$this: GET_VAR 'a: kotlin.Int declared in <root>.test4.<anonymous>' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test4.<anonymous>' type=kotlin.Int origin=null
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
FILE fqName:<root> fileName:/simpleOperators.kt
|
||||
FUN name:test1 visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test1 (a: kotlin.Int, b: kotlin.Int): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'a: kotlin.Int declared in <root>.test1' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test1' type=kotlin.Int origin=null
|
||||
FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test2 (a: kotlin.Int, b: kotlin.Int): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun minus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'a: kotlin.Int declared in <root>.test2' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test2' type=kotlin.Int origin=null
|
||||
FUN name:test3 visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 (a: kotlin.Int, b: kotlin.Int): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'a: kotlin.Int declared in <root>.test3' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test3' type=kotlin.Int origin=null
|
||||
FUN name:test4 visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test4 (a: kotlin.Int, b: kotlin.Int): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun div (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'a: kotlin.Int declared in <root>.test4' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test4' type=kotlin.Int origin=null
|
||||
FUN name:test5 visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test5 (a: kotlin.Int, b: kotlin.Int): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun rem (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'a: kotlin.Int declared in <root>.test5' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test5' type=kotlin.Int origin=null
|
||||
FUN name:test6 visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.ranges.IntRange
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test6 (a: kotlin.Int, b: kotlin.Int): kotlin.ranges.IntRange declared in <root>'
|
||||
CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange [operator] declared in kotlin.Int' type=kotlin.ranges.IntRange origin=null
|
||||
$this: GET_VAR 'a: kotlin.Int declared in <root>.test6' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test6' type=kotlin.Int origin=null
|
||||
FUN name:test1x visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test1x (a: kotlin.Int, b: kotlin.Int): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'a: kotlin.Int declared in <root>.test1x' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test1x' type=kotlin.Int origin=null
|
||||
FUN name:test2x visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test2x (a: kotlin.Int, b: kotlin.Int): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun minus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'a: kotlin.Int declared in <root>.test2x' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test2x' type=kotlin.Int origin=null
|
||||
FUN name:test3x visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test3x (a: kotlin.Int, b: kotlin.Int): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'a: kotlin.Int declared in <root>.test3x' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test3x' type=kotlin.Int origin=null
|
||||
FUN name:test4x visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test4x (a: kotlin.Int, b: kotlin.Int): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun div (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'a: kotlin.Int declared in <root>.test4x' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test4x' type=kotlin.Int origin=null
|
||||
FUN name:test5x visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test5x (a: kotlin.Int, b: kotlin.Int): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun rem (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'a: kotlin.Int declared in <root>.test5x' type=kotlin.Int origin=null
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test5x' type=kotlin.Int origin=null
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun test1(a: Int, b: Int) = a + b
|
||||
fun test2(a: Int, b: Int) = a - b
|
||||
fun test3(a: Int, b: Int) = a * b
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
FILE fqName:<root> fileName:/stringPlus.kt
|
||||
FUN name:test1 visibility:public modality:FINAL <> (a:kotlin.String, b:kotlin.Any) returnType:kotlin.String
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.String
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test1 (a: kotlin.String, b: kotlin.Any): kotlin.String declared in <root>'
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
$this: GET_VAR 'a: kotlin.String declared in <root>.test1' type=kotlin.String origin=null
|
||||
other: GET_VAR 'b: kotlin.Any declared in <root>.test1' type=kotlin.Any origin=null
|
||||
FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.String, b:kotlin.Int) returnType:kotlin.String
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.String
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test2 (a: kotlin.String, b: kotlin.Int): kotlin.String declared in <root>'
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
$this: CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
$this: GET_VAR 'a: kotlin.String declared in <root>.test2' type=kotlin.String origin=null
|
||||
other: CONST String type=kotlin.String value="+"
|
||||
other: GET_VAR 'b: kotlin.Int declared in <root>.test2' type=kotlin.Int origin=null
|
||||
FUN name:test3 visibility:public modality:FINAL <> (a:kotlin.String, b:kotlin.Int) returnType:kotlin.String
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.String
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 (a: kotlin.String, b: kotlin.Int): kotlin.String declared in <root>'
|
||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
$this: CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
$this: CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null
|
||||
$this: GET_VAR 'a: kotlin.String declared in <root>.test3' type=kotlin.String origin=null
|
||||
other: CONST String type=kotlin.String value="+"
|
||||
other: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'b: kotlin.Int declared in <root>.test3' type=kotlin.Int origin=null
|
||||
other: CONST Int type=kotlin.Int value=1
|
||||
other: GET_VAR 'a: kotlin.String declared in <root>.test3' type=kotlin.String origin=null
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun test1(a: String, b: Any) = a + b
|
||||
fun test2(a: String, b: Int) = a + "+" + b
|
||||
fun test3(a: String, b: Int) = (a + "+") + (b + 1) + a
|
||||
@@ -77,7 +77,7 @@ FILE fqName:<root> fileName:/thisOfGenericOuterClass.kt
|
||||
PROPERTY name:xx visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:xx type:kotlin.Int visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||
$this: CALL 'public final fun <get-x> (): T of <root>.Outer declared in <root>.Outer' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: GET_VAR '<this>: <root>.Outer<kotlin.Int> declared in <root>.test' type=<root>.Outer<kotlin.Int> origin=null
|
||||
other: CALL 'public final fun <get-y> (): kotlin.Int declared in <root>.Outer.Inner' type=kotlin.Int origin=GET_PROPERTY
|
||||
|
||||
@@ -79,7 +79,7 @@ FILE fqName:<root> fileName:/destructuringInLambda.kt
|
||||
CALL 'public final fun component2 (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=null
|
||||
$this: GET_VAR '<destruct>: <root>.A declared in <root>.fn.<anonymous>' type=<root>.A origin=null
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (<destruct>: <root>.A): kotlin.Int declared in <root>.fn'
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||
$this: CONST Int type=kotlin.Int value=42
|
||||
other: GET_VAR 'val y: kotlin.Int [val] declared in <root>.fn.<anonymous>' type=kotlin.Int origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-fn> visibility:public modality:FINAL <> () returnType:kotlin.Function1<<root>.A, kotlin.Int>
|
||||
|
||||
Reference in New Issue
Block a user