[SR-11084] Example LazyScanIterator, LazyScanSequence code in LazySequence doesn't compile #53476
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
documentation
standard library
Area: Standard library umbrella
Environment
macOS X 10.14.5, Xcode 10.2.1 and Xcode 11.0 beta 2 (11M337n), and Xcode 11.0 beta 3 (11M362v)
Additional Detail from JIRA
md5: 3b098d0a30040d1b877382878d38e8a1
Issue Description:
The documentation for `LazySequenceProtocol` Overview section includes some sample code for building "a sequence that lazily computes the elements in the result of scan". As written, this example code does not compile under Swift 5.0 or 5.1. This documentation comes from comments in stdlib/public/core/LazySequence.swift .
In particular, the `LazyScanIterator` construction in `LazyScanSequence::makeIterator()` gets the following compiler errors:
"LazyScanIterator<Base, ResultElement>' initializer is inaccessible due to 'private' protection level"
"Missing argument label 'nextPartialResult:' in call"
Similarly for the `LazyScanSequence` construction in `LazySequenceProtocol::scan(…)`:
Since readers of the documentation are likely to want to copy and paste this code and try it out, or copy it when making their own `LazySequenceProtocol` conforming struct, this code should compile and run properly.
A PR fixing the problems has been provided: #25995
The text was updated successfully, but these errors were encountered: