Test for cast added

This commit is contained in:
Konstantin Anisimov
2016-11-16 17:02:01 +03:00
committed by vvlevchenko
parent 103509d75d
commit 9c28555e55
3 changed files with 24 additions and 0 deletions
+4
View File
@@ -179,6 +179,10 @@ task local_variable(type: UnitKonanTest) {
source = "codegen/basics/local_variable.kt"
}
task cast_simple(type: UnitKonanTest) {
source = "codegen/basics/cast_simple.kt"
}
task hello0(type: RunKonanTest) {
goldValue = "Hello, world!\n"
source = "runtime/basic/hello0.kt"
@@ -0,0 +1,10 @@
extern void *resolve_symbol(const char*);
int
run_test() {
int (*castTest)() = resolve_symbol("kfun:castTest()");
if (!castTest()) return 1;
return 0;
}
@@ -0,0 +1,10 @@
open class A() {}
class B(): A() {}
fun castSimple(o: Any) : A = o as A
fun castTest(): Boolean {
val b = B()
castSimple(b)
return true
}