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-1752] Warning about unused result with ternary operator #44361

Closed
swift-ci opened this issue Jun 14, 2016 · 1 comment
Closed

[SR-1752] Warning about unused result with ternary operator #44361

swift-ci opened this issue Jun 14, 2016 · 1 comment
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-1752
Radar None
Original Reporter lennet (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Swift 3.0 shipped with Xcode 8.0 beta (8S128d)

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

md5: 0cedd5ebc37b5c0a569c425bf163b8a6

relates to:

  • SR-1895 compilation warning for void result type

Issue Description:

If you compile the following code, a?.bar() has a return value of Void?. This doesn't result in an unused result warning when the statement is used on its own, but if used inside the ternary the warning Expression of type '()?' is unused shows up.

struct Foo {
  func bar() {}
}

let a: Foo? = nil
let b = true


b ? nil : a?.bar()  // Expression of type '()?' is unused
@ahoppen
Copy link
Contributor

ahoppen commented Jul 6, 2016

Fixed in #3057

@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