[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 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
}