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-15061] EnumeratedSequence underestimatedCount does not forward the base enumeratedCount #57388

Open
swift-ci opened this issue Aug 13, 2021 · 1 comment
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

Previous ID SR-15061
Radar rdar://problem/81907273
Original Reporter laclouis5 (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee None
Priority Medium

md5: e03ba826acc0bd91edbf5d0b7b77aee4

Issue Description:

All lazy adaptors forward the underestimatedCount property of Sequences excepted EnumeratedSequence:

let array = [1, 2, 3, 4, 5]
let enumerated = array.enumerated()
print(enumerated.underestimatedCount)  // 0

Is this expected behavior? Does it create unnecessary reallocations in such code:

// array: some array 
let result = Array(array.enumerated().map { $0 })  // this Sequence underestimatedCount is 0
@typesanitizer
Copy link

@swift-ci create

@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. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants