[SR-10261] Unexpected results for compact-mapped lazy sequence #52661
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
Xcode 10.2 (10E125)
Swift 5
Additional Detail from JIRA
md5: 7321e0df08f39eaac4671a25ad294be4
Issue Description:
The sequence returned from a lazy sequence's compactMap has unexpected behavior.
In the example, subscripting the compact-mapped sequence produces the expected values, but they are located at the indices of the original un-mapped sequence. It's possible this is expected, though the behavior is surprising to me, as I would expect any kind of read into a sequence produced by lazy application of an operation to be the same as if the operation were applied non-lazily. I've been unable to find documentation clarifying this.
Expected:
lazy[2]
(for example) returns 30Actual:
lazy[2]
returns 10Edit: This ticket originally described two issues. The second issue has been moved to its own ticket: https://bugs.swift.org/browse/SR-10270
The text was updated successfully, but these errors were encountered: