Skip to content

core: return-type derivation cannot read integer_parameter from a value argument, so strptime_* and assume_timezone precision returns are not derivable #1329

Description

@nielspardon

Split out of #1242, whose return-program evaluator landed in #1288 and derives eleven of the fifteen pinned variants. The remaining four are blocked by something else:

strptime_time:str_str_i8
strptime_timestamp:str_str_i8
strptime_timestamp:str_str_str_i8
assume_timezone:date_str_i8

Each of these return programs reads integer_parameter(precision), where precision names a value argument (the i8) rather than a type parameter. The output precision therefore depends on the argument's value, not its type. SimpleExtension.Function.resolveType(List<Type>) only receives argument types, so nothing ever binds precision, and derivation fails with UnsupportedOperationException: Unbound type parameter 'precision' in return-type expression. ParameterizedReturnTypeTest pins that failure on main.

What the work is

The derivation needs access to the values of constant arguments, not only their types. Two things have to be decided:

  • API shape: add an overload that takes the argument expressions (or the literal values of constant arguments) next to the existing resolveType(List<Type>), so callers that only have types keep working.
  • Non-constant arguments: when the precision argument is not a literal, the return type cannot be derived. The overload should say so explicitly rather than fall back to a guess.

Before choosing, check what the spec says about integer_parameter on a value argument and how the sibling bindings handle it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions