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-5339] do/catch error #47913

Closed
swift-ci opened this issue Jun 30, 2017 · 2 comments
Closed

[SR-5339] do/catch error #47913

swift-ci opened this issue Jun 30, 2017 · 2 comments
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-5339
Radar None
Original Reporter marchyman (JIRA User)
Type Bug
Status Resolved
Resolution Invalid

Attachment: Download

Environment

Swift 3, Xcode 8.3.3m, macOS 10.12.5

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

md5: 975e6d745e8a771de73810c2e1e6cb5e

Issue Description:

Inner do/catch block is not being called.

do {
try ... assume failure
} catch {
do {
try ... assume failure
} catch error as NSError {
... this branch is never invoked
}
}

Test project (attached) should print an error and exit. Instead it aborts with a fatalError because the inner catch is not invoked.

@belkadan
Copy link
Contributor

belkadan commented Jul 1, 2017

It looks like the bug here is actually in NSFileManager—Objective-C code is doing the same thing. Can you file a bug report against Foundation at https://bugreport.apple.com ? (I could do it, but then you wouldn't get notified when it was fixed.)

static inline void objcCopyFile(NSURL * _Nonnull from, NSURL * _Nonnull to) {
  NSLog(@"%@ %@", from, to);
  NSError *error;
  BOOL result = [[NSFileManager defaultManager] copyItemAtURL:from toURL:to error:&error];
  NSLog(@"%@ %@", @(result), error);
}

@swift-ci
Copy link
Collaborator Author

swift-ci commented Jul 1, 2017

Comment by Marco S Hyman (JIRA)

Will do.

@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