Skip to content

Improve error message for pipe syntax #7520

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

Merged
merged 2 commits into from
May 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
- Allow oneliner formatting when including module with single type alias. https://github.com/rescript-lang/rescript/pull/7502
- Improve error messages for JSX type mismatches, passing objects where record is expected, passing array literal where tuple is expected, and more. https://github.com/rescript-lang/rescript/pull/7500
- Show in error messages when coercion can be used to fix a type mismatch. https://github.com/rescript-lang/rescript/pull/7505
- Remove deprecated pipe last (|>) syntax. https://github.com/rescript-lang/rescript/pull/7512
- Remove deprecated pipe last (`|>`) syntax. https://github.com/rescript-lang/rescript/pull/7512
- Improve error message for pipe (`->`) syntax. https://github.com/rescript-lang/rescript/pull/7520

# 12.0.0-alpha.13

Expand Down
3 changes: 2 additions & 1 deletion compiler/frontend/ast_exp_apply.ml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) : exp =
| _ -> Location.raise_errorf ~loc "invalid #= assignment"))
| Some {op = "->"; loc} ->
Location.raise_errorf ~loc
"invalid |. syntax, it can only be used as binary operator"
"Invalid pipe syntax. The pipe symbol (->) can only be used as a binary \
operator."
| Some {op = "##"; loc} ->
Location.raise_errorf ~loc
"Js object ## expect syntax like obj##(paint (a,b)) "
Expand Down