File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -1145,7 +1145,7 @@ extension Parser {
1145
1145
var unexpectedAfterAsync : [ RawSyntax ? ] = [ ]
1146
1146
/// Only allow recovery to the arrow with exprKeyword precedence so we only
1147
1147
/// skip over misplaced identifiers and don't e.g. recover to an arrow in a 'where' clause.
1148
- if self . at ( . arrow ) || self . canRecoverTo ( TokenSpec ( . arrow, recoveryPrecedence: . exprKeyword) ) != nil {
1148
+ if self . canRecoverTo ( TokenSpec ( . arrow, recoveryPrecedence: . exprKeyword) ) != nil {
1149
1149
let output = self . parseFunctionReturnClause ( effectSpecifiers: & effectSpecifiers, allowNamedOpaqueResultType: true )
1150
1150
unexpectedAfterAsync. append ( RawSyntax ( output) )
1151
1151
}
Original file line number Diff line number Diff line change @@ -527,7 +527,11 @@ extension RawDeinitEffectSpecifiersSyntax: RawMisplacedEffectSpecifiersTrait {
527
527
throwsSpecifier: RawTokenSyntax ? ,
528
528
arena: __shared SwiftSyntax. SyntaxArena
529
529
) {
530
- // Inserted missing throws is discarded
530
+ // `throwsSpecifier` should never be present because `parseMisplacedEffectSpecifiers()` only creates missing tokens
531
+ // and `CorrectThrowsTokenKinds` is an empty `TokenSpecSet`.
532
+ //
533
+ // We don't want to insert missing `throws` for deinit case,
534
+ // so if `parseMisplacedEffectSpecifiers()` creates one it will be discarded here.
531
535
precondition ( throwsSpecifier? . isMissing ?? true )
532
536
self . init (
533
537
nil ,
@@ -540,7 +544,11 @@ extension RawDeinitEffectSpecifiersSyntax: RawMisplacedEffectSpecifiersTrait {
540
544
func withMisplaced( async misplacedAsyncKeyword: RawTokenSyntax ? , throws misplacedThrowsKeyword: RawTokenSyntax ? , arena: SyntaxArena )
541
545
-> RawDeinitEffectSpecifiersSyntax
542
546
{
543
- // Inserted missing throws is discarded
547
+ // `throwsSpecifier` should never be present because `parseMisplacedEffectSpecifiers()` only creates missing tokens
548
+ // and `CorrectThrowsTokenKinds` is an empty `TokenSpecSet`.
549
+ //
550
+ // We don't want to insert missing `throws` for deinit case,
551
+ // so if `parseMisplacedEffectSpecifiers()` creates one it will be discarded here.
544
552
precondition ( throwsSpecifier? . isMissing ?? true )
545
553
return Self . init (
546
554
self . unexpectedBeforeAsyncSpecifier,
You can’t perform that action at this time.
0 commit comments