[FIR] add reversed testData to update it in the next commit

^KT-56543
This commit is contained in:
Dmitrii Gridin
2023-04-05 08:55:16 +02:00
committed by Space Team
parent cc52e896f9
commit 1c5aa6c45b
62 changed files with 695 additions and 36 deletions
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
fun <T, R> use(x: (T) -> R): (T) -> R = x
fun foo() = use(::bar)
@@ -0,0 +1,16 @@
FILE: implicitTypes.kt
public final fun <T, R> use(x: R|(T) -> R|): R|(T) -> R| {
^use R|<local>/x|
}
public final fun foo(): R|(kotlin/String) -> kotlin/Int| {
^foo R|/use|<R|kotlin/String|, R|kotlin/Int|>(::R|/bar|)
}
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
^bar Int(1)
}
public final fun loop1(): R|(ERROR CLASS: Cannot infer argument for type parameter T) -> ERROR CLASS: Cannot infer argument for type parameter R| {
^loop1 R|/use<Inapplicable(INAPPLICABLE): /use>#|<<ERROR TYPE REF: Cannot infer argument for type parameter T>, <ERROR TYPE REF: Cannot infer argument for type parameter R>>(::<Unresolved reference: loop2>#)
}
public final fun loop2(): <ERROR TYPE REF: cycle> {
^loop2 R|/loop1|()
}
@@ -0,0 +1,7 @@
fun <T, R> use(x: (T) -> R): (T) -> R = x
fun foo() = use(::bar)
fun bar(x: String) = 1
fun loop1() = <!INAPPLICABLE_CANDIDATE!>use<!>(::<!UNRESOLVED_REFERENCE!>loop2<!>)
fun loop2() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>loop1()<!>
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// MODULE: lib
// FILE: A.kt
@@ -0,0 +1,45 @@
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|
private <explicit backing field>: R|kotlin/Int| = Int(1)
public get(): R|kotlin/Number|
public final val b: R|kotlin/Number|
internal <explicit backing field>: R|kotlin/Int| = Int(2)
public get(): R|kotlin/Number|
public final val c: R|kotlin/Number|
protected <explicit backing field>: R|kotlin/Int| = Int(3)
public get(): R|kotlin/Number|
public final val d: R|kotlin/Number|
public <explicit backing field>: R|kotlin/Int| = Int(5)
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
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
val items: List<String>
field = mutableListOf()
@@ -0,0 +1,7 @@
FILE: backingFieldWithSmartTypeParameters.kt
public final val items: R|kotlin/collections/List<kotlin/String>|
private <explicit backing field>: R|kotlin/collections/MutableList<kotlin/String>| = R|kotlin/collections/mutableListOf|<R|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")
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
val list: List<String>
field = mutableListOf<String>()
@@ -0,0 +1,7 @@
FILE: filePrivateBackingFieldAccess.kt
public final val list: R|kotlin/collections/List<kotlin/String>|
private <explicit backing field>: R|kotlin/collections/MutableList<kotlin/String>| = R|kotlin/collections/mutableListOf|<R|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)
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
class A {
val it: Number
field = 4
@@ -0,0 +1,25 @@
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|
private <explicit backing field>: R|kotlin/Int| = Int(4)
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
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
fun foo(a: (String) -> Unit) {
"".<!UNRESOLVED_REFERENCE!>a<!>()
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
fun foo(a: (String) -> Unit) {
"".<!UNRESOLVED_REFERENCE!>a<!>()
}
@@ -0,0 +1,14 @@
fun foo(a: (String) -> Unit) {
"".<!UNRESOLVED_REFERENCE!>a<!>()
}
interface A : (String) -> Unit {}
typealias AliasedEFT = ExtensionFunctionType
fun foo(a: <!WRONG_EXTENSION_FUNCTION_TYPE!>@AliasedEFT<!> A) {
// @Extension annotation on an unrelated type shouldn't have any effect on this diagnostic.
// Only kotlin.Function{n} type annotated with @Extension should
"".a()
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// Functions can be recursively annotated
annotation class ann(val x: Int)
@ann(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>bar()<!>) fun foo() = 1
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// Functions can be recursively annotated
annotation class ann(val x: Int)
@ann(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>bar()<!>) fun foo() = 1
@@ -0,0 +1,4 @@
// Functions can be recursively annotated
annotation class ann(val x: Int)
@ann(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>bar()<!>) fun foo() = 1
@ann(<!ANNOTATION_ARGUMENT_MUST_BE_CONST, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>foo()<!>) fun bar() = 2
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FILE: I.kt
open class I : K() {
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FILE: I.kt
open class I : <!CYCLIC_INHERITANCE_HIERARCHY!>K<!>() {
@@ -1,7 +1,6 @@
// LL_FIR_DIVERGENCE
// The compiler doesn't guarantee exhaustiveness in reporting of inheritance cycles, so the compiler and LL FIR results are equally valid.
// LL_FIR_DIVERGENCE
// IGNORE_REVERSED_RESOLVE
// FILE: I.kt
open class I : <!CYCLIC_INHERITANCE_HIERARCHY!>K<!>() {
@@ -0,0 +1,20 @@
// LL_FIR_DIVERGENCE
// The compiler doesn't guarantee exhaustiveness in reporting of inheritance cycles, so the compiler and LL FIR results are equally valid.
// LL_FIR_DIVERGENCE
// FILE: I.kt
open class I : <!CYCLIC_INHERITANCE_HIERARCHY!>K<!>() {
fun foo() {}
}
// FILE: J.java
class J extends I {
void bar() {}
}
// FILE: K.kt
open class K : <!CYCLIC_INHERITANCE_HIERARCHY!>J<!>() {
fun baz() {}
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FILE: ExceptionTracker.kt
interface ExceptionTracker : <!EXPOSED_SUPER_INTERFACE!>LockBasedStorageManager.ExceptionHandlingStrategy<!> {
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FILE: ExceptionTracker.kt
interface ExceptionTracker : <!CYCLIC_INHERITANCE_HIERARCHY!>LockBasedStorageManager.ExceptionHandlingStrategy<!> {
@@ -0,0 +1,21 @@
// FILE: ExceptionTracker.kt
interface ExceptionTracker : <!EXPOSED_SUPER_INTERFACE!>LockBasedStorageManager.ExceptionHandlingStrategy<!> {
}
// FILE: StorageManager.kt
interface StorageManager : <!CYCLIC_INHERITANCE_HIERARCHY!>ExceptionTracker<!> {
fun foo()
}
// FILE: LockBasedStorageManager.java
class LockBasedStorageManager extends StorageManager {
interface ExceptionHandlingStrategy {
void bar();
}
@Override
void foo() {}
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// NI_EXPECTED_FILE
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// NI_EXPECTED_FILE
@@ -0,0 +1,17 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// NI_EXPECTED_FILE
import kotlin.reflect.KProperty
val a by <!RECURSION_IN_IMPLICIT_TYPES, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>a<!>
val b by Delegate(<!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>b<!>)
val c by d
val d by <!RECURSION_IN_IMPLICIT_TYPES, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>c<!>
class Delegate(i: Int) {
operator fun getValue(t: Any?, p: KProperty<*>): Int {
return 1
}
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// WITH_STDLIB
import kotlin.properties.ReadWriteProperty
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// WITH_STDLIB
import kotlin.properties.ReadWriteProperty
@@ -0,0 +1,35 @@
// WITH_STDLIB
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
import kotlin.reflect.KProperty1
inline fun <reified Self : DatabaseEntity, reified Target : DatabaseEntity> Self.parent(
property: KProperty1<Target, MutableCollection<Self>>): Delegate<Self, Target?> = TODO()
class GitLabBuildProcessor: DatabaseEntity {
var processor by parent(GitLabChangesProcessor::buildProcessors)
}
interface DatabaseEntity: Entity
interface Entity
interface ResourceFactory<T, R>
interface ValueFilter<K>
interface Delegate<R : Entity, T> : ReadWriteProperty<R, T>, ValueFilter<R> {
infix fun name(desc: KProperty<*>): String
infix fun by(name: String): Delegate<R, T>
infix fun resource(factory: ResourceFactory<R, T>): Delegate<R, T>
infix fun filter(filter: (R, Any?) -> Boolean): Delegate<R, T>
}
class GitLabChangesProcessor: DatabaseEntity {
var buildProcessors by <!INAPPLICABLE_CANDIDATE!>child_many<!>(
GitLabBuildProcessor::class.java,
GitLabBuildProcessor::<!UNRESOLVED_REFERENCE!>processor<!>
)
}
fun <Self : DatabaseEntity, Target : DatabaseEntity> Self.child_many(
clazz: Class<Target>, property: KProperty1<Target, Self?>, name: String = property.name
): Delegate<Self, MutableCollection<Target>> = TODO() // Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// !LANGUAGE: +ForbidRecursiveDelegateExpressions
// WITH_STDLIB
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// !LANGUAGE: +ForbidRecursiveDelegateExpressions
// WITH_STDLIB
@@ -0,0 +1,36 @@
// !LANGUAGE: +ForbidRecursiveDelegateExpressions
// WITH_STDLIB
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
import kotlin.reflect.KProperty1
inline fun <reified Self : DatabaseEntity, reified Target : DatabaseEntity> Self.parent(
property: KProperty1<Target, MutableCollection<Self>>): Delegate<Self, Target?> = TODO()
class GitLabBuildProcessor: DatabaseEntity {
var processor by parent(GitLabChangesProcessor::buildProcessors)
}
interface DatabaseEntity: Entity
interface Entity
interface ResourceFactory<T, R>
interface ValueFilter<K>
interface Delegate<R : Entity, T> : ReadWriteProperty<R, T>, ValueFilter<R> {
infix fun name(desc: KProperty<*>): String
infix fun by(name: String): Delegate<R, T>
infix fun resource(factory: ResourceFactory<R, T>): Delegate<R, T>
infix fun filter(filter: (R, Any?) -> Boolean): Delegate<R, T>
}
class GitLabChangesProcessor: DatabaseEntity {
var buildProcessors by <!INAPPLICABLE_CANDIDATE!>child_many<!>(
GitLabBuildProcessor::class.java,
GitLabBuildProcessor::<!UNRESOLVED_REFERENCE!>processor<!>
)
}
fun <Self : DatabaseEntity, Target : DatabaseEntity> Self.child_many(
clazz: Class<Target>, property: KProperty1<Target, Self?>, name: String = property.name
): Delegate<Self, MutableCollection<Target>> = TODO() // Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Scope
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Scope
@@ -0,0 +1,18 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Scope
fun <T> simpleAsync0(block: Scope.() -> T) {}
fun <T> simpleAsync1(block: suspend Scope.() -> T) {}
suspend fun <T> simpleAsync2(block: Scope.() -> T) {}
suspend fun <T> simpleAsync3(block: suspend Scope.() -> T) {}
fun insideJob0() = doTheJob0()
fun insideJob1() = doTheJob1()
suspend fun insideJob2() = doTheJob2()
suspend fun insideJob3() = doTheJob3()
fun doTheJob0() = simpleAsync0 { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob0()<!> }
fun doTheJob1() = simpleAsync1 { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob1()<!> }
suspend fun doTheJob2() = simpleAsync2 { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!NON_LOCAL_SUSPENSION_POINT!>insideJob2<!>()<!> }
suspend fun doTheJob3() = simpleAsync3 { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob3()<!> }
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// ISSUE: KT-57166
// FILE: Modality.kt
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// ISSUE: KT-57166
// FILE: Modality.kt
@@ -0,0 +1,33 @@
// ISSUE: KT-57166
// FILE: Modality.kt
enum class Modality {
FINAL
}
// FILE: ClassDescriptor.java
public interface ClassDescriptor {
@NotNull
Modality getModality();
}
// FILE: DeserializedClassDescriptor.kt
object ProtoEnumFlags {
fun modality(): Modality = Modality.FINAL
}
class DeserializedClassDescriptor : ClassDescriptor {
private val modality = ProtoEnumFlags.modality()
override fun getModality() = modality
}
fun modality(): Modality = Modality.FINAL
class DeserializedClassDescriptor2 : ClassDescriptor {
private val modality = modality()
override fun getModality() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>modality<!>
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FILE: Boo.java
public class Boo<P2, P3, P4> {
static Foo test1() { return null; }
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FILE: Boo.java
public class Boo<P2, P3, P4> {
static Foo test1() { return null; }
@@ -0,0 +1,12 @@
// FILE: Boo.java
public class Boo<P2, P3, P4> {
static Foo test1() { return null; }
}
// FILE: Foo.kt
class Foo<P1 : Boo<P2, P3, P4>, P2 : Boo<P1, P3, P4>, P3 : Boo<P1, P2, P4>, P4 : Boo<P1, P2, P3>> {}
// FILE: main.kt
fun main() {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("Foo<Boo<Boo<*, Boo<*, *, Boo<*, *, *>>, Boo<*, *, *>>, Boo<*, *, Boo<*, *, *>>, Boo<*, *, *>>, Boo<*, Boo<*, *, Boo<*, *, *>>, Boo<*, *, *>>, Boo<*, *, Boo<*, *, *>>, Boo<*, *, *>>..Foo<*, *, *, *>?!")!>Boo.test1()<!>
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FIR_IDENTICAL
// ISSUE: KT-57198
// FILE: CustomGdbServerRunConfiguration.java
@@ -0,0 +1,17 @@
// FIR_IDENTICAL
// ISSUE: KT-57198
// FILE: CustomGdbServerRunConfiguration.java
public class CustomGdbServerRunConfiguration implements CidrRunConfiguration {}
// FILE: main.kt
interface CidrBuildTarget<BC>
interface CidrRunConfiguration<BC, TARGET: CidrBuildTarget<BC>>
fun applyEditorTo(arg: CidrRunConfiguration<Any?, CidrBuildTarget<Any?>>) {}
fun main() {
// Previously, for CidrRunConfiguration raw type, it's lower bound was resolved as CidrRunConfiguration<Any?, CidrBuildTarget<*>> in K2
// That is not a subtype of CidrRunConfiguration<Any?, CidrBuildTarget<Any?>>
applyEditorTo(CustomGdbServerRunConfiguration()) // K1: ok, K2: was ARGUMENT_TYPE_MISMATCH
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// !DIAGNOSTICS: -FINAL_UPPER_BOUND -CAST_NEVER_SUCCEEDS
// !LANGUAGE: -AllowEmptyIntersectionsInResultTypeResolver
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// !DIAGNOSTICS: -FINAL_UPPER_BOUND -CAST_NEVER_SUCCEEDS
// !LANGUAGE: -AllowEmptyIntersectionsInResultTypeResolver
@@ -0,0 +1,84 @@
// !DIAGNOSTICS: -FINAL_UPPER_BOUND -CAST_NEVER_SUCCEEDS
// !LANGUAGE: -AllowEmptyIntersectionsInResultTypeResolver
interface I
class View1
open class View2
interface View3
abstract class View4
interface View5
fun <T: View1> findViewById1(): T = null as T
fun test1(): I = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById1()<!>
fun <T: View2> findViewById2(): T = null as T
fun test2(): I = findViewById2()
inline fun <reified T: View1> findViewById3(): T = null as T
fun test3(): I = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById3()<!>
inline fun <reified T: View2> findViewById4(): T = null as T
fun test4(): I = findViewById4()
fun <T: View3> findViewById5(): T = null as T
fun test5(): I = findViewById5()
inline fun <reified T: View3> findViewById6(): T = null as T
fun test6(): I = findViewById6()
fun <T: View4> findViewById7(): T = null as T
fun test7(): I = findViewById7()
inline fun <reified T: View4> findViewById8(): T = null as T
fun test8(): I = findViewById8()
fun <T> findViewById9(): T where T: View3, T: View5 = null as T
fun test9(): I = findViewById9()
inline fun <reified T> findViewById10(): T where T: View3, T: View5 = null as T
fun test10(): I = findViewById10()
fun <T: View2> findViewById11(): T = null as T
fun test11(): View4 = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById11()<!>
object Obj {
fun <T: I> findViewById1(): T = null as T
fun test1(): View1 = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById1()<!>
fun <T: I> findViewById2(): T = null as T
fun test2(): View2 = findViewById2()
inline fun <reified T: I> findViewById3(): T = null as T
fun test3(): View1 = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById3()<!>
inline fun <reified T: I> findViewById4(): T = null as T
fun test4(): View2 = findViewById4()
fun <T: I> findViewById5(): T = null as T
fun test5(): View3 = findViewById5()
inline fun <reified T: I> findViewById6(): T = null as T
fun test6(): View3 = findViewById6()
fun <T: I> findViewById7(): T = null as T
fun test7(): View4 = findViewById7()
inline fun <reified T: I> findViewById8(): T = null as T
fun test8(): View4 = findViewById8()
fun <T> findViewById9(): T where T: View3, T: View5 = null as T
fun test9(): View1 = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById9()<!>
inline fun <reified T> findViewById10(): T where T: View3, T: View5 = null as T
fun test10(): View1 = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById10()<!>
fun <T: View2> findViewById11(): T = null as T
fun test11(): View4 = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById11()<!>
}
interface A
open class B {
fun <T> f(): T where T : A, T : B = null as T
fun g(): A = f()
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FIR_IDENTICAL
// FILE: 1.kt
package bar
@@ -14,4 +13,4 @@ import bar.HostAlias.foo
fun test() {
foo()
}
}
@@ -0,0 +1,16 @@
// FIR_IDENTICAL
// FILE: 1.kt
package bar
typealias HostAlias = Host
object Host {
fun foo() {}
}
// FILE: 2.kt
import bar.HostAlias.foo
fun test() {
foo()
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
// SKIP_JAVAC
@@ -0,0 +1,29 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
// SKIP_JAVAC
// FILE: test/jv/JavaSample.java
package test.jv;
public class JavaSample {
public static void member() {}
}
// FILE: foo.kt
package test.kot
typealias JavaAlias = test.jv.JavaSample
// FILE: test.kt
import test.kot.JavaAlias
import test.kot.JavaAlias.member
fun foo(
sample: <!UNRESOLVED_REFERENCE!>JavaSample<!>,
alias: JavaAlias
) {
member()
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FILE: foo.kt
package test
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FILE: foo.kt
package test
@@ -0,0 +1,28 @@
// FILE: foo.kt
package test
typealias ClassAlias = ClassSample
typealias ObjectAlias = ObjectSample
typealias EnumAlias = EnumSample
class ClassSample
object ObjectSample
enum class EnumSample {
Entry;
}
// FILE: bar.kt
import test.ClassAlias.*
import test.ObjectAlias.*
import test.EnumAlias.*
import test.EnumAlias
fun bar() {
Entry
EnumAlias.Entry
}
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FIR_DUMP
// WITH_REFLECT
@@ -1,4 +1,3 @@
// IGNORE_REVERSED_RESOLVE
// FIR_DUMP
// WITH_REFLECT
@@ -0,0 +1,95 @@
FILE: kt50994.fir.kt
public final class ProcessorWithParent : R|Entity| {
public constructor(): R|ProcessorWithParent| {
super<R|kotlin/Any|>()
}
public final var processor: R|ProcessorWithChildren?|by this@R|/ProcessorWithParent|.R|/parent|<R|ProcessorWithParent|, R|ProcessorWithChildren|>(Q|ProcessorWithChildren|::R|/ProcessorWithChildren.processors|)
public get(): R|ProcessorWithChildren?| {
^ this@R|/ProcessorWithParent|.D|/ProcessorWithParent.processor|.R|SubstitutionOverride</Delegate.getValue: R|Stub (chain inference): TypeVariable(_TP)?|>|(this@R|/ProcessorWithParent|, ::R|/ProcessorWithParent.processor|)
}
public set(<set-?>: R|ProcessorWithChildren?|): R|kotlin/Unit| {
this@R|/ProcessorWithParent|.D|/ProcessorWithParent.processor|.R|SubstitutionOverride</Delegate.setValue: R|kotlin/Unit|>|(this@R|/ProcessorWithParent|, ::R|/ProcessorWithParent.processor|, R|<local>/processor|)
}
}
public final class ProcessorWithChildren : R|Entity| {
public constructor(): R|ProcessorWithChildren| {
super<R|kotlin/Any|>()
}
public final var processors: R|kotlin/collections/MutableCollection<ERROR CLASS: Type for TC is not inferred>|by this@R|/ProcessorWithChildren|.R|/children<Inapplicable(INAPPLICABLE): /children>#|<<ERROR TYPE REF: Type for SC is not inferred>, <ERROR TYPE REF: Type for TC is not inferred>>(<getClass>(Q|ProcessorWithParent|).R|kotlin/jvm/java|<R|ProcessorWithParent|>, Q|ProcessorWithParent|::<Unresolved reference: processor>#)
public get(): R|kotlin/collections/MutableCollection<ERROR CLASS: Type for TC is not inferred>| {
^ this@R|/ProcessorWithChildren|.D|/ProcessorWithChildren.processors|.R|SubstitutionOverride</Delegate.getValue: R|kotlin/collections/MutableCollection<Stub (chain inference): TypeVariable(_TC)>|>|(this@R|/ProcessorWithChildren|, ::R|/ProcessorWithChildren.processors|)
}
public set(<set-?>: R|kotlin/collections/MutableCollection<ERROR CLASS: Type for TC is not inferred>|): R|kotlin/Unit| {
this@R|/ProcessorWithChildren|.D|/ProcessorWithChildren.processors|.R|SubstitutionOverride</Delegate.setValue: R|kotlin/Unit|>|(this@R|/ProcessorWithChildren|, ::R|/ProcessorWithChildren.processors|, R|<local>/processors|)
}
}
public final class Processor2WithParent : R|Entity| {
public constructor(): R|Processor2WithParent| {
super<R|kotlin/Any|>()
}
public final var processor: R|Processor2WithChildren?|by this@R|/Processor2WithParent|.R|/parent|<R|Processor2WithParent|, R|Processor2WithChildren|>(Q|Processor2WithChildren|::R|/Processor2WithChildren.processors|)
public get(): R|Processor2WithChildren?| {
^ this@R|/Processor2WithParent|.D|/Processor2WithParent.processor|.R|SubstitutionOverride</Delegate.getValue: R|Processor2WithChildren?|>|(this@R|/Processor2WithParent|, ::R|/Processor2WithParent.processor|)
}
public set(<set-?>: R|Processor2WithChildren?|): R|kotlin/Unit| {
this@R|/Processor2WithParent|.D|/Processor2WithParent.processor|.R|SubstitutionOverride</Delegate.setValue: R|kotlin/Unit|>|(this@R|/Processor2WithParent|, ::R|/Processor2WithParent.processor|, R|<local>/processor|)
}
}
public final class Processor2WithChildren : R|Entity| {
public constructor(): R|Processor2WithChildren| {
super<R|kotlin/Any|>()
}
public final var processors: R|kotlin/collections/MutableCollection<Processor2WithParent>|by this@R|/Processor2WithChildren|.R|/children|<R|Processor2WithChildren|, R|Processor2WithParent|>(<getClass>(Q|Processor2WithParent|).R|kotlin/jvm/java|<R|Processor2WithParent|>, Q|Processor2WithParent|::R|/Processor2WithParent.processor|)
public get(): R|kotlin/collections/MutableCollection<Processor2WithParent>| {
^ this@R|/Processor2WithChildren|.D|/Processor2WithChildren.processors|.R|SubstitutionOverride</Delegate.getValue: R|kotlin/collections/MutableCollection<Stub (chain inference): TypeVariable(_TC)>|>|(this@R|/Processor2WithChildren|, ::R|/Processor2WithChildren.processors|)
}
public set(<set-?>: R|kotlin/collections/MutableCollection<Processor2WithParent>|): R|kotlin/Unit| {
this@R|/Processor2WithChildren|.D|/Processor2WithChildren.processors|.R|SubstitutionOverride</Delegate.setValue: R|kotlin/Unit|>|(this@R|/Processor2WithChildren|, ::R|/Processor2WithChildren.processors|, R|<local>/processors|)
}
}
public final class Processor3WithParent : R|Entity| {
public constructor(): R|Processor3WithParent| {
super<R|kotlin/Any|>()
}
public final var processor: R|Processor3WithChildren?|by this@R|/Processor3WithParent|.R|/parent|<R|Processor3WithParent|, R|Processor3WithChildren|>(Q|Processor3WithChildren|::R|/Processor3WithChildren.processors|)
public get(): R|Processor3WithChildren?| {
^ this@R|/Processor3WithParent|.D|/Processor3WithParent.processor|.R|SubstitutionOverride</Delegate.getValue: R|Processor3WithChildren?|>|(this@R|/Processor3WithParent|, ::R|/Processor3WithParent.processor|)
}
public set(<set-?>: R|Processor3WithChildren?|): R|kotlin/Unit| {
this@R|/Processor3WithParent|.D|/Processor3WithParent.processor|.R|SubstitutionOverride</Delegate.setValue: R|kotlin/Unit|>|(this@R|/Processor3WithParent|, ::R|/Processor3WithParent.processor|, R|<local>/processor|)
}
}
public final class Processor3WithChildren : R|Entity| {
public constructor(): R|Processor3WithChildren| {
super<R|kotlin/Any|>()
}
public final var processors: R|kotlin/collections/MutableCollection<Processor3WithParent>|by this@R|/Processor3WithChildren|.R|/children|<R|Processor3WithChildren|, R|Processor3WithParent|>(<getClass>(Q|Processor3WithParent|).R|kotlin/jvm/java|<R|Processor3WithParent|>, Q|Processor3WithParent|::R|/Processor3WithParent.processor|)
public get(): R|kotlin/collections/MutableCollection<Processor3WithParent>| {
^ this@R|/Processor3WithChildren|.D|/Processor3WithChildren.processors|.R|SubstitutionOverride</Delegate.getValue: R|kotlin/collections/MutableCollection<Stub (chain inference): TypeVariable(_TC)>|>|(this@R|/Processor3WithChildren|, ::R|/Processor3WithChildren.processors|)
}
public set(<set-?>: R|kotlin/collections/MutableCollection<Processor3WithParent>|): R|kotlin/Unit| {
this@R|/Processor3WithChildren|.D|/Processor3WithChildren.processors|.R|SubstitutionOverride</Delegate.setValue: R|kotlin/Unit|>|(this@R|/Processor3WithChildren|, ::R|/Processor3WithChildren.processors|, R|<local>/processors|)
}
}
public final inline fun <reified SP : R|Entity|, reified TP : R|Entity|> R|SP|.parent(property: R|kotlin/reflect/KProperty1<TP, kotlin/collections/MutableCollection<SP>>|): R|Delegate<SP, TP?>| {
^parent Null(null)!!
}
public final fun <SC : R|Entity|, TC : R|Entity|> R|SC|.children(clazz: R|java/lang/Class<TC>|, property: R|kotlin/reflect/KProperty1<TC, SC?>|, name: R|kotlin/String| = R|<local>/property|.R|SubstitutionOverride<kotlin/reflect/KProperty1.name: R|kotlin/String|>|): R|Delegate<SC, kotlin/collections/MutableCollection<TC>>| {
^children Null(null)!!
}
public abstract interface Delegate<R : R|Entity|, T> : R|kotlin/properties/ReadWriteProperty<R, T>| {
}
public abstract interface Entity : R|kotlin/Any| {
}
@@ -0,0 +1,41 @@
// FIR_DUMP
// WITH_REFLECT
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty1
class ProcessorWithParent : Entity {
var processor by parent(ProcessorWithChildren::processors)
}
class ProcessorWithChildren : Entity {
var processors by <!INAPPLICABLE_CANDIDATE!>children<!>(ProcessorWithParent::class.java, ProcessorWithParent::<!UNRESOLVED_REFERENCE!>processor<!>)
}
class Processor2WithParent : Entity {
var processor: Processor2WithChildren? by parent(Processor2WithChildren::processors)
}
class Processor2WithChildren : Entity {
var processors by children(Processor2WithParent::class.java, Processor2WithParent::processor)
}
class Processor3WithParent : Entity {
var processor by parent(Processor3WithChildren::processors)
}
class Processor3WithChildren : Entity {
var processors: MutableCollection<Processor3WithParent> by children(Processor3WithParent::class.java, Processor3WithParent::processor)
}
inline fun <reified SP : Entity, reified TP : Entity> SP.parent(
property: KProperty1<TP, MutableCollection<SP>>
): Delegate<SP, TP?> = null!!
fun <SC : Entity, TC : Entity> SC.children(
clazz: Class<TC>, property: KProperty1<TC, SC?>, name: String = property.name
): Delegate<SC, MutableCollection<TC>> = null!!
interface Delegate<R : Entity, T> : ReadWriteProperty<R, T>
interface Entity