File tree Expand file tree Collapse file tree 6 files changed +120
-2
lines changed Expand file tree Collapse file tree 6 files changed +120
-2
lines changed Original file line number Diff line number Diff line change 26
26
#### :bug : Bug Fix
27
27
- Fix issue where long layout break added a trailing comma in partial application ` ... ` . https://github.com/rescript-lang/rescript-compiler/pull/6949
28
28
- Fix incorrect format of function under unary operator. https://github.com/rescript-lang/rescript-compiler/pull/6953
29
+ - Fix incorrect incorrect printing of module binding with signature. https://github.com/rescript-lang/rescript-compiler/pull/6963
29
30
30
31
# 12.0.0-alpha.1
31
32
Original file line number Diff line number Diff line change @@ -452,6 +452,23 @@ let include_mod_expr mod_expr =
452
452
| Parsetree. Pmod_constraint _ -> true
453
453
| _ -> false
454
454
455
+ let mod_expr_parens mod_expr =
456
+ match mod_expr with
457
+ | {
458
+ Parsetree. pmod_desc =
459
+ Pmod_constraint
460
+ ( {Parsetree. pmod_desc = Pmod_structure _},
461
+ {Parsetree. pmty_desc = Pmty_signature [{psig_desc = Psig_module _}]} );
462
+ } ->
463
+ false
464
+ | {
465
+ Parsetree. pmod_desc =
466
+ Pmod_constraint
467
+ (_, {Parsetree. pmty_desc = Pmty_signature [{psig_desc = Psig_module _}]});
468
+ } ->
469
+ true
470
+ | _ -> false
471
+
455
472
let arrow_return_typ_expr typ_expr =
456
473
match typ_expr.Parsetree. ptyp_desc with
457
474
| Parsetree. Ptyp_arrow _ -> true
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ val call_expr : Parsetree.expression -> kind
33
33
34
34
val include_mod_expr : Parsetree .module_expr -> bool
35
35
36
+ val mod_expr_parens : Parsetree .module_expr -> bool
37
+
36
38
val arrow_return_typ_expr : Parsetree .core_type -> bool
37
39
38
40
val pattern_record_row_rhs : Parsetree .pattern -> bool
Original file line number Diff line number Diff line change @@ -685,6 +685,11 @@ and print_module_binding ~state ~is_rec module_binding cmt_tbl i =
685
685
Doc. concat [Doc. text " : " ; print_mod_type ~state mod_type cmt_tbl] )
686
686
| mod_expr -> (print_mod_expr ~state mod_expr cmt_tbl, Doc. nil)
687
687
in
688
+ let mod_expr_doc_parens =
689
+ if Parens. mod_expr_parens module_binding.pmb_expr then
690
+ Doc. concat [Doc. lparen; mod_expr_doc; Doc. rparen]
691
+ else mod_expr_doc
692
+ in
688
693
let mod_name =
689
694
let doc = Doc. text module_binding.pmb_name.Location. txt in
690
695
print_comments doc cmt_tbl module_binding.pmb_name.loc
@@ -698,7 +703,7 @@ and print_module_binding ~state ~is_rec module_binding cmt_tbl i =
698
703
mod_name;
699
704
mod_constraint_doc;
700
705
Doc. text " = " ;
701
- mod_expr_doc ;
706
+ mod_expr_doc_parens ;
702
707
]
703
708
in
704
709
print_comments doc cmt_tbl module_binding.pmb_loc
Original file line number Diff line number Diff line change @@ -22,3 +22,49 @@ let g = {
22
22
module M: T = {}
23
23
0
24
24
}
25
+
26
+ module M7: {
27
+ module N': {
28
+ let x: int
29
+ }
30
+ } = (M6: {
31
+ module N: {
32
+ let x: int
33
+ }
34
+ module N' = N
35
+ })
36
+
37
+ module M8 = M7
38
+
39
+ module M5 = G0()
40
+
41
+ module M7: {
42
+ let x: int
43
+ } = {
44
+ let x = 8
45
+ }
46
+
47
+ module M3: {
48
+ module N': {
49
+ let x: int
50
+ }
51
+ } = {
52
+ include M'
53
+ }
54
+
55
+ module G0: (X: {}) =>
56
+ {
57
+ module N': {
58
+ let x: int
59
+ }
60
+ } = F0
61
+
62
+ module M6 = {
63
+ module D = {
64
+ let y = 3
65
+ }
66
+ module N = {
67
+ let x = 1
68
+ }
69
+ module N' = N
70
+ }
Original file line number Diff line number Diff line change @@ -21,4 +21,51 @@ module type T = {}
21
21
let g = {
22
22
module M : T = {}
23
23
0
24
- }
24
+ }
25
+
26
+ module M7 : {
27
+ module N ': {
28
+ let x : int
29
+ }
30
+ } = (M6 : {
31
+ module N : {
32
+ let x : int
33
+ }
34
+ module N ' = N
35
+ })
36
+
37
+
38
+ module M8 = M7
39
+
40
+ module M5 = G0 ()
41
+
42
+ module M7 : {
43
+ let x : int
44
+ } = {
45
+ let x = 8
46
+ }
47
+
48
+ module M3 : {
49
+ module N ': {
50
+ let x : int
51
+ }
52
+ } = {
53
+ include M '
54
+ }
55
+
56
+ module G0 : (X : {}) =>
57
+ {
58
+ module N ': {
59
+ let x : int
60
+ }
61
+ } = F0
62
+
63
+ module M6 = {
64
+ module D = {
65
+ let y = 3
66
+ }
67
+ module N = {
68
+ let x = 1
69
+ }
70
+ module N ' = N
71
+ }
You can’t perform that action at this time.
0 commit comments