Skip to content

[SR-4555] Crash bridging objective-c dictionary when it contains NSErrors as the values #47132

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
swift-ci opened this issue Apr 10, 2017 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-4555
Radar None
Original Reporter tourultimate (JIRA User)
Type Bug
Environment

compiled on: macOS 10.12
run on: macOS 10.12
swift version: Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)
xcode 8.2.1

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

md5: 696d775b055c54e1feffaf4a1fcc4cfc

Issue Description:

Consider the following objective-c object:

```
NS_ASSUME_NONNULL_BEGIN
@interface BusinessObject : NSObject
@Property (nonatomic, copy, readonly) NSDictionary <NSNumber , NSError> *errorsDictionary;
@EnD
NS_ASSUME_NONNULL_END

#import "BusinessObject.h"
@implementation BusinessObject
-(NSDictionary<NSNumber *,NSError *> *)errorsDictionary{
NSError *error = [NSError errorWithDomain:@"blah" code:1234 userInfo:nil];
return @{@(1): error};
}
@EnD
```

When using this in swift like so:

```
let b = BusinessObject()
let errorsDictionary = b.errorsDictionary;
print("errorsDictionary: (errorsDictionary)")
```

you will get a crash with the following stack trace:

```

@belkadan
Copy link
Contributor

@DougGregor, is this one of the ones you were looking at already?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution
Projects
None yet
Development

No branches or pull requests

3 participants