Skip to content

Commit 6e49443

Browse files
authored
Merge pull request #27040 from rintaro/syntaxparse-rdar55075237
[SyntaxParse] Parse 'self' as an 'identifier' token in type parsing
2 parents 99d8042 + dba6514 commit 6e49443

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

include/swift/Parse/Parser.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,10 @@ class Parser {
547547
ParsedTokenSyntax consumeIdentifierSyntax(bool allowDollarIdentifier = false) {
548548
assert(Tok.isAny(tok::identifier, tok::kw_self, tok::kw_Self));
549549

550-
Context.getIdentifier(Tok.getText());
551-
552550
if (Tok.getText()[0] == '$' && !allowDollarIdentifier)
553551
diagnoseDollarIdentifier(Tok);
554552

553+
Tok.setKind(tok::identifier);
555554
return consumeTokenSyntax();
556555
}
557556

test/type/types.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,5 @@ var _: sr5505 = sr5505 // expected-error {{use of undeclared type 'sr5505'}}
193193
typealias A = (inout Int ..., Int ... = [42, 12]) -> Void // expected-error {{'inout' must not be used on variadic parameters}}
194194
// expected-error@-1 {{only a single element can be variadic}} {{35-39=}}
195195
// expected-error@-2 {{default argument not permitted in a tuple type}} {{39-49=}}
196+
197+
typealias rdar55075237 = Int.self // expected-error {{'self' is not a member type of 'Int'}}

0 commit comments

Comments
 (0)