Add new FIR tests related to KT-31508 problems, replace failing MM testJava...Signature

This commit is contained in:
Mikhail Glukhikh
2019-10-14 11:10:28 +03:00
parent 27094d0371
commit 79c0a69219
11 changed files with 60 additions and 16 deletions
@@ -0,0 +1,6 @@
// FULL_JDK
class MyException : Exception()
fun test(e: MyException) {
e.printStackTrace() // Cannot be resolved with early J2K mapping due deriving of kotlin.Throwable instead of java.lang.Throwable
}
@@ -0,0 +1,10 @@
FILE: MyException.kt
public final class MyException : R|kotlin/Exception| {
public constructor(): R|MyException| {
super<R|kotlin/Exception|>()
}
}
public final fun test(e: R|MyException|): R|kotlin/Unit| {
R|<local>/e|.R|kotlin/printStackTrace|()
}
@@ -1,3 +1,8 @@
// FULL_JDK
// FILE: MyIterable.java
public interface MyIterable<T> extends Iterable<T>
// FILE: test.kt
interface UseIterable : MyIterable<String> {
fun test() {
val it = iterator()
@@ -0,0 +1,8 @@
FILE: test.kt
public abstract interface UseIterable : R|MyIterable<kotlin/String>| {
public open fun test(): R|kotlin/Unit| {
lval it: R|kotlin/collections/MutableIterator<kotlin/String>| = this@R|kotlin/collections/MutableIterable|.R|FakeOverride<kotlin/collections/MutableIterable.iterator: R|kotlin/collections/MutableIterator<kotlin/String>|>|()
lval split: <ERROR TYPE REF: Unresolved name: spliterator> = <Unresolved name: spliterator>#()
}
}
@@ -0,0 +1,9 @@
// FULL_JDK
// FILE: MyMap.java
public abstract class MyMap implements java.util.Map<String, String> {}
// FILE: test.kt
fun test(map: MyMap) {
val result = map.getOrPut("key") { "value" } // Cannot be resolved without early J2K mapping
}
@@ -0,0 +1,7 @@
FILE: test.kt
public final fun test(map: R|MyMap|): R|kotlin/Unit| {
lval result: R|kotlin/String| = R|<local>/map|.R|kotlin/collections/getOrPut|<R|kotlin/String|, R|kotlin/String|>(String(key), <L> = getOrPut@fun <anonymous>(): R|kotlin/String| <kind=EXACTLY_ONCE> {
String(value)
}
)
}
@@ -86,6 +86,21 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/resolve/testData/diagnostics/j+k/KotlinClassParameterGeneric.kt");
}
@TestMetadata("MyException.kt")
public void testMyException() throws Exception {
runTest("compiler/fir/resolve/testData/diagnostics/j+k/MyException.kt");
}
@TestMetadata("MyIterable.kt")
public void testMyIterable() throws Exception {
runTest("compiler/fir/resolve/testData/diagnostics/j+k/MyIterable.kt");
}
@TestMetadata("MyMap.kt")
public void testMyMap() throws Exception {
runTest("compiler/fir/resolve/testData/diagnostics/j+k/MyMap.kt");
}
@TestMetadata("outerInnerClasses.kt")
public void testOuterInnerClasses() throws Exception {
runTest("compiler/fir/resolve/testData/diagnostics/j+k/outerInnerClasses.kt");
@@ -1,2 +0,0 @@
public abstract interface MyIterable<T> : R|java/lang/Iterable<T>| {
}
@@ -1 +0,0 @@
public interface MyIterable<T> extends Iterable<T>
@@ -1,8 +0,0 @@
FILE: test.kt
public abstract interface UseIterable : R|MyIterable<kotlin/String>| {
public open fun test(): R|kotlin/Unit| {
lval it: R|ft<kotlin/collections/MutableIterator<ft<T, T?>>, kotlin/collections/Iterator<ft<T, T?>>?>|! = R|FakeOverride<java/lang/Iterable.iterator: R|ft<kotlin/collections/MutableIterator<ft<T, T?>>, kotlin/collections/Iterator<ft<T, T?>>?>|!>|()
lval split: R|ft<java/util/Spliterator<ft<T, T>>, java/util/Spliterator<ft<T, T>>>| = R|FakeOverride<java/lang/Iterable.spliterator: R|ft<java/util/Spliterator<ft<T, T>>, java/util/Spliterator<ft<T, T>>>|>|()
}
}
@@ -64,11 +64,6 @@ public class FirMultiModuleResolveTestGenerated extends AbstractFirMultiModuleRe
runTest("idea/testData/fir/multiModule/fieldAccessFromDerived/");
}
@TestMetadata("fullWithJavaPredefinedSignature")
public void testFullWithJavaPredefinedSignature() throws Exception {
runTest("idea/testData/fir/multiModule/fullWithJavaPredefinedSignature/");
}
@TestMetadata("intersectionTypesProblem")
public void testIntersectionTypesProblem() throws Exception {
runTest("idea/testData/fir/multiModule/intersectionTypesProblem/");