Navigation Menu

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-3665] Global functions called with an explicit namespace do not respect @discardableResult #46250

Closed
swift-ci opened this issue Jan 18, 2017 · 3 comments
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 good first issue Good for newcomers

Comments

@swift-ci
Copy link
Collaborator

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

Xcode 8.2.1

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, StarterBug
Assignee KingOfBrian (JIRA)
Priority Medium

md5: 5badbbf9b6ed219edff146a5daa85af1

Issue Description:

class Foo {  }

@discardableResult
func bar() -> Foo {
    
   return Foo()
}

bar() // no warning

Module.bar() // Result of call is unused, but produces 'Foo'

The first call to bar() produces no warning, whereas the second does. Unless I'm forgetting something, the latter seems like a bug.

@belkadan
Copy link
Contributor

Still reproduces in master!

@belkadan
Copy link
Contributor

Tagged as StarterBug because I suspect it will be a simple modification to the existing DiscardableResult logic. It will require a bit of spelunking around the AST to see how Module.bar() is represented, though. swiftc -dump-ast Module.swift is your friend.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Feb 5, 2017

Comment by Brian (JIRA)

#7201

@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 diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants