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
I know this is because `.Type` accesses meta type. So either the error message should be more clear or `Type` should be forbidden as name of nest types.
<stdin>:2:10: error: type member may not be named 'Type', since it would conflict with the 'foo.Type' expression
enum Type {
^
<stdin>:2:10: note: backticks can escape this name if it is important to use
enum Type {
^~~~
`Type`
We're seeing this issue on our Swift 3.0 project as well. Given an enum named `Type`, we cannot access its members or functions.
Here's a code snippet that reproduces the issue:
class Sample {
public enum `Type`:Int {
case foo = 1
case bar = 2
}
}
let val1 = Sample.Type.foo // Type 'Sample.Type' has no member 'foo'
let val2 = Sample.`Type`.foo // Type 'Sample.Type' has no member 'foo'
let rawValue = 1
let val3: Sample.Type? = Sample.Type(rawValue: rawValue) // Argument passed to call that takes no arguments
let val4: Sample.`Type`? = Sample.`Type`(rawValue: rawValue) // Argument passed to call that takes no arguments
Environment
Swift 3 in Xcode 8.0 beta 3
Additional Detail from JIRA
md5: 6e55591eaee67c084dcc85c1bde947ff
is duplicated by:
Type
is not properly resolvedrelates to:
Type
propertyIssue Description:
This code produces this error:
I know this is because `.Type` accesses meta type. So either the error message should be more clear or `Type` should be forbidden as name of nest types.
The text was updated successfully, but these errors were encountered: