It will match the wrong op, and thus then cast the result to the wrong return type.
This is a danger with how the type-safe namespace signatures are currently set up. We made the decision to allow the ops matcher some flexibility in which op gets matched. However, they do not constrain the return type to match that expected, nor even test it before casting. Fortunately, the Ops matcher can constrain the return type, so let's do that!
Consider the following ops:
These currently would have following built-in methods in the
FruitNamespace
:Now suppose we have a hybrid type:
And we run the following code:
It will match the wrong op, and thus then cast the result to the wrong return type.
This is a danger with how the type-safe namespace signatures are currently set up. We made the decision to allow the ops matcher some flexibility in which op gets matched. However, they do not constrain the return type to match that expected, nor even test it before casting. Fortunately, the Ops matcher can constrain the return type, so let's do that!