You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the expr.WithContext option, the named variable must also be provided at compilation time using expr.Env, otherwise the patch seems to fail to correctly update calls to functions that require a context. (I'm not exactly sure why this happens, but if it's necessary, perhaps we should document it?)
With the expr.Env line commented out, this will fail (see playground), and with it uncommented, it succeeds (see playground). The error produced at runtime is:
reflect: Call with too few input arguments (1:1)
| cancelled()
| ^
The text was updated successfully, but these errors were encountered:
swdunlop
changed the title
expr.WithContext Requires expr.Env
expr.WithContext requires expr.Env?
Feb 8, 2025
Since this error also happens if cancelled is not bound at compilation but is bound at run, playground, I assume the problem is that Patch cannot figure out the argument of the function at compilation time.
When using the
expr.WithContext
option, the named variable must also be provided at compilation time usingexpr.Env
, otherwise the patch seems to fail to correctly update calls to functions that require a context. (I'm not exactly sure why this happens, but if it's necessary, perhaps we should document it?)Reproduction:
With the
expr.Env
line commented out, this will fail (see playground), and with it uncommented, it succeeds (see playground). The error produced at runtime is:The text was updated successfully, but these errors were encountered: