File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Tests/SwiftParserTest/translated Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -412,7 +412,12 @@ extension Parser {
412
412
keywordRecovery: Bool = false
413
413
) -> ( RawUnexpectedNodesSyntax ? , RawTokenSyntax ) {
414
414
if allowIdentifierLikeKeywords {
415
- if let ( _, handle) = self . canRecoverTo ( anyIn: IdentifierTokens . self) {
415
+ if currentToken. isEditorPlaceholder {
416
+ return (
417
+ RawUnexpectedNodesSyntax ( elements: [ RawSyntax ( self . consumeAnyToken ( ) ) ] , arena: self . arena) ,
418
+ self . missingToken ( . identifier, text: nil )
419
+ )
420
+ } else if let ( _, handle) = self . canRecoverTo ( anyIn: IdentifierTokens . self) {
416
421
return self . eat ( handle)
417
422
}
418
423
} else {
Original file line number Diff line number Diff line change @@ -83,9 +83,10 @@ final class IdentifiersTests: XCTestCase {
83
83
AssertParse (
84
84
"""
85
85
// Placeholders are recognized as identifiers but with error.
86
- func <#some name#>() {}
86
+ func 1️⃣ <#some name#>() {}
87
87
""" ,
88
88
diagnostics: [
89
+ DiagnosticSpec ( message: " editor placeholder in source file " )
89
90
// TODO: (good first issue) Old parser expected error on line 2: editor placeholder in source file
90
91
]
91
92
)
You can’t perform that action at this time.
0 commit comments