This causes inconsistent type unification when running our tests. It's a bad user experience too.
16 lines
458 B
Plaintext
16 lines
458 B
Plaintext
-- main.mcl --
|
|
# $id could theoretically have type func(int) int or func(str) str, but it
|
|
# can't be both because it is bound to a class parameter, which must have a
|
|
# single type.
|
|
class use_polymorphically($id) {
|
|
test "test1" {
|
|
int8 => $id(42),
|
|
}
|
|
test "test2" {
|
|
anotherstr => $id("hello"),
|
|
}
|
|
}
|
|
include use_polymorphically(func($x) {$x})
|
|
-- OUTPUT --
|
|
# err: errUnify: unify error with: topLevel(singleton(func(x) { var(x) })): type error: Int != Str
|