File tree Expand file tree Collapse file tree 5 files changed +56
-1
lines changed
packages/prettier-plugin-java
test/unit-test/binary_expressions Expand file tree Collapse file tree 5 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -684,7 +684,10 @@ function binary(
684684 }
685685 }
686686 level . push ( operands . shift ( ) ! ) ;
687- if ( ! levelOperator || ! isAssignmentOperator ( levelOperator ) ) {
687+ if (
688+ ! levelOperator ||
689+ ( ! isAssignmentOperator ( levelOperator ) && levelOperator !== "instanceof" )
690+ ) {
688691 return group ( level ) ;
689692 }
690693 if ( ! isRoot || hasNonAssignmentOperators ) {
Original file line number Diff line number Diff line change @@ -132,4 +132,17 @@ void parentheses() {
132132
133133 if (aaaaaaaaaa + bbbbbbbbbb == cccccccccc + dddddddddd && eeeeeeeeee + ffffffffff == gggggggggg + hhhhhhhhhh || iiiiiiiiii + jjjjjjjjjj == kkkkkkkkkk + llllllllll && mmmmmmmmmm + nnnnnnnnnn == oooooooooo + pppppppppp || qqqqqqqqqq + rrrrrrrrrr == ssssssssss + tttttttttt && uuuuuuuuuu + vvvvvvvvvv == wwwwwwwwww + xxxxxxxxxxx ) {}
134134 }
135+
136+ void instanceOf () {
137+ var a =
138+ a &&
139+ Foo .get (longlinelonglinelonglinelonglinelongline ) instanceof
140+ NumberNumberNumberNumber n &&
141+ n .foo ();
142+
143+ var a =
144+ Foo .get (longlinelonglinelonglinelonglinelongline ) instanceof
145+ NumberNumberNumberNumber n &&
146+ n .foo ();
147+ }
135148}
Original file line number Diff line number Diff line change @@ -252,4 +252,17 @@ void parentheses() {
252252 uuuuuuuuuu + vvvvvvvvvv == wwwwwwwwww + xxxxxxxxxxx )
253253 ) {}
254254 }
255+
256+ void instanceOf () {
257+ var a =
258+ a &&
259+ Foo .get (longlinelonglinelonglinelonglinelongline ) instanceof
260+ NumberNumberNumberNumber n &&
261+ n .foo ();
262+
263+ var a =
264+ Foo .get (longlinelonglinelonglinelonglinelongline ) instanceof
265+ NumberNumberNumberNumber n &&
266+ n .foo ();
267+ }
255268}
Original file line number Diff line number Diff line change @@ -132,4 +132,17 @@ void parentheses() {
132132
133133 if (aaaaaaaaaa + bbbbbbbbbb == cccccccccc + dddddddddd && eeeeeeeeee + ffffffffff == gggggggggg + hhhhhhhhhh || iiiiiiiiii + jjjjjjjjjj == kkkkkkkkkk + llllllllll && mmmmmmmmmm + nnnnnnnnnn == oooooooooo + pppppppppp || qqqqqqqqqq + rrrrrrrrrr == ssssssssss + tttttttttt && uuuuuuuuuu + vvvvvvvvvv == wwwwwwwwww + xxxxxxxxxxx ) {}
134134 }
135+
136+ void instanceOf () {
137+ var a =
138+ a &&
139+ Foo .get (longlinelonglinelonglinelonglinelongline ) instanceof
140+ NumberNumberNumberNumber n &&
141+ n .foo ();
142+
143+ var a =
144+ Foo .get (longlinelonglinelonglinelonglinelongline ) instanceof
145+ NumberNumberNumberNumber n &&
146+ n .foo ();
147+ }
135148}
Original file line number Diff line number Diff line change @@ -245,4 +245,17 @@ void parentheses() {
245245 && uuuuuuuuuu + vvvvvvvvvv == wwwwwwwwww + xxxxxxxxxxx )
246246 ) {}
247247 }
248+
249+ void instanceOf () {
250+ var a =
251+ a
252+ && Foo .get (longlinelonglinelonglinelonglinelongline )
253+ instanceof NumberNumberNumberNumber n
254+ && n .foo ();
255+
256+ var a =
257+ Foo .get (longlinelonglinelonglinelonglinelongline )
258+ instanceof NumberNumberNumberNumber n
259+ && n .foo ();
260+ }
248261}
You can’t perform that action at this time.
0 commit comments