@@ -245,19 +245,21 @@ impl<'a> State<'a> {
245245        base_args :  & [ P < ast:: Expr > ] , 
246246        fixup :  FixupContext , 
247247    )  { 
248-         // Unlike in `print_expr_call`, no change to fixup here  because 
248+         // The fixup here is different than in `print_expr_call`  because 
249249        // statement boundaries never occur in front of a `.` (or `?`) token. 
250250        // 
251-         //     match () { _ => f }.method(); 
251+         // Needs parens: 
252+         // 
253+         //     (loop { break x; })(); 
254+         // 
255+         // Does not need parens: 
256+         // 
257+         //     loop { break x; }.method(); 
252258        // 
253-         // Parenthesizing only for precedence and not with regard to statement 
254-         // boundaries, `$receiver.method()` can be parsed back as a statement 
255-         // containing an expression if and only if `$receiver` can be parsed as 
256-         // a statement containing an expression. 
257259        self . print_expr_cond_paren ( 
258260            receiver, 
259261            receiver. precedence ( )  < ExprPrecedence :: Unambiguous , 
260-             fixup, 
262+             fixup. leftmost_subexpression_with_dot ( ) , 
261263        ) ; 
262264
263265        self . word ( "." ) ; 
@@ -503,7 +505,7 @@ impl<'a> State<'a> {
503505                        self . print_expr_cond_paren ( 
504506                            expr, 
505507                            expr. precedence ( )  < ExprPrecedence :: Unambiguous , 
506-                             fixup, 
508+                             fixup. leftmost_subexpression_with_dot ( ) , 
507509                        ) ; 
508510                        self . word_nbsp ( ".match" ) ; 
509511                    } 
@@ -567,7 +569,7 @@ impl<'a> State<'a> {
567569                self . print_expr_cond_paren ( 
568570                    expr, 
569571                    expr. precedence ( )  < ExprPrecedence :: Unambiguous , 
570-                     fixup, 
572+                     fixup. leftmost_subexpression_with_dot ( ) , 
571573                ) ; 
572574                self . word ( ".await" ) ; 
573575            } 
@@ -606,7 +608,7 @@ impl<'a> State<'a> {
606608                self . print_expr_cond_paren ( 
607609                    expr, 
608610                    expr. precedence ( )  < ExprPrecedence :: Unambiguous , 
609-                     fixup, 
611+                     fixup. leftmost_subexpression_with_dot ( ) , 
610612                ) ; 
611613                self . word ( "." ) ; 
612614                self . print_ident ( * ident) ; 
@@ -763,7 +765,11 @@ impl<'a> State<'a> {
763765                } 
764766            } 
765767            ast:: ExprKind :: Try ( e)  => { 
766-                 self . print_expr_cond_paren ( e,  e. precedence ( )  < ExprPrecedence :: Unambiguous ,  fixup) ; 
768+                 self . print_expr_cond_paren ( 
769+                     e, 
770+                     e. precedence ( )  < ExprPrecedence :: Unambiguous , 
771+                     fixup. leftmost_subexpression_with_dot ( ) , 
772+                 ) ; 
767773                self . word ( "?" ) 
768774            } 
769775            ast:: ExprKind :: TryBlock ( blk)  => { 
0 commit comments