lang: funcs: Catch non-specific type build error

If you had ambiguous code, and specified an invalid type, this could
sneak through and become a runtime error, instead of a compile-time
error. We fix this and add a test.
This commit is contained in:
James Shubin
2024-07-31 16:01:27 -04:00
parent bfb5d983c1
commit 6de7d8b254
4 changed files with 23 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ $ayear = 60 * 60 * 24 * 365 # is a year in seconds (31536000)
$tmplvalues = struct{year => $secplusone, load => $theload,}
$theload = sys.load()->x1
$theload float = sys.load()->x1 # ambiguous so we specify the type!
if 5 > 3 {
file "/tmp/mgmt/datetime" {

View File

@@ -9,7 +9,7 @@ $ayear = 60 * 60 * 24 * 365 # is a year in seconds (31536000)
$tmplvalues = struct{year => $secplusone, load => $theload, vumeter => $vumeter,}
$theload = sys.load()->x1
$theload float = sys.load()->x1 # ambiguous so we specify the type!
$vumeter = example.vumeter("====", 10, 0.9)