[FIR] Add test data
This commit is contained in:
committed by
TeamCityServer
parent
4e56ba2fa4
commit
f6ae6af741
+28
@@ -0,0 +1,28 @@
|
||||
FILE: backingFieldModifiers.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val a: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val b: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val c: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val d: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val e: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val f: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val g: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
class A {
|
||||
val a: Number
|
||||
<!WRONG_MODIFIER_TARGET!>abstract<!> field = 1
|
||||
|
||||
val b: Number
|
||||
<!WRONG_MODIFIER_TARGET!>open<!> field = 1
|
||||
|
||||
val c: Number
|
||||
<!WRONG_MODIFIER_TARGET!>final<!> field = 1
|
||||
|
||||
val d: Number
|
||||
<!WRONG_MODIFIER_TARGET!>inline<!> field = 1
|
||||
|
||||
val e: Number
|
||||
<!WRONG_MODIFIER_TARGET!>noinline<!> field = 1
|
||||
|
||||
val f: Number
|
||||
<!WRONG_MODIFIER_TARGET!>crossinline<!> field = 1
|
||||
|
||||
val g: Number
|
||||
<!WRONG_MODIFIER_TARGET!>tailrec<!> field = 1
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
Module: lib
|
||||
FILE: A.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val a: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val b: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val c: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val d: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final fun rest(): R|kotlin/Unit| {
|
||||
lval aI: R|kotlin/Int| = R|/A.A|().R|/A.a|.R|kotlin/Int.plus|(Int(10))
|
||||
lval bI: R|kotlin/Int| = R|/A.A|().R|/A.b|.R|kotlin/Int.plus|(Int(20))
|
||||
lval cI: <ERROR TYPE REF: Unresolved name: plus> = R|/A.A|().R|/A.c|.<Unresolved name: plus>#(Int(30))
|
||||
lval dI: <ERROR TYPE REF: Unresolved name: plus> = R|/A.A|().R|/A.d|.<Unresolved name: plus>#(Int(40))
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval aA: <ERROR TYPE REF: Unresolved name: plus> = R|/A.A|().R|/A.a|.<Unresolved name: plus>#(Int(10))
|
||||
lval bA: R|kotlin/Int| = R|/A.A|().R|/A.b|.R|kotlin/Int.plus|(Int(20))
|
||||
lval cA: <ERROR TYPE REF: Unresolved name: plus> = R|/A.A|().R|/A.c|.<Unresolved name: plus>#(Int(30))
|
||||
lval dA: <ERROR TYPE REF: Unresolved name: plus> = R|/A.A|().R|/A.d|.<Unresolved name: plus>#(Int(40))
|
||||
}
|
||||
Module: main
|
||||
FILE: B.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
lval aB: <ERROR TYPE REF: Unresolved name: plus> = R|/A.A|().R|/A.a|.<Unresolved name: plus>#(Int(10))
|
||||
lval bB: <ERROR TYPE REF: Unresolved name: plus> = R|/A.A|().R|/A.b|.<Unresolved name: plus>#(Int(20))
|
||||
lval cB: <ERROR TYPE REF: Unresolved name: plus> = R|/A.A|().R|/A.c|.<Unresolved name: plus>#(Int(30))
|
||||
lval dB: <ERROR TYPE REF: Unresolved name: plus> = R|/A.A|().R|/A.d|.<Unresolved name: plus>#(Int(40))
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// MODULE: lib
|
||||
// FILE: A.kt
|
||||
|
||||
class A {
|
||||
val a: Number
|
||||
private field = 1
|
||||
|
||||
val b: Number
|
||||
internal field = 2
|
||||
|
||||
val c: Number
|
||||
<!WRONG_MODIFIER_TARGET!>protected<!> field = 3
|
||||
|
||||
val d: Number
|
||||
<!WRONG_MODIFIER_TARGET!>public<!> field = 5
|
||||
|
||||
fun rest() {
|
||||
val aI = A().a + 10
|
||||
val bI = A().b + 20
|
||||
val cI = A().c <!UNRESOLVED_REFERENCE!>+<!> 30
|
||||
val dI = A().d <!UNRESOLVED_REFERENCE!>+<!> 40
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val aA = A().a <!UNRESOLVED_REFERENCE!>+<!> 10
|
||||
val bA = A().b + 20
|
||||
val cA = A().c <!UNRESOLVED_REFERENCE!>+<!> 30
|
||||
val dA = A().d <!UNRESOLVED_REFERENCE!>+<!> 40
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: B.kt
|
||||
|
||||
fun main() {
|
||||
val aB = A().a <!UNRESOLVED_REFERENCE!>+<!> 10
|
||||
val bB = A().b <!UNRESOLVED_REFERENCE!>+<!> 20
|
||||
val cB = A().c <!UNRESOLVED_REFERENCE!>+<!> 30
|
||||
val dB = A().d <!UNRESOLVED_REFERENCE!>+<!> 40
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
FILE: backingFieldWithSmartTypeParameters.kt
|
||||
public final val items: R|kotlin/collections/List<kotlin/String>|
|
||||
public get(): R|kotlin/collections/List<kotlin/String>|
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/items|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String(one more item))
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
val items: List<String>
|
||||
field = mutableListOf()
|
||||
|
||||
fun test() {
|
||||
items.add("one more item")
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
FILE: explicitBackingFieldInInterface.kt
|
||||
public abstract interface I : R|kotlin/Any| {
|
||||
public abstract val it: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
interface I {
|
||||
val it: Number
|
||||
<!EXPLICIT_BACKING_FIELD_IN_INTERFACE!>field<!> = 10
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
FILE: explicitBackingFieldType.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val a: R|kotlin/Int| = Int(20)
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
public final val it: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val joke: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val incompatible: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val customGetterNeeded: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
public final val invertedTypes: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int| {
|
||||
^ Int(30)
|
||||
}
|
||||
|
||||
public final val uninitialized: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final val uninitializedWithGetter: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number| {
|
||||
^ Int(2)
|
||||
}
|
||||
|
||||
public final val initiaizedWithExplicitBackingField: R|kotlin/collections/List<kotlin/Int>| = R|kotlin/collections/listOf|<R|kotlin/Int|>(vararg(Int(1), Int(2)))
|
||||
public get(): R|kotlin/collections/List<kotlin/Int>|
|
||||
|
||||
public final val p: R|kotlin/Int| = Int(5)
|
||||
public get(): R|kotlin/Int| {
|
||||
^ this@R|/A|.F|/A.p|
|
||||
}
|
||||
|
||||
public final var setterNeeded: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int| {
|
||||
^ this@R|/A|.F|/A.setterNeeded|.R|kotlin/String.length|
|
||||
}
|
||||
public set(value: R|kotlin/Int|): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
class A {
|
||||
val a = 20
|
||||
|
||||
val it: Number
|
||||
field = 4
|
||||
|
||||
<!PROPERTY_MUST_HAVE_GETTER!>val joke: Number
|
||||
field = "Haha"<!>
|
||||
|
||||
<!PROPERTY_MUST_HAVE_GETTER!>val incompatible: Number
|
||||
field: Any? = 42<!>
|
||||
|
||||
<!PROPERTY_MUST_HAVE_GETTER!>val customGetterNeeded: Int
|
||||
field: Number = 42<!>
|
||||
|
||||
val invertedTypes: Int
|
||||
field: Number = 42
|
||||
get() = 30
|
||||
|
||||
val uninitialized: Number
|
||||
<!PROPERTY_FIELD_DECLARATION_MISSING_INITIALIZER!>field: Int<!>
|
||||
|
||||
val uninitializedWithGetter: Number
|
||||
<!PROPERTY_FIELD_DECLARATION_MISSING_INITIALIZER!>field: Int<!>
|
||||
get() = 2
|
||||
|
||||
val initiaizedWithExplicitBackingField = <!PROPERTY_INITIALIZER_WITH_EXPLICIT_FIELD_DECLARATION!>listOf(1, 2)<!>
|
||||
<!PROPERTY_FIELD_DECLARATION_MISSING_INITIALIZER!>field: MutableList<Int><!>
|
||||
|
||||
val p = 5
|
||||
get() = field
|
||||
|
||||
<!PROPERTY_MUST_HAVE_SETTER!>var setterNeeded: Int
|
||||
field = "test"
|
||||
get() = field.length<!>
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
FILE: explicitBackingFieldsWithDelegates.kt
|
||||
public final val thingWithDelefate: R|kotlin/Number|by R|kotlin/lazy|<R|kotlin/Number|>(<L> = lazy@fun <anonymous>(): R|kotlin/Number| <inline=NoInline> {
|
||||
^ (Int(2) as R|kotlin/Number|)
|
||||
}
|
||||
)
|
||||
public get(): R|kotlin/Number| {
|
||||
^ D|/thingWithDelefate|.R|kotlin/getValue|<R|kotlin/Number|>(Null(null), ::R|/thingWithDelefate|)
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
val thingWithDelefate by lazy { 2 as Number }
|
||||
<!BACKING_FIELD_FOR_DELEGATED_PROPERTY!>field<!> = 10
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
FILE: filePrivateBackingFieldAccess.kt
|
||||
public final val list: R|kotlin/collections/List<kotlin/String>|
|
||||
public get(): R|kotlin/collections/List<kotlin/String>|
|
||||
public final fun add(s: R|kotlin/String|): R|kotlin/Unit| {
|
||||
R|/list|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(R|<local>/s|)
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
val list: List<String>
|
||||
field = mutableListOf<String>()
|
||||
|
||||
fun add(s: String) {
|
||||
list.add(s)
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
FILE: lateinitBackingFields.kt
|
||||
public final var that: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int| {
|
||||
^ F|/that|.R|kotlin/String.length|
|
||||
}
|
||||
public set(value: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
F|/that| = R|<local>/value|.R|kotlin/Any.toString|()
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/that| = Int(1)
|
||||
R|kotlin/io/println|(R|/that|)
|
||||
}
|
||||
public final lateinit var number: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
public set(value: R|kotlin/Number|): R|kotlin/Unit| {
|
||||
F|/number| = Int(10)
|
||||
}
|
||||
public final val something: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
public final lateinit var oneMore: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
public set(value: R|kotlin/Number|): R|kotlin/Unit| {
|
||||
F|/oneMore| = Int(10)
|
||||
}
|
||||
public final var thingWithNullableField: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number| {
|
||||
^ Int(20)
|
||||
}
|
||||
public set(value: R|kotlin/Number|): R|kotlin/Unit| {
|
||||
F|/thingWithNullableField| = R|<local>/value|.R|kotlin/Any.toString|()
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
var that: Int
|
||||
lateinit field: String
|
||||
get() = field.length
|
||||
set(value) {
|
||||
field = value.toString()
|
||||
}
|
||||
|
||||
fun test() {
|
||||
that = 1
|
||||
println(that)
|
||||
}
|
||||
|
||||
// Not allowed for properties with
|
||||
// custom accessors
|
||||
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var number: Number
|
||||
field = 4
|
||||
set(value) {
|
||||
field = 10
|
||||
}
|
||||
|
||||
val something: Number
|
||||
<!LATEINIT_FIELD_IN_VAL_PROPERTY, LATEINIT_PROPERTY_FIELD_DECLARATION_WITH_INITIALIZER!>lateinit<!> field = 4
|
||||
|
||||
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var oneMore: Number
|
||||
<!LATEINIT_PROPERTY_FIELD_DECLARATION_WITH_INITIALIZER!>lateinit<!> field = 4
|
||||
set(value) {
|
||||
field = 10
|
||||
}
|
||||
|
||||
var thingWithNullableField: Number
|
||||
<!LATEINIT_NULLABLE_BACKING_FIELD!>lateinit<!> field: String?
|
||||
get() = 20
|
||||
set(value) {
|
||||
field = value.toString()
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
FILE: localVariablesWithBackingFields.kt
|
||||
public final val that: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval a: R|kotlin/Number|
|
||||
<Unresolved name: field># = Int(1)
|
||||
lval b: R|kotlin/Number|by R|kotlin/lazy|<R|kotlin/Int|>(<L> = lazy@fun <anonymous>(): R|kotlin/Int| <inline=NoInline> {
|
||||
^ Int(2)
|
||||
}
|
||||
)
|
||||
<Unresolved name: field># = Int(10)
|
||||
}
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val c: R|kotlin/Number|by R|kotlin/lazy|<R|kotlin/Int|>(<L> = lazy@fun <anonymous>(): R|kotlin/Int| <inline=NoInline> {
|
||||
^ Int(2)
|
||||
}
|
||||
)
|
||||
public get(): R|kotlin/Number| {
|
||||
^ this@R|/A|.D|/A.c|.R|kotlin/getValue|<R|kotlin/Int|>(this@R|/A|, ::R|/A.c|)
|
||||
}
|
||||
|
||||
}
|
||||
public final val R|A|.cc: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
public final fun R|A|.cc(): R|kotlin/Unit| {
|
||||
lval it: <ERROR TYPE REF: Ambiguity: plus, [kotlin/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/sequences/plus]> = <Unresolved name: a>#.<Ambiguity: plus, [kotlin/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/collections/plus, kotlin/sequences/plus]>#(Int(2))
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
val that: Number
|
||||
field = 239
|
||||
|
||||
fun test() {
|
||||
val a: Number
|
||||
<!UNRESOLVED_REFERENCE!>field<!> = 1
|
||||
|
||||
val b: Number by lazy { 2 }
|
||||
<!UNRESOLVED_REFERENCE!>field<!> = 10
|
||||
}
|
||||
|
||||
class A {
|
||||
val c: Number by lazy { 2 }
|
||||
<!BACKING_FIELD_FOR_DELEGATED_PROPERTY!>field<!> = 10
|
||||
}
|
||||
|
||||
val A.cc: Number
|
||||
<!EXPLICIT_BACKING_FIELD_IN_EXTENSION!>field<!> = 10
|
||||
|
||||
fun A.cc() {
|
||||
val it = <!UNRESOLVED_REFERENCE!>a<!> + 2
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
FILE: overriddenPropertiesWithExplicitBackingFields.kt
|
||||
public open class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public open var it: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
public set(value: R|kotlin/Number|): R|kotlin/Unit| {
|
||||
this@R|/A|.F|/A.it| = R|<local>/value|.R|kotlin/Number.toInt|()
|
||||
}
|
||||
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
<Ambiguity: println, [kotlin/io/println, kotlin/io/println, kotlin/io/println, kotlin/io/println, kotlin/io/println, kotlin/io/println, kotlin/io/println, kotlin/io/println, kotlin/io/println, kotlin/io/println]>#(this@R|/A|.R|/A.it|.<Unresolved name: plus>#(Int(1)))
|
||||
}
|
||||
|
||||
}
|
||||
public open class B : R|A| {
|
||||
public constructor(): R|B| {
|
||||
super<R|A|>()
|
||||
}
|
||||
|
||||
public open override var it: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number| {
|
||||
^ Double(3.14)
|
||||
}
|
||||
public set(value: R|kotlin/Number|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
open class A {
|
||||
open var it: Number
|
||||
private field = 3
|
||||
set(value) {
|
||||
field = value.toInt()
|
||||
}
|
||||
|
||||
fun test() {
|
||||
// error, because `it` is not
|
||||
// final, so no smart type narrowing
|
||||
// is provided
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(it <!UNRESOLVED_REFERENCE!>+<!> 1)
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
override var it: Number
|
||||
get() = 3.14
|
||||
set(value) {}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
FILE: propertyTypeNarrowing.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val it: R|kotlin/Number|
|
||||
public get(): R|kotlin/Number|
|
||||
|
||||
public final fun test(): R|kotlin/Int| {
|
||||
^test this@R|/A|.R|/A.it|.R|kotlin/Int.plus|(Int(3))
|
||||
}
|
||||
|
||||
public final val p: R|kotlin/Int| = Int(5)
|
||||
public get(): R|kotlin/Int| {
|
||||
^ this@R|/A|.F|/A.p|
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval c: <ERROR TYPE REF: Unresolved name: plus> = R|/A.A|().R|/A.it|.<Unresolved name: plus>#(Int(1))
|
||||
lval d: R|kotlin/Unit| = R|/test|()
|
||||
lval b: R|kotlin/Int| = R|/A.A|().R|/A.p|.R|kotlin/Int.plus|(Int(2))
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class A {
|
||||
val it: Number
|
||||
field = 4
|
||||
|
||||
fun test() = it + 3
|
||||
|
||||
val p = 5
|
||||
get() = field
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val c = A().it <!UNRESOLVED_REFERENCE!>+<!> 1
|
||||
val d = test()
|
||||
val b = A().p + 2
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
FILE: randomWeirdBackingFields.kt
|
||||
public abstract class Some1 : R|kotlin/Any| {
|
||||
public constructor(): R|Some1| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public abstract val foo: R|kotlin/collections/List<kotlin/Int>|
|
||||
public get(): R|kotlin/collections/List<kotlin/Int>|
|
||||
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
abstract class Some1 {
|
||||
abstract val foo: List<Int>
|
||||
internal <!EXPLICIT_BACKING_FIELD_IN_ABSTRACT_PROPERTY!>field<!> = mutableListOf<Int>()
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
FILE: redundantExplicitBackingField.kt
|
||||
public final val it: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int|
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
val it: Int
|
||||
<!REDUNDANT_EXPLICIT_BACKING_FIELD!>field<!> = 42
|
||||
+98
@@ -5532,6 +5532,104 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Properties {
|
||||
@Test
|
||||
public void testAllFilesPresentInProperties() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BackingField {
|
||||
@Test
|
||||
public void testAllFilesPresentInBackingField() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("backingFieldModifiers.kt")
|
||||
public void testBackingFieldModifiers() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldModifiers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("backingFieldVisibility.kt")
|
||||
public void testBackingFieldVisibility() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("backingFieldWithSmartTypeParameters.kt")
|
||||
public void testBackingFieldWithSmartTypeParameters() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("explicitBackingFieldInInterface.kt")
|
||||
public void testExplicitBackingFieldInInterface() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/explicitBackingFieldInInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("explicitBackingFieldType.kt")
|
||||
public void testExplicitBackingFieldType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/explicitBackingFieldType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("explicitBackingFieldsWithDelegates.kt")
|
||||
public void testExplicitBackingFieldsWithDelegates() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/explicitBackingFieldsWithDelegates.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("filePrivateBackingFieldAccess.kt")
|
||||
public void testFilePrivateBackingFieldAccess() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lateinitBackingFields.kt")
|
||||
public void testLateinitBackingFields() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/lateinitBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariablesWithBackingFields.kt")
|
||||
public void testLocalVariablesWithBackingFields() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/localVariablesWithBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenPropertiesWithExplicitBackingFields.kt")
|
||||
public void testOverriddenPropertiesWithExplicitBackingFields() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/overriddenPropertiesWithExplicitBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyTypeNarrowing.kt")
|
||||
public void testPropertyTypeNarrowing() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("randomWeirdBackingFields.kt")
|
||||
public void testRandomWeirdBackingFields() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/randomWeirdBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redundantExplicitBackingField.kt")
|
||||
public void testRedundantExplicitBackingField() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/redundantExplicitBackingField.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/reinitializations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+98
@@ -5532,6 +5532,104 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Properties {
|
||||
@Test
|
||||
public void testAllFilesPresentInProperties() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BackingField {
|
||||
@Test
|
||||
public void testAllFilesPresentInBackingField() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("backingFieldModifiers.kt")
|
||||
public void testBackingFieldModifiers() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldModifiers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("backingFieldVisibility.kt")
|
||||
public void testBackingFieldVisibility() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("backingFieldWithSmartTypeParameters.kt")
|
||||
public void testBackingFieldWithSmartTypeParameters() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("explicitBackingFieldInInterface.kt")
|
||||
public void testExplicitBackingFieldInInterface() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/explicitBackingFieldInInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("explicitBackingFieldType.kt")
|
||||
public void testExplicitBackingFieldType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/explicitBackingFieldType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("explicitBackingFieldsWithDelegates.kt")
|
||||
public void testExplicitBackingFieldsWithDelegates() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/explicitBackingFieldsWithDelegates.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("filePrivateBackingFieldAccess.kt")
|
||||
public void testFilePrivateBackingFieldAccess() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lateinitBackingFields.kt")
|
||||
public void testLateinitBackingFields() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/lateinitBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariablesWithBackingFields.kt")
|
||||
public void testLocalVariablesWithBackingFields() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/localVariablesWithBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenPropertiesWithExplicitBackingFields.kt")
|
||||
public void testOverriddenPropertiesWithExplicitBackingFields() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/overriddenPropertiesWithExplicitBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyTypeNarrowing.kt")
|
||||
public void testPropertyTypeNarrowing() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("randomWeirdBackingFields.kt")
|
||||
public void testRandomWeirdBackingFields() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/randomWeirdBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redundantExplicitBackingField.kt")
|
||||
public void testRedundantExplicitBackingField() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/redundantExplicitBackingField.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/reinitializations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+16
@@ -22485,6 +22485,22 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/properties/lateinitOnTopLevel.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/properties/backingField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BackingField {
|
||||
@Test
|
||||
public void testAllFilesPresentInBackingField() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/properties/backingField"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("trivialExplicitBackingFIeld.kt")
|
||||
public void testTrivialExplicitBackingFIeld() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/properties/backingField/trivialExplicitBackingFIeld.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/properties/inferenceFromGetters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+16
@@ -22485,6 +22485,22 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/properties/lateinitOnTopLevel.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/properties/backingField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BackingField {
|
||||
@Test
|
||||
public void testAllFilesPresentInBackingField() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/properties/backingField"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("trivialExplicitBackingFIeld.kt")
|
||||
public void testTrivialExplicitBackingFIeld() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/properties/backingField/trivialExplicitBackingFIeld.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/properties/inferenceFromGetters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+1
-7
@@ -610,13 +610,7 @@ class Fir2IrDeclarationStorage(
|
||||
signature,
|
||||
containerSource
|
||||
) { symbol ->
|
||||
val accessorReturnType = if (isSetter) {
|
||||
irBuiltIns.unitType
|
||||
} else if (property.canNarrowDownGetterType) {
|
||||
property.backingField?.returnTypeRef?.toIrType() ?: propertyType
|
||||
} else {
|
||||
propertyType
|
||||
}
|
||||
val accessorReturnType = if (isSetter) irBuiltIns.unitType else propertyType
|
||||
val visibility = propertyAccessor?.visibility?.let {
|
||||
components.visibilityConverter.convertToDescriptorVisibility(it)
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class A {
|
||||
val a: Number
|
||||
private field = 1
|
||||
|
||||
val b: Number
|
||||
internal field = a + 3
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return if (A().b + 20 == 24) {
|
||||
"OK"
|
||||
} else {
|
||||
"fail: A().b = " + A().b.toString()
|
||||
}
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
class Base {
|
||||
val x: CharSequence
|
||||
internal field: String = "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Base().x
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
class Base {
|
||||
val x: CharSequence
|
||||
internal field: String = "OK"
|
||||
|
||||
val s: String get() = x
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Base().s
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
class Base {
|
||||
val x: CharSequence
|
||||
internal field: String = "OK"
|
||||
|
||||
}
|
||||
val s: String get() = Base().x
|
||||
fun box(): String {
|
||||
return s
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
class Base {
|
||||
val x: CharSequence
|
||||
internal field: String = "OK"
|
||||
|
||||
}
|
||||
val s: String = Base().x
|
||||
fun box(): String {
|
||||
return s
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
open class Base {
|
||||
open val x: CharSequence = "BASE"
|
||||
// field = "BASE"
|
||||
}
|
||||
|
||||
class Ok : Base() {
|
||||
override val x: CharSequence
|
||||
internal field: String = "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Ok().x
|
||||
}
|
||||
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
interface I {
|
||||
val number: Number
|
||||
}
|
||||
|
||||
fun test1(): String? {
|
||||
val it = object : I {
|
||||
final override val number: Number
|
||||
field = 10
|
||||
|
||||
val next get() = number + 1
|
||||
}
|
||||
|
||||
return if (it.next != 11) {
|
||||
"[1] ${it.number}, ${it.next}"
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun test2(): String? {
|
||||
class Local : I {
|
||||
final override val number: Number
|
||||
internal field = 42
|
||||
}
|
||||
|
||||
return if (Local().number + 3 != 45) {
|
||||
"[2] " + Local().number.toString()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun test3(): String? {
|
||||
val it = object : I {
|
||||
override val number: Number
|
||||
field = "100"
|
||||
get() {
|
||||
return field.length
|
||||
}
|
||||
}
|
||||
|
||||
return if (it.number != 3) {
|
||||
"[3] " + it.number.toString()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val problem = test1()
|
||||
?: test2()
|
||||
?: test3()
|
||||
|
||||
return if (problem != null) {
|
||||
"fail: " + problem
|
||||
} else {
|
||||
"OK"
|
||||
}
|
||||
}
|
||||
compiler/fir/fir2ir/testData/codegen/box/properties/backingField/getterReturnTypeWithBackingField.kt
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
interface Storage {
|
||||
val s: String
|
||||
}
|
||||
|
||||
class ImmutableStorage(override val s: String) : Storage
|
||||
class MutableStorage(override var s: String) : Storage {
|
||||
fun asImmutable() = ImmutableStorage(s)
|
||||
}
|
||||
|
||||
class My {
|
||||
val storage: Storage
|
||||
field = MutableStorage("OK")
|
||||
get() = field.asImmutable()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val my = My()
|
||||
if (my.storage is MutableStorage) {
|
||||
return "MUTABLE"
|
||||
}
|
||||
return my.storage.s
|
||||
}
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
fun createString() = "AAA" + "BBB"
|
||||
|
||||
class A {
|
||||
var it: Int
|
||||
field = 3.14
|
||||
get() = (field + 10).toInt()
|
||||
set(value) {
|
||||
field = (value - 10).toDouble()
|
||||
|
||||
if (field < -3 || -1 < field) {
|
||||
throw Exception("fail: value = $value, field = $field")
|
||||
}
|
||||
}
|
||||
|
||||
var that: Int
|
||||
field = createString() + "!"
|
||||
get() = field.length
|
||||
set(value) {
|
||||
field = value.toString()
|
||||
|
||||
if (field != "17") {
|
||||
throw Exception("fail: value = $value, field = $field")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
val a = A()
|
||||
|
||||
val it: Int = A().it and 10
|
||||
a.it = it
|
||||
|
||||
val that: Int = a.that
|
||||
a.that = that + 10
|
||||
} catch (e: Exception) {
|
||||
return e.message ?: "fail"
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
var that: Int
|
||||
lateinit field: String
|
||||
get() = field.length
|
||||
set(value) {
|
||||
field = value.toString()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
that = 1
|
||||
|
||||
return if (that == 1) {
|
||||
"OK"
|
||||
} else {
|
||||
"fail: $that"
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
open class A {
|
||||
open var it: Number
|
||||
private field = 3
|
||||
set(value) {
|
||||
field = value.toInt()
|
||||
}
|
||||
|
||||
fun test(): String {
|
||||
// Note that `it` is open,
|
||||
// so no smart type narrowing
|
||||
// is possible, and we expect
|
||||
// here a call to the possibly
|
||||
// overridden getter
|
||||
return if (it.toInt() + 1 == 11) {
|
||||
"OK"
|
||||
} else {
|
||||
"fail: $it"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
override var it: Number
|
||||
get() = 10.12
|
||||
set(value) {}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return B().test()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
val items: List<String>
|
||||
field = mutableListOf()
|
||||
|
||||
fun box(): String {
|
||||
items.add("OK")
|
||||
return items.last()
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// MODULE: ModuleA
|
||||
// FILE: AI.kt
|
||||
|
||||
public interface AI {
|
||||
val number: Number
|
||||
}
|
||||
|
||||
// FILE: AC.kt
|
||||
|
||||
public class AC : AI {
|
||||
final override val number: Number
|
||||
field = 4
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
@kotlin.Metadata
|
||||
public final class AC {
|
||||
// source: 'AC.kt'
|
||||
private final field number: int
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getNumber(): java.lang.Number
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface AI {
|
||||
// source: 'AI.kt'
|
||||
public abstract @org.jetbrains.annotations.NotNull method getNumber(): java.lang.Number
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
class A {
|
||||
val a: Number
|
||||
private field = 1
|
||||
|
||||
val b: Number
|
||||
internal field = a + 2
|
||||
|
||||
val c = 1
|
||||
val d = c + 2
|
||||
|
||||
fun rest() {
|
||||
val aI = A().a + 10
|
||||
val bI = A().b + 20
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val bA = A().b + 20
|
||||
}
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
class A {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val a: Int
|
||||
field = 1
|
||||
get
|
||||
|
||||
val b: Int
|
||||
field = <this>.<get-a>().plus(other = 2)
|
||||
get
|
||||
|
||||
val c: Int
|
||||
field = 1
|
||||
get
|
||||
|
||||
val d: Int
|
||||
field = <this>.<get-c>().plus(other = 2)
|
||||
get
|
||||
|
||||
fun rest() {
|
||||
val aI: Int = A().<get-a>().plus(other = 10)
|
||||
val bI: Int = A().<get-b>().plus(other = 20)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val bA: Int = A().<get-b>().plus(other = 20)
|
||||
}
|
||||
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
FILE fqName:<root> fileName:/backingFieldVisibility.kt
|
||||
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:a visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:a type:kotlin.Int visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value=1
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-a> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Number
|
||||
correspondingProperty: PROPERTY name:a visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-a> (): kotlin.Number declared in <root>.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:a type:kotlin.Int visibility:private [final]' type=kotlin.Number origin=null
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-a>' type=<root>.A origin=null
|
||||
PROPERTY name:b visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:b type:kotlin.Int visibility:internal [final]
|
||||
EXPRESSION_BODY
|
||||
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-a> (): kotlin.Number declared in <root>.A' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: GET_VAR '<this>: <root>.A declared in <root>.A' type=<root>.A origin=null
|
||||
other: CONST Int type=kotlin.Int value=2
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-b> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Number
|
||||
correspondingProperty: PROPERTY name:b visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-b> (): kotlin.Number declared in <root>.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:b type:kotlin.Int visibility:internal [final]' type=kotlin.Number origin=null
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-b>' type=<root>.A origin=null
|
||||
PROPERTY name:c visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:c type:kotlin.Int visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value=1
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-c> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:c visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-c> (): kotlin.Int declared in <root>.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:c type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-c>' type=<root>.A origin=null
|
||||
PROPERTY name:d visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:d 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=PLUS
|
||||
$this: CALL 'public final fun <get-c> (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: GET_VAR '<this>: <root>.A declared in <root>.A' type=<root>.A origin=null
|
||||
other: CONST Int type=kotlin.Int value=2
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-d> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:d visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-d> (): kotlin.Int declared in <root>.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:d type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-d>' type=<root>.A origin=null
|
||||
FUN name:rest visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
VAR name:aI type:kotlin.Int [val]
|
||||
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-a> (): kotlin.Number declared in <root>.A' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.A' type=<root>.A origin=null
|
||||
other: CONST Int type=kotlin.Int value=10
|
||||
VAR name:bI type:kotlin.Int [val]
|
||||
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-b> (): kotlin.Number declared in <root>.A' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.A' type=<root>.A origin=null
|
||||
other: CONST Int type=kotlin.Int value=20
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:bA type:kotlin.Int [val]
|
||||
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-b> (): kotlin.Number declared in <root>.A' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.A' type=<root>.A origin=null
|
||||
other: CONST Int type=kotlin.Int value=20
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// FIR_IDENTICAL
|
||||
class A {
|
||||
val a = 20
|
||||
|
||||
val it: Number
|
||||
field = 4
|
||||
|
||||
var invertedTypes: Int
|
||||
field: Number = 42
|
||||
get() = if (field.toInt() > 10) field.toInt() else 10
|
||||
|
||||
val p = 5
|
||||
get() = field
|
||||
}
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
class A {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val a: Int
|
||||
field = 20
|
||||
get
|
||||
|
||||
val it: Int
|
||||
field = 4
|
||||
get
|
||||
|
||||
var invertedTypes: Number
|
||||
field = 42
|
||||
get(): Int {
|
||||
return when {
|
||||
greater(arg0 = <this>.#invertedTypes.toInt(), arg1 = 10) -> <this>.#invertedTypes.toInt()
|
||||
else -> 10
|
||||
}
|
||||
}
|
||||
set
|
||||
|
||||
val p: Int
|
||||
field = 5
|
||||
get(): Int {
|
||||
return <this>.#p
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
FILE fqName:<root> fileName:/explicitBackingFieldType.kt
|
||||
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:a visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:a type:kotlin.Int visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value=20
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-a> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:a visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-a> (): kotlin.Int declared in <root>.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:a type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-a>' type=<root>.A origin=null
|
||||
PROPERTY name:it visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:it type:kotlin.Int visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value=4
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-it> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Number
|
||||
correspondingProperty: PROPERTY name:it visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-it> (): kotlin.Number declared in <root>.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:it type:kotlin.Int visibility:private [final]' type=kotlin.Number origin=null
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-it>' type=<root>.A origin=null
|
||||
PROPERTY name:invertedTypes visibility:public modality:FINAL [var]
|
||||
FIELD PROPERTY_BACKING_FIELD name:invertedTypes type:kotlin.Number visibility:private
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value=42
|
||||
FUN name:<get-invertedTypes> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:invertedTypes visibility:public modality:FINAL [var]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-invertedTypes> (): kotlin.Int declared in <root>.A'
|
||||
WHEN type=kotlin.Int origin=IF
|
||||
BRANCH
|
||||
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
|
||||
arg0: CALL 'public abstract fun toInt (): kotlin.Int declared in kotlin.Number' type=kotlin.Int origin=null
|
||||
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:invertedTypes type:kotlin.Number visibility:private' type=kotlin.Number origin=GET_PROPERTY
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-invertedTypes>' type=<root>.A origin=null
|
||||
arg1: CONST Int type=kotlin.Int value=10
|
||||
then: CALL 'public abstract fun toInt (): kotlin.Int declared in kotlin.Number' type=kotlin.Int origin=null
|
||||
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:invertedTypes type:kotlin.Number visibility:private' type=kotlin.Number origin=GET_PROPERTY
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-invertedTypes>' type=<root>.A origin=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CONST Int type=kotlin.Int value=10
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-invertedTypes> visibility:public modality:FINAL <> ($this:<root>.A, <set-?>:kotlin.Int) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:invertedTypes visibility:public modality:FINAL [var]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:invertedTypes type:kotlin.Number visibility:private' type=kotlin.Unit origin=null
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<set-invertedTypes>' type=<root>.A origin=null
|
||||
value: GET_VAR '<set-?>: kotlin.Int declared in <root>.A.<set-invertedTypes>' type=kotlin.Int origin=null
|
||||
PROPERTY name:p visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value=5
|
||||
FUN name:<get-p> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-p> (): kotlin.Int declared in <root>.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=GET_PROPERTY
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-p>' type=<root>.A origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// FIR_IDENTICAL
|
||||
class A {
|
||||
var it: Int
|
||||
field = 3.14
|
||||
get() = (field + 10).toInt()
|
||||
set(value) {
|
||||
field = (value - 10).toDouble()
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a = A()
|
||||
val it: Int = A().it and 10
|
||||
a.it = it
|
||||
}
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
class A {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
var it: Double
|
||||
field = 3.14
|
||||
get(): Int {
|
||||
return <this>.#it.plus(other = 10).toInt()
|
||||
}
|
||||
set(value: Int) {
|
||||
<this>.#it = value.minus(other = 10).toDouble()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a: A = A()
|
||||
val it: Int = A().<get-it>().and(other = 10)
|
||||
a.<set-it>(value = it)
|
||||
}
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
FILE fqName:<root> fileName:/independentBackingFieldType.kt
|
||||
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:it visibility:public modality:FINAL [var]
|
||||
FIELD PROPERTY_BACKING_FIELD name:it type:kotlin.Double visibility:private
|
||||
EXPRESSION_BODY
|
||||
CONST Double type=kotlin.Double value=3.14
|
||||
FUN name:<get-it> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:it visibility:public modality:FINAL [var]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-it> (): kotlin.Int declared in <root>.A'
|
||||
CALL 'public open fun toInt (): kotlin.Int declared in kotlin.Double' type=kotlin.Int origin=null
|
||||
$this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=PLUS
|
||||
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:it type:kotlin.Double visibility:private' type=kotlin.Double origin=GET_PROPERTY
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-it>' type=<root>.A origin=null
|
||||
other: CONST Int type=kotlin.Int value=10
|
||||
FUN name:<set-it> visibility:public modality:FINAL <> ($this:<root>.A, value:kotlin.Int) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:it visibility:public modality:FINAL [var]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:it type:kotlin.Double visibility:private' type=kotlin.Unit origin=EQ
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<set-it>' type=<root>.A origin=null
|
||||
value: CALL 'public open fun toDouble (): kotlin.Double declared in kotlin.Int' type=kotlin.Double origin=null
|
||||
$this: CALL 'public final fun minus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MINUS
|
||||
$this: GET_VAR 'value: kotlin.Int declared in <root>.A.<set-it>' type=kotlin.Int origin=null
|
||||
other: CONST Int type=kotlin.Int value=10
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:a type:<root>.A [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.A' type=<root>.A origin=null
|
||||
VAR name:it type:kotlin.Int [val]
|
||||
CALL 'public final fun and (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: CALL 'public final fun <get-it> (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.A' type=<root>.A origin=null
|
||||
other: CONST Int type=kotlin.Int value=10
|
||||
CALL 'public final fun <set-it> (value: kotlin.Int): kotlin.Unit declared in <root>.A' type=kotlin.Unit origin=EQ
|
||||
$this: GET_VAR 'val a: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
||||
value: GET_VAR 'val it: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// FIR_IDENTICAL
|
||||
class A {
|
||||
val it: Number
|
||||
field = 4
|
||||
|
||||
fun test() = it + 3
|
||||
|
||||
val p = 5
|
||||
get() = field
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val d = test()
|
||||
val b = A().p + 2
|
||||
}
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
class A {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val it: Int
|
||||
field = 4
|
||||
get
|
||||
|
||||
fun test(): Int {
|
||||
return <this>.<get-it>().plus(other = 3)
|
||||
}
|
||||
|
||||
val p: Int
|
||||
field = 5
|
||||
get(): Int {
|
||||
return <this>.#p
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val d: Unit = test()
|
||||
val b: Int = A().<get-p>().plus(other = 2)
|
||||
}
|
||||
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
FILE fqName:<root> fileName:/propertyTypeNarrowing.kt
|
||||
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:it visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:it type:kotlin.Int visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value=4
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-it> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Number
|
||||
correspondingProperty: PROPERTY name:it visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-it> (): kotlin.Number declared in <root>.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:it type:kotlin.Int visibility:private [final]' type=kotlin.Number origin=null
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-it>' type=<root>.A origin=null
|
||||
FUN name:test visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Int
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test (): kotlin.Int declared in <root>.A'
|
||||
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-it> (): kotlin.Number declared in <root>.A' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: GET_VAR '<this>: <root>.A declared in <root>.A.test' type=<root>.A origin=null
|
||||
other: CONST Int type=kotlin.Int value=3
|
||||
PROPERTY name:p visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value=5
|
||||
FUN name:<get-p> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-p> (): kotlin.Int declared in <root>.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=GET_PROPERTY
|
||||
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-p>' type=<root>.A origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:d type:kotlin.Unit [val]
|
||||
CALL 'public final fun test (): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
VAR name:b type:kotlin.Int [val]
|
||||
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-p> (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.A' type=<root>.A origin=null
|
||||
other: CONST Int type=kotlin.Int value=2
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.test.runners.codegen;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/fir/fir2ir/testData/codegen/bytecodeListing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Fir2IrSpecificBytecodeListingTestGenerated extends AbstractFirBytecodeListingTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInBytecodeListing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/codegen/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("explicitBackingFieldsInJava.kt")
|
||||
public void testExplicitBackingFieldsInJava() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/bytecodeListing/explicitBackingFieldsInJava.kt");
|
||||
}
|
||||
}
|
||||
+134
-9
@@ -17,17 +17,142 @@ import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/fir/fir2ir/testData/codegen/box")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirSpecificBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInBox() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/fir2ir/testData/codegen/box")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Box {
|
||||
@Test
|
||||
public void testAllFilesPresentInBox() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sample.kt")
|
||||
public void testSample() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/sample.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/fir2ir/testData/codegen/box/properties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Properties {
|
||||
@Test
|
||||
public void testAllFilesPresentInProperties() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/codegen/box/properties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/fir2ir/testData/codegen/box/properties/backingField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BackingField {
|
||||
@Test
|
||||
public void testAllFilesPresentInBackingField() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/codegen/box/properties/backingField"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("backingFieldVisibility.kt")
|
||||
public void testBackingFieldVisibility() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/properties/backingField/backingFieldVisibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("charSequenceWithBackingField1.kt")
|
||||
public void testCharSequenceWithBackingField1() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/properties/backingField/charSequenceWithBackingField1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("charSequenceWithBackingField2.kt")
|
||||
public void testCharSequenceWithBackingField2() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/properties/backingField/charSequenceWithBackingField2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("charSequenceWithBackingField3.kt")
|
||||
public void testCharSequenceWithBackingField3() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/properties/backingField/charSequenceWithBackingField3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("charSequenceWithBackingField4.kt")
|
||||
public void testCharSequenceWithBackingField4() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/properties/backingField/charSequenceWithBackingField4.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("charSequenceWithBackingField5.kt")
|
||||
public void testCharSequenceWithBackingField5() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/properties/backingField/charSequenceWithBackingField5.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("explicitBackingFieldInAnonymous.kt")
|
||||
public void testExplicitBackingFieldInAnonymous() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/properties/backingField/explicitBackingFieldInAnonymous.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("getterReturnTypeWithBackingField.kt")
|
||||
public void testGetterReturnTypeWithBackingField() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/properties/backingField/getterReturnTypeWithBackingField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("independentBackingFieldType.kt")
|
||||
public void testIndependentBackingFieldType() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/properties/backingField/independentBackingFieldType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lateinitBackingFields.kt")
|
||||
public void testLateinitBackingFields() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/properties/backingField/lateinitBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenPropertiesWithExplicitBackingFields.kt")
|
||||
public void testOverriddenPropertiesWithExplicitBackingFields() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/properties/backingField/overriddenPropertiesWithExplicitBackingFields.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sample.kt")
|
||||
public void testSample() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/box/sample.kt");
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/fir2ir/testData/codegen/boxWithStdLib")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BoxWithStdLib {
|
||||
@Test
|
||||
public void testAllFilesPresentInBoxWithStdLib() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/codegen/boxWithStdLib"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/fir2ir/testData/codegen/boxWithStdLib/properties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Properties {
|
||||
@Test
|
||||
public void testAllFilesPresentInProperties() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/codegen/boxWithStdLib/properties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/fir2ir/testData/codegen/boxWithStdLib/properties/backingField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BackingField {
|
||||
@Test
|
||||
public void testAllFilesPresentInBackingField() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/codegen/boxWithStdLib/properties/backingField"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("backingFieldWithSmartTypeParameters.kt")
|
||||
public void testBackingFieldWithSmartTypeParameters() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/codegen/boxWithStdLib/properties/backingField/backingFieldWithSmartTypeParameters.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+44
@@ -30,4 +30,48 @@ public class Fir2IrSpecificTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
public void testSample() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/ir/irText/sample.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/fir2ir/testData/ir/irText/properties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Properties {
|
||||
@Test
|
||||
public void testAllFilesPresentInProperties() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/ir/irText/properties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/fir2ir/testData/ir/irText/properties/backingField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BackingField {
|
||||
@Test
|
||||
public void testAllFilesPresentInBackingField() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/ir/irText/properties/backingField"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("backingFieldVisibility.kt")
|
||||
public void testBackingFieldVisibility() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/ir/irText/properties/backingField/backingFieldVisibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("explicitBackingFieldType.kt")
|
||||
public void testExplicitBackingFieldType() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/ir/irText/properties/backingField/explicitBackingFieldType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("independentBackingFieldType.kt")
|
||||
public void testIndependentBackingFieldType() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/ir/irText/properties/backingField/independentBackingFieldType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyTypeNarrowing.kt")
|
||||
public void testPropertyTypeNarrowing() throws Exception {
|
||||
runTest("compiler/fir/fir2ir/testData/ir/irText/properties/backingField/propertyTypeNarrowing.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
class A {
|
||||
val number: Number
|
||||
field = 1
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class A {
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val number: Number<!>
|
||||
<!EXPLICIT_BACKING_FIELDS_UNSUPPORTED!>field = 1<!>
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
package
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
public final val number: kotlin.Number
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -197,17 +197,22 @@ KtFile: explicitBackingField.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
BACKING_FIELD
|
||||
PsiElement(field)('field')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('10')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('10')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
|
||||
Generated
+16
@@ -22491,6 +22491,22 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/properties/lateinitOnTopLevel.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/properties/backingField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BackingField {
|
||||
@Test
|
||||
public void testAllFilesPresentInBackingField() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/properties/backingField"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("trivialExplicitBackingFIeld.kt")
|
||||
public void testTrivialExplicitBackingFIeld() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/properties/backingField/trivialExplicitBackingFIeld.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/properties/inferenceFromGetters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+7
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.builders.configureFirHandlersStep
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_PSI_CLASS_FILES_READING
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_STDLIB
|
||||
import org.jetbrains.kotlin.test.frontend.fir.Fir2IrResultsConverter
|
||||
import org.jetbrains.kotlin.test.frontend.fir.FirFrontendFacade
|
||||
import org.jetbrains.kotlin.test.frontend.fir.FirMetaInfoDiffSuppressor
|
||||
@@ -43,6 +44,12 @@ open class AbstractFirBlackBoxCodegenTest : AbstractJvmBlackBoxCodegenTestBase<F
|
||||
-USE_PSI_CLASS_FILES_READING
|
||||
}
|
||||
|
||||
forTestsMatching("*WithStdLib/*") {
|
||||
defaultDirectives {
|
||||
+WITH_STDLIB
|
||||
}
|
||||
}
|
||||
|
||||
configureFirHandlersStep {
|
||||
useHandlers(
|
||||
::FirDumpHandler,
|
||||
|
||||
+1
@@ -203,6 +203,7 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
|
||||
suiteTestClassName = "FirSpecificBlackBoxCodegenTestGenerated"
|
||||
) {
|
||||
model("codegen/box")
|
||||
model("codegen/boxWithStdLib")
|
||||
}
|
||||
|
||||
testClass<AbstractFir2IrTextTest>(
|
||||
|
||||
+98
@@ -5532,6 +5532,104 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Properties {
|
||||
@Test
|
||||
public void testAllFilesPresentInProperties() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BackingField {
|
||||
@Test
|
||||
public void testAllFilesPresentInBackingField() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("backingFieldModifiers.kt")
|
||||
public void testBackingFieldModifiers() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldModifiers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("backingFieldVisibility.kt")
|
||||
public void testBackingFieldVisibility() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("backingFieldWithSmartTypeParameters.kt")
|
||||
public void testBackingFieldWithSmartTypeParameters() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("explicitBackingFieldInInterface.kt")
|
||||
public void testExplicitBackingFieldInInterface() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/explicitBackingFieldInInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("explicitBackingFieldType.kt")
|
||||
public void testExplicitBackingFieldType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/explicitBackingFieldType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("explicitBackingFieldsWithDelegates.kt")
|
||||
public void testExplicitBackingFieldsWithDelegates() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/explicitBackingFieldsWithDelegates.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("filePrivateBackingFieldAccess.kt")
|
||||
public void testFilePrivateBackingFieldAccess() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lateinitBackingFields.kt")
|
||||
public void testLateinitBackingFields() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/lateinitBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariablesWithBackingFields.kt")
|
||||
public void testLocalVariablesWithBackingFields() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/localVariablesWithBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenPropertiesWithExplicitBackingFields.kt")
|
||||
public void testOverriddenPropertiesWithExplicitBackingFields() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/overriddenPropertiesWithExplicitBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyTypeNarrowing.kt")
|
||||
public void testPropertyTypeNarrowing() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("randomWeirdBackingFields.kt")
|
||||
public void testRandomWeirdBackingFields() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/randomWeirdBackingFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redundantExplicitBackingField.kt")
|
||||
public void testRedundantExplicitBackingField() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/redundantExplicitBackingField.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/reinitializations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+16
@@ -22485,6 +22485,22 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/properties/lateinitOnTopLevel.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/properties/backingField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BackingField {
|
||||
@Test
|
||||
public void testAllFilesPresentInBackingField() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/properties/backingField"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("trivialExplicitBackingFIeld.kt")
|
||||
public void testTrivialExplicitBackingFIeld() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/properties/backingField/trivialExplicitBackingFIeld.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/properties/inferenceFromGetters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Reference in New Issue
Block a user