You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A parameter written Any stops the checker from checking the other arguments #764
A parameter written Any switches off argument checking for the whole call: every other argument is let through unchecked.
let tag(label: Atom, primaryKey: Bool = false, default: Any = :none) -> String = "${label}"
main do
IO.printLine(tag(:owner, 0))
end
$ kex -C any.kex
No errors found.
Expected:`tag` expects argument 2 to be Bool, but got Integer, as without the default: Any parameter.
The same holds for a make function (t.text(:owner, 0)). There the BEAM, which dispatches on the argument types, then fails with undefined method: text for Builder while the walker runs it. The metamorphic search found it in spec/named_block_argument_typed.kex (the fuzz job on #762, seed 44988405989: t.text(:owner, oneOf: [...], 0)), so it fails that PR's CI and every rerun of it.
Cause
Any is the checker's Unknown (typechecker.cxx, type-expression resolution). The overload check treats a candidate with an Unknown parameter as one whose contract it never learned (an un-annotated stand-in, a native builtin missing from the table) and returns without checking (unreliableCandidates, typechecker_expr.cxx). An Unknown the source wrote is not such a gap.
Fix
Only an Unknown parameter without a written type makes a candidate unreliable. Being fixed on branch any-param-check, with spec/error_argument_beside_any_param.kex.
Activity