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-3134] force-unwrapping fails mysteriously when interleaved with + operators #45722

Closed
mattneub opened this issue Nov 4, 2016 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@mattneub
Copy link

mattneub commented Nov 4, 2016

Previous ID SR-3134
Radar None
Original Reporter @mattneub
Type Bug
Status Resolved
Resolution Duplicate
Environment

Xcode 8.1, Swift 3.0.1

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 73e5bd88561f175fe66f6ba87f08030f

duplicates:

  • SR-1122 Failure to typecheck chain of binary operators on force-unwrapped values
  • SR-2636 + Operator fails to infer type for more than 2 force unwrapped values

Issue Description:

This compiles:

        var d : [String:Double] = ["a" : 1]
        var total : Double = d["a"]! + d["a"]!

This doesn't compile:

        var d : [String:Double] = ["a" : 1]
        var total : Double = d["a"]! + d["a"]! + d["a"]!

The error message reads " Value of optional type 'Double?' not unwrapped; did you mean to use '!' or '?'?", and if you perform the Fix-It, you get a different error.

That makes no sense.

@mattneub
Copy link
Author

mattneub commented Nov 4, 2016

Duplicate of https://bugs.swift.org/browse/SR-2636

@belkadan
Copy link
Contributor

belkadan commented Nov 4, 2016

:-) Thanks for finding the dup. Feel free to mark it yourself in the future if you want.

@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. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants