From 1c5aa6c45b50d9fb9374b13b5a4d74b6d7f359ca Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Wed, 5 Apr 2023 08:55:16 +0200 Subject: [PATCH] [FIR] add reversed testData to update it in the next commit ^KT-56543 --- .../callableReferences/implicitTypes.kt | 1 - .../implicitTypes.reversed.fir.txt | 16 ++++ .../implicitTypes.reversed.kt | 7 ++ .../backingField/backingFieldVisibility.kt | 1 - .../backingFieldVisibility.reversed.fir.txt | 45 +++++++++ .../backingFieldVisibility.reversed.kt | 40 ++++++++ .../backingFieldWithSmartTypeParameters.kt | 1 - ...ldWithSmartTypeParameters.reversed.fir.txt | 7 ++ ...ngFieldWithSmartTypeParameters.reversed.kt | 6 ++ .../filePrivateBackingFieldAccess.kt | 1 - ...PrivateBackingFieldAccess.reversed.fir.txt | 7 ++ .../filePrivateBackingFieldAccess.reversed.kt | 6 ++ .../backingField/propertyTypeNarrowing.kt | 1 - .../propertyTypeNarrowing.reversed.fir.txt | 25 +++++ .../propertyTypeNarrowing.reversed.kt | 15 +++ .../FreeFunctionCalledAsExtension.fir.kt | 1 - .../tests/FreeFunctionCalledAsExtension.kt | 1 - .../FreeFunctionCalledAsExtension.reversed.kt | 14 +++ ...yRecursivelyAnnotatedGlobalFunction.fir.kt | 1 - ...uallyRecursivelyAnnotatedGlobalFunction.kt | 1 - ...rsivelyAnnotatedGlobalFunction.reversed.kt | 4 + .../kotlinJavaKotlinCycle.fir.kt | 1 - .../cyclicHierarchy/kotlinJavaKotlinCycle.kt | 1 - .../kotlinJavaKotlinCycle.ll.kt | 1 - .../kotlinJavaKotlinCycle.reversed.kt | 20 ++++ .../kotlinJavaNestedCycle.fir.kt | 1 - .../cyclicHierarchy/kotlinJavaNestedCycle.kt | 1 - .../kotlinJavaNestedCycle.reversed.kt | 21 ++++ .../delegatedProperty/recursiveType.fir.kt | 1 - .../tests/delegatedProperty/recursiveType.kt | 1 - .../recursiveType.reversed.kt | 17 ++++ .../tests/delegation/kt49477.fir.kt | 1 - .../diagnostics/tests/delegation/kt49477.kt | 1 - .../tests/delegation/kt49477.reversed.kt | 35 +++++++ .../tests/delegation/kt49477Error.fir.kt | 1 - .../tests/delegation/kt49477Error.kt | 1 - .../tests/delegation/kt49477Error.reversed.kt | 36 +++++++ .../inference/recursiveCalls/kt23531.fir.kt | 1 - .../tests/inference/recursiveCalls/kt23531.kt | 1 - .../recursiveCalls/kt23531.reversed.kt | 18 ++++ .../j+k/syntheticPropertyOverridden2.fir.kt | 1 - .../tests/j+k/syntheticPropertyOverridden2.kt | 1 - .../syntheticPropertyOverridden2.reversed.kt | 33 +++++++ ...erdependentTypeParametersFromKotlin.fir.kt | 1 - .../interdependentTypeParametersFromKotlin.kt | 1 - ...endentTypeParametersFromKotlin.reversed.kt | 12 +++ .../rawTypes/nonProjectedInnerErasure.kt | 1 - .../nonProjectedInnerErasure.reversed.kt | 17 ++++ .../tests/typeParameters/kt46186.fir.kt | 1 - .../tests/typeParameters/kt46186.kt | 1 - .../tests/typeParameters/kt46186.reversed.kt | 84 ++++++++++++++++ .../typealias/importFromTypeAliasObject.kt | 3 +- .../importFromTypeAliasObject.reversed.kt | 16 ++++ .../typealias/importMemberFromJavaViaAlias.kt | 1 - .../importMemberFromJavaViaAlias.reversed.kt | 29 ++++++ .../typealias/starImportOnTypeAlias.fir.kt | 1 - .../tests/typealias/starImportOnTypeAlias.kt | 1 - .../starImportOnTypeAlias.reversed.kt | 28 ++++++ .../inference/delegates/kt50994.fir.kt | 1 - .../inference/delegates/kt50994.kt | 1 - .../delegates/kt50994.reversed.fir.txt | 95 +++++++++++++++++++ .../inference/delegates/kt50994.reversed.kt | 41 ++++++++ 62 files changed, 695 insertions(+), 36 deletions(-) create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.fir.txt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.kt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.reversed.fir.txt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.reversed.kt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.reversed.fir.txt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.reversed.kt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.reversed.fir.txt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.reversed.kt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.reversed.fir.txt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/delegation/kt49477.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/delegation/kt49477Error.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/j+k/syntheticPropertyOverridden2.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/platformTypes/rawTypes/interdependentTypeParametersFromKotlin.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonProjectedInnerErasure.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/typeParameters/kt46186.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/typealias/importFromTypeAliasObject.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/typealias/importMemberFromJavaViaAlias.reversed.kt create mode 100644 compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.reversed.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.reversed.fir.txt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.reversed.kt diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.kt index dc9e8ea9078..6298db84ebc 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun use(x: (T) -> R): (T) -> R = x fun foo() = use(::bar) diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.fir.txt new file mode 100644 index 00000000000..4ea0a252edf --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.fir.txt @@ -0,0 +1,16 @@ +FILE: implicitTypes.kt + public final fun use(x: R|(T) -> R|): R|(T) -> R| { + ^use R|/x| + } + public final fun foo(): R|(kotlin/String) -> kotlin/Int| { + ^foo R|/use|(::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#|<, >(::#) + } + public final fun loop2(): { + ^loop2 R|/loop1|() + } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.kt new file mode 100644 index 00000000000..6298db84ebc --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.kt @@ -0,0 +1,7 @@ +fun use(x: (T) -> R): (T) -> R = x + +fun foo() = use(::bar) +fun bar(x: String) = 1 + +fun loop1() = use(::loop2) +fun loop2() = loop1() diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.kt index 0f6cce3f0f9..963c85ae7c9 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // MODULE: lib // FILE: A.kt diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.reversed.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.reversed.fir.txt new file mode 100644 index 00000000000..2942fb461c5 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.reversed.fir.txt @@ -0,0 +1,45 @@ +Module: lib +FILE: A.kt + public final class A : R|kotlin/Any| { + public constructor(): R|A| { + super() + } + + public final val a: R|kotlin/Number| + private : R|kotlin/Int| = Int(1) + public get(): R|kotlin/Number| + + public final val b: R|kotlin/Number| + internal : R|kotlin/Int| = Int(2) + public get(): R|kotlin/Number| + + public final val c: R|kotlin/Number| + protected : R|kotlin/Int| = Int(3) + public get(): R|kotlin/Number| + + public final val d: R|kotlin/Number| + public : 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: = R|/A.A|().R|/A.c|.#(Int(30)) + lval dI: = R|/A.A|().R|/A.d|.#(Int(40)) + } + + } + public final fun test(): R|kotlin/Unit| { + lval aA: = R|/A.A|().R|/A.a|.#(Int(10)) + lval bA: R|kotlin/Int| = R|/A.A|().R|/A.b|.R|kotlin/Int.plus|(Int(20)) + lval cA: = R|/A.A|().R|/A.c|.#(Int(30)) + lval dA: = R|/A.A|().R|/A.d|.#(Int(40)) + } +Module: main +FILE: B.kt + public final fun main(): R|kotlin/Unit| { + lval aB: = R|/A.A|().R|/A.a|.#(Int(10)) + lval bB: = R|/A.A|().R|/A.b|.#(Int(20)) + lval cB: = R|/A.A|().R|/A.c|.#(Int(30)) + lval dB: = R|/A.A|().R|/A.d|.#(Int(40)) + } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.reversed.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.reversed.kt new file mode 100644 index 00000000000..963c85ae7c9 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldVisibility.reversed.kt @@ -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 + protected field = 3 + + val d: Number + public field = 5 + + fun rest() { + val aI = A().a + 10 + val bI = A().b + 20 + val cI = A().c + 30 + val dI = A().d + 40 + } +} + +fun test() { + val aA = A().a + 10 + val bA = A().b + 20 + val cA = A().c + 30 + val dA = A().d + 40 +} + +// MODULE: main(lib) +// FILE: B.kt + +fun main() { + val aB = A().a + 10 + val bB = A().b + 20 + val cB = A().c + 30 + val dB = A().d + 40 +} diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.kt index 9fcb84e4582..7fe46de630b 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE val items: List field = mutableListOf() diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.reversed.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.reversed.fir.txt new file mode 100644 index 00000000000..c41ad3dee9e --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.reversed.fir.txt @@ -0,0 +1,7 @@ +FILE: backingFieldWithSmartTypeParameters.kt + public final val items: R|kotlin/collections/List| + private : R|kotlin/collections/MutableList| = R|kotlin/collections/mutableListOf|() + public get(): R|kotlin/collections/List| + public final fun test(): R|kotlin/Unit| { + R|/items|.R|SubstitutionOverride|(String(one more item)) + } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.reversed.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.reversed.kt new file mode 100644 index 00000000000..7fe46de630b --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/backingFieldWithSmartTypeParameters.reversed.kt @@ -0,0 +1,6 @@ +val items: List + field = mutableListOf() + +fun test() { + items.add("one more item") +} diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.kt index a4fa40b24b4..d71b5697aaa 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE val list: List field = mutableListOf() diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.reversed.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.reversed.fir.txt new file mode 100644 index 00000000000..f8daf7214ed --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.reversed.fir.txt @@ -0,0 +1,7 @@ +FILE: filePrivateBackingFieldAccess.kt + public final val list: R|kotlin/collections/List| + private : R|kotlin/collections/MutableList| = R|kotlin/collections/mutableListOf|() + public get(): R|kotlin/collections/List| + public final fun add(s: R|kotlin/String|): R|kotlin/Unit| { + R|/list|.R|SubstitutionOverride|(R|/s|) + } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.reversed.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.reversed.kt new file mode 100644 index 00000000000..d71b5697aaa --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/filePrivateBackingFieldAccess.reversed.kt @@ -0,0 +1,6 @@ +val list: List + field = mutableListOf() + +fun add(s: String) { + list.add(s) +} diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.kt index de197cb4aef..ebd1d9e3ca0 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A { val it: Number field = 4 diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.reversed.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.reversed.fir.txt new file mode 100644 index 00000000000..e7d9ed0cae0 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.reversed.fir.txt @@ -0,0 +1,25 @@ +FILE: propertyTypeNarrowing.kt + public final class A : R|kotlin/Any| { + public constructor(): R|A| { + super() + } + + public final val it: R|kotlin/Number| + private : 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: = R|/A.A|().R|/A.it|.#(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)) + } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.reversed.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.reversed.kt new file mode 100644 index 00000000000..ebd1d9e3ca0 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/propertyTypeNarrowing.reversed.kt @@ -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 + 1 + val d = test() + val b = A().p + 2 +} diff --git a/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.fir.kt b/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.fir.kt index 9acfe8bc214..140ff3919a6 100644 --- a/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.fir.kt +++ b/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun foo(a: (String) -> Unit) { "".a() } diff --git a/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.kt b/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.kt index 3770aaffe43..b742d3ccb3c 100644 --- a/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.kt +++ b/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun foo(a: (String) -> Unit) { "".a() } diff --git a/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.reversed.kt b/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.reversed.kt new file mode 100644 index 00000000000..140ff3919a6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.reversed.kt @@ -0,0 +1,14 @@ +fun foo(a: (String) -> Unit) { + "".a() +} + + + +interface A : (String) -> Unit {} +typealias AliasedEFT = ExtensionFunctionType + +fun foo(a: @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() +} diff --git a/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.fir.kt b/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.fir.kt index 4dac3e7ca5f..21c3066e89b 100644 --- a/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // Functions can be recursively annotated annotation class ann(val x: Int) @ann(bar()) fun foo() = 1 diff --git a/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt b/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt index 58cac24bed1..552ec93b99e 100644 --- a/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt +++ b/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // Functions can be recursively annotated annotation class ann(val x: Int) @ann(bar()) fun foo() = 1 diff --git a/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.reversed.kt b/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.reversed.kt new file mode 100644 index 00000000000..240fc6e4d79 --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.reversed.kt @@ -0,0 +1,4 @@ +// Functions can be recursively annotated +annotation class ann(val x: Int) +@ann(bar()) fun foo() = 1 +@ann(foo()) fun bar() = 2 \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.fir.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.fir.kt index 165a6b0e16f..c56c6f3492f 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.fir.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FILE: I.kt open class I : K() { diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.kt index 24e97f83e97..1df66a7bd15 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FILE: I.kt open class I : K() { diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.ll.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.ll.kt index ba8326c24d3..450445819cf 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.ll.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.ll.kt @@ -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 : K() { diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.reversed.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.reversed.kt new file mode 100644 index 00000000000..450445819cf --- /dev/null +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.reversed.kt @@ -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 : K() { + fun foo() {} +} + +// FILE: J.java + +class J extends I { + void bar() {} +} + +// FILE: K.kt + +open class K : J() { + fun baz() {} +} diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.fir.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.fir.kt index 663f78ed117..208e0735310 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.fir.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FILE: ExceptionTracker.kt interface ExceptionTracker : LockBasedStorageManager.ExceptionHandlingStrategy { diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.kt index 7d341522483..1edd2e30e6d 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FILE: ExceptionTracker.kt interface ExceptionTracker : LockBasedStorageManager.ExceptionHandlingStrategy { diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.reversed.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.reversed.kt new file mode 100644 index 00000000000..208e0735310 --- /dev/null +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.reversed.kt @@ -0,0 +1,21 @@ +// FILE: ExceptionTracker.kt + +interface ExceptionTracker : LockBasedStorageManager.ExceptionHandlingStrategy { +} + +// FILE: StorageManager.kt + +interface StorageManager : ExceptionTracker { + fun foo() +} + +// FILE: LockBasedStorageManager.java + +class LockBasedStorageManager extends StorageManager { + interface ExceptionHandlingStrategy { + void bar(); + } + + @Override + void foo() {} +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.fir.kt index be7e772f445..0ca79449c41 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER // NI_EXPECTED_FILE diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt index 870c51aaa54..a85581e4f19 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER // NI_EXPECTED_FILE diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.reversed.kt b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.reversed.kt new file mode 100644 index 00000000000..0ca79449c41 --- /dev/null +++ b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.reversed.kt @@ -0,0 +1,17 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// NI_EXPECTED_FILE + +import kotlin.reflect.KProperty + +val a by a + +val b by Delegate(b) + +val c by d +val d by c + +class Delegate(i: Int) { + operator fun getValue(t: Any?, p: KProperty<*>): Int { + return 1 + } +} diff --git a/compiler/testData/diagnostics/tests/delegation/kt49477.fir.kt b/compiler/testData/diagnostics/tests/delegation/kt49477.fir.kt index 990bb273b76..45014c3ecde 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt49477.fir.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt49477.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // WITH_STDLIB import kotlin.properties.ReadWriteProperty diff --git a/compiler/testData/diagnostics/tests/delegation/kt49477.kt b/compiler/testData/diagnostics/tests/delegation/kt49477.kt index b7778d18b5d..2efb3cc60fd 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt49477.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt49477.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // WITH_STDLIB import kotlin.properties.ReadWriteProperty diff --git a/compiler/testData/diagnostics/tests/delegation/kt49477.reversed.kt b/compiler/testData/diagnostics/tests/delegation/kt49477.reversed.kt new file mode 100644 index 00000000000..45014c3ecde --- /dev/null +++ b/compiler/testData/diagnostics/tests/delegation/kt49477.reversed.kt @@ -0,0 +1,35 @@ +// WITH_STDLIB + +import kotlin.properties.ReadWriteProperty +import kotlin.reflect.KProperty +import kotlin.reflect.KProperty1 + +inline fun Self.parent( + property: KProperty1>): Delegate = TODO() + +class GitLabBuildProcessor: DatabaseEntity { + var processor by parent(GitLabChangesProcessor::buildProcessors) +} + +interface DatabaseEntity: Entity +interface Entity +interface ResourceFactory +interface ValueFilter + +interface Delegate : ReadWriteProperty, ValueFilter { + infix fun name(desc: KProperty<*>): String +infix fun by(name: String): Delegate +infix fun resource(factory: ResourceFactory): Delegate +infix fun filter(filter: (R, Any?) -> Boolean): Delegate +} + +class GitLabChangesProcessor: DatabaseEntity { + var buildProcessors by child_many( + GitLabBuildProcessor::class.java, + GitLabBuildProcessor::processor + ) +} + +fun Self.child_many( + clazz: Class, property: KProperty1, name: String = property.name +): Delegate> = TODO() // Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly diff --git a/compiler/testData/diagnostics/tests/delegation/kt49477Error.fir.kt b/compiler/testData/diagnostics/tests/delegation/kt49477Error.fir.kt index bcc6246dd1d..e99e8bdb576 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt49477Error.fir.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt49477Error.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +ForbidRecursiveDelegateExpressions // WITH_STDLIB diff --git a/compiler/testData/diagnostics/tests/delegation/kt49477Error.kt b/compiler/testData/diagnostics/tests/delegation/kt49477Error.kt index a0086fccd19..e51ea6d7b9e 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt49477Error.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt49477Error.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +ForbidRecursiveDelegateExpressions // WITH_STDLIB diff --git a/compiler/testData/diagnostics/tests/delegation/kt49477Error.reversed.kt b/compiler/testData/diagnostics/tests/delegation/kt49477Error.reversed.kt new file mode 100644 index 00000000000..e99e8bdb576 --- /dev/null +++ b/compiler/testData/diagnostics/tests/delegation/kt49477Error.reversed.kt @@ -0,0 +1,36 @@ +// !LANGUAGE: +ForbidRecursiveDelegateExpressions +// WITH_STDLIB + +import kotlin.properties.ReadWriteProperty +import kotlin.reflect.KProperty +import kotlin.reflect.KProperty1 + +inline fun Self.parent( + property: KProperty1>): Delegate = TODO() + +class GitLabBuildProcessor: DatabaseEntity { + var processor by parent(GitLabChangesProcessor::buildProcessors) +} + +interface DatabaseEntity: Entity +interface Entity +interface ResourceFactory +interface ValueFilter + +interface Delegate : ReadWriteProperty, ValueFilter { + infix fun name(desc: KProperty<*>): String +infix fun by(name: String): Delegate +infix fun resource(factory: ResourceFactory): Delegate +infix fun filter(filter: (R, Any?) -> Boolean): Delegate +} + +class GitLabChangesProcessor: DatabaseEntity { + var buildProcessors by child_many( + GitLabBuildProcessor::class.java, + GitLabBuildProcessor::processor + ) +} + +fun Self.child_many( + clazz: Class, property: KProperty1, name: String = property.name +): Delegate> = TODO() // Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly diff --git a/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt index 304c0b457ed..68c66797f5d 100644 --- a/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER class Scope diff --git a/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.kt b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.kt index e5fb4a2f48a..12d5f370ad2 100644 --- a/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.kt +++ b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER class Scope diff --git a/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.reversed.kt b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.reversed.kt new file mode 100644 index 00000000000..68c66797f5d --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.reversed.kt @@ -0,0 +1,18 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +class Scope + +fun simpleAsync0(block: Scope.() -> T) {} +fun simpleAsync1(block: suspend Scope.() -> T) {} +suspend fun simpleAsync2(block: Scope.() -> T) {} +suspend fun simpleAsync3(block: suspend Scope.() -> T) {} + +fun insideJob0() = doTheJob0() +fun insideJob1() = doTheJob1() +suspend fun insideJob2() = doTheJob2() +suspend fun insideJob3() = doTheJob3() + +fun doTheJob0() = simpleAsync0 { insideJob0() } +fun doTheJob1() = simpleAsync1 { insideJob1() } +suspend fun doTheJob2() = simpleAsync2 { insideJob2() } +suspend fun doTheJob3() = simpleAsync3 { insideJob3() } diff --git a/compiler/testData/diagnostics/tests/j+k/syntheticPropertyOverridden2.fir.kt b/compiler/testData/diagnostics/tests/j+k/syntheticPropertyOverridden2.fir.kt index dc52330bc7d..bcaf683633d 100644 --- a/compiler/testData/diagnostics/tests/j+k/syntheticPropertyOverridden2.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/syntheticPropertyOverridden2.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // ISSUE: KT-57166 // FILE: Modality.kt diff --git a/compiler/testData/diagnostics/tests/j+k/syntheticPropertyOverridden2.kt b/compiler/testData/diagnostics/tests/j+k/syntheticPropertyOverridden2.kt index fd9693c30b3..1655a63b08a 100644 --- a/compiler/testData/diagnostics/tests/j+k/syntheticPropertyOverridden2.kt +++ b/compiler/testData/diagnostics/tests/j+k/syntheticPropertyOverridden2.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // ISSUE: KT-57166 // FILE: Modality.kt diff --git a/compiler/testData/diagnostics/tests/j+k/syntheticPropertyOverridden2.reversed.kt b/compiler/testData/diagnostics/tests/j+k/syntheticPropertyOverridden2.reversed.kt new file mode 100644 index 00000000000..bcaf683633d --- /dev/null +++ b/compiler/testData/diagnostics/tests/j+k/syntheticPropertyOverridden2.reversed.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() = modality +} diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/interdependentTypeParametersFromKotlin.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/interdependentTypeParametersFromKotlin.fir.kt index 03dfd2010b5..e35849f58bf 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/interdependentTypeParametersFromKotlin.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/interdependentTypeParametersFromKotlin.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FILE: Boo.java public class Boo { static Foo test1() { return null; } diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/interdependentTypeParametersFromKotlin.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/interdependentTypeParametersFromKotlin.kt index 2b6e1182cd6..92ab706d78f 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/interdependentTypeParametersFromKotlin.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/interdependentTypeParametersFromKotlin.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FILE: Boo.java public class Boo { static Foo test1() { return null; } diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/interdependentTypeParametersFromKotlin.reversed.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/interdependentTypeParametersFromKotlin.reversed.kt new file mode 100644 index 00000000000..e35849f58bf --- /dev/null +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/interdependentTypeParametersFromKotlin.reversed.kt @@ -0,0 +1,12 @@ +// FILE: Boo.java +public class Boo { + static Foo test1() { return null; } +} + +// FILE: Foo.kt +class Foo, P2 : Boo, P3 : Boo, P4 : Boo> {} + +// FILE: main.kt +fun main() { + val x = >, Boo<*, *, *>>, Boo<*, *, Boo<*, *, *>>, Boo<*, *, *>>, Boo<*, Boo<*, *, Boo<*, *, *>>, Boo<*, *, *>>, Boo<*, *, Boo<*, *, *>>, Boo<*, *, *>>..Foo<*, *, *, *>?!")!>Boo.test1() +} diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonProjectedInnerErasure.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonProjectedInnerErasure.kt index e0de223d22a..87bba19b3ac 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonProjectedInnerErasure.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonProjectedInnerErasure.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // ISSUE: KT-57198 // FILE: CustomGdbServerRunConfiguration.java diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonProjectedInnerErasure.reversed.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonProjectedInnerErasure.reversed.kt new file mode 100644 index 00000000000..87bba19b3ac --- /dev/null +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonProjectedInnerErasure.reversed.kt @@ -0,0 +1,17 @@ +// FIR_IDENTICAL +// ISSUE: KT-57198 +// FILE: CustomGdbServerRunConfiguration.java + +public class CustomGdbServerRunConfiguration implements CidrRunConfiguration {} + +// FILE: main.kt +interface CidrBuildTarget +interface CidrRunConfiguration> + +fun applyEditorTo(arg: CidrRunConfiguration>) {} + +fun main() { + // Previously, for CidrRunConfiguration raw type, it's lower bound was resolved as CidrRunConfiguration> in K2 + // That is not a subtype of CidrRunConfiguration> + applyEditorTo(CustomGdbServerRunConfiguration()) // K1: ok, K2: was ARGUMENT_TYPE_MISMATCH +} diff --git a/compiler/testData/diagnostics/tests/typeParameters/kt46186.fir.kt b/compiler/testData/diagnostics/tests/typeParameters/kt46186.fir.kt index 9c383c9c0da..20a9e1bba95 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/kt46186.fir.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/kt46186.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -FINAL_UPPER_BOUND -CAST_NEVER_SUCCEEDS // !LANGUAGE: -AllowEmptyIntersectionsInResultTypeResolver diff --git a/compiler/testData/diagnostics/tests/typeParameters/kt46186.kt b/compiler/testData/diagnostics/tests/typeParameters/kt46186.kt index d57b9bf2b88..09b059945f9 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/kt46186.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/kt46186.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -FINAL_UPPER_BOUND -CAST_NEVER_SUCCEEDS // !LANGUAGE: -AllowEmptyIntersectionsInResultTypeResolver diff --git a/compiler/testData/diagnostics/tests/typeParameters/kt46186.reversed.kt b/compiler/testData/diagnostics/tests/typeParameters/kt46186.reversed.kt new file mode 100644 index 00000000000..20a9e1bba95 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/kt46186.reversed.kt @@ -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 findViewById1(): T = null as T +fun test1(): I = findViewById1() + +fun findViewById2(): T = null as T +fun test2(): I = findViewById2() + +inline fun findViewById3(): T = null as T +fun test3(): I = findViewById3() + +inline fun findViewById4(): T = null as T +fun test4(): I = findViewById4() + +fun findViewById5(): T = null as T +fun test5(): I = findViewById5() + +inline fun findViewById6(): T = null as T +fun test6(): I = findViewById6() + +fun findViewById7(): T = null as T +fun test7(): I = findViewById7() + +inline fun findViewById8(): T = null as T +fun test8(): I = findViewById8() + +fun findViewById9(): T where T: View3, T: View5 = null as T +fun test9(): I = findViewById9() + +inline fun findViewById10(): T where T: View3, T: View5 = null as T +fun test10(): I = findViewById10() + +fun findViewById11(): T = null as T +fun test11(): View4 = findViewById11() + +object Obj { + fun findViewById1(): T = null as T + fun test1(): View1 = findViewById1() + + fun findViewById2(): T = null as T + fun test2(): View2 = findViewById2() + + inline fun findViewById3(): T = null as T + fun test3(): View1 = findViewById3() + + inline fun findViewById4(): T = null as T + fun test4(): View2 = findViewById4() + + fun findViewById5(): T = null as T + fun test5(): View3 = findViewById5() + + inline fun findViewById6(): T = null as T + fun test6(): View3 = findViewById6() + + fun findViewById7(): T = null as T + fun test7(): View4 = findViewById7() + + inline fun findViewById8(): T = null as T + fun test8(): View4 = findViewById8() + + fun findViewById9(): T where T: View3, T: View5 = null as T + fun test9(): View1 = findViewById9() + + inline fun findViewById10(): T where T: View3, T: View5 = null as T + fun test10(): View1 = findViewById10() + + fun findViewById11(): T = null as T + fun test11(): View4 = findViewById11() +} + +interface A +open class B { + fun f(): T where T : A, T : B = null as T + fun g(): A = f() +} diff --git a/compiler/testData/diagnostics/tests/typealias/importFromTypeAliasObject.kt b/compiler/testData/diagnostics/tests/typealias/importFromTypeAliasObject.kt index 2ee4491434e..53a250ce5dc 100644 --- a/compiler/testData/diagnostics/tests/typealias/importFromTypeAliasObject.kt +++ b/compiler/testData/diagnostics/tests/typealias/importFromTypeAliasObject.kt @@ -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() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/typealias/importFromTypeAliasObject.reversed.kt b/compiler/testData/diagnostics/tests/typealias/importFromTypeAliasObject.reversed.kt new file mode 100644 index 00000000000..eb29413f66a --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/importFromTypeAliasObject.reversed.kt @@ -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() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/typealias/importMemberFromJavaViaAlias.kt b/compiler/testData/diagnostics/tests/typealias/importMemberFromJavaViaAlias.kt index af1f0857e70..8c4115c85b5 100644 --- a/compiler/testData/diagnostics/tests/typealias/importMemberFromJavaViaAlias.kt +++ b/compiler/testData/diagnostics/tests/typealias/importMemberFromJavaViaAlias.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // SKIP_JAVAC diff --git a/compiler/testData/diagnostics/tests/typealias/importMemberFromJavaViaAlias.reversed.kt b/compiler/testData/diagnostics/tests/typealias/importMemberFromJavaViaAlias.reversed.kt new file mode 100644 index 00000000000..8c4115c85b5 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/importMemberFromJavaViaAlias.reversed.kt @@ -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: JavaSample, + alias: JavaAlias +) { + member() +} diff --git a/compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.fir.kt b/compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.fir.kt index 19d363d89e0..ea3d6ab50cc 100644 --- a/compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FILE: foo.kt package test diff --git a/compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.kt b/compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.kt index 9ffcdd63723..02ae714f6e2 100644 --- a/compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.kt +++ b/compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FILE: foo.kt package test diff --git a/compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.reversed.kt b/compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.reversed.kt new file mode 100644 index 00000000000..ea3d6ab50cc --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.reversed.kt @@ -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 +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.fir.kt index f8ec9dae3e9..88b67ef10c0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_DUMP // WITH_REFLECT diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.kt index 11f8d77f6c1..0bb5bcd6966 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_DUMP // WITH_REFLECT diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.reversed.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.reversed.fir.txt new file mode 100644 index 00000000000..2db301ef395 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.reversed.fir.txt @@ -0,0 +1,95 @@ +FILE: kt50994.fir.kt + public final class ProcessorWithParent : R|Entity| { + public constructor(): R|ProcessorWithParent| { + super() + } + + public final var processor: R|ProcessorWithChildren?|by this@R|/ProcessorWithParent|.R|/parent|(Q|ProcessorWithChildren|::R|/ProcessorWithChildren.processors|) + public get(): R|ProcessorWithChildren?| { + ^ this@R|/ProcessorWithParent|.D|/ProcessorWithParent.processor|.R|SubstitutionOverride|(this@R|/ProcessorWithParent|, ::R|/ProcessorWithParent.processor|) + } + public set(: R|ProcessorWithChildren?|): R|kotlin/Unit| { + this@R|/ProcessorWithParent|.D|/ProcessorWithParent.processor|.R|SubstitutionOverride|(this@R|/ProcessorWithParent|, ::R|/ProcessorWithParent.processor|, R|/processor|) + } + + } + public final class ProcessorWithChildren : R|Entity| { + public constructor(): R|ProcessorWithChildren| { + super() + } + + public final var processors: R|kotlin/collections/MutableCollection|by this@R|/ProcessorWithChildren|.R|/children#|<, >((Q|ProcessorWithParent|).R|kotlin/jvm/java|, Q|ProcessorWithParent|::#) + public get(): R|kotlin/collections/MutableCollection| { + ^ this@R|/ProcessorWithChildren|.D|/ProcessorWithChildren.processors|.R|SubstitutionOverride|>|(this@R|/ProcessorWithChildren|, ::R|/ProcessorWithChildren.processors|) + } + public set(: R|kotlin/collections/MutableCollection|): R|kotlin/Unit| { + this@R|/ProcessorWithChildren|.D|/ProcessorWithChildren.processors|.R|SubstitutionOverride|(this@R|/ProcessorWithChildren|, ::R|/ProcessorWithChildren.processors|, R|/processors|) + } + + } + public final class Processor2WithParent : R|Entity| { + public constructor(): R|Processor2WithParent| { + super() + } + + public final var processor: R|Processor2WithChildren?|by this@R|/Processor2WithParent|.R|/parent|(Q|Processor2WithChildren|::R|/Processor2WithChildren.processors|) + public get(): R|Processor2WithChildren?| { + ^ this@R|/Processor2WithParent|.D|/Processor2WithParent.processor|.R|SubstitutionOverride|(this@R|/Processor2WithParent|, ::R|/Processor2WithParent.processor|) + } + public set(: R|Processor2WithChildren?|): R|kotlin/Unit| { + this@R|/Processor2WithParent|.D|/Processor2WithParent.processor|.R|SubstitutionOverride|(this@R|/Processor2WithParent|, ::R|/Processor2WithParent.processor|, R|/processor|) + } + + } + public final class Processor2WithChildren : R|Entity| { + public constructor(): R|Processor2WithChildren| { + super() + } + + public final var processors: R|kotlin/collections/MutableCollection|by this@R|/Processor2WithChildren|.R|/children|((Q|Processor2WithParent|).R|kotlin/jvm/java|, Q|Processor2WithParent|::R|/Processor2WithParent.processor|) + public get(): R|kotlin/collections/MutableCollection| { + ^ this@R|/Processor2WithChildren|.D|/Processor2WithChildren.processors|.R|SubstitutionOverride|>|(this@R|/Processor2WithChildren|, ::R|/Processor2WithChildren.processors|) + } + public set(: R|kotlin/collections/MutableCollection|): R|kotlin/Unit| { + this@R|/Processor2WithChildren|.D|/Processor2WithChildren.processors|.R|SubstitutionOverride|(this@R|/Processor2WithChildren|, ::R|/Processor2WithChildren.processors|, R|/processors|) + } + + } + public final class Processor3WithParent : R|Entity| { + public constructor(): R|Processor3WithParent| { + super() + } + + public final var processor: R|Processor3WithChildren?|by this@R|/Processor3WithParent|.R|/parent|(Q|Processor3WithChildren|::R|/Processor3WithChildren.processors|) + public get(): R|Processor3WithChildren?| { + ^ this@R|/Processor3WithParent|.D|/Processor3WithParent.processor|.R|SubstitutionOverride|(this@R|/Processor3WithParent|, ::R|/Processor3WithParent.processor|) + } + public set(: R|Processor3WithChildren?|): R|kotlin/Unit| { + this@R|/Processor3WithParent|.D|/Processor3WithParent.processor|.R|SubstitutionOverride|(this@R|/Processor3WithParent|, ::R|/Processor3WithParent.processor|, R|/processor|) + } + + } + public final class Processor3WithChildren : R|Entity| { + public constructor(): R|Processor3WithChildren| { + super() + } + + public final var processors: R|kotlin/collections/MutableCollection|by this@R|/Processor3WithChildren|.R|/children|((Q|Processor3WithParent|).R|kotlin/jvm/java|, Q|Processor3WithParent|::R|/Processor3WithParent.processor|) + public get(): R|kotlin/collections/MutableCollection| { + ^ this@R|/Processor3WithChildren|.D|/Processor3WithChildren.processors|.R|SubstitutionOverride|>|(this@R|/Processor3WithChildren|, ::R|/Processor3WithChildren.processors|) + } + public set(: R|kotlin/collections/MutableCollection|): R|kotlin/Unit| { + this@R|/Processor3WithChildren|.D|/Processor3WithChildren.processors|.R|SubstitutionOverride|(this@R|/Processor3WithChildren|, ::R|/Processor3WithChildren.processors|, R|/processors|) + } + + } + public final inline fun R|SP|.parent(property: R|kotlin/reflect/KProperty1>|): R|Delegate| { + ^parent Null(null)!! + } + public final fun R|SC|.children(clazz: R|java/lang/Class|, property: R|kotlin/reflect/KProperty1|, name: R|kotlin/String| = R|/property|.R|SubstitutionOverride|): R|Delegate>| { + ^children Null(null)!! + } + public abstract interface Delegate : R|kotlin/properties/ReadWriteProperty| { + } + public abstract interface Entity : R|kotlin/Any| { + } diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.reversed.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.reversed.kt new file mode 100644 index 00000000000..88b67ef10c0 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.reversed.kt @@ -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 children(ProcessorWithParent::class.java, ProcessorWithParent::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 by children(Processor3WithParent::class.java, Processor3WithParent::processor) +} + +inline fun SP.parent( + property: KProperty1> +): Delegate = null!! + +fun SC.children( + clazz: Class, property: KProperty1, name: String = property.name +): Delegate> = null!! + +interface Delegate : ReadWriteProperty + +interface Entity