FIR2IR: make sources of qualified accesses & calls closer to PSI2IR
#KT-60111 Fixed
This commit is contained in:
committed by
Space Team
parent
7c66a3dc65
commit
b7b7dd1000
@@ -31,8 +31,7 @@ class ConstValueProviderImpl(
|
|||||||
if (firExpression is FirVarargArgumentsExpression) return null
|
if (firExpression is FirVarargArgumentsExpression) return null
|
||||||
|
|
||||||
val fileName = firFile.packageFqName.child(Name.identifier(firFile.name)).asString()
|
val fileName = firFile.packageFqName.child(Name.identifier(firFile.name)).asString()
|
||||||
return if (firExpression is FirQualifiedAccessExpression) {
|
return if (firExpression is FirQualifiedAccessExpression && firExpression.shouldUseCalleeReferenceAsItsSourceInIr()) {
|
||||||
// TODO check that this behavior is expected in ConversionUtils and if not fix it
|
|
||||||
val calleeReference = firExpression.calleeReference
|
val calleeReference = firExpression.calleeReference
|
||||||
val start = calleeReference.source?.startOffsetSkippingComments() ?: calleeReference.source?.startOffset ?: UNDEFINED_OFFSET
|
val start = calleeReference.source?.startOffsetSkippingComments() ?: calleeReference.source?.startOffset ?: UNDEFINED_OFFSET
|
||||||
val end = firExpression.source?.endOffset ?: return null
|
val end = firExpression.source?.endOffset ?: return null
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ import org.jetbrains.kotlin.ir.symbols.*
|
|||||||
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
|
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
|
||||||
import org.jetbrains.kotlin.ir.types.*
|
import org.jetbrains.kotlin.ir.types.*
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrErrorTypeImpl
|
import org.jetbrains.kotlin.ir.types.impl.IrErrorTypeImpl
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens
|
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.name.SpecialNames
|
import org.jetbrains.kotlin.name.SpecialNames
|
||||||
import org.jetbrains.kotlin.name.StandardClassIds
|
import org.jetbrains.kotlin.name.StandardClassIds
|
||||||
@@ -97,7 +96,28 @@ internal inline fun <T : IrElement> KtSourceElement?.convertWithOffsets(f: (star
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal inline fun <T : IrElement> FirQualifiedAccessExpression.convertWithOffsets(f: (startOffset: Int, endOffset: Int) -> T): T {
|
internal inline fun <T : IrElement> FirQualifiedAccessExpression.convertWithOffsets(f: (startOffset: Int, endOffset: Int) -> T): T {
|
||||||
return convertWithOffsets(this.calleeReference, f)
|
if (shouldUseCalleeReferenceAsItsSourceInIr()) {
|
||||||
|
return convertWithOffsets(calleeReference, f)
|
||||||
|
}
|
||||||
|
return (this as FirElement).convertWithOffsets(f)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function determines which source should be used for IR counterpart of this FIR expression.
|
||||||
|
*
|
||||||
|
* At the moment, this function reproduces (~) K1 logic.
|
||||||
|
* Currently, K1 uses full qualified expression source (from receiver to selector)
|
||||||
|
* in case of an operator call, an infix call, a callable reference, or a referenced class/object.
|
||||||
|
* Otherwise, only selector is used as a source.
|
||||||
|
*
|
||||||
|
* See also KT-60111 about an operator call case (xxx + yyy).
|
||||||
|
*/
|
||||||
|
fun FirQualifiedAccessExpression.shouldUseCalleeReferenceAsItsSourceInIr(): Boolean {
|
||||||
|
return when {
|
||||||
|
this is FirFunctionCall && origin != FirFunctionCallOrigin.Regular -> false
|
||||||
|
this is FirCallableReferenceAccess -> false
|
||||||
|
else -> (calleeReference as? FirResolvedNamedReference)?.resolvedSymbol is FirCallableSymbol
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal inline fun <T : IrElement> FirThisReceiverExpression.convertWithOffsets(f: (startOffset: Int, endOffset: Int) -> T): T {
|
internal inline fun <T : IrElement> FirThisReceiverExpression.convertWithOffsets(f: (startOffset: Int, endOffset: Int) -> T): T {
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ const val methodName = A::foo.<!EVALUATED("foo")!>name<!>
|
|||||||
const val suspendMethodName = A::bar.<!EVALUATED("bar")!>name<!>
|
const val suspendMethodName = A::bar.<!EVALUATED("bar")!>name<!>
|
||||||
const val className = ::A.<!EVALUATED("<init>")!>name<!>
|
const val className = ::A.<!EVALUATED("<init>")!>name<!>
|
||||||
const val topLevelPropName = ::topLevelProp.<!EVALUATED("topLevelProp")!>name<!>
|
const val topLevelPropName = ::topLevelProp.<!EVALUATED("topLevelProp")!>name<!>
|
||||||
const val nameInComplexExpression = A::OK.name <!EVALUATED("OK!")!>+ "!"<!>
|
const val nameInComplexExpression = <!EVALUATED("OK!")!>A::OK.name + "!"<!>
|
||||||
|
|
||||||
// STOP_EVALUATION_CHECKS
|
// STOP_EVALUATION_CHECKS
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -31,7 +31,7 @@ class A {
|
|||||||
val insideStringConcat = "${temp::b.<!EVALUATED("b")!>name<!>}"
|
val insideStringConcat = "${temp::b.<!EVALUATED("b")!>name<!>}"
|
||||||
|
|
||||||
val complexExpression1 = A()::a.<!EVALUATED("a")!>name<!> + A()::b.<!EVALUATED("b")!>name<!>
|
val complexExpression1 = A()::a.<!EVALUATED("a")!>name<!> + A()::b.<!EVALUATED("b")!>name<!>
|
||||||
val complexExpression2 = A::a.name <!EVALUATED("ab")!>+ A::b.name<!>
|
val complexExpression2 = <!EVALUATED("ab")!>A::a.name + A::b.name<!>
|
||||||
|
|
||||||
var recursive = ::test.<!EVALUATED("test")!>name<!>
|
var recursive = ::test.<!EVALUATED("test")!>name<!>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ public @interface ComponentScan {
|
|||||||
@ComponentScans(
|
@ComponentScans(
|
||||||
value = [
|
value = [
|
||||||
ComponentScan(
|
ComponentScan(
|
||||||
a = ["String" <!EVALUATED("StringA")!>+ "A"<!>],
|
a = [<!EVALUATED("StringA")!>"String" + "A"<!>],
|
||||||
c = ["String" <!EVALUATED("StringC")!>+ "C"<!>],
|
c = [<!EVALUATED("StringC")!>"String" + "C"<!>],
|
||||||
b = ["String" <!EVALUATED("StringB")!>+ "B"<!>],
|
b = [<!EVALUATED("StringB")!>"String" + "B"<!>],
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -53,9 +53,9 @@ annotation class KtComponentScan(
|
|||||||
@ComponentScans(
|
@ComponentScans(
|
||||||
value = [
|
value = [
|
||||||
ComponentScan(
|
ComponentScan(
|
||||||
a = ["String" <!EVALUATED("StringA")!>+ "A"<!>],
|
a = [<!EVALUATED("StringA")!>"String" + "A"<!>],
|
||||||
c = ["String" <!EVALUATED("StringC")!>+ "C"<!>],
|
c = [<!EVALUATED("StringC")!>"String" + "C"<!>],
|
||||||
b = ["String" <!EVALUATED("StringB")!>+ "B"<!>],
|
b = [<!EVALUATED("StringB")!>"String" + "B"<!>],
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-2
@@ -17,10 +17,10 @@ annotation class AnnotationWithAnnotation(val anno: Annotation)
|
|||||||
@Retention(AnnotationRetention.BINARY)
|
@Retention(AnnotationRetention.BINARY)
|
||||||
annotation class AnnotationWithAnnotationWithAnnotation(val anno: AnnotationWithAnnotation)
|
annotation class AnnotationWithAnnotationWithAnnotation(val anno: AnnotationWithAnnotation)
|
||||||
|
|
||||||
@AnnotationWithAnnotation(Annotation("Str" <!EVALUATED("String")!>+ "ing"<!>))
|
@AnnotationWithAnnotation(Annotation(<!EVALUATED("String")!>"Str" + "ing"<!>))
|
||||||
class A
|
class A
|
||||||
|
|
||||||
@AnnotationWithAnnotationWithAnnotation(AnnotationWithAnnotation(Annotation("Str" <!EVALUATED("String")!>+ "ing"<!>)))
|
@AnnotationWithAnnotationWithAnnotation(AnnotationWithAnnotation(Annotation(<!EVALUATED("String")!>"Str" + "ing"<!>)))
|
||||||
class B
|
class B
|
||||||
|
|
||||||
// MODULE: main
|
// MODULE: main
|
||||||
|
|||||||
Vendored
+19
-19
@@ -28,29 +28,29 @@ annotation class BinaryAnnotation(val str: String)
|
|||||||
|
|
||||||
// 1. CLASS
|
// 1. CLASS
|
||||||
// 8. CONSTRUCTOR
|
// 8. CONSTRUCTOR
|
||||||
@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>)
|
@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>)
|
||||||
class A @BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>) constructor(val i: Int) {
|
class A @BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>) constructor(val i: Int) {
|
||||||
@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>) constructor() : this(0)
|
@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>) constructor() : this(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. ANNOTATION_CLASS
|
// 2. ANNOTATION_CLASS
|
||||||
@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>)
|
@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>)
|
||||||
annotation class Anno
|
annotation class Anno
|
||||||
|
|
||||||
// 3. TYPE_PARAMETER
|
// 3. TYPE_PARAMETER
|
||||||
fun <@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>) T, U> fooWithTypeParam(a: T, b: U) {}
|
fun <@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>) T, U> fooWithTypeParam(a: T, b: U) {}
|
||||||
|
|
||||||
// 4. PROPERTY
|
// 4. PROPERTY
|
||||||
@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>)
|
@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>)
|
||||||
val prop: Int = 0
|
val prop: Int = 0
|
||||||
|
|
||||||
// 5. FIELD
|
// 5. FIELD
|
||||||
enum class SomeEnum {
|
enum class SomeEnum {
|
||||||
@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>) A,
|
@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>) A,
|
||||||
B;
|
B;
|
||||||
}
|
}
|
||||||
|
|
||||||
@field:BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>)
|
@field:BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>)
|
||||||
var x: Int = 5
|
var x: Int = 5
|
||||||
|
|
||||||
object Delegate {
|
object Delegate {
|
||||||
@@ -58,42 +58,42 @@ object Delegate {
|
|||||||
operator fun setValue(instance: Any?, property: Any, value: String) {}
|
operator fun setValue(instance: Any?, property: Any, value: String) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@delegate:BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>)
|
@delegate:BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>)
|
||||||
val p: String by Delegate
|
val p: String by Delegate
|
||||||
|
|
||||||
|
|
||||||
// 7. VALUE_PARAMETER
|
// 7. VALUE_PARAMETER
|
||||||
fun @receiver:BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>) String.myExtension() { }
|
fun @receiver:BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>) String.myExtension() { }
|
||||||
fun foo(@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>) a: Int) { }
|
fun foo(@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>) a: Int) { }
|
||||||
|
|
||||||
val @receiver:BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>) String.a: Int
|
val @receiver:BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>) String.a: Int
|
||||||
get() = 0
|
get() = 0
|
||||||
|
|
||||||
class WithConstructorArgumentAnnotation(
|
class WithConstructorArgumentAnnotation(
|
||||||
@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>)
|
@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>)
|
||||||
val a: Int
|
val a: Int
|
||||||
)
|
)
|
||||||
|
|
||||||
@setparam:BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>)
|
@setparam:BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>)
|
||||||
var setParamProp: Int = 0
|
var setParamProp: Int = 0
|
||||||
get() = field + 1
|
get() = field + 1
|
||||||
set(x: Int) { field = x * 2 }
|
set(x: Int) { field = x * 2 }
|
||||||
|
|
||||||
var mutablePropWithAnnotationOnSetterParam = 0
|
var mutablePropWithAnnotationOnSetterParam = 0
|
||||||
set(@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>) x: Int) { field = x * 2 }
|
set(@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>) x: Int) { field = x * 2 }
|
||||||
|
|
||||||
// 9. FUNCTION
|
// 9. FUNCTION
|
||||||
@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>)
|
@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>)
|
||||||
fun bar() {}
|
fun bar() {}
|
||||||
|
|
||||||
// 10. PROPERTY_GETTER
|
// 10. PROPERTY_GETTER
|
||||||
// 11. PROPERTY_SETTER
|
// 11. PROPERTY_SETTER
|
||||||
var b: Int
|
var b: Int
|
||||||
@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>) get() = 0
|
@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>) get() = 0
|
||||||
@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>) set(value) {}
|
@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>) set(value) {}
|
||||||
|
|
||||||
// 15. TYPEALIAS
|
// 15. TYPEALIAS
|
||||||
@BinaryAnnotation("Str" <!EVALUATED("String")!>+ "ing"<!>)
|
@BinaryAnnotation(<!EVALUATED("String")!>"Str" + "ing"<!>)
|
||||||
typealias C = Int
|
typealias C = Int
|
||||||
|
|
||||||
// MODULE: main
|
// MODULE: main
|
||||||
|
|||||||
+2
-2
@@ -13,10 +13,10 @@ annotation class AnnotationWithVararg(vararg val array: String)
|
|||||||
@Retention(AnnotationRetention.BINARY)
|
@Retention(AnnotationRetention.BINARY)
|
||||||
annotation class AnnotationWithArray(val array: Array<String>)
|
annotation class AnnotationWithArray(val array: Array<String>)
|
||||||
|
|
||||||
@AnnotationWithVararg("Str" <!EVALUATED("String")!>+ "ing"<!>, <!EVALUATED("String2")!>"String2"<!>, <!EVALUATED("String3")!>"String${3}"<!>)
|
@AnnotationWithVararg(<!EVALUATED("String")!>"Str" + "ing"<!>, <!EVALUATED("String2")!>"String2"<!>, <!EVALUATED("String3")!>"String${3}"<!>)
|
||||||
class A
|
class A
|
||||||
|
|
||||||
@AnnotationWithArray(["Str" <!EVALUATED("String")!>+ "ing"<!>, <!EVALUATED("String2")!>"String2"<!>, <!EVALUATED("String3")!>"String${3}"<!>])
|
@AnnotationWithArray([<!EVALUATED("String")!>"Str" + "ing"<!>, <!EVALUATED("String2")!>"String2"<!>, <!EVALUATED("String3")!>"String${3}"<!>])
|
||||||
class B
|
class B
|
||||||
|
|
||||||
// MODULE: main
|
// MODULE: main
|
||||||
|
|||||||
Vendored
+1
-1
@@ -22,7 +22,7 @@ annotation class IntegerNumberValid(
|
|||||||
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.BINARY)
|
@Retention(AnnotationRetention.BINARY)
|
||||||
annotation class AnnotationWithDefault(val str: String = "Str" <!EVALUATED("String")!>+ "ing"<!>)
|
annotation class AnnotationWithDefault(val str: String = <!EVALUATED("String")!>"Str" + "ing"<!>)
|
||||||
|
|
||||||
@AnnotationWithDefault()
|
@AnnotationWithDefault()
|
||||||
class A
|
class A
|
||||||
|
|||||||
+2
-2
@@ -18,8 +18,8 @@ annotation class Nested(val a: TypeAnnotation)
|
|||||||
@Retention(AnnotationRetention.BINARY)
|
@Retention(AnnotationRetention.BINARY)
|
||||||
annotation class NestedArray(val a: Array<TypeAnnotation>)
|
annotation class NestedArray(val a: Array<TypeAnnotation>)
|
||||||
|
|
||||||
val a: @Nested(TypeAnnotation("Int" <!EVALUATED("IntAnno")!>+ "Anno"<!>)) Int = 1
|
val a: @Nested(TypeAnnotation(<!EVALUATED("IntAnno")!>"Int" + "Anno"<!>)) Int = 1
|
||||||
val b: @NestedArray([TypeAnnotation("Element1" <!EVALUATED("Element1Anno")!>+ "Anno"<!>), TypeAnnotation("Element2" <!EVALUATED("Element2Anno")!>+ "Anno"<!>)]) Int = 1
|
val b: @NestedArray([TypeAnnotation(<!EVALUATED("Element1Anno")!>"Element1" + "Anno"<!>), TypeAnnotation(<!EVALUATED("Element2Anno")!>"Element2" + "Anno"<!>)]) Int = 1
|
||||||
|
|
||||||
// MODULE: main
|
// MODULE: main
|
||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
|
|||||||
+16
-16
@@ -16,39 +16,39 @@ open class A
|
|||||||
interface B
|
interface B
|
||||||
//class C : @TypeAnnotation("AClass" + "Anno") A(), @TypeAnnotation("BInterface" + "Anno") B
|
//class C : @TypeAnnotation("AClass" + "Anno") A(), @TypeAnnotation("BInterface" + "Anno") B
|
||||||
|
|
||||||
val a: @TypeAnnotation("Int" <!EVALUATED("IntAnno")!>+ "Anno"<!>) Int = 1
|
val a: @TypeAnnotation(<!EVALUATED("IntAnno")!>"Int" + "Anno"<!>) Int = 1
|
||||||
var b: @TypeAnnotation("List" <!EVALUATED("ListAnno")!>+ "Anno"<!>) List<
|
var b: @TypeAnnotation(<!EVALUATED("ListAnno")!>"List" + "Anno"<!>) List<
|
||||||
@TypeAnnotation("Pair" <!EVALUATED("PairAnno")!>+ "Anno"<!>)Pair<
|
@TypeAnnotation(<!EVALUATED("PairAnno")!>"Pair" + "Anno"<!>)Pair<
|
||||||
@TypeAnnotation("PairInt1" <!EVALUATED("PairInt1Anno")!>+ "Anno"<!>) Int,
|
@TypeAnnotation(<!EVALUATED("PairInt1Anno")!>"PairInt1" + "Anno"<!>) Int,
|
||||||
@TypeAnnotation("PairInt2" <!EVALUATED("PairInt2Anno")!>+ "Anno"<!>) Int
|
@TypeAnnotation(<!EVALUATED("PairInt2Anno")!>"PairInt2" + "Anno"<!>) Int
|
||||||
>
|
>
|
||||||
>? = null
|
>? = null
|
||||||
|
|
||||||
fun foo(a: @TypeAnnotation("String" <!EVALUATED("StringAnno")!>+ "Anno"<!>) String): @TypeAnnotation("Any" <!EVALUATED("AnyAnno")!>+ "Anno"<!>) Any {
|
fun foo(a: @TypeAnnotation(<!EVALUATED("StringAnno")!>"String" + "Anno"<!>) String): @TypeAnnotation(<!EVALUATED("AnyAnno")!>"Any" + "Anno"<!>) Any {
|
||||||
val b : @TypeAnnotation("Double" <!EVALUATED("DoubleAnno")!>+ "Anno"<!>) Double = 1.0
|
val b : @TypeAnnotation(<!EVALUATED("DoubleAnno")!>"Double" + "Anno"<!>) Double = 1.0
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T: @TypeAnnotation("SuperT" <!EVALUATED("SuperTAnno")!>+ "Anno"<!>) Any> bar(a: @TypeAnnotation("T" <!EVALUATED("TAnno")!>+ "Anno"<!>) T) {}
|
fun <T: @TypeAnnotation(<!EVALUATED("SuperTAnno")!>"SuperT" + "Anno"<!>) Any> bar(a: @TypeAnnotation(<!EVALUATED("TAnno")!>"T" + "Anno"<!>) T) {}
|
||||||
|
|
||||||
fun example(computeAny: @TypeAnnotation("Fun" <!EVALUATED("FunAnno")!>+ "Anno"<!>) () -> Any) {
|
fun example(computeAny: @TypeAnnotation(<!EVALUATED("FunAnno")!>"Fun" + "Anno"<!>) () -> Any) {
|
||||||
// val memoizedFoo: @TypeAnnotation("LocalDelegate" + "Anno") Any by lazy(computeAny)
|
// val memoizedFoo: @TypeAnnotation("LocalDelegate" + "Anno") Any by lazy(computeAny)
|
||||||
}
|
}
|
||||||
|
|
||||||
typealias Fun = @TypeAnnotation("TypeAlias" <!EVALUATED("TypeAliasAnno")!>+ "Anno"<!>) (Int, Int) -> Int
|
typealias Fun = @TypeAnnotation(<!EVALUATED("TypeAliasAnno")!>"TypeAlias" + "Anno"<!>) (Int, Int) -> Int
|
||||||
|
|
||||||
fun memberAccess() {
|
fun memberAccess() {
|
||||||
bar<@TypeAnnotation("Float" <!EVALUATED("FloatAnno")!>+ "Anno"<!>) Float>(1.0f)
|
bar<@TypeAnnotation(<!EVALUATED("FloatAnno")!>"Float" + "Anno"<!>) Float>(1.0f)
|
||||||
}
|
}
|
||||||
|
|
||||||
val typeOperator = 1L as @TypeAnnotation("Long" <!EVALUATED("LongAnno")!>+ "Anno"<!>) Long
|
val typeOperator = 1L as @TypeAnnotation(<!EVALUATED("LongAnno")!>"Long" + "Anno"<!>) Long
|
||||||
|
|
||||||
fun withVararg(vararg args: @TypeAnnotation("Byte" <!EVALUATED("ByteAnno")!>+ "Anno"<!>) Byte) {}
|
fun withVararg(vararg args: @TypeAnnotation(<!EVALUATED("ByteAnno")!>"Byte" + "Anno"<!>) Byte) {}
|
||||||
|
|
||||||
fun withAnonymousObject() {
|
fun withAnonymousObject() {
|
||||||
object {
|
object {
|
||||||
fun bar() {
|
fun bar() {
|
||||||
val a: @TypeAnnotation("InsideObject" <!EVALUATED("InsideObjectAnno")!>+ "Anno"<!>) A? = null
|
val a: @TypeAnnotation(<!EVALUATED("InsideObjectAnno")!>"InsideObject" + "Anno"<!>) A? = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,8 +70,8 @@ fun functionWithLambda(action: (Int, String) -> Any) {
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
val inProjection: MutableList<in @TypeAnnotation("InProjection" <!EVALUATED("InProjectionAnno")!>+ "Anno"<!>) String> = mutableListOf()
|
val inProjection: MutableList<in @TypeAnnotation(<!EVALUATED("InProjectionAnno")!>"InProjection" + "Anno"<!>) String> = mutableListOf()
|
||||||
val outProjection: MutableList<out @TypeAnnotation("OutProjection" <!EVALUATED("OutProjectionAnno")!>+ "Anno"<!>) String> = mutableListOf()
|
val outProjection: MutableList<out @TypeAnnotation(<!EVALUATED("OutProjectionAnno")!>"OutProjection" + "Anno"<!>) String> = mutableListOf()
|
||||||
|
|
||||||
// MODULE: main
|
// MODULE: main
|
||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/exceptionFromInterpreter.kt:(197,200): error: Cannot evaluate constant expression: Exception java.lang.ArithmeticException: / by zero
|
/exceptionFromInterpreter.kt:(195,200): error: Cannot evaluate constant expression: Exception java.lang.ArithmeticException: / by zero
|
||||||
|
|
||||||
/exceptionFromInterpreter.kt:(239,254): error: Cannot evaluate constant expression: Exception java.lang.IllegalArgumentException: marginPrefix must be non-blank string.
|
/exceptionFromInterpreter.kt:(239,254): error: Cannot evaluate constant expression: Exception java.lang.IllegalArgumentException: marginPrefix must be non-blank string.
|
||||||
|
|
||||||
/exceptionFromInterpreter.kt:(305,308): error: Cannot evaluate constant expression: Exception java.lang.ArithmeticException: / by zero
|
/exceptionFromInterpreter.kt:(303,308): error: Cannot evaluate constant expression: Exception java.lang.ArithmeticException: / by zero
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
// !DIAGNOSTICS: -DIVISION_BY_ZERO
|
// !DIAGNOSTICS: -DIVISION_BY_ZERO
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
const val divideByZero = 1 <!EVALUATION_ERROR!>/ 0<!>
|
const val divideByZero = <!EVALUATION_ERROR!>1 / 0<!>
|
||||||
const val trimMarginException = "123".<!EVALUATION_ERROR!>trimMargin(" ")<!>
|
const val trimMarginException = "123".<!EVALUATION_ERROR!>trimMargin(" ")<!>
|
||||||
|
|
||||||
annotation class A(val i: Int, val b: Int)
|
annotation class A(val i: Int, val b: Int)
|
||||||
|
|
||||||
@A(1 <!EVALUATION_ERROR!>/ 0<!>, 2)
|
@A(<!EVALUATION_ERROR!>1 / 0<!>, 2)
|
||||||
fun foo() {}
|
fun foo() {}
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
/recursionAccess.kt:(180,194): error: Cannot evaluate constant expression: Exception java.lang.StackOverflowError
|
/recursionAccess.kt:(178,194): error: Cannot evaluate constant expression: Exception java.lang.StackOverflowError
|
||||||
|
|
||||||
/recursionAccess.kt:(280,283): error: Cannot evaluate constant expression: Exception java.lang.NullPointerException
|
/recursionAccess.kt:(267,283): error: Cannot evaluate constant expression: Exception java.lang.NullPointerException
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
object A {
|
object A {
|
||||||
const val recursive1: Int = 1 <!EVALUATION_ERROR!>+ B.recursive2<!>
|
const val recursive1: Int = <!EVALUATION_ERROR!>1 + B.recursive2<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
class B {
|
class B {
|
||||||
companion object {
|
companion object {
|
||||||
const val recursive2: Int = A.recursive1 <!EVALUATION_ERROR!>+ 2<!>
|
const val recursive2: Int = <!EVALUATION_ERROR!>A.recursive1 + 2<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
@27:8..25 VALUE_PARAMETER name:<this> type:<root>.Foo
|
@27:8..25 VALUE_PARAMETER name:<this> type:<root>.Foo
|
||||||
@27:16..25 BLOCK_BODY
|
@27:16..25 BLOCK_BODY
|
||||||
@27:25..25 RETURN type=kotlin.Nothing from='public final fun <get-x> (): kotlin.Int declared in <root>.Foo'
|
@27:25..25 RETURN type=kotlin.Nothing from='public final fun <get-x> (): kotlin.Int declared in <root>.Foo'
|
||||||
@27:22..25 CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
@27:16..25 CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||||
@27:16..21 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=GET_PROPERTY
|
@27:16..21 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=GET_PROPERTY
|
||||||
@27:16..21 GET_VAR '<this>: <root>.Foo declared in <root>.Foo.<get-x>' type=<root>.Foo origin=null
|
@27:16..21 GET_VAR '<this>: <root>.Foo declared in <root>.Foo.<get-x>' type=<root>.Foo origin=null
|
||||||
@27:24..25 CONST Int type=kotlin.Int value=1
|
@27:24..25 CONST Int type=kotlin.Int value=1
|
||||||
|
|||||||
+4
-4
@@ -35,11 +35,11 @@
|
|||||||
@28:10..37:1 BLOCK_BODY
|
@28:10..37:1 BLOCK_BODY
|
||||||
@30:4..10 TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
@30:4..10 TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
@30:4..10 GET_ENUM 'ENUM_ENTRY name:SINGLE' type=<root>.E
|
@30:4..10 GET_ENUM 'ENUM_ENTRY name:SINGLE' type=<root>.E
|
||||||
@33:4..7 TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
@32:4..33:7 TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
@33:4..7 FUNCTION_REFERENCE 'public final fun foo (): kotlin.Unit declared in <root>.O' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null reflectionTarget=<same>
|
@32:4..33:7 FUNCTION_REFERENCE 'public final fun foo (): kotlin.Unit declared in <root>.O' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null reflectionTarget=<same>
|
||||||
@32:4..5 GET_OBJECT 'CLASS OBJECT name:O modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.O
|
@32:4..5 GET_OBJECT 'CLASS OBJECT name:O modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.O
|
||||||
@36:4..8 TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
@35:4..36:8 TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
@36:4..8 FUNCTION_REFERENCE 'public final fun fail (): kotlin.String declared in <root>' type=kotlin.reflect.KFunction0<kotlin.String> origin=null reflectionTarget=<same>
|
@35:4..36:8 FUNCTION_REFERENCE 'public final fun fail (): kotlin.String declared in <root>' type=kotlin.reflect.KFunction0<kotlin.String> origin=null reflectionTarget=<same>
|
||||||
@35:4..6 CONST String type=kotlin.String value=""
|
@35:4..6 CONST String type=kotlin.String value=""
|
||||||
@39:0..41:1 CLASS ENUM_CLASS name:E modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.E>]
|
@39:0..41:1 CLASS ENUM_CLASS name:E modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.E>]
|
||||||
@39:0..41:1 CONSTRUCTOR visibility:private <> () returnType:<root>.E [primary]
|
@39:0..41:1 CONSTRUCTOR visibility:private <> () returnType:<root>.E [primary]
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
@0:0..8:0 FILE fqName:<root> fileName:/operators.kt
|
@0:0..8:0 FILE fqName:<root> fileName:/operators.kt
|
||||||
@2:0..27 PROPERTY name:addExpr visibility:public modality:FINAL [val]
|
@2:0..27 PROPERTY name:addExpr visibility:public modality:FINAL [val]
|
||||||
@2:0..27 FIELD PROPERTY_BACKING_FIELD name:addExpr type:kotlin.Int visibility:private [final,static]
|
@2:0..27 FIELD PROPERTY_BACKING_FIELD name:addExpr type:kotlin.Int visibility:private [final,static]
|
||||||
@2:20..27 EXPRESSION_BODY
|
@2:14..27 EXPRESSION_BODY
|
||||||
@2:20..27 CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
@2:14..27 CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||||
@2:14..19 CONST Int type=kotlin.Int value=12345
|
@2:14..19 CONST Int type=kotlin.Int value=12345
|
||||||
@2:22..27 CONST Int type=kotlin.Int value=67890
|
@2:22..27 CONST Int type=kotlin.Int value=67890
|
||||||
@2:0..27 FUN DEFAULT_PROPERTY_ACCESSOR name:<get-addExpr> visibility:public modality:FINAL <> () returnType:kotlin.Int
|
@2:0..27 FUN DEFAULT_PROPERTY_ACCESSOR name:<get-addExpr> visibility:public modality:FINAL <> () returnType:kotlin.Int
|
||||||
|
|||||||
Reference in New Issue
Block a user