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-10258] Enum CaseIterable produces AllCases (not allCases) function #52658

Closed
swift-ci opened this issue Apr 2, 2019 · 1 comment
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 2, 2019

Previous ID SR-10258
Radar None
Original Reporter tedbrosby (JIRA User)
Type Bug
Status Resolved
Resolution Invalid
Environment

Xcode 10.2

Swift 5

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

md5: 38eae80b6215c6e4b59f4a917848c181

Issue Description:

I'm not sure if this is intentional or not.

When conforming to CaseIterable, an Enum has a 'class style' function generated called AllCases. It doesn't produce a compile or warning and is an empty array.

Reproduction steps:

enum Direction: Int, CaseIterable {
  case north = 0, east, south, west
} 

func example() {
  let allDirections: [Direction] = Direction.AllCases()
  print(allDirections.count) // is 0
}
@belkadan
Copy link
Contributor

belkadan commented Apr 2, 2019

AllCases is the associated type; allCases is the property.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants