Add tests for obsolete issues

#KT-12008 Obsolete
 #KT-11881 Obsolete
 #KT-10822 Obsolete
This commit is contained in:
Mikhail Zarechenskiy
2018-09-11 12:34:09 +03:00
parent 58442899b8
commit 66a00f442c
12 changed files with 217 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
var result = ""
interface A {
fun foo() {
result += "foo;"
}
}
interface B : A {
fun hoo() {
result += "hoo;"
}
}
fun<T : A> doer(init: () -> T): T = init()
class Z {
operator fun<T : A> invoke(init: Z.() -> T): T = init()
infix fun<T : A> doer(init: Z.() -> T): T = init()
}
interface ARoot<T> {
val self : T
infix fun<U : A> consume(init: T.() -> U): U = self.init()
operator fun<U : A> invoke(init: T.() -> U): U = self.init()
}
class Y : ARoot<Y> {
override val self: Y
get() = this
}
fun box(): String {
doer {
object : B {}
}.hoo()
val z = Z()
val y = Y()
z.doer { object : B {} }.hoo()
y {
z {
object : B {}
}
}.hoo()
y.consume {
z {
object : B {}
}
}.hoo()
z {
object : B {}
}.foo()
z.doer { object : B {} }.foo()
z.doer { object : B {} }.hoo()
return if (result == "hoo;hoo;hoo;hoo;foo;foo;hoo;") "OK" else "Fail: $result"
}
@@ -0,0 +1,12 @@
// FULL_JDK
import java.util.*
fun foo(<!UNUSED_PARAMETER!>o<!>: Optional<String>) {}
class Test(nullable: String?) {
private val nullableOptional = Optional.ofNullable(nullable)
fun doIt() {
foo(nullableOptional)
}
}
@@ -0,0 +1,12 @@
package
public fun foo(/*0*/ o: java.util.Optional<kotlin.String>): kotlin.Unit
public final class Test {
public constructor Test(/*0*/ nullable: kotlin.String?)
private final val nullableOptional: java.util.Optional<kotlin.String>
public final fun doIt(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,9 @@
class Inv<T>
inline operator fun <reified T> Inv<T>.invoke() {}
operator fun <K> Inv<K>.get(<!UNUSED_PARAMETER!>i<!>: Int): Inv<K> = this
fun <K> test(a: Inv<K>) {
<!TYPE_PARAMETER_AS_REIFIED!>a[1]()<!>
}
@@ -0,0 +1,12 @@
package
public fun </*0*/ K> test(/*0*/ a: Inv<K>): kotlin.Unit
public operator fun </*0*/ K> Inv<K>.get(/*0*/ i: kotlin.Int): Inv<K>
public inline operator fun </*0*/ reified T> Inv<T>.invoke(): kotlin.Unit
public final class Inv</*0*/ T> {
public constructor Inv</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -2513,6 +2513,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.kt");
}
@TestMetadata("kt12008.kt")
public void testKt12008() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt12008.kt");
}
@TestMetadata("kt1558.kt")
public void testKt1558() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.kt");
@@ -2868,6 +2873,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/reified/arrayOfNullsReified.kt");
}
@TestMetadata("kt11881.kt")
public void testKt11881() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/reified/kt11881.kt");
}
@TestMetadata("nonCallableReiefied.kt")
public void testNonCallableReiefied() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/reified/nonCallableReiefied.kt");
@@ -2513,6 +2513,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.kt");
}
@TestMetadata("kt12008.kt")
public void testKt12008() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt12008.kt");
}
@TestMetadata("kt1558.kt")
public void testKt1558() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.kt");
@@ -2868,6 +2873,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/reified/arrayOfNullsReified.kt");
}
@TestMetadata("kt11881.kt")
public void testKt11881() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/reified/kt11881.kt");
}
@TestMetadata("nonCallableReiefied.kt")
public void testNonCallableReiefied() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/reified/nonCallableReiefied.kt");
@@ -11449,6 +11449,24 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
}
}
@TestMetadata("compiler/testData/codegen/box/inference")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Inference extends AbstractBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInInference() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt10822.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -11449,6 +11449,24 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
}
}
@TestMetadata("compiler/testData/codegen/box/inference")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Inference extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInInference() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt10822.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -11449,6 +11449,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
}
}
@TestMetadata("compiler/testData/codegen/box/inference")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Inference extends AbstractIrBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public void testAllFilesPresentInInference() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
}
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt10822.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -9994,6 +9994,24 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
}
}
@TestMetadata("compiler/testData/codegen/box/inference")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Inference extends AbstractIrJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInInference() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt10822.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -11059,6 +11059,24 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
}
}
@TestMetadata("compiler/testData/codegen/box/inference")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Inference extends AbstractJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
public void testAllFilesPresentInInference() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt10822.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)