Debian Codegraph @

lang/interpret_test/TestAstFunc2/test-monomorphic-class-arg.txtar

raw
1 -- main.mcl --
2 # $id could theoretically have type func(int) int or func(str) str, but it
3 # can't be both because it is bound to a class parameter, which must have a
4 # single type.
5 class use_polymorphically($id) {
6 test "test1" {
7 int8 => $id(42),
8 }
9 test "test2" {
10 anotherstr => $id("hello"),
11 }
12 }
13 include use_polymorphically(func($x) {$x})
14 -- OUTPUT --
15 # err: errUnify: unify error with: topLevel(singleton(func(x) { var(x) })): type error: int != str