Skip to content

[PrintAsObjC] Look through "compatibility" typealiases #20027

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
Oct 25, 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
6 changes: 4 additions & 2 deletions lib/PrintAsObjC/PrintAsObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2014,10 +2014,12 @@ class ReferencedTypeFinder : public TypeVisitor<ReferencedTypeFinder> {
}

void visitNameAliasType(NameAliasType *aliasTy) {
if (aliasTy->getDecl()->hasClangNode())
if (aliasTy->getDecl()->hasClangNode() &&
!aliasTy->getDecl()->isCompatibilityAlias()) {
Callback(*this, aliasTy->getDecl());
else
} else {
visit(aliasTy->getSinglyDesugaredType());
}
}

void visitParenType(ParenType *parenTy) {
Expand Down
3 changes: 3 additions & 0 deletions test/PrintAsObjC/versioned.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import VersionedFMWK
// CHECK-NEXT: - (nullable instancetype)initFormerlyFailableValue:(NSInteger)value OBJC_DESIGNATED_INITIALIZER;
} // CHECK-NEXT: @end

// Make sure we use forward declarations like we would for non-versioned names.
// CHECK: @class InnerClass;

// CHECK-LABEL: @interface UsesNestedClass
@objc class UsesNestedClass : NSObject {
// CHECK-NEXT: - (InnerClass * _Nullable)foo SWIFT_WARN_UNUSED_RESULT;
Expand Down