Skip to content

"Invalid |.u syntax" when mixing pipe styles #6724

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

Closed
5 tasks done
TheSpyder opened this issue Apr 16, 2024 · 2 comments · Fixed by #7520
Closed
5 tasks done

"Invalid |.u syntax" when mixing pipe styles #6724

TheSpyder opened this issue Apr 16, 2024 · 2 comments · Fixed by #7520
Labels

Comments

@TheSpyder
Copy link
Contributor

TheSpyder commented Apr 16, 2024

Thank you for filing! Check list:

  • Is it a bug? Usage questions should often be asked in the forum instead.
  • Concise, focused, friendly issue title & description.
  • A minimal, reproducible example.
  • OS and browser versions, if relevant. not browser specific
  • Is it already fixed in master? Instructions no

I'm converting a library to ReScript, and I accidentally saved my file with this weird mix of pipes:

let array = (encoder) => (a) => a|>Array.map(encoder)->Js.Json.array

This compile failed with invalid |.u syntax.

I'm not sure if I should expect the code to compile, but I do expect the compiler to give me a more reasonable error message. Playground example:
https://rescript-lang.org/try?version=v11.0.1&code=C4TwDgpgBMA8DkBDAfFAvFJ7UCkDOAdPgPYB2BwAUJQDYTBSIBOTiIAXFABRxKpqo4zViAQpkASnTcIpAMbEAJhCZSB3RGtSIAPsgCCLNgQC2iMF1kLlqgLTJ8RPGQLC2QA

@cristianoc cristianoc added the bug label Jul 26, 2024
@cristianoc
Copy link
Collaborator

This has to do with the compiler's ppx which transforms |> and ->.
The priority is unclear, since |> will go away (and is now reformatted away), but it is a bug.

@cknitt
Copy link
Member

cknitt commented May 25, 2025

|> was fully removed in #7512

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

Successfully merging a pull request may close this issue.

3 participants