diff options
author | Ori Bernstein <ori@eigenstate.org> | 2016-01-31 22:18:17 -0800 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2016-01-31 22:49:31 -0800 |
commit | 128470e404d843b3d71c5837cac05d4d4203bd66 (patch) | |
tree | 267d7879867aebd35a7f8203d0ff9f77fb9238f0 /test | |
parent | fb8753c942a8d06926977d221d5c89c3a867fa29 (diff) | |
download | mc-128470e404d843b3d71c5837cac05d4d4203bd66.tar.gz |
Add support for generic impls.
You can now implement generic shit like iterators.
Diffstat (limited to 'test')
-rw-r--r-- | test/genericimpl.myr | 33 | ||||
-rw-r--r-- | test/tests | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/test/genericimpl.myr b/test/genericimpl.myr new file mode 100644 index 0000000..ef8e094 --- /dev/null +++ b/test/genericimpl.myr @@ -0,0 +1,33 @@ +use std + +trait gimpl @a = + desc : (x : @a -> byte[:]) +;; + +impl gimpl int = + desc = {x + -> "int" + } +;; + +impl gimpl byte[:] = + desc = {x + -> "string" + } +;; + +impl gimpl @a = + desc = {x + -> "@a" + } +;; + +impl gimpl @b[:] = + desc = {x + -> "@a[:]" + } +;; + +const main = { + std.put("{} {} {} {}\n", desc(123), desc("foo"), desc('x'), desc([true][:])) +} @@ -93,6 +93,7 @@ B generictype E 0 B genericret E 42 B genericmatch E 15 B genericrec E 0 +B genericimpl P 'int string @a @a[:]' B recgeneric P 'built' B bigtyblob P '`U100 ' # B genericchain P 'val = 123' ## BUGGERED |