mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CodeCompletion] Don't suggest initializers on 'AnyObject'
'AnyObject' cannot be instantiated, we shouldn't be providing any initializers on 'AnyObject' type. 'AnyObject(<HERE>' and global completions with initializers (i.e. `addinitstotoplevel`) showed all initializers from objc classes. Note that, 'lookupVisibleMemberDecls()' on 'AnyObject' (i.e. 'AnyObject.<HERE>') doesn't return initializers even before this change. But 'QualifiedLookup' did. rdar://93059166
This commit is contained in:
@@ -365,6 +365,10 @@ static void collectPossibleCalleesByQualifiedLookup(
|
||||
if (!baseInstanceTy->mayHaveMembers())
|
||||
return;
|
||||
|
||||
// 'AnyObject' is not initializable.
|
||||
if (baseInstanceTy->isAnyObject() && name == DeclNameRef::createConstructor())
|
||||
return;
|
||||
|
||||
// Make sure we've resolved implicit members.
|
||||
namelookup::installSemanticMembersIfNeeded(baseInstanceTy, name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user