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-11214] Swift compiler incorrectly warns or errors when a try is captured by a throwing @autoclosure parameter to a function which does not itself throw. #53613

Closed
tkrajacic opened this issue Jul 26, 2019 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@tkrajacic
Copy link

Previous ID SR-11214
Radar rdar://problem/53578737
Original Reporter @tkrajacic
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Environment

Xcode 11b4

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

md5: 334b4a0425d8766e9fca105ae7568f5a

duplicates:

Issue Description:

The sample project shows that there is an incorrect diagnostic

'catch' block is unreachable because no errors are thrown in 'do' block

when in reality removing the do-catch will result in a compile error.

@gwynne
Copy link
Contributor

gwynne commented Jul 26, 2019

@swift-ci create

@theblixguy
Copy link
Collaborator

Example that does not involve XCTest:

func foo(_: @autoclosure () throws -> Void) {}
func bar() throws {}

func test() {
  do {
    foo(try bar())
  } catch { // 'catch' block is unreachable because no errors are thrown in 'do' block
    print(error)
  }
}

@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

3 participants