Tests for KT-3224 and KT-3244. Both pass already in M11 or even earlier

This commit is contained in:
Mikhail Glukhikh
2015-04-07 17:40:08 +03:00
parent 8f07960fd4
commit f49c79f4f0
5 changed files with 54 additions and 0 deletions
@@ -0,0 +1,8 @@
// Works already in M11
fun test(c : Class<*>) {
val sc = <!UNCHECKED_CAST!>c as Class<String><!>
// No ambiguous overload
c.getAnnotations();
sc.getAnnotations();
}
@@ -0,0 +1,3 @@
package
internal fun test(/*0*/ c: java.lang.Class<*>): kotlin.Unit
@@ -0,0 +1,12 @@
// Should work already in M11
open class A(val s : String)
class B(s : String) : A(s)
fun test(a : A): String? {
if (a is B) {
// Earlier (14.01.2013) reported overload ambiguity over s
return a.s
}
return null
}
@@ -0,0 +1,19 @@
package
internal fun test(/*0*/ a: A): kotlin.String?
internal open class A {
public constructor A(/*0*/ s: kotlin.String)
internal final val s: kotlin.String
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
}
internal final class B : A {
public constructor B(/*0*/ s: kotlin.String)
internal final override /*1*/ /*fake_override*/ val s: kotlin.String
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
}
@@ -11323,6 +11323,18 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/smartCasts/varnotnull"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("kt3224.kt")
public void testKt3224() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt3224.kt");
doTest(fileName);
}
@TestMetadata("kt3244.kt")
public void testKt3244() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt3244.kt");
doTest(fileName);
}
@TestMetadata("kt3993.kt")
public void testKt3993() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt3993.kt");