Added test for ambiguous SAM adapters within one class.

This commit is contained in:
Evgeny Gerashchenko
2013-06-07 19:51:22 +04:00
parent 4980dacd33
commit cfc99b941a
5 changed files with 48 additions and 0 deletions
@@ -0,0 +1,18 @@
// FILE: A.java
import java.io.Closeable;
public class A {
public static void foo(Runnable r) {
}
public static void foo(Closeable c) {
}
}
// FILE: test.kt
fun main() {
A.<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo { "Hello!" }<!>
A.foo(Runnable { "Hello!" })
}
@@ -0,0 +1,11 @@
package test;
import java.io.Closeable;
public class AmbiguousAdapters {
public void foo(Runnable r) {
}
public void foo(Closeable c) {
}
}
@@ -0,0 +1,9 @@
package test
public open class AmbiguousAdapters : java.lang.Object {
public constructor AmbiguousAdapters()
public open /*synthesized*/ fun foo(/*0*/ p0: (() -> jet.Unit)?): jet.Unit
public open /*synthesized*/ fun foo(/*0*/ p0: (() -> jet.Unit)?): jet.Unit
public open fun foo(/*0*/ p0: java.io.Closeable?): jet.Unit
public open fun foo(/*0*/ p0: java.lang.Runnable?): jet.Unit
}
@@ -3224,6 +3224,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/diagnostics/tests/j+k"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("ambiguousSamAdapters.kt")
public void testAmbiguousSamAdapters() throws Exception {
doTest("compiler/testData/diagnostics/tests/j+k/ambiguousSamAdapters.kt");
}
@TestMetadata("innerNestedClassFromJava.kt")
public void testInnerNestedClassFromJava() throws Exception {
doTest("compiler/testData/diagnostics/tests/j+k/innerNestedClassFromJava.kt");
@@ -1234,6 +1234,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/loadJava/compiledJava/singleAbstractMethod/adapter"), Pattern.compile("^(.+)\\.java$"), true);
}
@TestMetadata("AmbiguousAdapters.java")
public void testAmbiguousAdapters() throws Exception {
doTestCompiledJava("compiler/testData/loadJava/compiledJava/singleAbstractMethod/adapter/AmbiguousAdapters.java");
}
@TestMetadata("Basic.java")
public void testBasic() throws Exception {
doTestCompiledJava("compiler/testData/loadJava/compiledJava/singleAbstractMethod/adapter/Basic.java");