Skip to content

[Clang importer] Fix bridging of the underlying types of typedefs. #12680

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

Conversation

DougGregor
Copy link
Member

Typedefs tend to be imported without bridging the underlying
type. However, when a typedef is used within a bridging context, we
should bridge based on the underlying type. That wasn't being done
consistently, causing us to import various typedefs without bridging
at all. Update the logic to use the bridged underlying type whenever
the (often unbridged) typedef type itself doesn't line up.

Fixes rdar://problem/34913507.

(cherry picked from commit 687d753)

Typedefs tend to be imported without bridging the underlying
type. However, when a typedef is used within a bridging context, we
should bridge based on the underlying type. That wasn't being done
consistently, causing us to import various typedefs without bridging
at all. Update the logic to use the bridged underlying type whenever
the (often unbridged) typedef type itself doesn't line up.

Fixes rdar://problem/34913507.

(cherry picked from commit 687d753)
@DougGregor
Copy link
Member Author

@swift-ci please test

@rjmccall
Copy link
Contributor

Seems reasonable.

@DougGregor
Copy link
Member Author

@swift-ci please nominate

Explanation: Typedefs of bridged types---such as typedef NSArray<NSString *> *FooType;---were getting imported without being bridged, even in contexts where they should have been bridged.
Scope: Affects the import of Objective-C typedefs, which changed since Swift 4.0, causing source breaks.
Radar (and possibly SR Issue): rdar://problem/34913507
Risk: Low; we're reinstating Swift 4.0 behavior that we hadn't intended to change.
Testing: Compiler regression testing, with a new test for this case.
Reviewed by: John McCall

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor DougGregor merged commit a8cfb77 into swiftlang:swift-4.1-branch Oct 31, 2017
@DougGregor DougGregor deleted the importer-bridged-typedef-4.1 branch October 31, 2017 16:22
@jrose-apple
Copy link
Contributor

Hoping to supersede in #12737.

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.

3 participants