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

PrintAsObjC: Handle new upper bounds of Array/Dictionary/Set correctly. #3918

Merged
merged 1 commit into from Aug 2, 2016

Conversation

jckarter
Copy link
Member

@jckarter jckarter commented Aug 1, 2016

We would crash because 'Any' doesn't have a corresponding bridged type through the normal bridging mechanism. Handle this correctly, and correctly recognize 'AnyHashable' and 'Any' as the upper bounds of Dictionary, Set, and Array so we present the unqualified NS types in the generated header.

@jckarter
Copy link
Member Author

jckarter commented Aug 1, 2016

@swift-ci Please smoke test

else if (swiftNominal == ctx.getDictionaryDecl() &&
isNSObjectOrAnyHashable(ctx, typeArgs[0])) {
if (Module *M = ctx.getLoadedModule(ctx.Id_Foundation)) {
UnqualifiedLookup lookup(ctx.getIdentifier("NSCopying"), M, nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

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

lookupQualified is probably more appropriate here. Also, the if (!NSCopyingType) should guard this whole section.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was following the example of what ASTContext::getNSErrorType does. Should that be changed too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably. I guess it's not immediately important. (The guard being inverted is, though.)

We would crash because 'Any' doesn't have a corresponding bridged type through the normal bridging mechanism. Handle this correctly, and correctly recognize 'AnyHashable' and 'Any' as the upper bounds of Dictionary, Set, and Array so we present the unqualified NS types in the generated header.
@jckarter
Copy link
Member Author

jckarter commented Aug 2, 2016

@swift-ci Please smoke test and merge

1 similar comment
@shahmishal
Copy link
Member

@swift-ci Please smoke test and merge

@shahmishal shahmishal merged commit 8d854d2 into apple:master Aug 2, 2016
@jckarter
Copy link
Member Author

jckarter commented Aug 2, 2016

Thanks @shahmishal !

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.

None yet

3 participants