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-5515] popFirst error message is silly #48087

Open
mattneub opened this issue Jul 20, 2017 · 3 comments
Open

[SR-5515] popFirst error message is silly #48087

mattneub opened this issue Jul 20, 2017 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis

Comments

@mattneub
Copy link

Previous ID SR-5515
Radar None
Original Reporter @mattneub
Type Bug
Environment

Xcode Version 9.0 beta 3 (9M174d)

Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug, DiagnosticsQoI, TypeChecker
Assignee @xedin
Priority Medium

md5: a87fa35be4ed517d2c1b701a237232de

Issue Description:

var arr = [1,2,3]
arr.popFirst()  // cannot use mutating member on immutable value: 'arr' is immutable

That's a silly error message. `arr` is not immutable in any normal sense. The problem is actually that popFirst doesn't operate on an Array at all (something I've always found rather weird, but there it is).

@belkadan
Copy link
Contributor

Yeah, we're looking at this popFirst.

@xedin, any idea what's going on here? And @dabrahams, why doesn't RangeReplaceableCollection have its own popFirst?

@dabrahams
Copy link
Collaborator

Pop operations are supposed to be O(1), and many models of RangeReplaceableCollection can't offer that guarantee.

@belkadan
Copy link
Contributor

Ah, of course. Thanks.

@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. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants