ref: bf18e66ef2986eb84e884297404c38da668ab7a2
parent: 1efff8a755b22b20bec7c671c25a63825cfd90f1
author: Ori Bernstein <[email protected]>
date: Thu Feb 20 17:58:17 EST 2014
Make the traitimpl test cover more ground.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1339,7 +1339,8 @@
dcl->decl.name = name;
putdcl(file->file.globls, dcl);
if (debugopt['S'])
- printf("specializing trait [%d]%s => %s\n", n->line, namestr(n->decl.name), namestr(name));
+ printf("specializing trait [%d]%s:%s => %s:%s\n",
+ n->line, namestr(proto->decl.name), tystr(type(st, proto)), namestr(name), tystr(ty));
lappend(&file->file.stmts, &file->file.nstmts, dcl);
}
}
--- a/test/tests
+++ b/test/tests
@@ -73,7 +73,7 @@
B genericval E 42
B trait-builtin E 42
B emptytrait E 123
-B traitimpl E 24
+B traitimpl P 246,44
B nestucon P asdf
B mkunion E 0
B genericcall E 42
--- a/test/traitimpl.myr
+++ b/test/traitimpl.myr
@@ -10,11 +10,20 @@
}
;;
+impl frobable int16 =
+ frob = {val
+ -> val * 4
+ }
+;;
+
generic foo = {x : @a::frobable
-> frob(x)
}
const main = {
- std.exit(foo(12))
+ var a, b
+ a = foo(123)
+ b = foo(11 castto(int16))
+ std.put("%i,%w\n", a, b)
}