This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
src/tools/rust-analyzer/crates Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -599,12 +599,14 @@ impl Printer<'_> {
599599 w ! ( self , ")" ) ;
600600 }
601601 Pat :: Or ( pats) => {
602+ w ! ( self , "(" ) ;
602603 for ( i, pat) in pats. iter ( ) . enumerate ( ) {
603604 if i != 0 {
604605 w ! ( self , " | " ) ;
605606 }
606607 self . print_pat ( * pat) ;
607608 }
609+ w ! ( self , ")" ) ;
608610 }
609611 Pat :: Record { path, args, ellipsis } => {
610612 match path {
Original file line number Diff line number Diff line change @@ -8743,7 +8743,6 @@ fn foo() {
87438743 ) ;
87448744}
87458745
8746-
87478746#[ test]
87488747fn test_hover_function_with_pat_param ( ) {
87498748 check (
@@ -8856,4 +8855,20 @@ fn test_hover_function_with_pat_param() {
88568855 ```
88578856 "# ] ] ,
88588857 ) ;
8858+
8859+ // Test case with Enum and Or pattern
8860+ check (
8861+ r#"enum MyEnum { A(i32), B(i32) } fn test_8$0((MyEnum::A(x) | MyEnum::B(x)): MyEnum) {}"# ,
8862+ expect ! [ [ r#"
8863+ *test_8*
8864+
8865+ ```rust
8866+ test
8867+ ```
8868+
8869+ ```rust
8870+ fn test_8((MyEnum::A(x) | MyEnum::B(x)): MyEnum)
8871+ ```
8872+ "# ] ] ,
8873+ ) ;
88598874}
You can’t perform that action at this time.
0 commit comments