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-3256] Invalid redeclaration of 'functionName()' in an enum with the same case name #45844

Open
DevAndArtist mannequin opened this issue Nov 22, 2016 · 2 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@DevAndArtist
Copy link
Mannequin

DevAndArtist mannequin commented Nov 22, 2016

Previous ID SR-3256
Radar None
Original Reporter @DevAndArtist
Type Bug
Environment

Xcode 8.1, latest master Snapshot and Xcode 8.1 Swift version

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 8bf507a02afb241bddd08514e8d57a65

Issue Description:

enum States {
    
    case a
    case b
    case c
    
    mutating func b() {
        
        self = .b
    }
}
Playground execution failed: error: invalid redeclaration of 'b()'
    mutating func b() {
                  ^

note: 'b' previously declared here
    case b
         ^
@CodaFi
Copy link
Member

CodaFi commented Dec 29, 2016

This is correct: this is definitely ambiguous

let x = States.b
^ What types does `x` have, `States` or `() -> ()`?

The diagnostic could be a bit more clever nonetheless.

@DevAndArtist
Copy link
Mannequin Author

DevAndArtist mannequin commented Jan 3, 2017

The latter is actually

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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
Projects
None yet
Development

No branches or pull requests

1 participant