@@ -618,22 +618,26 @@ extension Parser.Lookahead {
618618 break
619619 }
620620
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+ }
624628
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 ( )
630634 }
631635
632- guard self . consume ( if : . arrow ) != nil else {
633- return false
636+ if self . currentToken . isEllipsis {
637+ self . consumeAnyToken ( )
634638 }
635639
636- return self . canParseType ( )
640+ return true
637641 }
638642
639643 mutating func canParseTupleBodyType( ) -> Bool {
@@ -822,14 +826,16 @@ extension Parser.Lookahead {
822826 }
823827
824828 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)
832829
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+ }
833839
834840 guard self . currentToken. starts ( with: " > " ) else {
835841 return false
0 commit comments