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
It's still a bit unclear if this is a bug or a feature, but anyhow Swift allows to use same names in Enums for cases and static variables, but only if the type is explicitely defined to the variable before it's value is initialized.
So the question is that should enum allow same names for cases and static variables, and if so should this fllowing compiler error to be resolved?
Here's the example:
enumFoo {
casebar(Int?)
casedoostaticvarbar: Foo { .bar(nil) }
staticvarbaar: Foo { .bar(nil) }
}
letbar = Foo.bar// Swift Compiler Error: Ambigious use of 'bar'letbaar = Foo.baar// No problemsletdoo = Foo.doo// No problemsletbar2: Foo = Foo.bar// No problems
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: c6b9cbdeb816022bc0c82f678d2fa2b4
Issue Description:
It's still a bit unclear if this is a bug or a feature, but anyhow Swift allows to use same names in Enums for cases and static variables, but only if the type is explicitely defined to the variable before it's value is initialized.
So the question is that should enum allow same names for cases and static variables, and if so should this fllowing compiler error to be resolved?
Here's the example:
The text was updated successfully, but these errors were encountered: