diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-10-28 20:18:17 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-10-28 20:18:17 -0400 |
commit | af4899a510efb31008f335f78689f77d77a1afe5 (patch) | |
tree | 731042417ff533669baab51533caba61d20cc7f0 | |
parent | 2d2ee05b901728efca22adc2ba02ec09397fd6a0 (diff) |
still some issues with user-defined types
-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; } |