This repository was archived by the owner on Jun 15, 2023. It is now read-only.
File tree 5 files changed +28
-2
lines changed
5 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 62
62
- Fix support for recursive components in JSX V4 https://github.com/rescript-lang/syntax/pull/733
63
63
- Fix issue with overlapping labelled argument with default value https://github.com/rescript-lang/syntax/pull/734
64
64
- Fix issue with using alias and default value together https://github.com/rescript-lang/syntax/pull/734
65
+ - Fix formatting of ` switch ` expressions that contain braced ` cases ` inside https://github.com/rescript-lang/syntax/pull/735
65
66
66
67
#### :eyeglasses : Spec Compliance
67
68
Original file line number Diff line number Diff line change @@ -345,7 +345,13 @@ let getLoc node =
345
345
let open Parsetree in
346
346
match node with
347
347
| Case case ->
348
- {case.pc_lhs.ppat_loc with loc_end = case.pc_rhs.pexp_loc.loc_end}
348
+ {
349
+ case.pc_lhs.ppat_loc with
350
+ loc_end =
351
+ (match ParsetreeViewer. processBracesAttr case.pc_rhs with
352
+ | None , _ -> case.pc_rhs.pexp_loc.loc_end
353
+ | Some ({loc} , _ ), _ -> loc.Location. loc_end);
354
+ }
349
355
| CoreType ct -> ct.ptyp_loc
350
356
| ExprArgument expr -> (
351
357
match expr.Parsetree. pexp_attributes with
Original file line number Diff line number Diff line change @@ -4743,7 +4743,10 @@ and printCases ~customLayout (cases : Parsetree.case list) cmtTbl =
4743
4743
~get Loc:(fun n ->
4744
4744
{
4745
4745
n.Parsetree. pc_lhs.ppat_loc with
4746
- loc_end = n.pc_rhs.pexp_loc.loc_end;
4746
+ loc_end =
4747
+ (match ParsetreeViewer. processBracesAttr n.pc_rhs with
4748
+ | None , _ -> n.pc_rhs.pexp_loc.loc_end
4749
+ | Some ({loc} , _ ), _ -> loc.Location. loc_end);
4747
4750
})
4748
4751
~print: (printCase ~custom Layout) ~nodes: cases cmtTbl;
4749
4752
];
Original file line number Diff line number Diff line change @@ -55,3 +55,11 @@ switch route {
55
55
<div> {React.string("Second B div")} </div>
56
56
</>
57
57
}
58
+
59
+ switch x {
60
+ | A => {
61
+ let _ = 1
62
+ let _ = 2
63
+ } // no blank line below
64
+ | B => ()
65
+ }
Original file line number Diff line number Diff line change @@ -49,3 +49,11 @@ switch route {
49
49
<div > {React .string ("Second B div" )} </div >
50
50
</>
51
51
}
52
+
53
+ switch x {
54
+ | A => {
55
+ let _ = 1
56
+ let _ = 2
57
+ } // no blank line below
58
+ | B => ()
59
+ }
You can’t perform that action at this time.
0 commit comments