reworked type inference for operations