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-8964] Type check operator (is) fails for Any! variable holding an Error (struct) value #51469

Closed
swift-ci opened this issue Oct 10, 2018 · 3 comments

Comments

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Oct 10, 2018

Previous ID SR-8964
Radar rdar://problem/45217461
Original Reporter wojciechczerski (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Xcode 10.0 (10A255), Swift 4.2

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

md5: 942adf7e130c74daa296f6ca84a5bcbc

relates to:

  • SR-4552 Implicitly Unwrapped Optional after casting to Any, can't be casted to Protocol it conforms to

Issue Description:

In the following code the "b is Error" incorrectly returns false though the b variable holds an Error value.

struct MyError: Error { }

let a: Any! = MyError()
let b: Any = a
b is Error // false 

The result of the type check should be true. This issue might be related to SR-4552.

@AnnaZaks
Copy link
Mannequin

@AnnaZaks AnnaZaks mannequin commented Oct 12, 2018

CC @jckarter
@swift-ci create

@tbkka
Copy link
Contributor

@tbkka tbkka commented Aug 27, 2020

#33561 should fix this for the non-optimized case (where the cast is being handled by the runtime). There may still be issues with optimized casts, though.

@tbkka
Copy link
Contributor

@tbkka tbkka commented Nov 12, 2020

This now appears to be fixed for both debug and release builds.

@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
Projects
None yet
Development

No branches or pull requests

2 participants