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

format migrate leads to error: invalid try target #7555

Closed
Anton-4 opened this issue Jan 28, 2025 · 0 comments Β· Fixed by #7557
Closed

format migrate leads to error: invalid try target #7555

Anton-4 opened this issue Jan 28, 2025 · 0 comments Β· Fixed by #7557
Assignees

Comments

@Anton-4
Copy link
Collaborator

Anton-4 commented Jan 28, 2025

basic-webserver on ξ‚  HEAD (db94e89) via πŸ¦€ v1.79.0
❯ cat platform/Path.roc | rg read_err
        |> Result.mapErr? \read_err -> FileReadErr path (InternalIOErr.handle_err read_err)

basic-webserver on ξ‚  HEAD (db94e89) via πŸ¦€ v1.79.0
❯ roc format --migrate platform/Path.roc

basic-webserver on ξ‚  HEAD (db94e89) [!] via πŸ¦€ v1.79.0
❯ cat platform/Path.roc | rg read_err
        |> Result.map_err?(|read_err| FileReadErr(path, InternalIOErr.handle_err(read_err)))

basic-webserver on ξ‚  HEAD (db94e89) [!] via πŸ¦€ v1.79.0
❯ roc version
roc built from commit 0e35e33f85, committed at 2025-01-28 09:57:55 UTC

Error:

+ roc check ./examples/dir.roc

── INVALID TRY TARGET in ./examples/../platform/Path.roc ───────────────────────

This expression cannot be tried with the ? operator:

310β”‚          |> Result.map_err?(|read_err| FileReadErr(path, InternalIOErr.handle_err(read_err)))
                 ^^^^^^^^^^^^^^

I expected a Result, but it actually has type:

    Result ok a, (a -> b) -> Result ok b

Hint: Did you forget to wrap the value with an Ok or an Err tag?

────────────────────────────────────────────────────────────────────────────────

1 error and 0 warnings found in 25 ms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants