Empty Lexical Context When Expanding Expression Macro as Argument's Default Value #81749
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
I'm trying to use a freestanding expression macro as the default value of a function argument, as outlined in SE-0422. This macro accesses the lexical context, which is unfortunately empty when the macro is expanded as the default value to an argument. I can only get the lexical context when explicitly passing in the macro to the argument.
Reproduction
Client.swift
Macro.swift
Expected behavior
I would expect that the lexical context is passed to the macro even when the macro is expanded as the argument's default value, i.e.
useContext()
anduseContext(#_environmentValuesContext)
should yield the same result.Environment
Swift version 6.2-dev (LLVM f3274059e0a182e, Swift 442f25d)
Target: aarch64-unknown-linux-gnu
Build config: +assertions
Additional information
No response
The text was updated successfully, but these errors were encountered: