Skip to content

[5.0] [ClangImporter] swift_wrapper: transfer inherited synthesized protos #14271

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
Jan 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ClangImporter/ImportDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5063,7 +5063,7 @@ static bool conformsToProtocolInOriginalModule(NominalTypeDecl *nominal,

for (auto attr : nominal->getAttrs().getAttributes<SynthesizedProtocolAttr>())
if (auto *otherProto = ctx.getProtocol(attr->getProtocolKind()))
if (otherProto == proto)
if (otherProto == proto || otherProto->inheritsFrom(proto))
return true;

// Only consider extensions from the original module...or from an overlay
Expand Down
4 changes: 2 additions & 2 deletions test/IDE/newtype.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
// PRINT-NEXT: let Notification: String
// PRINT-NEXT: let swiftNamedNotification: String
//
// PRINT-LABEL: struct CFNewType : _SwiftNewtypeWrapper, RawRepresentable {
// PRINT-LABEL: struct CFNewType : Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable {
// PRINT-NEXT: init(_ rawValue: CFString)
// PRINT-NEXT: init(rawValue: CFString)
// PRINT-NEXT: let rawValue: CFString
Expand All @@ -97,7 +97,7 @@
// PRINT-NEXT: func FooAudited() -> CFNewType
// PRINT-NEXT: func FooUnaudited() -> Unmanaged<CFString>
//
// PRINT-LABEL: struct MyABINewType : _SwiftNewtypeWrapper, RawRepresentable {
// PRINT-LABEL: struct MyABINewType : Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable {
// PRINT-NEXT: init(_ rawValue: CFString)
// PRINT-NEXT: init(rawValue: CFString)
// PRINT-NEXT: let rawValue: CFString
Expand Down