Support generic @compatibility_alias in PrintAsObjC #33573
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When Objective-C's
@compatibility_alias
feature is used with a class using lightweight generics, this ends up importing as a generic Swift typealias. PrintAsObjC previously didn’t handle declarations involving these types correctly; it would fail an assertion in asserts compilers, and potentially print an incorrect compatibility header in non-asserts compilers.This PR makes it so that PrintAsObjC can now correctly print generic compatibility aliases imported from Objective-C modules. It is, of course, still not possible to declare a generic typealias in Swift that will be printed into the Objective-C header.
This PR also adds a
ClangNode::dump()
method for use in the debugger and adds doc comments clarifying whatTypeAliasDecl::{is,markAs}CompatibilityAlias()
are for (and that they have nothing to do with@compatibility_alias
).Fixes rdar://67256866.