We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd280d7 commit 1698884Copy full SHA for 1698884
lib/AST/Decl.cpp
@@ -512,6 +512,9 @@ static_assert(sizeof(checkSourceLocType(&ID##Decl::getLoc)) == 2, \
512
#include "swift/AST/DeclNodes.def"
513
if (isa<ModuleDecl>(this))
514
return SourceLoc();
515
+ // When the decl is context-free, we should get loc from source buffer.
516
+ if (!getDeclContext())
517
+ return getLocFromSource();
518
auto *File = cast<FileUnit>(getDeclContext()->getModuleScopeContext());
519
switch(File->getKind()) {
520
case FileUnitKind::Source:
0 commit comments