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-5211] The base method implementation for RangeReplaceableCollection should use RangeExpression #47787

Closed
phausler opened this issue Jun 13, 2017 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@phausler
Copy link
Member

Previous ID SR-5211
Radar None
Original Reporter @phausler
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee None
Priority Medium

md5: e54df8e3c5a73e81f9faa60b203e6743

duplicates:

  • SR-6501 RangeReplaceableCollection default implementations cause infinite recursion

Issue Description:

RangeReplaceableCollection uses the pseudo funnel method

mutating func replaceSubrange<C where C : Collection, Self.Iterator.Element == C.Iterator.Element>(_ subrange: Range<Self.Index>, with newElements: C)

But this in reality should use RangeExpression instead and be written in the more generic terms:

mutating func replaceSubrange<C, R>(_ subrange: R, with newElements: C) where C : Collection, C.Iterator.Element == Element, R : RangeExpression, R.Bound == Index

This means that range replacement for collections should be able to be expressed in the terms of closed ranges or half open ranges etc.

@gwynne
Copy link
Contributor

gwynne commented Jul 26, 2019

Duping to SR-6501 as that's where the active discussion on this has ended up.

@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