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

Result pattern matching hint is confusing when it is a literal result #3835

Open
lpil opened this issue Nov 15, 2024 · 0 comments
Open

Result pattern matching hint is confusing when it is a literal result #3835

lpil opened this issue Nov 15, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Contributions encouraged priority:medium

Comments

@lpil
Copy link
Member

lpil commented Nov 15, 2024

error: Type mismatch
    ┌─ /Users/louis/src/gleam/decode/test/decode/zero_test.gleam:885:19
    │
885 │   |> should.equal(Ok(100))
    │                   ^^^^^^^

Expected type:

    Int

Found type:

    Result(Int, a)

Hint: If you want to get a `Int` out of a `Result(Int, a)` you can pattern match
on it:

    case result {
      Ok(value) -> todo
      Error(error) -> todo
    }

In this case I think the hint should not be included. It could perhaps be suggested to remove the Ok or Error.

@lpil lpil added bug Something isn't working help wanted Contributions encouraged good first issue Good for newcomers priority:medium labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Contributions encouraged priority:medium
Projects
None yet
Development

No branches or pull requests

1 participant