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-1660] Enum with String rawValue and escaped init
identifier causes compile error
#44269
Comments
Yep. This is caused by our representation of the keyword |
Comment by Manuel Krebber (JIRA) Does that mean it won't be fixed? It is not really a pressing issue, as one can simply use a different identifier, but I guess other problem could also arise from mixing the initializers with the normal namespace. |
Well, it's definitely a bug, and something I'd like to fix, but given that you usually can use a different identifier I don't expect it to be prioritized. |
Comment by Richard Venable (JIRA) I also ran into this bug, so then I tested other keywords and verified that it is just `init` that has this problem: enum Keyword: String {
case `associatedtype`
case `class`
case `deinit`
case `enum`
case `extension`
case `fileprivate`
case `func`
case `import`
//case `init`
case `inout`
case `internal`
case `let`
case `open`
case `operator`
case `private`
case `protocol`
case `public`
case `static`
case `struct`
case `subscript`
case `typealias`
case `var`
case `break`
case `case`
case `continue`
case `default`
case `defer`
case `do`
case `else`
case `fallthrough`
case `for`
case `guard`
case `if`
case `in`
case `repeat`
case `return`
case `switch`
case `where`
case `while`
case `as`
case `Any`
case `catch`
case `false`
case `is`
case `nil`
case `rethrows`
case `super`
case `self`
case `Self`
case `throw`
case `throws`
case `true`
case `try`
case `associativity`
case `convenience`
case `dynamic`
case `didSet`
case `final`
case `get`
case `infix`
case `indirect`
case `lazy`
case `left`
case `mutating`
case `none`
case `nonmutating`
case `optional`
case `override`
case `postfix`
case `precedence`
case `prefix`
case `Protocol`
case `required`
case `right`
case `set`
case `Type`
case `unowned`
case `weak`
case `willSet`
}
let keyword = Keyword(rawValue: "func") |
The right fix for this is to make |
Additional Detail from JIRA
md5: 5665fa3f90e5789f42eca1cf46a3fc49
is duplicated by:
init
as a enum case with associated valuesrelates to:
init
case of enum can be used implicitlyIssue Description:
The following program results in a compile time error, because the generated rawValue initializer interferes with the `init` case:
The compiler gives the following error message:
From my understanding, this enum should work perfectly fine, as that is what the backtick escapes are supposed to prevent.
The text was updated successfully, but these errors were encountered: