Skip to content

Commit c18e9ca

Browse files
authored
Merge pull request #2698 from ahoppen/6.0/deprecate-lexical-context-default-implementation
[6.0] Properly deprecate default implementation of `MacroExpansionContext.lexicalContext`
2 parents 8edb81c + 8ed06a4 commit c18e9ca

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/SwiftSyntaxMacros/MacroExpansionContext.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,18 @@ extension MacroExpansionContext {
8888
return location(of: node, at: .afterLeadingTrivia, filePathMode: .fileID)
8989
}
9090

91+
#if compiler(>=6.0)
92+
@available(*, deprecated, message: "`MacroExpansionContext` conformance must implement `lexicalContext`")
93+
public var lexicalContext: [Syntax] {
94+
return []
95+
}
96+
#else
9197
public var lexicalContext: [Syntax] {
9298
fatalError(
9399
"`MacroExpansionContext` conformance must implement `lexicalContext`"
94100
)
95101
}
102+
#endif
96103
}
97104

98105
/// Diagnostic message used for thrown errors.

0 commit comments

Comments
 (0)