ref: dc6135b7b6b30fb07d2ac661e56f23be8c12f8f7
dir: /test/trait-builtin.myr/
use std
/* checks that generic types with traits are compiled correctly.
without the 'tcnum' trait on '@a', the '>' operator would not work
within max. without the 'tctest' trait on '@a' in intlike_is42,
comparing to 42 wouldn't work.
exits with 42.
*/
generic max = {a:@a::tcnum, b:@a::tcnum
if a > b
-> a
else
-> b
;;
}
generic intlike_is42 = {a : @a::(tcnum,tctest,tcint)
-> a == 42
}
const main = {
if intlike_is42(123)
std.exit(16)
else
std.exit(max(12, 42))
;;
}