Skip to content

Commit 8ab0c37

Browse files
committedJan 21, 2023
fix location of variable when function definition {v => ...} is enclosed in braces
In addition to creating problems with the analysis performed by the editor integration, this was not issue a warning for unused variable: ```res let _ = {thisGetsBrokenLoc => 4} ```
1 parent ada7100 commit 8ab0c37

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ These are only breaking changes for unformatted code.
4949
- Fix issue where the internal representation of uncurried types would leak when a non-function is applied in a curried way https://github.com/rescript-lang/rescript-compiler/pull/5892
5050
- In GenType, check annotations also in module types to decide whether to produce the `.gen.tsx` file https://github.com/rescript-lang/rescript-compiler/pull/5903
5151
- Fix some comments disappearing in array access expressions https://github.com/rescript-lang/rescript-compiler/pull/5947
52+
- Parser: fix location of variable when function definition `{v => ...}` is enclosed in braces https://github.com/rescript-lang/rescript-compiler/pull/5949
5253

5354
#### :nail_care: Polish
5455

‎res_syntax/src/res_core.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2933,7 +2933,7 @@ and parseBracedOrRecordExpr p =
29332933
attrs = [];
29342934
label = Asttypes.Nolabel;
29352935
expr = None;
2936-
pat = Ast_helper.Pat.var ident;
2936+
pat = Ast_helper.Pat.var ~loc:ident.loc ident;
29372937
pos = startPos;
29382938
};
29392939
]

0 commit comments

Comments
 (0)
Please sign in to comment.