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.
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:
Each of these return programs reads
integer_parameter(precision), whereprecisionnames a value argument (thei8) 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 bindsprecision, and derivation fails withUnsupportedOperationException: Unbound type parameter 'precision' in return-type expression.ParameterizedReturnTypeTestpins 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:
resolveType(List<Type>), so callers that only have types keep working.Before choosing, check what the spec says about
integer_parameteron a value argument and how the sibling bindings handle it.