[FIR] Add test data

This commit is contained in:
Nikolay Lunyak
2021-08-09 16:02:09 +03:00
committed by TeamCityServer
parent 4e56ba2fa4
commit f6ae6af741
69 changed files with 1834 additions and 27 deletions
@@ -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|
}
@@ -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
}
@@ -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))
}
@@ -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
}
@@ -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))
}
@@ -0,0 +1,6 @@
val items: List<String>
field = mutableListOf()
fun test() {
items.add("one more item")
}
@@ -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|
}
@@ -0,0 +1,4 @@
interface I {
val it: Number
<!EXPLICIT_BACKING_FIELD_IN_INTERFACE!>field<!> = 10
}
@@ -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|
}
@@ -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<!>
}
@@ -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|)
}
@@ -0,0 +1,2 @@
val thingWithDelefate by lazy { 2 as Number }
<!BACKING_FIELD_FOR_DELEGATED_PROPERTY!>field<!> = 10
@@ -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|)
}
@@ -0,0 +1,6 @@
val list: List<String>
field = mutableListOf<String>()
fun add(s: String) {
list.add(s)
}
@@ -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|()
}
@@ -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()
}
@@ -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))
}
@@ -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
}
@@ -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| {
}
}
@@ -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) {}
}
@@ -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))
}
@@ -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
}
@@ -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>|
}
@@ -0,0 +1,4 @@
abstract class Some1 {
abstract val foo: List<Int>
internal <!EXPLICIT_BACKING_FIELD_IN_ABSTRACT_PROPERTY!>field<!> = mutableListOf<Int>()
}
@@ -0,0 +1,3 @@
FILE: redundantExplicitBackingField.kt
public final val it: R|kotlin/Int|
public get(): R|kotlin/Int|
@@ -0,0 +1,2 @@
val it: Int
<!REDUNDANT_EXPLICIT_BACKING_FIELD!>field<!> = 42