summaryrefslogtreecommitdiff
path: root/test/genericimpl.myr
diff options
context:
space:
mode:
Diffstat (limited to 'test/genericimpl.myr')
-rw-r--r--test/genericimpl.myr33
1 files changed, 33 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][:]))
+}