summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-10-28 20:18:17 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2019-10-28 20:18:17 -0400
commitaf4899a510efb31008f335f78689f77d77a1afe5 (patch)
tree731042417ff533669baab51533caba61d20cc7f0
parent2d2ee05b901728efca22adc2ba02ec09397fd6a0 (diff)
still some issues with user-defined types
-rw-r--r--main.c1
-rw-r--r--test.toc17
-rw-r--r--types.c1
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;
}