Inconsistent runtime type check of "initial" argument in graph.reachable
and graph.reachable_paths
#4951
Labels
graph.reachable
and graph.reachable_paths
#4951
The
graph.reachable
andgraph.reachable_paths
built-in functions seem to behave differently from other built-in functions at runtime, as providing an unsupported type as the second argument (the "initial" value) does not cause an undefined result, and does not render a runtime error with--strict-builtin-errors
provided. The declared type of theinitial
argument is either a set or an array, but this is never checked in the code.Other built-ins return either undefined on runtime type check failures, or an error if strict built-in errors is requested, e.g:
Discovered when porting these built-ins for Jarl, and while only a minor inconsistency/inconvenience in OPA, the runtime type checker there currently verifies the type of the arguments against the types declared for any given built-in in the plan definition. Fixing this here seems like the better option compared to hard coding a workaround for these two functions in any IR implementation.
The text was updated successfully, but these errors were encountered: