[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

@@ -13,7 +13,6 @@ func test() {
// RUN: %FileCheck -check-prefix=NAME_UNSORTED %s < %t.orig.off
// RUN: not %diff -u %t.orig %t.orig.off
// NAME_SORTED: key.name: "column"
// NAME_SORTED: key.name: "foo(a:)"
// NAME_SORTED-NOT: key.name:
// NAME_SORTED: key.name: "foo(a:)"
@@ -46,7 +45,6 @@ func test() {
// CONTEXT: key.name: "foo(b:)"
// CONTEXT-NOT: key.name:
// CONTEXT: key.name: "test()"
// CONTEXT: key.name: "column"
// CONTEXT: key.name: "complete_sort_order"
// RUN: %complete-test -tok=STMT_0 %s | %FileCheck %s -check-prefix=STMT
@@ -242,7 +240,3 @@ func test8() {
// CALLARG: String
// CALLARG: intVal
}
// REQUIRES: swift_swift_parser
// FIXME: Swift parser is not enabled on Linux CI yet.
// REQUIRES: OS=macosx