A previous patch made Value::getType() be resilient to null values which was
considered to be too sweeping. This is a more targeted change which requires
deabstracting some templates.
A middle ground would be to make ValueTypeIterator be tolerant to null values.
Should this use a different variable name for the "Value op" argument to the lambda since there exists "Operation *op" as well? I was initially confused due to the name reuse here.