@@ -1419,14 +1419,25 @@ bool CodeCompletionCallbacksImpl::trySolverCompletion(bool MaybeFuncBody) {
14191419 llvm::SaveAndRestore<TypeCheckCompletionCallback*>
14201420 CompletionCollector (Context.CompletionCallback , &Lookup);
14211421 if (AttrWithCompletion) {
1422- // / The attribute might not be attached to the AST if there is no var decl
1423- // / it could be attached to. Type check it standalone.
1424- ASTNode Call = CallExpr::create (
1425- CurDeclContext->getASTContext (), AttrWithCompletion->getTypeExpr (),
1426- AttrWithCompletion->getArgs (), /* implicit=*/ true );
1427- typeCheckContextAt (
1428- TypeCheckASTNodeAtLocContext::node (CurDeclContext, Call),
1429- CompletionLoc);
1422+ // / The attribute might not be attached to the AST if there is no var
1423+ // / decl it could be attached to. Type check it standalone.
1424+
1425+ // First try to check it as an attached macro.
1426+ auto resolvedMacro = evaluateOrDefault (
1427+ CurDeclContext->getASTContext ().evaluator ,
1428+ ResolveMacroRequest{AttrWithCompletion, CurDeclContext},
1429+ ConcreteDeclRef ());
1430+
1431+ // If that fails, type check as a call to the attribute's type. This is
1432+ // how, e.g., property wrappers are modelled.
1433+ if (!resolvedMacro) {
1434+ ASTNode Call = CallExpr::create (
1435+ CurDeclContext->getASTContext (), AttrWithCompletion->getTypeExpr (),
1436+ AttrWithCompletion->getArgs (), /* implicit=*/ true );
1437+ typeCheckContextAt (
1438+ TypeCheckASTNodeAtLocContext::node (CurDeclContext, Call),
1439+ CompletionLoc);
1440+ }
14301441 } else {
14311442 typeCheckContextAt (
14321443 TypeCheckASTNodeAtLocContext::declContext (CurDeclContext),
0 commit comments