8000 `.or(~f)` with a function of no parameters passes the checker and returns the function · Issue #776 · kexhq/kex · GitHub
[go: up one dir, main page]

Skip to content

.or(~f) with a function of no parameters passes the checker and returns the function #776

Open

Description

@akoskovacs

.or with a captured function is rejected when the function takes one parameter (KEXET-0435), but not when it takes none. The function itself then comes out as the value.

let fallback -> String = "nobody"

main do
  IO.printLine(["ada"].first.or(~fallback))
  IO.printLine([].first.or(~fallback))
end

kex -C says No errors found., and both backends print ada, then <function>. The checker treats the second line as a String.

Expected: KEXET-0435, as for a one-parameter function.

Seen on kex 0.4.0-rc.4 built from main at 371bbdf. Found while writing explanations for oops.kex.run.

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