8000 Unary `-` on a `String` passes the checker · Issue #769 · kexhq/kex · GitHub
[go: up one dir, main page]

Skip to content

Unary - on a String passes the checker #769

Open

Description

@akoskovacs

-"5" is accepted, and fails at run time.

main do
  IO.printLine(-"5")
end
  • kex -C: No errors found.
  • kex -R: runtime error: cannot negate String
  • kex (BEAM): Internal error: badarith

Expected: KEXET-0420 (unary '-' requires a number, got String), which exists for this case but is not reported.

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

Activity

  1. akoskovacs commented on Nov 22, 2026

    @akoskovacs
    CollaboratorAuthor

    The same happens for a Bool:

    main do
      let flag = true
      IO.printLine(-flag)
    end
    

    kex -C: No errors found. Then runtime error: cannot negate Bool on the walker, and Internal error: badarith on BEAM. Checked on main at 371bbdf.

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