You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Handle decl modifier keywords in isStartOfSwiftDecl
Previously we would always return true if we
encountered a decl modifier keyword, however this
could cause us to incorrectly consider SIL's
usage of such keywords, e.g 'private', to be the
start of a Swift decl.
Adjust the logic to check the next token for the
start of a Swift decl.
classswitch{} // expected-error {{keyword 'switch' cannot be used as an identifier here}} expected-note {{if this name is unavoidable, use backticks to escape it}} {{7-13=`switch`}}
33
33
structSelf{} // expected-error {{keyword 'Self' cannot be used as an identifier here}} expected-note {{if this name is unavoidable, use backticks to escape it}} {{8-12=`Self`}}
34
34
protocolenum{} // expected-error {{keyword 'enum' cannot be used as an identifier here}} expected-note {{if this name is unavoidable, use backticks to escape it}} {{10-14=`enum`}}
35
-
protocoltest{ // expected-note{{in declaration of 'test'}}
36
-
associatedtypepublic // expected-error {{keyword 'public' cannot be used as an identifier here}} expected-note {{if this name is unavoidable, use backticks to escape it}} {{18-24=`public`}} expected-error {{consecutive declarations on a line must be separated by ';'}}
37
-
} // expected-error{{expected declaration}}
35
+
protocoltest{
36
+
associatedtypepublic // expected-error {{keyword 'public' cannot be used as an identifier here}} expected-note {{if this name is unavoidable, use backticks to escape it}} {{18-24=`public`}}
37
+
}
38
38
func _(_ x:Int){} // expected-error {{keyword '_' cannot be used as an identifier here}} // expected-note {{if this name is unavoidable, use backticks to escape it}} {{6-7=`_`}}
39
39
40
40
// SIL keywords are tokenized as normal identifiers in non-SIL mode.
0 commit comments