Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad error message when enums do not match up #1771

Closed
andreabedini opened this issue Jan 23, 2024 · 1 comment · Fixed by #1772
Closed

Bad error message when enums do not match up #1771

andreabedini opened this issue Jan 23, 2024 · 1 comment · Fixed by #1772

Comments

@andreabedini
Copy link

Describe the bug

When enum do not match up the error is ... bad?

this expression has type Enum, but Enum was expected

To Reproduce

❯ nickel repl
nickel> match { 'a => 1 } 'b
error: dynamic type error
  ┌─ <repl-input-0>:1:1
  │
1 │ match { 'a => 1 } 'b
  │ ^^^^^^^^^^^^^^^^^^^^
  │ │                 │
  │ │                 evaluated to this
  │ this expression has type Enum, but Enum was expected
  │
  = match expects its argument to be a Enum

Expected behavior

The error is not telling us what the interpreter is actually expecting, mentioning 'a and/or 'b.

Environment

  • x86_64 GNU/Linux
  • nickel-lang-cli nickel 1.4.0 (rev cargore)
@yannham
Copy link
Member

yannham commented Jan 23, 2024

Prophetic comment 🙃

// ? We should have a dedicated error for unmatched pattern

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

Successfully merging a pull request may close this issue.

2 participants