Files
mgmt/lang/interpret_test/TestAstFunc2/test-monomorphic-lambda-arg.txtar
James Shubin e10e92596f lang: types: Add stringer information manually
This lets us get the more correct lowercase versions of type kinds in
error messages. (These match what the user would type.)
2024-07-01 18:35:20 -04:00

14 lines
427 B
Plaintext

-- main.mcl --
import "fmt"
# $id could theoretically have type func(int) int or func(str) str, but it
# can't be both because it is bound to a lambda parameter, which must have a
# single type.
$use_polymorphically = func($id) {
fmt.printf("%d %s", $id(42), $id("hello"))
}
test "test1" {
anotherstr => $use_polymorphically(func($x) {$x}),
}
-- OUTPUT --
# err: errUnify: unify error with: param(id): type error: int != str