diff --git a/compiler/fir/resolve/testData/resolve/problems2.kt b/compiler/fir/resolve/testData/resolve/problems2.kt new file mode 100644 index 00000000000..7477479399d --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/problems2.kt @@ -0,0 +1,30 @@ +class Interner { + private fun find(obj: T): Int? = null + + fun intern(obj: T) = find(obj) +} + +class Externer { + private fun find(obj: Int): Int? = null + + fun intern(obj: Int) = find(obj) +} + +interface Some { + data class WithPrimary(val x: Int, val arr: Array? = null, val s: String? = null) +} + +fun test() { + Some.WithPrimary(42, arrayOf("alpha", "omega")) +} + +class KonanTarget(val name: String) + +val KonanTarget.presetName + get() = this.name + +// Own private property conflicts with synthetic property from Java supertype +// Exhaustive when expressions give Any result type +// Substitution for field declared in Java super-type does not work (KotlinStringLiteralTextEscaper.myHost) +// Super is not resolved in anonymous object +// TypeParameterDescriptor.name is not resolved \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/problems2.txt b/compiler/fir/resolve/testData/resolve/problems2.txt new file mode 100644 index 00000000000..2ee2cc0d8b6 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/problems2.txt @@ -0,0 +1,78 @@ +FILE: problems2.kt + public final class Interner : R|kotlin/Any| { + public constructor(): R|Interner| { + super() + } + + private final fun find(obj: R|T|): R|kotlin/Int?| { + ^find Null(null) + } + + public final fun intern(obj: R|T|): { + ^intern #(R|/obj|) + } + + } + public final class Externer : R|kotlin/Any| { + public constructor(): R|Externer| { + super() + } + + private final fun find(obj: R|kotlin/Int|): R|kotlin/Int?| { + ^find Null(null) + } + + public final fun intern(obj: R|kotlin/Int|): R|kotlin/Int?| { + ^intern this@R|/Externer|.R|/Externer.find|(R|/obj|) + } + + } + public abstract interface Some : R|kotlin/Any| { + public final data class WithPrimary : R|kotlin/Any| { + public constructor(x: R|kotlin/Int|, arr: R|kotlin/Array?| = Null(null), s: R|kotlin/String?| = Null(null)): R|Some.WithPrimary| { + super() + } + + public final val x: R|kotlin/Int| = R|/x| + public get(): R|kotlin/Int| + + public final val arr: R|kotlin/Array?| = R|/arr| + public get(): R|kotlin/Array?| + + public final val s: R|kotlin/String?| = R|/s| + public get(): R|kotlin/String?| + + public final fun component1(): R|kotlin/Int| { + ^component1 this@R|/Some.WithPrimary|.R|/Some.WithPrimary.x| + } + + public final fun component2(): R|kotlin/Array?| { + ^component2 this@R|/Some.WithPrimary|.R|/Some.WithPrimary.arr| + } + + public final fun component3(): R|kotlin/String?| { + ^component3 this@R|/Some.WithPrimary|.R|/Some.WithPrimary.s| + } + + public final fun copy(x: R|kotlin/Int| = this@R|/Some.WithPrimary|.R|/Some.WithPrimary.x|, arr: R|kotlin/Array?| = this@R|/Some.WithPrimary|.R|/Some.WithPrimary.arr|, s: R|kotlin/String?| = this@R|/Some.WithPrimary|.R|/Some.WithPrimary.s|): R|Some.WithPrimary| { + } + + } + + } + public final fun test(): R|kotlin/Unit| { + Q|Some|.#(Int(42), R?C|kotlin/arrayOf|(String(alpha), String(omega))) + } + public final class KonanTarget : R|kotlin/Any| { + public constructor(name: R|kotlin/String|): R|KonanTarget| { + super() + } + + public final val name: R|kotlin/String| = R|/name| + public get(): R|kotlin/String| + + } + public final val R|KonanTarget|.presetName: + public get(): { + ^ this#.# + } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java index c332a311b74..11c93a1224d 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java @@ -129,6 +129,11 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase { runTest("compiler/fir/resolve/testData/resolve/NestedSuperType.kt"); } + @TestMetadata("problems2.kt") + public void testProblems2() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/problems2.kt"); + } + @TestMetadata("recursiveCallOnWhenWithSealedClass.kt") public void testRecursiveCallOnWhenWithSealedClass() throws Exception { runTest("compiler/fir/resolve/testData/resolve/recursiveCallOnWhenWithSealedClass.kt");