lang/interpret_test/TestAstFunc2/test-monomorphic-bind.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 variable, which must have a single |
| 4 | # type. |
| 5 | $id = func($x) {$x} |
| 6 | test "test1" { |
| 7 | int8 => $id(42), |
| 8 | } |
| 9 | test "test2" { |
| 10 | anotherstr => $id("hello"), |
| 11 | } |
| 12 | -- OUTPUT -- |
| 13 | # err: errUnify: unify error with: topLevel(singleton(func(x) { var(x) })): type error: int != str |