Commit Graph

13 Commits

Author SHA1 Message Date
Holly Borla
d03ef5ad99 [Macros] Replace all uses of the ConformanceMacro protocol with ExtensionMacro. 2023-08-04 22:32:30 -07:00
Holly Borla
61e5811d73 [NFC] Update IDE, Index, ModuleInterface, and SourceKit tests to remove
conformance macros.
2023-07-19 12:38:52 -07:00
Ben Barham
9bc26cbf96 [Index] Include generic macro arguments
`ASTWalker` was missing a walk into the generic arguments for
freestanding declarations and expressions. `SemaAnnotator` was missing
the walk into the `TypeRepr` when walking over custom attributes.

Resolves rdar://110856428.
2023-06-27 16:34:44 -07:00
Holly Borla
83030a9c63 [Macros] Don't visit macro-generated extensions in 'visitAuxiliaryDecls'.
Macro-generated extensions are hoisted to file scope, because extensions are
not valid in nested scopes. Callers of 'visitAuxiliaryDecls' assume that the
auxiliary decls are in the same decl context as the original, which is clearly
not the case for extensions, and it leads to issues like visiting extension at
the wrong time during SILGen. The extensions are already added to the top-level
decls, so we don't need to visit them as auxiliary decls, and we can type-check
macro-expanded decls at the end of visitation in TypeCheckDeclPrimary.
2023-06-23 23:25:32 -07:00
Ben Barham
b3af130e90 [IDE] Visit auxiliary declarations if walking expansions
After visiting declarations, also walk into their auxiliary decls if
expansions are being walked.

Resolves rdar://109548265.
2023-06-07 20:02:06 -07:00
Doug Gregor
1ba67b9cac Update test cases for generic macros 2023-03-05 23:12:24 -08:00
Doug Gregor
f88d2c638f Clean up feature flags for macros.
Enable expression macros by default, and add separate feature flags for
attached and freestanding macros.
2023-03-02 14:34:59 -08:00
Richard Wei
01e4c8df26 [Macros] Use name lookup for lazy declaration macro expansion (#63411)
- Use the name lookup table instead of adding members from a macro expansion to the parent decl context.
- Require declaration macros to specify introduced names and used the declared names to guide macro expansions lazily.
2023-02-07 11:24:42 +08:00
Holly Borla
e3cd34ce82 [Macros] Fix macro index test. 2023-01-31 23:30:46 -08:00
Doug Gregor
3be6344619 Eliminate dependencies on _SwiftSyntaxMacros having actual macros in it 2022-12-14 16:13:48 -08:00
Rintaro Ishizaki
9f137074af [SourceKit/Refactoring] Macro expansion
Add refactoring "Expand Macro" that expands macro expressions.

rdar://102739026
2022-12-06 16:20:07 -08:00
Doug Gregor
e6ed154407 Macro tests only run in CI for macOS at the moment 2022-11-28 18:33:11 -08:00
Doug Gregor
c8819bd266 [Indexing] Index macro expansion expressions. 2022-11-28 18:33:10 -08:00