File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -599,12 +599,14 @@ impl Printer<'_> {
599
599
w ! ( self , ")" ) ;
600
600
}
601
601
Pat :: Or ( pats) => {
602
+ w ! ( self , "(" ) ;
602
603
for ( i, pat) in pats. iter ( ) . enumerate ( ) {
603
604
if i != 0 {
604
605
w ! ( self , " | " ) ;
605
606
}
606
607
self . print_pat ( * pat) ;
607
608
}
609
+ w ! ( self , ")" ) ;
608
610
}
609
611
Pat :: Record { path, args, ellipsis } => {
610
612
match path {
Original file line number Diff line number Diff line change @@ -8743,7 +8743,6 @@ fn foo() {
8743
8743
) ;
8744
8744
}
8745
8745
8746
-
8747
8746
#[ test]
8748
8747
fn test_hover_function_with_pat_param ( ) {
8749
8748
check (
@@ -8856,4 +8855,20 @@ fn test_hover_function_with_pat_param() {
8856
8855
```
8857
8856
"# ] ] ,
8858
8857
) ;
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
+ ) ;
8859
8874
}
You can’t perform that action at this time.
0 commit comments