From 271c15114cecd252ffe351e33b90ca0111fd2174 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 29 Aug 2019 11:43:06 +0300 Subject: [PATCH] FIR: add test with problematic cases --- .../testData/resolve/stdlib/problems.kt | 34 ++++++++ .../testData/resolve/stdlib/problems.txt | 78 +++++++++++++++++++ ...FirResolveTestCaseWithStdlibGenerated.java | 5 ++ 3 files changed, 117 insertions(+) create mode 100644 compiler/fir/resolve/testData/resolve/stdlib/problems.kt create mode 100644 compiler/fir/resolve/testData/resolve/stdlib/problems.txt diff --git a/compiler/fir/resolve/testData/resolve/stdlib/problems.kt b/compiler/fir/resolve/testData/resolve/stdlib/problems.kt new file mode 100644 index 00000000000..0e2fbd0418a --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/stdlib/problems.kt @@ -0,0 +1,34 @@ +val sb = StringBuilder() +val o = object : Any() { + val name = "123" + + fun test() { + name + } +} +fun test() { + class Local + Local() +} +val Any.bar get() = "456" +val String.bar get() = "987" + +val t = "".bar + +val p = Pair(0, "") + +class Base(val x: T) +class Derived : Base(10) +val xx = Derived().x + 1 + +val t = throw AssertionError("") + +interface A +interface B +interface C : A +class BC : B, C +fun C.analyze() {} +inline fun T.analyze() where T : A, T : B {} +fun testAnalyze() { + BC().analyze() +} diff --git a/compiler/fir/resolve/testData/resolve/stdlib/problems.txt b/compiler/fir/resolve/testData/resolve/stdlib/problems.txt new file mode 100644 index 00000000000..f675c2f2399 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/stdlib/problems.txt @@ -0,0 +1,78 @@ +FILE: problems.kt + public final val sb: = #() + public get(): + public final val o: R|kotlin/Any| = object : R|kotlin/Any| { + private constructor(): R|kotlin/Any| { + super() + } + + public final val name: R|kotlin/String| = String(123) + public get(): R|kotlin/String| + + public final fun test(): R|kotlin/Unit| { + # + } + + } + + public get(): R|kotlin/Any| + public final fun test(): R|kotlin/Unit| { + local final class Local : R|kotlin/Any| { + public constructor(): R|Local| { + super() + } + + } + + #() + } + public final val R|kotlin/Any|.bar: R|kotlin/String| + public get(): R|kotlin/String| { + ^ String(456) + } + public final val R|kotlin/String|.bar: R|kotlin/String| + public get(): R|kotlin/String| { + ^ String(987) + } + public final val t: = String().# + public get(): + public final val p: = #(Int(0), String()) + public get(): + public final class Base : R|kotlin/Any| { + public constructor(x: R|T|): R|Base| { + super() + } + + public final val x: R|T| = R|/x| + public get(): R|T| + + } + public final class Derived : R|Base| { + public constructor(): R|Derived| { + super|>(Int(10)) + } + + } + public final val xx: = D|R|/Derived.Derived|()|.R|/Base.x|.#(Int(1)) + public get(): + public final val t: R|kotlin/Nothing| = throw #(String()) + public get(): R|kotlin/Nothing| + public abstract interface A : R|kotlin/Any| { + } + public abstract interface B : R|kotlin/Any| { + } + public abstract interface C : R|A| { + } + public final class BC : R|B|, R|C| { + public constructor(): R|BC| { + super() + } + + } + public final fun R|C|.analyze(): R|kotlin/Unit| { + } + public final inline fun R|T|.analyze(): R|kotlin/Unit| { + } + public final fun testAnalyze(): R|kotlin/Unit| { + R|/BC.BC|().#() + } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseWithStdlibGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseWithStdlibGenerated.java index c006a9cac56..78d880b0fcc 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseWithStdlibGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseWithStdlibGenerated.java @@ -94,6 +94,11 @@ public class FirResolveTestCaseWithStdlibGenerated extends AbstractFirResolveTes runTest("compiler/fir/resolve/testData/resolve/stdlib/multipleImplicitReceivers.kt"); } + @TestMetadata("problems.kt") + public void testProblems() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/stdlib/problems.kt"); + } + @TestMetadata("recursiveBug.kt") public void testRecursiveBug() throws Exception { runTest("compiler/fir/resolve/testData/resolve/stdlib/recursiveBug.kt");