File tree Expand file tree Collapse file tree 4 files changed +60
-30
lines changed Expand file tree Collapse file tree 4 files changed +60
-30
lines changed Original file line number Diff line number Diff line change @@ -1123,38 +1123,20 @@ def deconstruct_keys(_keys)
11231123 end
11241124
11251125 def format ( q )
1126- parts = [ *requireds ]
1127- parts << RestFormatter . new ( rest ) if rest
1128- parts += posts
1129-
1130- if constant
1131- q . group do
1132- q . format ( constant )
1133- q . text ( "[" )
1134- q . indent do
1135- q . breakable ( "" )
1136- q . seplist ( parts ) { |part | q . format ( part ) }
1137- end
1138- q . breakable ( "" )
1139- q . text ( "]" )
1140- end
1141-
1142- return
1143- end
1144-
1145- parent = q . parent
1146- if parts . length == 1 || PATTERNS . include? ( parent . class )
1126+ q . group do
1127+ q . format ( constant ) if constant
11471128 q . text ( "[" )
11481129 q . indent do
11491130 q . breakable ( "" )
1131+
1132+ parts = [ *requireds ]
1133+ parts << RestFormatter . new ( rest ) if rest
1134+ parts += posts
1135+
11501136 q . seplist ( parts ) { |part | q . format ( part ) }
11511137 end
11521138 q . breakable ( "" )
11531139 q . text ( "]" )
1154- elsif parts . empty?
1155- q . text ( "[]" )
1156- else
1157- q . group { q . seplist ( parts ) { |part | q . format ( part ) } }
11581140 end
11591141 end
11601142 end
Original file line number Diff line number Diff line change 66case foo
77in _, _
88end
9+ -
10+ case foo
11+ in [_, _]
12+ end
913%
1014case foo
1115in bar, baz
1216end
17+ -
18+ case foo
19+ in [bar, baz]
20+ end
1321%
1422case foo
1523in [bar]
1624end
1725%
1826case foo
19- in [bar, baz]
27+ in [bar]
28+ in [baz]
2029end
21- -
30+ %
2231case foo
23- in bar, baz
32+ in [ bar, baz]
2433end
2534%
2635case foo
2736in bar, *baz
2837end
38+ -
39+ case foo
40+ in [bar, *baz]
41+ end
2942%
3043case foo
3144in *bar, baz
3245end
46+ -
47+ case foo
48+ in [*bar, baz]
49+ end
3350%
3451case foo
3552in bar, *, baz
3653end
54+ -
55+ case foo
56+ in [bar, *, baz]
57+ end
3758%
3859case foo
3960in *, bar, baz
4061end
62+ -
63+ case foo
64+ in [*, bar, baz]
65+ end
4166%
4267case foo
4368in Constant[bar]
4469end
4570%
4671case foo
72+ in Constant(bar)
73+ end
74+ -
75+ case foo
76+ in Constant[bar]
77+ end
78+ %
79+ case foo
4780in Constant[bar, baz]
4881end
4982%
5083case foo
5184in bar, [baz, _] => qux
5285end
86+ -
87+ case foo
88+ in [bar, [baz, _] => qux]
89+ end
5390%
5491case foo
5592in bar, baz if bar == baz
5693end
94+ -
95+ case foo
96+ in [bar, baz] if bar == baz
97+ end
Original file line number Diff line number Diff line change 7171in bar, { baz:, **nil }
7272in qux:
7373end
74+ -
75+ case foo
76+ in [bar, { baz:, **nil }]
77+ in qux:
78+ end
Original file line number Diff line number Diff line change 1414end
1515-
1616case foo
17- in fooooooooooooooooooooooooooooooooooooo,
18- barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
17+ in [
18+ fooooooooooooooooooooooooooooooooooooo,
19+ barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
20+ ]
1921 baz
2022end
2123%
You can’t perform that action at this time.
0 commit comments