Skip to content

[IRGen] Check for nil in final class cast opt. #65636

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

Merged
merged 1 commit into from
May 4, 2023

Conversation

nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented May 4, 2023

As an optimization, there is a fast-cast to final classes that just compares isa pointers. If the source of the cast is an Optional<class>, though, it's not allowed to "directly compare the isa-pointer"; because the source might be Optional.none, i.e. null.

Add a check for null when emitting the fast class cast.

rdar://108614878

As an optimization, there is a fast-cast to non-final classes that just
compares isa pointers.  If the source of the cast is an Optional<class>,
though, it's not allowed to "directly compare the isa-pointer"; because
the source might be Optional.none, i.e. null.

Add a check for nil when emitting the fast class cast.

rdar://108614878
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@nate-chandler nate-chandler merged commit 74cbe26 into swiftlang:main May 4, 2023
@nate-chandler nate-chandler deleted the rdar108614878 branch May 4, 2023 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants