Skip to content

Fix tuple coercion #7024

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
Sep 8, 2024
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: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

# 12.0.0-alpha.4 (Unreleased)

#### :bug: Bug fix
- Fix tuple coercion. https://github.com/rescript-lang/rescript-compiler/pull/7024

# 12.0.0-alpha.3

#### :bug: Bug fix
Expand Down
1 change: 1 addition & 0 deletions jscomp/syntax/src/res_core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1823,6 +1823,7 @@ and parse_constrained_expr_region p =
| token when Grammar.is_expr_start token -> (
let expr = parse_expr p in
match p.Parser.token with
| ColonGreaterThan -> Some (parse_coerced_expr ~expr p)
| Colon ->
Parser.next p;
let typ = parse_typ_expr p in
Expand Down
10 changes: 9 additions & 1 deletion jscomp/syntax/tests/parsing/grammar/expressions/coerce.res
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
let foo = (x:int) => (x :> int)

let foo = x => (x : t :> int)
let foo = x => (x : t :> int)

let _ = (x : int)

let foo = (x : int, y :> float)

let foo = (x : int, y :> float, z :> int)

let foo = (x : int, y, z :> int)
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
let foo = ((Function$ (fun (x : int) -> (x :> int)))[@res.arity 1])
let foo = ((Function$ (fun x -> ((x : t) :> int)))[@res.arity 1])
let foo = ((Function$ (fun x -> ((x : t) :> int)))[@res.arity 1])
let _ = (x : int)
let foo = ((x : int), (y :> float))
let foo = ((x : int), (y :> float), (z :> int))
let foo = ((x : int), y, (z :> int))