Open
Description
If the partial evaluator replaces one function call with another, it checks that the new function is well-typed for it's arguments. This only seems to be there as a sanity check/safeguard against bad implementation of partial evaluation. This safeguard doesn't even check the return type is correct, just that the function is callable.
Non-function evaluations (such as when the result is evaluated all the way down to a literal value) are not checked at all.
If we'd like to keep this kind of check, it would be more useful throw an exception instead of silently suppressing the invalid partial evaluation.
Originally discussed with @nhuurre in #1115 (comment)