[Completion] Only provide macro completions when they are valid

Only return macros that are valid in their current position, ie. an
attached macro is not valid on a nominal.

Also return freestanding expression macros in code block item position
and handle the new freestanding code item macros.

Resolves rdar://105563583.
This commit is contained in:
Ben Barham
2023-03-31 11:22:10 -07:00
parent 3e3a98f801
commit 31dee1ce1c
16 changed files with 508 additions and 208 deletions

View File

@@ -1167,9 +1167,9 @@ Completion *CompletionBuilder::finish() {
new (sink.allocator) ContextFreeCodeCompletionResult(
contextFreeBase.getKind(),
contextFreeBase.getOpaqueAssociatedKind(), opKind,
contextFreeBase.isSystem(), contextFreeBase.isAsync(),
contextFreeBase.hasAsyncAlternative(), newCompletionString,
contextFreeBase.getModuleName(),
contextFreeBase.getMacroRoles(), contextFreeBase.isSystem(),
contextFreeBase.isAsync(), contextFreeBase.hasAsyncAlternative(),
newCompletionString, contextFreeBase.getModuleName(),
contextFreeBase.getBriefDocComment(),
contextFreeBase.getAssociatedUSRs(),
contextFreeBase.getResultType(),