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
Add optional tz parameter to datetime_now and reject extra positional args (#725)
### Problem
`datetime.now(timezone.utc)` caused an arity mismatch because the
prelude's `datetime_now` declared 0 parameters while the Python call
passed 1 argument. This surfaced as a "call [end_time] :=
datetime_now($hole_12($heap_in))" error in check_storage_costs.
### Approach
Rather than silently dropping extra positional arguments (which could
mask real bugs), we model the missing optional parameter in the prelude
and add an arity check that rejects extra positional arguments for all
functions.
**Prelude changes:**
- Add `tz: Any` parameter to `datetime_now` in the Laurel prelude
- Add `tz: AnyOrNone` parameter to `datetime_now` in the Core prelude
and FunctionSignatures
**Arity checking:**
`combinePositionalAndKeywordArgs` now raises a user error when a call
passes more positional arguments than the function signature declares,
for both user-defined and prelude functions alike
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
---------
Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
0 commit comments