From af4899a510efb31008f335f78689f77d77a1afe5 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Mon, 28 Oct 2019 20:18:17 -0400 Subject: still some issues with user-defined types --- main.c | 1 + test.toc | 17 ++++++++++++++--- types.c | 1 - 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index e876310..c7094ce 100644 --- a/main.c +++ b/main.c @@ -1,5 +1,6 @@ /* TODO: +resolve user-defined types make sure user defined types work structs length of slice/arr with .len diff --git a/test.toc b/test.toc index 3cc5c91..5cc4f17 100644 --- a/test.toc +++ b/test.toc @@ -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]); }; diff --git a/types.c b/types.c index 27295fe..a03a476 100644 --- a/types.c +++ b/types.c @@ -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; } -- cgit v1.2.3