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-12271] @discardableResult not working for static function with function return type #54699

Closed
swift-ci opened this issue Feb 26, 2020 · 4 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12271
Radar None
Original Reporter fumoboy007 (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
Target: x86_64-apple-darwin19.3.0

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

md5: 2b293c108978b3a0712411c5b80192dc

is duplicated by:

  • SR-7297 Discarding a function from a discardableResult method causes a compiler error

Issue Description:

The following code does not compile:

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

Foo.bar()

The error:

error: expression resolves to an unused function
Foo.bar()
~~~~^~~~~
@theblixguy
Copy link
Collaborator

Fix: #30077

@theblixguy
Copy link
Collaborator

Fixed on master. Please verify using the next development snapshot and close this ticket.

@swift-ci
Copy link
Collaborator Author

Comment by Darren Mo (JIRA)

Verified. Thanks!

1 similar comment
@swift-ci
Copy link
Collaborator Author

Comment by Darren Mo (JIRA)

Verified. Thanks!

@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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants