File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -333,7 +333,12 @@ impl<'a> BindingsBuilder<'a> {
333333 self . finish_match_or_fork ( ) ;
334334 narrow_ops. unwrap_or_default ( )
335335 }
336- Pattern :: MatchStar ( _) => NarrowOps :: new ( ) ,
336+ Pattern :: MatchStar ( p) => {
337+ if let Some ( name) = & p. name {
338+ self . bind_definition ( name, Binding :: Forward ( subject_idx) , FlowStyle :: Other ) ;
339+ }
340+ NarrowOps :: new ( )
341+ }
337342 }
338343 }
339344
Original file line number Diff line number Diff line change @@ -721,7 +721,7 @@ match x:
721721) ;
722722
723723testcase ! (
724- test_crashing_match ,
724+ test_crashing_match_sequence ,
725725 r#"
726726match []:
727727 case [[1]]:
@@ -731,6 +731,19 @@ match []:
731731"# ,
732732) ;
733733
734+ testcase ! (
735+ test_crashing_match_star,
736+ r#"
737+ match []:
738+ case *x: # E: Parse error: Star pattern cannot be used here
739+ pass
740+ case *x | 1: # E: Parse error: Star pattern cannot be used here # E: alternative patterns bind different names
741+ pass
742+ case 1 | *x: # E: Parse error: Star pattern cannot be used here # E: alternative patterns bind different names
743+ pass
744+ "# ,
745+ ) ;
746+
734747testcase ! (
735748 test_match_narrow_generic,
736749 r#"
You can’t perform that action at this time.
0 commit comments