Details
-
Type:
Bug
-
Status: In Progress
-
Priority:
Medium
-
Resolution: Unresolved
-
Component/s: Compiler
-
Labels:
-
Environment:
Swift version 4.2-dev (LLVM 95345677bd, Clang daefc772c1, Swift 76c264e9a1)
Target: x86_64-apple-darwin17.4.0
Description
This example doesn't compile:
struct S { @discardableResult func foo() -> () -> String { fatalError() } } let s = S() s.foo() // error: Expression resolves to an unused function
But really it should. Interestingly enough it does compile if it's a top-level function:
@discardableResult
func foo() -> () -> String { fatalError() }
foo()
Attachments
Issue Links
- relates to
-
SR-2948 Discarding a closure from a @discardableResult function results in a compile error.
-
- Resolved
-