Skip to content

Commit d07a3f8

Browse files
committed
Sema: Fix the 'aka AnyObject' thing some more
1 parent 707cecb commit d07a3f8

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/AST/DiagnosticEngine.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -323,16 +323,18 @@ static bool isInterestingTypealias(Type type) {
323323
if (type->is<BuiltinType>())
324324
return false;
325325

326-
auto underlyingTy = aliasTy->getDecl()->getUnderlyingTypeLoc().getType();
326+
auto aliasDecl = aliasTy->getDecl();
327327

328-
// A typealias that directly points at Builtin.AnyObject is not
329-
// 'interesting', since it is in fact the AnyObject typealias in
330-
// the standard library.
331-
if (underlyingTy->isAnyObject() &&
332-
isa<ProtocolCompositionType>(underlyingTy.getPointer()))
328+
// The 'Swift.AnyObject' typealias is not 'interesting'.
329+
if (aliasDecl->getName() ==
330+
aliasDecl->getASTContext().getIdentifier("AnyObject") &&
331+
aliasDecl->getParentModule()->isStdlibModule()) {
333332
return false;
333+
}
334+
335+
auto underlyingTy = aliasDecl->getUnderlyingTypeLoc().getType();
334336

335-
if (aliasTy->getDecl()->isCompatibilityAlias())
337+
if (aliasDecl->isCompatibilityAlias())
336338
return isInterestingTypealias(underlyingTy);
337339

338340
return true;

0 commit comments

Comments
 (0)