Skip to content

Commit 173b78b

Browse files
authored
Merge pull request #2695 from ahoppen/deprecate-lexical-context-default-implementation
Properly deprecate default implementation of `MacroExpansionContext.lexicalContext`
2 parents ebab3ea + 1c87ea5 commit 173b78b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/SwiftSyntaxMacros/MacroExpansionContext.swift

+7
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)