[Macros] Turn Macro into a declaration node.

Although the declaration of macros doesn't appear in Swift source code
that uses macros, they still operate as declarations within the
language. Rework `Macro` as `MacroDecl`, a generic value declaration,
which appropriate models its place in the language.

The vast majority of this change is in extending all of the various
switches on declaration kinds to account for macros.
This commit is contained in:
Doug Gregor
2022-11-13 12:21:29 -08:00
parent 4b87cb7b14
commit 5ab6b72604
39 changed files with 226 additions and 106 deletions

View File

@@ -24,7 +24,6 @@
#include "TypeChecker.h"
#include "swift/AST/GenericEnvironment.h"
#include "swift/AST/Initializer.h"
#include "swift/AST/Macro.h"
#include "swift/AST/ParameterList.h"
#include "swift/AST/ProtocolConformance.h"
#include "swift/AST/TypeCheckRequests.h"
@@ -2485,10 +2484,10 @@ Type ConstraintSystem::getTypeOfMacroReference(Identifier macroName,
// Open any the generic types.
OpenedTypeMap replacements;
openGeneric(macro->owningModule, macro->genericSignature,
openGeneric(macro->getParentModule(), macro->getGenericSignature(),
getConstraintLocator(anchor), replacements);
return openType(macro->signature, replacements);
return openType(macro->getInterfaceType(), replacements);
}
#endif