lang: ast: Expr Param and Poly should not have values

Sometimes a recursive call through ExprVar's Value method would hit one
of these and return (nil, nil) which would throw off things.
This commit is contained in:
James Shubin
2023-12-17 21:16:03 -05:00
parent 6a6546db8d
commit c333cb542c
2 changed files with 14 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
-- main.mcl --
import "fmt"
$format = "%d" # should get ignored
$fn = func($format) {
fmt.printf($format, 42)
}
test $fn("%s") {}
# should error at unification if possible, otherwise at runtime
# TODO: I would expect that if the "%s" and "%d" swapped, that speculatively we
# would be able to run this at compile time and know the result statically.
-- OUTPUT --
# err: errStream: func `printf@??????????` stopped before it was loaded: base kind does not match (Str != Int)