From 09fa15c22b9b4cfbff7485bd8bab22fd698b0f8f Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 31 Oct 2019 17:27:51 +0300 Subject: [PATCH] [FIR] Support old FE-like multifile tests --- .../resolve/multifile/Annotations.1.kt | 12 ---- .../testData/resolve/multifile/Annotations.kt | 17 ++++++ .../resolve/multifile/Annotations.txt | 60 ++++++++++++++++++- .../testData/resolve/multifile/ByteArray.1.kt | 5 -- .../testData/resolve/multifile/ByteArray.kt | 10 ++++ .../testData/resolve/multifile/ByteArray.txt | 8 ++- .../resolve/multifile/NestedSuperType.1.kt | 7 --- .../resolve/multifile/NestedSuperType.2.kt | 5 -- .../resolve/multifile/NestedSuperType.kt | 20 +++++++ .../resolve/multifile/NestedSuperType.txt | 30 +++++++++- .../resolve/multifile/TypeAliasExpansion.1.kt | 7 --- .../resolve/multifile/TypeAliasExpansion.kt | 12 +++- .../resolve/multifile/TypeAliasExpansion.txt | 10 +++- .../resolve/multifile/importFromObject.1.kt | 6 -- .../resolve/multifile/importFromObject.kt | 10 ++++ .../resolve/multifile/importFromObject.txt | 12 +++- .../resolve/multifile/sealedStarImport.1.kt | 7 --- .../resolve/multifile/sealedStarImport.kt | 12 ++++ .../resolve/multifile/sealedStarImport.txt | 26 +++++++- .../multifile/simpleAliasedImport.1.kt | 8 --- .../resolve/multifile/simpleAliasedImport.kt | 13 ++++ .../resolve/multifile/simpleAliasedImport.txt | 15 ++++- .../resolve/multifile/simpleImport.1.kt | 8 --- .../resolve/multifile/simpleImport.kt | 14 +++++ .../resolve/multifile/simpleImport.txt | 14 ++++- .../resolve/multifile/simpleImportNested.1.kt | 5 -- .../resolve/multifile/simpleImportNested.kt | 10 ++++ .../resolve/multifile/simpleImportNested.txt | 16 ++++- .../resolve/multifile/simpleImportOuter.1.kt | 5 -- .../resolve/multifile/simpleImportOuter.kt | 10 ++++ .../resolve/multifile/simpleImportOuter.txt | 16 ++++- .../resolve/multifile/simpleStarImport.1.kt | 7 --- .../resolve/multifile/simpleStarImport.kt | 12 ++++ .../resolve/multifile/simpleStarImport.txt | 13 +++- .../kotlin/fir/AbstractFirCfgBuildingTest.kt | 6 +- .../kotlin/fir/AbstractFirResolveTestCase.kt | 26 +------- 36 files changed, 353 insertions(+), 121 deletions(-) delete mode 100644 compiler/fir/resolve/testData/resolve/multifile/Annotations.1.kt delete mode 100644 compiler/fir/resolve/testData/resolve/multifile/ByteArray.1.kt delete mode 100644 compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.1.kt delete mode 100644 compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.2.kt delete mode 100644 compiler/fir/resolve/testData/resolve/multifile/TypeAliasExpansion.1.kt delete mode 100644 compiler/fir/resolve/testData/resolve/multifile/importFromObject.1.kt delete mode 100644 compiler/fir/resolve/testData/resolve/multifile/sealedStarImport.1.kt delete mode 100644 compiler/fir/resolve/testData/resolve/multifile/simpleAliasedImport.1.kt delete mode 100644 compiler/fir/resolve/testData/resolve/multifile/simpleImport.1.kt delete mode 100644 compiler/fir/resolve/testData/resolve/multifile/simpleImportNested.1.kt delete mode 100644 compiler/fir/resolve/testData/resolve/multifile/simpleImportOuter.1.kt delete mode 100644 compiler/fir/resolve/testData/resolve/multifile/simpleStarImport.1.kt diff --git a/compiler/fir/resolve/testData/resolve/multifile/Annotations.1.kt b/compiler/fir/resolve/testData/resolve/multifile/Annotations.1.kt deleted file mode 100644 index a93f5753dc4..00000000000 --- a/compiler/fir/resolve/testData/resolve/multifile/Annotations.1.kt +++ /dev/null @@ -1,12 +0,0 @@ -package annotations - -@Target(AnnotationTarget.FILE, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.PROPERTY_GETTER) -annotation class Simple - -annotation class WithInt(val value: Int) - -annotation class WithString(val s: String) - -annotation class Complex(val wi: WithInt, val ws: WithString) - -annotation class VeryComplex(val f: Float, val d: Double, val b: Boolean, val l: Long, val n: Int?) \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/multifile/Annotations.kt b/compiler/fir/resolve/testData/resolve/multifile/Annotations.kt index 9be2dd7dc35..038f2326470 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/Annotations.kt +++ b/compiler/fir/resolve/testData/resolve/multifile/Annotations.kt @@ -1,3 +1,20 @@ +// FILE: annotations.kt + +package annotations + +@Target(AnnotationTarget.FILE, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.PROPERTY_GETTER) +annotation class Simple + +annotation class WithInt(val value: Int) + +annotation class WithString(val s: String) + +annotation class Complex(val wi: WithInt, val ws: WithString) + +annotation class VeryComplex(val f: Float, val d: Double, val b: Boolean, val l: Long, val n: Int?) + +// FILE: main.kt + @file:Simple package test diff --git a/compiler/fir/resolve/testData/resolve/multifile/Annotations.txt b/compiler/fir/resolve/testData/resolve/multifile/Annotations.txt index 70a937451ae..8edd63b6d2c 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/Annotations.txt +++ b/compiler/fir/resolve/testData/resolve/multifile/Annotations.txt @@ -1,4 +1,62 @@ -FILE: Annotations.kt +FILE: annotations.kt + @R|kotlin/annotation/Target|(Q|kotlin/annotation/AnnotationTarget.FILE|, Q|kotlin/annotation/AnnotationTarget.FUNCTION|, Q|kotlin/annotation/AnnotationTarget.TYPE|, Q|kotlin/annotation/AnnotationTarget.PROPERTY_GETTER|) public final annotation class Simple : R|kotlin/Annotation| { + public constructor(): R|annotations/Simple| { + super() + } + + } + public final annotation class WithInt : R|kotlin/Annotation| { + public constructor(value: R|kotlin/Int|): R|annotations/WithInt| { + super() + } + + public final val value: R|kotlin/Int| = R|/value| + public get(): R|kotlin/Int| + + } + public final annotation class WithString : R|kotlin/Annotation| { + public constructor(s: R|kotlin/String|): R|annotations/WithString| { + super() + } + + public final val s: R|kotlin/String| = R|/s| + public get(): R|kotlin/String| + + } + public final annotation class Complex : R|kotlin/Annotation| { + public constructor(wi: R|annotations/WithInt|, ws: R|annotations/WithString|): R|annotations/Complex| { + super() + } + + public final val wi: R|annotations/WithInt| = R|/wi| + public get(): R|annotations/WithInt| + + public final val ws: R|annotations/WithString| = R|/ws| + public get(): R|annotations/WithString| + + } + public final annotation class VeryComplex : R|kotlin/Annotation| { + public constructor(f: R|kotlin/Float|, d: R|kotlin/Double|, b: R|kotlin/Boolean|, l: R|kotlin/Long|, n: R|kotlin/Int?|): R|annotations/VeryComplex| { + super() + } + + public final val f: R|kotlin/Float| = R|/f| + public get(): R|kotlin/Float| + + public final val d: R|kotlin/Double| = R|/d| + public get(): R|kotlin/Double| + + public final val b: R|kotlin/Boolean| = R|/b| + public get(): R|kotlin/Boolean| + + public final val l: R|kotlin/Long| = R|/l| + public get(): R|kotlin/Long| + + public final val n: R|kotlin/Int?| = R|/n| + public get(): R|kotlin/Int?| + + } +FILE: main.kt @FILE:R|annotations/Simple|() @R|annotations/WithInt|(Int(42)) public abstract class First : R|kotlin/Any| { public constructor(): R|test/First| { diff --git a/compiler/fir/resolve/testData/resolve/multifile/ByteArray.1.kt b/compiler/fir/resolve/testData/resolve/multifile/ByteArray.1.kt deleted file mode 100644 index d7721f6c336..00000000000 --- a/compiler/fir/resolve/testData/resolve/multifile/ByteArray.1.kt +++ /dev/null @@ -1,5 +0,0 @@ -package Test - -interface ByteArray { - val array: ByteArray -} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/multifile/ByteArray.kt b/compiler/fir/resolve/testData/resolve/multifile/ByteArray.kt index 3f207ed688e..6ff526b84b2 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/ByteArray.kt +++ b/compiler/fir/resolve/testData/resolve/multifile/ByteArray.kt @@ -1,3 +1,13 @@ +// FILE: byteArray.kt + +package Test + +interface ByteArray { + val array: ByteArray +} + +// FILE: main.kt + package use import test.* diff --git a/compiler/fir/resolve/testData/resolve/multifile/ByteArray.txt b/compiler/fir/resolve/testData/resolve/multifile/ByteArray.txt index 3a6202cb7dd..81d92c24037 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/ByteArray.txt +++ b/compiler/fir/resolve/testData/resolve/multifile/ByteArray.txt @@ -1,4 +1,10 @@ -FILE: ByteArray.kt +FILE: byteArray.kt + public abstract interface ByteArray : R|kotlin/Any| { + public abstract val array: R|Test/ByteArray| + public get(): R|Test/ByteArray| + + } +FILE: main.kt public abstract interface My : R|kotlin/Any| { public abstract val array: R|kotlin/ByteArray| public get(): R|kotlin/ByteArray| diff --git a/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.1.kt b/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.1.kt deleted file mode 100644 index 8516df3ffff..00000000000 --- a/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.1.kt +++ /dev/null @@ -1,7 +0,0 @@ -package b - -import c.C - -open class B : C() { - open class NestedInB : NestedInC() -} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.2.kt b/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.2.kt deleted file mode 100644 index 2fbe275f779..00000000000 --- a/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.2.kt +++ /dev/null @@ -1,5 +0,0 @@ -package c - -open class C { - open class NestedInC -} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.kt b/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.kt index 1219fa33550..b01d0b6f983 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.kt +++ b/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.kt @@ -1,3 +1,23 @@ +// FILE: C.kt + +package c + +open class C { + open class NestedInC +} + +// FILE: B.kt + +package b + +import c.C + +open class B : C() { + open class NestedInB : NestedInC() +} + +// FILE: A.kt + package a import b.B diff --git a/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.txt b/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.txt index 7e5c2bfd0b6..2075d3ef696 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.txt +++ b/compiler/fir/resolve/testData/resolve/multifile/NestedSuperType.txt @@ -1,4 +1,32 @@ -FILE: NestedSuperType.kt +FILE: C.kt + public open class C : R|kotlin/Any| { + public constructor(): R|c/C| { + super() + } + + public open class NestedInC : R|kotlin/Any| { + public constructor(): R|c/C.NestedInC| { + super() + } + + } + + } +FILE: B.kt + public open class B : R|c/C| { + public constructor(): R|b/B| { + super() + } + + public open class NestedInB : R|c/C.NestedInC| { + public constructor(): R|b/B.NestedInB| { + super() + } + + } + + } +FILE: A.kt public final class A : R|b/B| { public constructor(): R|a/A| { super() diff --git a/compiler/fir/resolve/testData/resolve/multifile/TypeAliasExpansion.1.kt b/compiler/fir/resolve/testData/resolve/multifile/TypeAliasExpansion.1.kt deleted file mode 100644 index 0921428ea16..00000000000 --- a/compiler/fir/resolve/testData/resolve/multifile/TypeAliasExpansion.1.kt +++ /dev/null @@ -1,7 +0,0 @@ -package b - -class A - -typealias TA = A - -// analyzePriority: 1 \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/multifile/TypeAliasExpansion.kt b/compiler/fir/resolve/testData/resolve/multifile/TypeAliasExpansion.kt index 3bd0301b470..1dc92a5aba5 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/TypeAliasExpansion.kt +++ b/compiler/fir/resolve/testData/resolve/multifile/TypeAliasExpansion.kt @@ -1,7 +1,15 @@ +// FILE: B.kt + +package b + +class A + +typealias TA = A + +// FILE: A.kt + package a import b.TA class MyClass : TA() - -// analyzePriority: 0 \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/multifile/TypeAliasExpansion.txt b/compiler/fir/resolve/testData/resolve/multifile/TypeAliasExpansion.txt index d3a84a855f3..5011be1a648 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/TypeAliasExpansion.txt +++ b/compiler/fir/resolve/testData/resolve/multifile/TypeAliasExpansion.txt @@ -1,4 +1,12 @@ -FILE: TypeAliasExpansion.kt +FILE: B.kt + public final class A : R|kotlin/Any| { + public constructor(): R|b/A| { + super() + } + + } + public final typealias TA = R|b/A| +FILE: A.kt public final class MyClass : R|b/TA| { public constructor(): R|a/MyClass| { super() diff --git a/compiler/fir/resolve/testData/resolve/multifile/importFromObject.1.kt b/compiler/fir/resolve/testData/resolve/multifile/importFromObject.1.kt deleted file mode 100644 index 6228aa8da80..00000000000 --- a/compiler/fir/resolve/testData/resolve/multifile/importFromObject.1.kt +++ /dev/null @@ -1,6 +0,0 @@ -package a - -object A { - fun foo() {} -} - diff --git a/compiler/fir/resolve/testData/resolve/multifile/importFromObject.kt b/compiler/fir/resolve/testData/resolve/multifile/importFromObject.kt index e0068b2c571..0cd243d60c8 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/importFromObject.kt +++ b/compiler/fir/resolve/testData/resolve/multifile/importFromObject.kt @@ -1,3 +1,13 @@ +// FILE: a.kt + +package a + +object A { + fun foo() {} +} + +// FILE: b.kt + package b import a.A.foo diff --git a/compiler/fir/resolve/testData/resolve/multifile/importFromObject.txt b/compiler/fir/resolve/testData/resolve/multifile/importFromObject.txt index a0f9b2f6ec6..aa136bbd26f 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/importFromObject.txt +++ b/compiler/fir/resolve/testData/resolve/multifile/importFromObject.txt @@ -1,4 +1,14 @@ -FILE: importFromObject.kt +FILE: a.kt + public final object A : R|kotlin/Any| { + private constructor(): R|a/A| { + super() + } + + public final fun foo(): R|kotlin/Unit| { + } + + } +FILE: b.kt public final fun bar(): R|kotlin/Unit| { this@R|a/A|.R|a/A.foo|() } diff --git a/compiler/fir/resolve/testData/resolve/multifile/sealedStarImport.1.kt b/compiler/fir/resolve/testData/resolve/multifile/sealedStarImport.1.kt deleted file mode 100644 index 7b3aab1955d..00000000000 --- a/compiler/fir/resolve/testData/resolve/multifile/sealedStarImport.1.kt +++ /dev/null @@ -1,7 +0,0 @@ -package test - -sealed class Test { - object O : Test() - - class Extra(val x: Int): Test -} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/multifile/sealedStarImport.kt b/compiler/fir/resolve/testData/resolve/multifile/sealedStarImport.kt index 84b91e4d963..cfe3423e264 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/sealedStarImport.kt +++ b/compiler/fir/resolve/testData/resolve/multifile/sealedStarImport.kt @@ -1,3 +1,15 @@ +// FILE: test.kt + +package test + +sealed class Test { + object O : Test() + + class Extra(val x: Int): Test +} + +// FILE: main.kt + package other import test.Test.* diff --git a/compiler/fir/resolve/testData/resolve/multifile/sealedStarImport.txt b/compiler/fir/resolve/testData/resolve/multifile/sealedStarImport.txt index 97a14836838..5e5a02551f7 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/sealedStarImport.txt +++ b/compiler/fir/resolve/testData/resolve/multifile/sealedStarImport.txt @@ -1,4 +1,28 @@ -FILE: sealedStarImport.kt +FILE: test.kt + public sealed class Test : R|kotlin/Any| { + private constructor(): R|test/Test| { + super() + } + + public final object O : R|test/Test| { + private constructor(): R|test/Test.O| { + super() + } + + } + + public final class Extra : R|test/Test| { + public constructor(x: R|kotlin/Int|): R|test/Test.Extra| { + super() + } + + public final val x: R|kotlin/Int| = R|/x| + public get(): R|kotlin/Int| + + } + + } +FILE: main.kt public abstract class Factory : R|kotlin/Any| { public constructor(): R|other/Factory| { super() diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleAliasedImport.1.kt b/compiler/fir/resolve/testData/resolve/multifile/simpleAliasedImport.1.kt deleted file mode 100644 index 49ea5516daa..00000000000 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleAliasedImport.1.kt +++ /dev/null @@ -1,8 +0,0 @@ -package b - -abstract class MyClass - -fun foo() {} - -fun I() {} -interface I {} diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleAliasedImport.kt b/compiler/fir/resolve/testData/resolve/multifile/simpleAliasedImport.kt index b4123cf45b2..79e5fc9ae81 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleAliasedImport.kt +++ b/compiler/fir/resolve/testData/resolve/multifile/simpleAliasedImport.kt @@ -1,3 +1,16 @@ +// FILE: B.kt + +package b + +abstract class MyClass + +fun foo() {} + +fun I() {} +interface I {} + +// FILE: A.kt + package a import b.MyClass as HisClass import b.foo as foo2 diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleAliasedImport.txt b/compiler/fir/resolve/testData/resolve/multifile/simpleAliasedImport.txt index ab8704519bf..3b4d27cad9b 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleAliasedImport.txt +++ b/compiler/fir/resolve/testData/resolve/multifile/simpleAliasedImport.txt @@ -1,4 +1,17 @@ -FILE: simpleAliasedImport.kt +FILE: B.kt + public abstract class MyClass : R|kotlin/Any| { + public constructor(): R|b/MyClass| { + super() + } + + } + public final fun foo(): R|kotlin/Unit| { + } + public final fun I(): R|kotlin/Unit| { + } + public abstract interface I : R|kotlin/Any| { + } +FILE: A.kt public final class YourClass : R|b/MyClass| { public constructor(): R|a/YourClass| { super() diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleImport.1.kt b/compiler/fir/resolve/testData/resolve/multifile/simpleImport.1.kt deleted file mode 100644 index 49ea5516daa..00000000000 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleImport.1.kt +++ /dev/null @@ -1,8 +0,0 @@ -package b - -abstract class MyClass - -fun foo() {} - -fun I() {} -interface I {} diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleImport.kt b/compiler/fir/resolve/testData/resolve/multifile/simpleImport.kt index 3d58130f3f9..26d2d379273 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleImport.kt +++ b/compiler/fir/resolve/testData/resolve/multifile/simpleImport.kt @@ -1,3 +1,17 @@ +// FILE B.kt + +package b + +abstract class MyClass + +fun foo() {} + +fun I() {} +interface I {} + + +// FILE A.kt + package a import b.MyClass import b.foo diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleImport.txt b/compiler/fir/resolve/testData/resolve/multifile/simpleImport.txt index 0a4de16218f..d776d1e0291 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleImport.txt +++ b/compiler/fir/resolve/testData/resolve/multifile/simpleImport.txt @@ -1,6 +1,18 @@ FILE: simpleImport.kt + public abstract class MyClass : R|kotlin/Any| { + public constructor(): R|b/MyClass| { + super() + } + + } + public final fun foo(): R|kotlin/Unit| { + } + public final fun I(): R|kotlin/Unit| { + } + public abstract interface I : R|kotlin/Any| { + } public final class YourClass : R|b/MyClass| { - public constructor(): R|a/YourClass| { + public constructor(): R|b/YourClass| { super() } diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleImportNested.1.kt b/compiler/fir/resolve/testData/resolve/multifile/simpleImportNested.1.kt deleted file mode 100644 index e9b54c9a2df..00000000000 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleImportNested.1.kt +++ /dev/null @@ -1,5 +0,0 @@ -package a - -class MyClass { - open class MyNested -} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleImportNested.kt b/compiler/fir/resolve/testData/resolve/multifile/simpleImportNested.kt index f329620b08d..a5ee84d5f39 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleImportNested.kt +++ b/compiler/fir/resolve/testData/resolve/multifile/simpleImportNested.kt @@ -1,3 +1,13 @@ +// FILE: A.kt + +package a + +class MyClass { + open class MyNested +} + +// FILE: B.kt + package b import a.MyClass.MyNested diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleImportNested.txt b/compiler/fir/resolve/testData/resolve/multifile/simpleImportNested.txt index 51fbf1808f9..849c696ad97 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleImportNested.txt +++ b/compiler/fir/resolve/testData/resolve/multifile/simpleImportNested.txt @@ -1,4 +1,18 @@ -FILE: simpleImportNested.kt +FILE: A.kt + public final class MyClass : R|kotlin/Any| { + public constructor(): R|a/MyClass| { + super() + } + + public open class MyNested : R|kotlin/Any| { + public constructor(): R|a/MyClass.MyNested| { + super() + } + + } + + } +FILE: B.kt public final class YourClass : R|a/MyClass.MyNested| { public constructor(): R|b/YourClass| { super() diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleImportOuter.1.kt b/compiler/fir/resolve/testData/resolve/multifile/simpleImportOuter.1.kt deleted file mode 100644 index be937a512cb..00000000000 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleImportOuter.1.kt +++ /dev/null @@ -1,5 +0,0 @@ -package a - -class Outer { - open class Nested -} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleImportOuter.kt b/compiler/fir/resolve/testData/resolve/multifile/simpleImportOuter.kt index 1c953ed57f5..877b0420088 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleImportOuter.kt +++ b/compiler/fir/resolve/testData/resolve/multifile/simpleImportOuter.kt @@ -1,3 +1,13 @@ +// FILE: A.kt + +package a + +class Outer { + open class Nested +} + +// FILE: B.kt + package b import a.Outer diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleImportOuter.txt b/compiler/fir/resolve/testData/resolve/multifile/simpleImportOuter.txt index e64d77a4990..5cfb396ac82 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleImportOuter.txt +++ b/compiler/fir/resolve/testData/resolve/multifile/simpleImportOuter.txt @@ -1,4 +1,18 @@ -FILE: simpleImportOuter.kt +FILE: A.kt + public final class Outer : R|kotlin/Any| { + public constructor(): R|a/Outer| { + super() + } + + public open class Nested : R|kotlin/Any| { + public constructor(): R|a/Outer.Nested| { + super() + } + + } + + } +FILE: B.kt public final class My : R|a/Outer.Nested| { public constructor(): R|b/My| { super() diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleStarImport.1.kt b/compiler/fir/resolve/testData/resolve/multifile/simpleStarImport.1.kt deleted file mode 100644 index f333ff0db4c..00000000000 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleStarImport.1.kt +++ /dev/null @@ -1,7 +0,0 @@ -package b.d - -expect interface Other - -expect class Another - -fun baz() {} diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleStarImport.kt b/compiler/fir/resolve/testData/resolve/multifile/simpleStarImport.kt index a7cbfa77cfb..b442bd93bac 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleStarImport.kt +++ b/compiler/fir/resolve/testData/resolve/multifile/simpleStarImport.kt @@ -1,3 +1,15 @@ +// FILE: B.kt + +package b.d + +expect interface Other + +expect class Another + +fun baz() {} + +// FILE: A.kt + package a.d import b.d.* diff --git a/compiler/fir/resolve/testData/resolve/multifile/simpleStarImport.txt b/compiler/fir/resolve/testData/resolve/multifile/simpleStarImport.txt index cf862cfddc4..b4ee96b6861 100644 --- a/compiler/fir/resolve/testData/resolve/multifile/simpleStarImport.txt +++ b/compiler/fir/resolve/testData/resolve/multifile/simpleStarImport.txt @@ -1,4 +1,15 @@ -FILE: simpleStarImport.kt +FILE: B.kt + public abstract expect interface Other : R|kotlin/Any| { + } + public final expect class Another : R|kotlin/Any| { + public constructor(): R|b/d/Another| { + super() + } + + } + public final fun baz(): R|kotlin/Unit| { + } +FILE: A.kt public final fun foo(arg: R|b/d/Other|): R|b/d/Another| public final fun bar(): R|kotlin/Unit| { R|b/d/baz|() diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt index 0dfd7f4b88c..be7bd962976 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt @@ -38,10 +38,10 @@ abstract class AbstractFirCfgBuildingTest : AbstractFirResolveTestCase() { override val configurationKind: ConfigurationKind get() = ConfigurationKind.ALL - override fun doTest(path: String) { - val firFiles = processInputFile(path) - checkFir(path, firFiles) + override fun doTest(path: String): List { + val firFiles = super.doTest(path) checkCfg(path, firFiles) + return firFiles } fun checkCfg(path: String, firFiles: List) { diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirResolveTestCase.kt b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirResolveTestCase.kt index 886a624d140..002186d3f01 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirResolveTestCase.kt +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirResolveTestCase.kt @@ -62,38 +62,18 @@ abstract class AbstractFirResolveTestCase : AbstractFirResolveWithSessionTestCas } } - protected fun generateKtFiles(path: String): List { - val file = File(path) - - val allFiles = listOf(file) + file.parentFile.listFiles { sibling -> - sibling.name.removePrefix(file.nameWithoutExtension).removeSuffix(file.extension).matches("\\.[0-9]+\\.".toRegex()) - } - - return allFiles.map { - val text = KotlinTestUtils.doLoadFile(it) - it.name to text - }.sortedBy { (_, text) -> - KotlinTestUtils.parseDirectives(text)["analyzePriority"]?.toInt() - }.map { (name, text) -> - KotlinTestUtils.createFile(name, text, project) - } - } - - protected fun processInputFile(path: String): List { - return doCreateAndProcessFir(generateKtFiles(path)) - } - - open fun doTest(path: String) { + open fun doTest(path: String): List { val file = File(path) val expectedText = KotlinTestUtils.doLoadFile(file) val testFiles = createTestFiles(file, expectedText) val firFiles = doCreateAndProcessFir(testFiles.mapNotNull { it.ktFile }) checkDiagnostics(file, testFiles, firFiles) checkFir(path, firFiles) + return firFiles } fun checkFir(path: String, firFiles: List) { - val firFileDump = StringBuilder().also { firFiles.first().accept(FirRenderer(it), null) }.toString() + val firFileDump = StringBuilder().apply { firFiles.forEach { it.accept(FirRenderer(this), null) } }.toString() val expectedPath = path.replace(".kt", ".txt") KotlinTestUtils.assertEqualsToFile(File(expectedPath), firFileDump) }