mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #81346 from rintaro/macros-definition-typecheck-ifconfig
[Macros] Don't include attr range when checking macro definition
This commit is contained in:
@@ -136,7 +136,7 @@ MacroDefinition MacroDefinitionRequest::evaluate(
|
||||
SM.getEntireTextForBuffer(sourceFile->getBufferID());
|
||||
StringRef macroDeclText =
|
||||
SM.extractText(Lexer::getCharSourceRangeFromSourceRange(
|
||||
SM, macro->getSourceRangeIncludingAttrs()));
|
||||
SM, macro->getSourceRange()));
|
||||
|
||||
auto checkResult = swift_Macros_checkMacroDefinition(
|
||||
&ctx.Diags, sourceFileText, macroDeclText, &externalMacroName,
|
||||
|
||||
@@ -234,3 +234,10 @@ func someGlobalNext(
|
||||
) async throws {
|
||||
fatalError()
|
||||
}
|
||||
|
||||
// This is testing if the definition is actually checked. The error means the '#externalMacro' was correctly parsed and checked.
|
||||
#if true
|
||||
@available(*, unavailable)
|
||||
#endif
|
||||
@freestanding(expression) public macro MacroWithIfConfigAttr() = #externalMacro(module: "ThisMacroModuleDoesNotExist", type: "ThisMacroTypeDoesNotExist")
|
||||
// expected-warning@-1{{external macro implementation type 'ThisMacroModuleDoesNotExist.ThisMacroTypeDoesNotExist'}}
|
||||
|
||||
Reference in New Issue
Block a user