ref: 9be5f6e05a432918ab171ad27183b010d0855457
parent: 28fd8a46376eef8895573949da7cac6fbe6775c5
author: Ori Bernstein <[email protected]>
date: Thu Dec 18 18:45:34 EST 2014
Add tests for trait impls.
--- a/test/tests
+++ b/test/tests
@@ -79,7 +79,7 @@
B genericval E 42
B trait-builtin E 42
B emptytrait E 123
-B traitimpl P 246,44
+B traitimpl P 246,44,meee
# B compoundimpl P intptr,charptr BUGGERED
B nestucon P asdf
B mkunion E 0
--- a/test/traitimpl.myr
+++ b/test/traitimpl.myr
@@ -16,14 +16,21 @@
}
;;
+impl frobable byte[:] =
+ frob = {val
+ -> val[:4]
+ }
+;;
+
generic foo = {x : @a::frobable
-> frob(x)
}
const main = {
- var a, b
+ var a, b, c
a = foo(123)
b = foo(11 castto(int16))
- std.put("%i,%w\n", a, b)
+ c = frob("meeeeeeh")
+ std.put("%i,%w,%s\n", a, b, c)
}