Make FIR multi-module tests from IDE regular FIR compiler resolve tests

This commit is contained in:
Mikhail Glukhikh
2020-06-24 15:56:47 +03:00
parent 79691feb8f
commit 699829ccb3
105 changed files with 564 additions and 527 deletions
@@ -1,3 +1,5 @@
// FILE: Annotated.java
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -7,4 +9,14 @@ public class Annotated {
if (param != null) return param;
else return "";
}
}
}
// FILE: jvm.kt
class User : Annotated() {
fun test() {
val x = foo("123")
val y = foo(null)
}
}
@@ -0,0 +1,29 @@
// FILE: Annotated.java
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Annotated {
@NotNull
public String foo(@Nullable String param) {
if (param != null) return param;
else return "";
}
}
// FILE: AnnotatedDerived.java
public class AnnotatedDerived extends Annotated {
public String foo(String param) {
return super.foo(param);
}
}
// FILE: jvm.kt
class User : AnnotatedDerived() {
fun test() {
val x = foo("123")
val y = foo(null)
}
}
@@ -0,0 +1,9 @@
// FILE: Some.java
public class Some {
}
// FILE: jvm.kt
class A : Some()
@@ -0,0 +1,19 @@
// FILE: A.java
public class A<T> {
public T foo(T t) {
return t;
}
}
// FILE: simpleFakeOverride.kt
class Some
class B : A<Some>() {
fun test() {
foo(Some())
}
}
@@ -1,3 +1,5 @@
// FILE: Some.java
public class Some {
public boolean foo(int param) {
return param > 0;
@@ -11,4 +13,14 @@ public class Some {
}
return result;
}
}
}
// FILE: jvm.kt
class A : Some() {
fun test() {
val res1 = foo(1)
val res2 = foo(-1)
val res3 = bar(intArrayOf(0, 2, -2))
}
}
@@ -0,0 +1,13 @@
// FILE: Base.java
public class Base {
public int value = 0;
}
// FILE: Derived.kt
class Derived : Base() {
fun getValue() = value
fun foo() = value
}
@@ -0,0 +1,32 @@
// FILE: Diagnostic.java
package jvm;
public interface Diagnostic {}
// FILE: DiagnosticWithParameters1.java
package jvm;
public interface DiagnosticWithParameters1<E, A> extends Diagnostic {
A getA();
}
// FILE: DiagnosticWithParameters2.java
package jvm;
public interface DiagnosticWithParameters2<E, A, B> extends Diagnostic {
A getA();
B getB();
}
// FILE: test.kt
package jvm;
fun <K> select(x: K, y: K): K = x
fun test(d1: DiagnosticWithParameters1<*, *>, d2: DiagnosticWithParameters2<*, *, *>) {
val res = select(d1.a, d2.b)
}
@@ -0,0 +1,7 @@
FILE: test.kt
public final fun <K> select(x: R|K|, y: R|K|): R|K| {
^select R|<local>/x|
}
public final fun test(d1: R|DiagnosticWithParameters1<*, *>|, d2: R|DiagnosticWithParameters2<*, *, *>|): R|kotlin/Unit| {
lval res: R|ft<kotlin/Any, kotlin/Any?>!| = R|jvm/select|<R|ft<kotlin/Any, kotlin/Any?>!|>(R|<local>/d1|.R|/DiagnosticWithParameters1.a|, R|<local>/d2|.R|/DiagnosticWithParameters2.b|)
}
@@ -1,3 +1,5 @@
// FILE: JavaClass.java
public class JavaClass {
public String getText() {
return "Text";
@@ -6,4 +8,15 @@ public class JavaClass {
public String getText(String param) {
return "Text with " + param;
}
}
}
// FILE: Test.kt
fun test() {
val jc = JavaClass()
val result = jc.text
}
fun otherTest(jc: JavaClass) {
val result = jc.text
}
@@ -0,0 +1,22 @@
// FILE: JavaClass.java
public class JavaClass extends Derived {
}
// FILE: Base.kt
open class Base {
open val some: String get() = "Base"
}
open class Derived : Base() {
override val some: String get() = "Derived"
}
// FILE: Test.kt
fun test() {
val jc = JavaClass()
val result = jc.some
}
@@ -21,3 +21,8 @@ FILE: Base.kt
}
}
FILE: Test.kt
public final fun test(): R|kotlin/Unit| {
lval jc: R|JavaClass| = R|/JavaClass.JavaClass|()
lval result: R|kotlin/String| = R|<local>/jc|.R|/Derived.some|
}
@@ -0,0 +1,21 @@
// FILE: Inheritor.java
public class Inheritor extends Second {
public void foo(First first, String s, int i) {}
}
// FILE: Base.kt
interface First
open class Second {
open fun First.foo(s: String, i: Int) {}
}
// FILE: Test.kt
class Tester : Inheritor(), First {
fun test() {
foo("abc", 456)
}
}
@@ -10,3 +10,14 @@ FILE: Base.kt
}
}
FILE: Test.kt
public final class Tester : R|Inheritor|, R|First| {
public constructor(): R|Tester| {
super<R|Inheritor|>()
}
public final fun test(): R|kotlin/Unit| {
(this@R|/Tester|, this@R|/Tester|).R|/Inheritor.foo|(String(abc), Int(456))
}
}
@@ -0,0 +1,21 @@
// FILE: Base.kt
interface Base {
val x: Int
}
// FILE: Inheritor.java
public class Inheritor implements Base {
public int getX() {
return 42;
}
}
// FILE: Test.kt
class Tester : Inheritor() {
fun test(): Int {
return x
}
}
@@ -1,3 +1,9 @@
FILE: Base.kt
public abstract interface Base : R|kotlin/Any| {
public abstract val x: R|kotlin/Int|
public get(): R|kotlin/Int|
}
FILE: Test.kt
public final class Tester : R|Inheritor| {
public constructor(): R|Tester| {
@@ -0,0 +1,17 @@
// FILE: Derived.kt
class Derived : Some()
// FILE: Some.java
public class Some implements Strange {
public Object foo() {
return "";
}
}
// FILE: Strange.kt
interface Strange<out T> {
fun foo(): T
}
@@ -5,3 +5,8 @@ FILE: Derived.kt
}
}
FILE: Strange.kt
public abstract interface Strange<out T> : R|kotlin/Any| {
public abstract fun foo(): R|T|
}
@@ -0,0 +1,9 @@
// FILE: JavaClass.java
class JavaClass {
public String getFoo() { return null; }
}
// FILE: test.kt
val x = JavaClass().foo
@@ -1,3 +1,3 @@
FILE: Test.kt
FILE: test.kt
public final val x: R|ft<kotlin/String, kotlin/String?>!| = R|/JavaClass.JavaClass|().R|/JavaClass.foo|
public get(): R|ft<kotlin/String, kotlin/String?>!|
@@ -1,3 +1,17 @@
// FILE: A.java
public class A {
public A foo() {
return this;
}
public A bar() {
return this;
}
}
// FILE: test.kt
class B : A() {
override fun foo(): B = this
fun bar(): B = this // Here we should have "missing override" but no ambiguity
@@ -1,4 +1,4 @@
FILE: B.kt
FILE: test.kt
public final class B : R|A| {
public constructor(): R|B| {
super<R|A|>()
@@ -0,0 +1,18 @@
// MODULE: m1
// FILE: base.kt
package hello
class Hello(val msg: String)
class Test(val set: java.util.Set<*>)
// MODULE: m2(m1)
// FILE: user.kt
package test
import hello.Hello
fun foo(hello: Hello): String = hello.msg
@@ -17,3 +17,7 @@ FILE: base.kt
public get(): R|java/util/Set<*>|
}
FILE: user.kt
public final fun foo(hello: R|hello/Hello|): R|kotlin/String| {
^foo R|<local>/hello|.R|hello/Hello.msg|
}
@@ -0,0 +1,31 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: m1-common
// FILE: common.kt
expect open class A<T>() {
open fun foo(arg: T)
}
open class B : A<String>() {
// Fake: override fun foo(arg: String) = super.foo(arg)
// Fake (JVM only): override fun bar(arg: String): String = super.bar(arg)
}
open class C : B() {
open fun bar(arg: String): String = arg
open fun baz(arg: CharSequence): String = arg.toString()
}
// MODULE: m1-jvm(m1-common)
// FILE: jvm.kt
actual open class A<T> {
actual open fun foo(arg: T) {}
open fun bar(arg: T): T = arg
open fun baz(arg: T): T = arg
}
class D : C() {
fun test() {
foo("")
bar("") // should be resolved to just C.bar
baz("")
}
}
@@ -1,3 +1,32 @@
FILE: common.kt
public open expect class A<T> : R|kotlin/Any| {
public constructor<T>(): R|A<T>| {
super<R|kotlin/Any|>()
}
public open fun foo(arg: R|T|): R|kotlin/Unit|
}
public open class B : R|A<kotlin/String>| {
public constructor(): R|B| {
super<R|A<kotlin/String>|>()
}
}
public open class C : R|B| {
public constructor(): R|C| {
super<R|B|>()
}
public open fun bar(arg: R|kotlin/String|): R|kotlin/String| {
^bar R|<local>/arg|
}
public open fun baz(arg: R|kotlin/CharSequence|): R|kotlin/String| {
^baz R|<local>/arg|.R|kotlin/Any.toString|()
}
}
FILE: jvm.kt
public open actual class A<T> : R|kotlin/Any| {
public constructor<T>(): R|A<T>| {
@@ -1,3 +1,16 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: m1-common
// FILE: common.kt
expect class MyList {
fun get(i: Int): Int
}
open class Wrapper(val list: MyList)
// MODULE: m1-jvm(m1-common)
// FILE: jvm.kt
actual class MyList {
actual fun get(i: Int): Int = i
@@ -17,10 +30,10 @@ fun useList(list: MyList) {
list.set(2, 3)
}
class DerivedWrapper : Wrapper() {
class DerivedWrapper : Wrapper(MyList()) {
fun use() {
// We should deal with receiver to resolve this
list.get(1)
list.set(2, 3)
}
}
}
@@ -1,3 +1,21 @@
FILE: common.kt
public final expect class MyList : R|kotlin/Any| {
public constructor(): R|MyList| {
super<R|kotlin/Any|>()
}
public final fun get(i: R|kotlin/Int|): R|kotlin/Int|
}
public open class Wrapper : R|kotlin/Any| {
public constructor(list: R|MyList|): R|Wrapper| {
super<R|kotlin/Any|>()
}
public final val list: R|MyList| = R|<local>/list|
public get(): R|MyList|
}
FILE: jvm.kt
public final actual class MyList : R|kotlin/Any| {
public constructor(): R|MyList| {
@@ -29,7 +47,7 @@ FILE: jvm.kt
}
public final class DerivedWrapper : R|Wrapper| {
public constructor(): R|DerivedWrapper| {
super<R|Wrapper|>()
super<R|Wrapper|>(R|/MyList.MyList|())
}
public final fun use(): R|kotlin/Unit| {
@@ -1,3 +1,16 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: m1-common
// FILE: common.kt
expect open class A() {
fun foo()
}
open class B : A()
// MODULE: m1-jvm(m1-common)
// FILE: jvm.kt
actual open class A {
actual fun foo() {}
@@ -16,4 +29,4 @@ class D : A() {
foo()
bar()
}
}
}
@@ -1,3 +1,18 @@
FILE: common.kt
public open expect class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun foo(): R|kotlin/Unit|
}
public open class B : R|A| {
public constructor(): R|B| {
super<R|A|>()
}
}
FILE: jvm.kt
public open actual class A : R|kotlin/Any| {
public constructor(): R|A| {
@@ -1,3 +1,16 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: m1-common
// FILE: common.kt
expect open class A() {
fun foo()
}
open class B : A()
// MODULE: m1-jvm(m1-common)
// FILE: jvm.kt
abstract class X {
fun bar() {}
}
@@ -1,3 +1,18 @@
FILE: common.kt
public open expect class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun foo(): R|kotlin/Unit|
}
public open class B : R|A| {
public constructor(): R|B| {
super<R|A|>()
}
}
FILE: jvm.kt
public abstract class X : R|kotlin/Any| {
public constructor(): R|X| {
@@ -710,6 +710,31 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("BasicWithAnnotatedJava.kt")
public void testBasicWithAnnotatedJava() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/BasicWithAnnotatedJava.kt");
}
@TestMetadata("BasicWithAnnotatedOverriddenJava.kt")
public void testBasicWithAnnotatedOverriddenJava() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/BasicWithAnnotatedOverriddenJava.kt");
}
@TestMetadata("BasicWithJava.kt")
public void testBasicWithJava() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/BasicWithJava.kt");
}
@TestMetadata("BasicWithJavaFakeOverride.kt")
public void testBasicWithJavaFakeOverride() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/BasicWithJavaFakeOverride.kt");
}
@TestMetadata("BasicWithPrimitiveJava.kt")
public void testBasicWithPrimitiveJava() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/BasicWithPrimitiveJava.kt");
}
@TestMetadata("capturedFlexible.kt")
public void testCapturedFlexible() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/capturedFlexible.kt");
@@ -720,6 +745,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/complexFlexibleInference.kt");
}
@TestMetadata("FieldAccessFromDerived.kt")
public void testFieldAccessFromDerived() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/FieldAccessFromDerived.kt");
}
@TestMetadata("FieldAndGetter.kt")
public void testFieldAndGetter() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/FieldAndGetter.kt");
@@ -750,6 +780,41 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/FunctionTypeInJava.kt");
}
@TestMetadata("IntersectionTypesProblem.kt")
public void testIntersectionTypesProblem() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/IntersectionTypesProblem.kt");
}
@TestMetadata("JavaGetPrefixConflict.kt")
public void testJavaGetPrefixConflict() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/JavaGetPrefixConflict.kt");
}
@TestMetadata("JavaInheritsKotlinDerived.kt")
public void testJavaInheritsKotlinDerived() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/JavaInheritsKotlinDerived.kt");
}
@TestMetadata("JavaInheritsKotlinExtension.kt")
public void testJavaInheritsKotlinExtension() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/JavaInheritsKotlinExtension.kt");
}
@TestMetadata("JavaInheritsKotlinProperty.kt")
public void testJavaInheritsKotlinProperty() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/JavaInheritsKotlinProperty.kt");
}
@TestMetadata("JavaInheritsRawKotlin.kt")
public void testJavaInheritsRawKotlin() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/JavaInheritsRawKotlin.kt");
}
@TestMetadata("JavaSyntheticProperty.kt")
public void testJavaSyntheticProperty() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/JavaSyntheticProperty.kt");
}
@TestMetadata("JavaVisibility2.kt")
public void testJavaVisibility2() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/JavaVisibility2.kt");
@@ -825,6 +890,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/outerInnerClasses.kt");
}
@TestMetadata("OverrideWithJava.kt")
public void testOverrideWithJava() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/OverrideWithJava.kt");
}
@TestMetadata("RawType.kt")
public void testRawType() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/RawType.kt");
@@ -871,6 +941,44 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
}
}
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/multiModule")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class MultiModule extends AbstractFirDiagnosticsWithStdlibTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInMultiModule() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/multiModule"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("Basic.kt")
public void testBasic() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/multiModule/Basic.kt");
}
@TestMetadata("FakeOverrides.kt")
public void testFakeOverrides() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/multiModule/FakeOverrides.kt");
}
@TestMetadata("MemberType.kt")
public void testMemberType() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/multiModule/MemberType.kt");
}
@TestMetadata("Members.kt")
public void testMembers() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/multiModule/Members.kt");
}
@TestMetadata("SuperTypes.kt")
public void testSuperTypes() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/multiModule/SuperTypes.kt");
}
}
@TestMetadata("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -27,104 +27,4 @@ public class FirMultiModuleResolveTestGenerated extends AbstractFirMultiModuleRe
public void testAllFilesPresentInMultiModule() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/fir/multiModule"), Pattern.compile("^([^\\.]+)$"), null, false);
}
@TestMetadata("basic")
public void testBasic() throws Exception {
runTest("idea/testData/fir/multiModule/basic/");
}
@TestMetadata("basicWithAnnotatedJava")
public void testBasicWithAnnotatedJava() throws Exception {
runTest("idea/testData/fir/multiModule/basicWithAnnotatedJava/");
}
@TestMetadata("basicWithAnnotatedOverriddenJava")
public void testBasicWithAnnotatedOverriddenJava() throws Exception {
runTest("idea/testData/fir/multiModule/basicWithAnnotatedOverriddenJava/");
}
@TestMetadata("basicWithJava")
public void testBasicWithJava() throws Exception {
runTest("idea/testData/fir/multiModule/basicWithJava/");
}
@TestMetadata("basicWithJavaFakeOverride")
public void testBasicWithJavaFakeOverride() throws Exception {
runTest("idea/testData/fir/multiModule/basicWithJavaFakeOverride/");
}
@TestMetadata("basicWithPrimitiveJava")
public void testBasicWithPrimitiveJava() throws Exception {
runTest("idea/testData/fir/multiModule/basicWithPrimitiveJava/");
}
@TestMetadata("fieldAccessFromDerived")
public void testFieldAccessFromDerived() throws Exception {
runTest("idea/testData/fir/multiModule/fieldAccessFromDerived/");
}
@TestMetadata("intersectionTypesProblem")
public void testIntersectionTypesProblem() throws Exception {
runTest("idea/testData/fir/multiModule/intersectionTypesProblem/");
}
@TestMetadata("javaGetPrefixConflict")
public void testJavaGetPrefixConflict() throws Exception {
runTest("idea/testData/fir/multiModule/javaGetPrefixConflict/");
}
@TestMetadata("javaInheritsKotlinDerived")
public void testJavaInheritsKotlinDerived() throws Exception {
runTest("idea/testData/fir/multiModule/javaInheritsKotlinDerived/");
}
@TestMetadata("javaInheritsKotlinExtension")
public void testJavaInheritsKotlinExtension() throws Exception {
runTest("idea/testData/fir/multiModule/javaInheritsKotlinExtension/");
}
@TestMetadata("javaInheritsKotlinProperty")
public void testJavaInheritsKotlinProperty() throws Exception {
runTest("idea/testData/fir/multiModule/javaInheritsKotlinProperty/");
}
@TestMetadata("javaInheritsRawKotlin")
public void testJavaInheritsRawKotlin() throws Exception {
runTest("idea/testData/fir/multiModule/javaInheritsRawKotlin/");
}
@TestMetadata("javaSyntheticProperty")
public void testJavaSyntheticProperty() throws Exception {
runTest("idea/testData/fir/multiModule/javaSyntheticProperty/");
}
@TestMetadata("mppFakeOverrides")
public void testMppFakeOverrides() throws Exception {
runTest("idea/testData/fir/multiModule/mppFakeOverrides/");
}
@TestMetadata("mppMemberType")
public void testMppMemberType() throws Exception {
runTest("idea/testData/fir/multiModule/mppMemberType/");
}
@TestMetadata("mppMembers")
public void testMppMembers() throws Exception {
runTest("idea/testData/fir/multiModule/mppMembers/");
}
@TestMetadata("mppSuperTypes")
public void testMppSuperTypes() throws Exception {
runTest("idea/testData/fir/multiModule/mppSuperTypes/");
}
@TestMetadata("overrideWithJava")
public void testOverrideWithJava() throws Exception {
runTest("idea/testData/fir/multiModule/overrideWithJava/");
}
@TestMetadata("withStdlib")
public void testWithStdlib() throws Exception {
runTest("idea/testData/fir/multiModule/withStdlib/");
}
}
-5
View File
@@ -1,5 +0,0 @@
package hello
class Hello(val msg: String)
class Test(val set: java.util.Set<*>)
@@ -1,5 +0,0 @@
package test
import hello.Hello
fun foo(hello: Hello): String = hello.msg
@@ -1,4 +0,0 @@
FILE: user.kt
public final fun foo(hello: R|hello/Hello|): R|kotlin/String| {
^foo R|<local>/hello|.R|hello/Hello.msg|
}
@@ -1,6 +0,0 @@
public open class Annotated : R|kotlin/Any| {
@R|org/jetbrains/annotations/NotNull|() public open fun foo(@R|org/jetbrains/annotations/Nullable|() param: R|kotlin/String?|): R|kotlin/String|
public constructor(): R|Annotated|
}
@@ -1,10 +0,0 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Annotated {
@NotNull
public String foo(@Nullable String param) {
if (param != null) return param;
else return "";
}
}
@@ -1,6 +0,0 @@
class User : Annotated() {
fun test() {
val x = foo("123")
val y = foo(null)
}
}
@@ -1,12 +0,0 @@
public open class Annotated : R|kotlin/Any| {
@R|org/jetbrains/annotations/NotNull|() public open fun foo(@R|org/jetbrains/annotations/Nullable|() param: R|kotlin/String?|): R|kotlin/String|
public constructor(): R|Annotated|
}
public open class AnnotatedDerived : R|Annotated| {
public open fun foo(param: R|kotlin/String?|): R|kotlin/String|
public constructor(): R|AnnotatedDerived|
}
@@ -1,5 +0,0 @@
public class AnnotatedDerived extends Annotated {
public String foo(String param) {
return super.foo(param);
}
}
@@ -1,6 +0,0 @@
class User : AnnotatedDerived() {
fun test() {
val x = foo("123")
val y = foo(null)
}
}
@@ -1,4 +0,0 @@
public open class Some : R|kotlin/Any| {
public constructor(): R|Some|
}
@@ -1,3 +0,0 @@
public class Some {
}
@@ -1,3 +0,0 @@
class A : Some()
@@ -1,6 +0,0 @@
public open class A<T : R|ft<kotlin/Any, kotlin/Any?>!|> : R|kotlin/Any| {
public open fun foo(t: R|ft<T, T?>!|): R|ft<T, T?>!|
public constructor<T : R|ft<kotlin/Any, kotlin/Any?>!|>(): R|A<T>|
}
@@ -1,5 +0,0 @@
public class A<T> {
public T foo(T t) {
return t;
}
}
@@ -1,9 +0,0 @@
class Some
class B : A<Some>() {
fun test() {
foo(Some())
}
}
@@ -1,8 +0,0 @@
public open class Some : R|kotlin/Any| {
public open fun foo(param: R|kotlin/Int|): R|kotlin/Boolean|
public open fun bar(arr: R|ft<kotlin/IntArray, kotlin/IntArray?>!|): R|ft<kotlin/Array<ft<kotlin/String, kotlin/String?>!>, kotlin/Array<out ft<kotlin/String, kotlin/String?>!>?>!|
public constructor(): R|Some|
}
@@ -1,7 +0,0 @@
class A : Some() {
fun test() {
val res1 = foo(1)
val res2 = foo(-1)
val res3 = bar(intArrayOf(0, 2, -2))
}
}
+1
View File
@@ -0,0 +1 @@
This file is just to keep parent directory alive.
@@ -1,6 +0,0 @@
public open class Base : R|kotlin/Any| {
public open field value:
public constructor(): R|Base|
}
@@ -1,3 +0,0 @@
public class Base {
public int value = 0;
}
@@ -1,5 +0,0 @@
class Derived : Base() {
fun getValue() = value
fun foo() = value
}
@@ -1,12 +0,0 @@
public abstract interface Diagnostic : R|kotlin/Any| {
}
public abstract interface DiagnosticWithParameters1<E : R|ft<kotlin/Any, kotlin/Any?>!|, A : R|ft<kotlin/Any, kotlin/Any?>!|> : R|jvm/Diagnostic| {
public abstract fun getA(): R|ft<A, A?>!|
}
public abstract interface DiagnosticWithParameters2<E : R|ft<kotlin/Any, kotlin/Any?>!|, A : R|ft<kotlin/Any, kotlin/Any?>!|, B : R|ft<kotlin/Any, kotlin/Any?>!|> : R|jvm/Diagnostic| {
public abstract fun getA(): R|ft<A, A?>!|
public abstract fun getB(): R|ft<B, B?>!|
}
@@ -1,3 +0,0 @@
package jvm;
public interface Diagnostic {}
@@ -1,5 +0,0 @@
package jvm;
public interface DiagnosticWithParameters1<E, A> extends Diagnostic {
A getA();
}
@@ -1,6 +0,0 @@
package jvm;
public interface DiagnosticWithParameters2<E, A, B> extends Diagnostic {
A getA();
B getB();
}
@@ -1,7 +0,0 @@
package jvm;
fun <K> select(x: K, y: K): K = x
fun test(d1: DiagnosticWithParameters1<*, *>, d2: DiagnosticWithParameters2<*, *, *>) {
val res = select(d1.a, d2.b)
}
@@ -1,7 +0,0 @@
FILE: test.kt
public final fun <K> select(x: R|K|, y: R|K|): R|K| {
^select R|<local>/x|
}
public final fun test(d1: R|jvm/DiagnosticWithParameters1<*, *>|, d2: R|jvm/DiagnosticWithParameters2<*, *, *>|): R|kotlin/Unit| {
lval res: R|ft<kotlin/Any, kotlin/Any?>!| = R|jvm/select|<R|ft<kotlin/Any, kotlin/Any?>!|>(R|<local>/d1|.R|jvm/DiagnosticWithParameters1.a|, R|<local>/d2|.R|jvm/DiagnosticWithParameters2.b|)
}
@@ -1,8 +0,0 @@
public open class JavaClass : R|kotlin/Any| {
public open fun getText(): R|ft<kotlin/String, kotlin/String?>!|
public open fun getText(param: R|ft<kotlin/String, kotlin/String?>!|): R|ft<kotlin/String, kotlin/String?>!|
public constructor(): R|JavaClass|
}
@@ -1,8 +0,0 @@
fun test() {
val jc = JavaClass()
val result = jc.text
}
fun otherTest(jc: JavaClass) {
val result = jc.text
}
@@ -1,4 +0,0 @@
public open class JavaClass : R|Derived| {
public constructor(): R|JavaClass|
}
@@ -1,7 +0,0 @@
open class Base {
open val some: String get() = "Base"
}
open class Derived : Base() {
override val some: String get() = "Derived"
}
@@ -1,3 +0,0 @@
public class JavaClass extends Derived {
}
@@ -1,4 +0,0 @@
fun test() {
val jc = JavaClass()
val result = jc.some
}
@@ -1,5 +0,0 @@
FILE: Test.kt
public final fun test(): R|kotlin/Unit| {
lval jc: R|JavaClass| = R|/JavaClass.JavaClass|()
lval result: R|kotlin/String| = R|<local>/jc|.R|/Derived.some|
}
@@ -1,6 +0,0 @@
public open class Inheritor : R|Second| {
public open fun R|First|.foo(first: R|kotlin/String|, s: R|kotlin/Int|): R|kotlin/Unit|
public constructor(): R|Inheritor|
}
@@ -1,5 +0,0 @@
interface First
open class Second {
open fun First.foo(s: String, i: Int) {}
}
@@ -1,3 +0,0 @@
public class Inheritor extends Second {
public void foo(First first, String s, int i) {}
}
@@ -1,5 +0,0 @@
class Tester : Inheritor(), First {
fun test() {
foo("abc", 456)
}
}
@@ -1,11 +0,0 @@
FILE: Test.kt
public final class Tester : R|Inheritor|, R|First| {
public constructor(): R|Tester| {
super<R|Inheritor|>()
}
public final fun test(): R|kotlin/Unit| {
(this@R|/Tester|, this@R|/Tester|).R|/Inheritor.foo|(String(abc), Int(456))
}
}
@@ -1,6 +0,0 @@
public open class Inheritor : R|kotlin/Any|, R|Base| {
public open fun getX(): R|kotlin/Int|
public constructor(): R|Inheritor|
}
@@ -1,3 +0,0 @@
interface Base {
val x: Int
}
@@ -1,6 +0,0 @@
FILE: Base.kt
public abstract interface Base : R|kotlin/Any| {
public abstract val x: R|kotlin/Int|
public get(): R|kotlin/Int|
}
@@ -1,5 +0,0 @@
public class Inheritor implements Base {
public int getX() {
return 42;
}
}
@@ -1,5 +0,0 @@
class Tester : Inheritor() {
fun test(): Int {
return x
}
}
@@ -1,6 +0,0 @@
public open class Some : R|kotlin/Any|, R|Strange<kotlin/Any?>| {
public open fun foo(): R|kotlin/Any?|
public constructor(): R|Some|
}
@@ -1 +0,0 @@
class Derived : Some()
@@ -1,5 +0,0 @@
public class Some implements Strange {
public Object foo() {
return "";
}
}
@@ -1,3 +0,0 @@
interface Strange<out T> {
fun foo(): T
}
@@ -1,5 +0,0 @@
FILE: Strange.kt
public abstract interface Strange<out T> : R|kotlin/Any| {
public abstract fun foo(): R|T|
}
@@ -1,6 +0,0 @@
public/*package*/ open class JavaClass : R|kotlin/Any| {
public open fun getFoo(): R|ft<kotlin/String, kotlin/String?>!|
public/*package*/ constructor(): R|JavaClass|
}
@@ -1,3 +0,0 @@
class JavaClass {
public String getFoo() { return null; }
}
@@ -1 +0,0 @@
val x = JavaClass().foo
@@ -1,11 +0,0 @@
expect open class A<T>() {
open fun foo(arg: T)
}
open class B : A<String>() {
// Fake: override fun foo(arg: String) = super.foo(arg)
// Fake (JVM only): override fun bar(arg: String): String = super.bar(arg)
}
open class C : B() {
open fun bar(arg: String): String = arg
open fun baz(arg: CharSequence): String = arg.toString()
}
@@ -1,29 +0,0 @@
FILE: common.kt
public open expect class A<T> : R|kotlin/Any| {
public constructor<T>(): R|A<T>| {
super<R|kotlin/Any|>()
}
public open fun foo(arg: R|T|): R|kotlin/Unit|
}
public open class B : R|A<kotlin/String>| {
public constructor(): R|B| {
super<R|A<kotlin/String>|>()
}
}
public open class C : R|B| {
public constructor(): R|C| {
super<R|B|>()
}
public open fun bar(arg: R|kotlin/String|): R|kotlin/String| {
^bar R|<local>/arg|
}
public open fun baz(arg: R|kotlin/CharSequence|): R|kotlin/String| {
^baz R|<local>/arg|.R|kotlin/Any.toString|()
}
}
@@ -1,12 +0,0 @@
actual open class A<T> {
actual open fun foo(arg: T) {}
open fun bar(arg: T): T = arg
open fun baz(arg: T): T = arg
}
class D : C() {
fun test() {
foo("")
bar("") // should be resolved to just C.bar
baz("")
}
}
@@ -1,5 +0,0 @@
expect class MyList {
fun get(i: Int): Int
}
open class Wrapper(val list: MyList)
@@ -1,18 +0,0 @@
FILE: common.kt
public final expect class MyList : R|kotlin/Any| {
public constructor(): R|MyList| {
super<R|kotlin/Any|>()
}
public final fun get(i: R|kotlin/Int|): R|kotlin/Int|
}
public open class Wrapper : R|kotlin/Any| {
public constructor(list: R|MyList|): R|Wrapper| {
super<R|kotlin/Any|>()
}
public final val list: R|MyList| = R|<local>/list|
public get(): R|MyList|
}
@@ -1,5 +0,0 @@
expect open class A() {
fun foo()
}
open class B : A()
@@ -1,15 +0,0 @@
FILE: common.kt
public open expect class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun foo(): R|kotlin/Unit|
}
public open class B : R|A| {
public constructor(): R|B| {
super<R|A|>()
}
}
@@ -1,5 +0,0 @@
expect open class A() {
fun foo()
}
open class B : A()

Some files were not shown because too many files have changed in this diff Show More