[code-completion] Strip outer nullability annotations when completing method implementations.
The outer nullability is transferred from the declaration to the implementation so including them is redundant. The inner ones are not transferred so they are kept to match the exact types. When we transfer the inner ones as well adding them in the implementation will become redundant and we should strip those as well. rdar://21737451 llvm-svn: 243119
This commit is contained in:
@@ -7079,11 +7079,13 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S,
|
||||
|
||||
// If the result type was not already provided, add it to the
|
||||
// pattern as (type).
|
||||
if (ReturnType.isNull())
|
||||
AddObjCPassingTypeChunk(Method->getSendResultType()
|
||||
.stripObjCKindOfType(Context),
|
||||
if (ReturnType.isNull()) {
|
||||
QualType ResTy = Method->getSendResultType().stripObjCKindOfType(Context);
|
||||
AttributedType::stripOuterNullability(ResTy);
|
||||
AddObjCPassingTypeChunk(ResTy,
|
||||
Method->getObjCDeclQualifier(), Context, Policy,
|
||||
Builder);
|
||||
}
|
||||
|
||||
Selector Sel = Method->getSelector();
|
||||
|
||||
@@ -7114,6 +7116,7 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S,
|
||||
ParamType = (*P)->getOriginalType();
|
||||
ParamType = ParamType.substObjCTypeArgs(Context, {},
|
||||
ObjCSubstitutionContext::Parameter);
|
||||
AttributedType::stripOuterNullability(ParamType);
|
||||
AddObjCPassingTypeChunk(ParamType,
|
||||
(*P)->getObjCDeclQualifier(),
|
||||
Context, Policy,
|
||||
|
||||
Reference in New Issue
Block a user