@@ -618,22 +618,26 @@ extension Parser.Lookahead {
618
618
break
619
619
}
620
620
621
- guard self . isAtFunctionTypeArrow ( ) else {
622
- return true
623
- }
621
+ if self . isAtFunctionTypeArrow ( ) {
622
+ // Handle type-function if we have an '->' with optional
623
+ // 'async' and/or 'throws'.
624
+ var loopProgress = LoopProgressCondition ( )
625
+ while let ( _, handle) = self . at ( anyIn: EffectsSpecifier . self) , loopProgress. evaluate ( currentToken) {
626
+ self . eat ( handle)
627
+ }
624
628
625
- // Handle type-function if we have an '->' with optional
626
- // 'async' and/or 'throws'.
627
- var loopProgress = LoopProgressCondition ( )
628
- while let ( _ , handle ) = self . at ( anyIn : EffectsSpecifier . self ) , loopProgress . evaluate ( currentToken ) {
629
- self . eat ( handle )
629
+ guard self . consume ( if : . arrow ) != nil else {
630
+ return false
631
+ }
632
+
633
+ return self . canParseType ( )
630
634
}
631
635
632
- guard self . consume ( if : . arrow ) != nil else {
633
- return false
636
+ if self . currentToken . isEllipsis {
637
+ self . consumeAnyToken ( )
634
638
}
635
639
636
- return self . canParseType ( )
640
+ return true
637
641
}
638
642
639
643
mutating func canParseTupleBodyType( ) -> Bool {
@@ -822,14 +826,16 @@ extension Parser.Lookahead {
822
826
}
823
827
824
828
self . consumePrefix ( " < " , as: . leftAngle)
825
- var loopProgress = LoopProgressCondition ( )
826
- repeat {
827
- guard self . canParseType ( ) else {
828
- return false
829
- }
830
- // Parse the comma, if the list continues.
831
- } while self . consume ( if: . comma) != nil && loopProgress. evaluate ( currentToken)
832
829
830
+ if !self . currentToken. starts ( with: " > " ) {
831
+ var loopProgress = LoopProgressCondition ( )
832
+ repeat {
833
+ guard self . canParseType ( ) else {
834
+ return false
835
+ }
836
+ // Parse the comma, if the list continues.
837
+ } while self . consume ( if: . comma) != nil && loopProgress. evaluate ( currentToken)
838
+ }
833
839
834
840
guard self . currentToken. starts ( with: " > " ) else {
835
841
return false
0 commit comments