@@ -477,6 +477,7 @@ Expr *swift::expandMacroExpr(
477
477
auto macroSourceFile = new (ctx) SourceFile (
478
478
*dc->getParentModule (), SourceFileKind::MacroExpansion, macroBufferID,
479
479
/* parsingOpts=*/ {}, /* isPrimary=*/ false );
480
+ macroSourceFile->setImports (sourceFile->getImports ());
480
481
481
482
// Retrieve the parsed expression from the list of top-level items.
482
483
auto topLevelItems = macroSourceFile->getTopLevelItems ();
@@ -655,6 +656,7 @@ bool swift::expandFreestandingDeclarationMacro(
655
656
auto macroSourceFile = new (ctx) SourceFile (
656
657
*dc->getParentModule (), SourceFileKind::MacroExpansion, macroBufferID,
657
658
/* parsingOpts=*/ {}, /* isPrimary=*/ false );
659
+ macroSourceFile->setImports (sourceFile->getImports ());
658
660
659
661
PrettyStackTraceDecl debugStack (
660
662
" type checking expanded declaration macro" , med);
@@ -832,6 +834,7 @@ void swift::expandAccessors(
832
834
auto macroSourceFile = new (ctx) SourceFile (
833
835
*dc->getParentModule (), SourceFileKind::MacroExpansion, macroBufferID,
834
836
/* parsingOpts=*/ {}, /* isPrimary=*/ false );
837
+ macroSourceFile->setImports (declSourceFile->getImports ());
835
838
836
839
PrettyStackTraceDecl debugStack (
837
840
" type checking expanded declaration macro" , storage);
@@ -1014,6 +1017,7 @@ void swift::expandAttributes(CustomAttr *attr, MacroDecl *macro, Decl *member,
1014
1017
auto macroSourceFile = new (ctx) SourceFile (
1015
1018
*dc->getParentModule (), SourceFileKind::MacroExpansion, macroBufferID,
1016
1019
/* parsingOpts=*/ {}, /* isPrimary=*/ false );
1020
+ macroSourceFile->setImports (declSourceFile->getImports ());
1017
1021
1018
1022
PrettyStackTraceDecl debugStack (
1019
1023
" type checking expanded declaration macro" , member);
0 commit comments