summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/genericimpl.myr33
-rw-r--r--test/tests1
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][:]))
+}
diff --git a/test/tests b/test/tests
index d7c10d9..4ed8cdd 100644
--- a/test/tests
+++ b/test/tests
@@ -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