-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Closed
Copy link
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfparserArea → compiler: The legacy C++ parserArea → compiler: The legacy C++ parserproperty wrappersFeature: property wrappersFeature: property wrappers
Description
Previous ID | SR-13232 |
Radar | None |
Original Reporter | @ole |
Type | Bug |
Status | Resolved |
Resolution | Done |
Attachment: Download
Environment
Tested in Xcode 12.0 beta 2 (Swift 5.3) and Xcode 11.5 (Swift 5.2.4).
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, Parser, PropertyWrappers |
Assignee | @theblixguy |
Priority | Medium |
md5: dcf92c5bd51f756e2d49a1e2a2c52ace
is duplicated by:
- SR-14094 Projected value's name is parsed incorrectly if it contains non-ASCII characters
Issue Description:
The last line of this snippet doesn't compile:
@propertyWrapper
struct Wrapper {
var wrappedValue: Int
var projectedValue: String {
String(wrappedValue)
}
}
struct S {
@Wrapper var café = 42
}
S().$café // parse/lex error here
Errors:
non-ascii.swift:14:9: error: consecutive statements on a line must be separated by ';'
S().$café
non-ascii.swift:14:5: error: value of type 'S' has no member '$caf'
S().$café
non-ascii.swift:14:9: error: cannot find 'é' in scope
S().$café
It looks like the $projectedValue
syntax can't handle non-ASCII characters in the identifier. I tried wrapping it in backticks like this: `$café`
or like this: $`café`
. But it still doesn't compile.
Changing the variable name to cafe
works, of course.
I tried this with several identifiers with non-ASCII characters and/or emoji, always with the same result.
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfparserArea → compiler: The legacy C++ parserArea → compiler: The legacy C++ parserproperty wrappersFeature: property wrappersFeature: property wrappers