Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-13981] Disallow $ sign in the middle of an identifier #56376

Closed
typesanitizer opened this issue Dec 21, 2020 · 2 comments
Closed

[SR-13981] Disallow $ sign in the middle of an identifier #56376

typesanitizer opened this issue Dec 21, 2020 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself parser Area → compiler: The legacy C++ parser

Comments

@typesanitizer
Copy link

Previous ID SR-13981
Radar rdar://problem/72553623
Original Reporter @typesanitizer
Type Bug
Status Resolved
Resolution Won't Do
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Parser
Assignee @typesanitizer
Priority Medium

md5: a3979ea4362d9d0a40a05ce59262acf0

Issue Description:

https://forums.swift.org/t/is-an-identifier-character-now/43190

let a$b = 4

This code should not compile according to TSPL.

@typesanitizer
Copy link
Author

@swift-ci create

@ahoppen
Copy link
Contributor

ahoppen commented Jan 6, 2021

This is not a regression. '$' has been a valid identifier-continuation-code-point for a long time. E.g. in 2013:

swift/lib/Parse/Lexer.cpp

Lines 314 to 316 in 7b305c7

static bool isValidContinuationOfIdentifier(char c) {
return isalnum(c) || c == '_' || c == '$';
}

static bool isValidContinuationOfIdentifier(char c) {
  return isalnum(c) || c == '_' || c == '$';
}

Changing it would be a source breaking change. We should update TSPL instead.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

2 participants