Skip to content

Commit ded2d06

Browse files
authored
Fix tuple coercion (#7024)
* Fix tuple coercion It was only handled for the first arg in the tuple * Update CHANGELOG
1 parent a39f1fc commit ded2d06

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
1313
# 12.0.0-alpha.4 (Unreleased)
1414

15+
#### :bug: Bug fix
16+
- Fix tuple coercion. https://github.com/rescript-lang/rescript-compiler/pull/7024
17+
1518
# 12.0.0-alpha.3
1619

1720
#### :bug: Bug fix

jscomp/syntax/src/res_core.ml

+1
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,7 @@ and parse_constrained_expr_region p =
18231823
| token when Grammar.is_expr_start token -> (
18241824
let expr = parse_expr p in
18251825
match p.Parser.token with
1826+
| ColonGreaterThan -> Some (parse_coerced_expr ~expr p)
18261827
| Colon ->
18271828
Parser.next p;
18281829
let typ = parse_typ_expr p in
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
let foo = (x:int) => (x :> int)
22

3-
let foo = x => (x : t :> int)
3+
let foo = x => (x : t :> int)
4+
5+
let _ = (x : int)
6+
7+
let foo = (x : int, y :> float)
8+
9+
let foo = (x : int, y :> float, z :> int)
10+
11+
let foo = (x : int, y, z :> int)
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
let foo = ((Function$ (fun (x : int) -> (x :> int)))[@res.arity 1])
2-
let foo = ((Function$ (fun x -> ((x : t) :> int)))[@res.arity 1])
2+
let foo = ((Function$ (fun x -> ((x : t) :> int)))[@res.arity 1])
3+
let _ = (x : int)
4+
let foo = ((x : int), (y :> float))
5+
let foo = ((x : int), (y :> float), (z :> int))
6+
let foo = ((x : int), y, (z :> int))

0 commit comments

Comments
 (0)