diff options
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | test.toc | 17 | ||||
-rw-r--r-- | types.c | 1 |
3 files changed, 15 insertions, 4 deletions
@@ -1,5 +1,6 @@ /* TODO: +resolve user-defined types make sure user defined types work structs length of slice/arr with .len @@ -13,9 +13,20 @@ putf @= fn(x: float) { "); }; -Foo @= int; +Foo @= [3]int; + +f @= fn() Foo { + a : Foo; + p := &(a as [3]int)[0]; + *p = 1; + *(p + 1) = 2; + *(p + 2) = 3; + a +}; main @= fn() { - a := 35238 as Foo; - puti(a as int); + foo := f(); + puti((foo as [3]int)[0]); + puti((foo as [3]int)[1]); + puti((foo as [3]int)[2]); }; @@ -395,7 +395,6 @@ typedef enum { static Status type_cast_status(Type *from, Type *to) { if (to->kind == TYPE_UNKNOWN) return STATUS_NONE; - fprint_type(stdout, from); puts(""); if (from->kind == TYPE_USER) { return type_eq(to, ident_typeval(from->user.name)) ? STATUS_NONE : STATUS_ERR; } |