Test for using dynamic types with smart casts

This commit is contained in:
Andrey Breslav
2014-11-19 19:48:08 +03:00
parent cdecb9d8c4
commit 712f776545
3 changed files with 33 additions and 0 deletions
@@ -0,0 +1,16 @@
// !MARK_DYNAMIC_CALLS
// !DIAGNOSTICS: -UNUSED_PARAMETER
// MODULE[js]: m1
// FILE: k.kt
fun foo(d: dynamic) {
if (d is Foo) {
d.bar() // resolved statically
d.<!DEBUG_INFO_DYNAMIC!>baz<!>()
}
}
class Foo {
fun bar() {}
}
@@ -0,0 +1,11 @@
package
internal fun foo(/*0*/ d: dynamic): kotlin.Unit
internal final class Foo {
public constructor Foo()
internal final fun bar(): 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
}
@@ -3788,6 +3788,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("smartCast.kt")
public void testSmartCast() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/dynamicTypes/smartCast.kt");
doTest(fileName);
}
@TestMetadata("unsupported.kt")
public void testUnsupported() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/dynamicTypes/unsupported.kt");