8000 A parameter written `Any` stops the checker from checking the other arguments · Issue #764 · kexhq/kex · GitHub
[go: up one dir, main page]

Skip to content

A parameter written Any stops the checker from checking the other arguments #764

Open

Description

@akoskovacs

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0