Merge pull request #586 from JetBrains/rr/yole/kt3107

Regression tests for some obsolete issues in the JVM backend
This commit is contained in:
Alexander Udalov
2015-03-04 20:00:42 +03:00
7 changed files with 88 additions and 0 deletions
@@ -0,0 +1,17 @@
fun foo(): String {
val s = try {
"OK"
} catch (e: Exception) {
try {
""
} catch (ee: Exception) {
""
}
}
return s
}
fun box(): String {
return foo()
}
@@ -0,0 +1,9 @@
public object Globals{
public fun get(key: String, remove: Boolean = true): String {
return "OK"
}
}
fun box(): String {
return Globals["test"]
}
@@ -0,0 +1,11 @@
class Foo {
fun bar(): String {
fun foo<T>(t:() -> T) : T = t()
foo { }
return "OK"
}
}
fun box(): String {
return Foo().bar()
}
@@ -0,0 +1,15 @@
abstract class C {
fun test(x: Int) {
if (x == 0) return
if (this is D) {
(this: D).test(x - 1)
}
}
}
class D: C()
fun box(): String {
D().test(10)
return "OK"
}
@@ -0,0 +1,6 @@
fun box(): String {
val m = hashMapOf<String, String?>()
m.put("b", null)
val oldValue = m.getOrPut("b", { "Foo" })
return if (oldValue == null) "OK" else "fail: $oldValue"
}
@@ -6037,24 +6037,48 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("kt3107.kt")
public void testKt3107() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt3107.kt");
doTest(fileName);
}
@TestMetadata("kt3173.kt")
public void testKt3173() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt3173.kt");
doTest(fileName);
}
@TestMetadata("kt3421.kt")
public void testKt3421() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt3421.kt");
doTest(fileName);
}
@TestMetadata("kt3587.kt")
public void testKt3587() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt3587.kt");
doTest(fileName);
}
@TestMetadata("kt3903.kt")
public void testKt3903() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt3903.kt");
doTest(fileName);
}
@TestMetadata("kt3999.kt")
public void testKt3999() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt3999.kt");
doTest(fileName);
}
@TestMetadata("kt4281.kt")
public void testKt4281() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt4281.kt");
doTest(fileName);
}
@TestMetadata("kt4682.kt")
public void testKt4682() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/regressions/kt4682.kt");
@@ -2892,6 +2892,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
doTestWithStdlib(fileName);
}
@TestMetadata("kt3442.kt")
public void testKt3442() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt3442.kt");
doTestWithStdlib(fileName);
}
@TestMetadata("kt4262.kt")
public void testKt4262() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt4262.kt");