Repository: numpy/numpy
File: numpy/typing/tests/data/reveal/ma.pyi (Python)

Code before:
assert_type(MAR_o - AR_LIKE_o, Any)

assert_type(AR_LIKE_b - MAR_o, Any)
assert_type(AR_LIKE_u - MAR_o, Any)
assert_type(AR_LIKE_i - MAR_o, Any)
assert_type(AR_LIKE_f - MAR_o, Any)
assert_type(AR_LIKE_c - MAR_o, Any)
assert_type(AR_LIKE_td64 - MAR_o, Any)
assert_type(AR_LIKE_dt64 - MAR_o, Any)
assert_type(AR_LIKE_o - MAR_o, Any)

# Masked Array multiplication

assert_type(MAR_b * AR_LIKE_u, MaskedArray[np.uint32])
assert_type(MAR_b * AR_LIKE_i, MaskedArray[np.signedinteger])
assert_type(MAR_b * AR_LIKE_f, MaskedArray[np.floating])
assert_type(MAR_b * AR_LIKE_c, MaskedArray[np.complexfloating])
assert_type(MAR_b * AR_LIKE_td64, MaskedArray[np.timedelta64])
assert_type(MAR_b * AR_LIKE_o, Any)

# assert_type(AR_LIKE_u * MAR_b, MaskedArray[np.uint32])
# assert_type(AR_LIKE_i * MAR_b, MaskedArray[np.signedinteger])
# assert_type(AR_LIKE_f * MAR_b, MaskedArray[np.floating])
# assert_type(AR_LIKE_c * MAR_b, MaskedArray[np.complexfloating])
# assert_type(AR_LIKE_td64 * MAR_b, MaskedArray[np.timedelta64])
# assert_type(AR_LIKE_o * MAR_b, Any)

assert_type(MAR_u4 * AR_LIKE_b, MaskedArray[np.uint32])
assert_type(MAR_u4 * AR_LIKE_u, MaskedArray[np.unsignedinteger])
assert_type(MAR_u4 * AR_LIKE_i, MaskedArray[np.signedinteger])
assert_type(MAR_u4 * AR_LIKE_f, MaskedArray[np.floating])
assert_type(MAR_u4 * AR_LIKE_c, MaskedArray[np.complexfloating])
assert_type(MAR_u4 * AR_LIKE_td64, MaskedArray[np.timedelta64])
assert_type(MAR_u4 * AR_LIKE_o, Any)

# assert_type(AR_LIKE_b * MAR_u4, MaskedArray[np.uint32])
# assert_type(AR_LIKE_u * MAR_u4, MaskedArray[np.unsignedinteger])
# assert_type(AR_LIKE_i * MAR_u4, MaskedArray[np.signedinteger])
# assert_type(AR_LIKE_f * MAR_u4, MaskedArray[np.floating])
# assert_type(AR_LIKE_c * MAR_u4, MaskedArray[np.complexfloating])
# assert_type(AR_LIKE_td64 * MAR_u4, MaskedArray[np.timedelta64])
# assert_type(AR_LIKE_o * MAR_u4, Any)

assert_type(MAR_i8 * AR_LIKE_b, MaskedArray[np.int64])
assert_type(MAR_i8 * AR_LIKE_u, MaskedArray[np.signedinteger])
assert_type(MAR_i8 * AR_LIKE_i, MaskedArray[np.signedinteger])
assert_type(MAR_i8 * AR_LIKE_f, MaskedArray[np.floating])
assert_type(MAR_i8 * AR_LIKE_c, MaskedArray[np.complexfloating])
assert_type(MAR_i8 * AR_LIKE_td64, MaskedArray[np.timedelta64])
assert_type(MAR_i8 * AR_LIKE_o, Any)


Review comment (suggestion):
I can't get these commented-out ones to pass

The first one, for example, `AR_LIKE_u * MAR_b` is:
- exactly the reverse of `MAR_b * AR_LIKE_u`, which passes
- `MaskedArray.__mul__` has the following overload:
  ```python
  @overload
  def __mul__(self: _MaskedArray[np.bool], other: _ArrayLike[_NumberT], /) -> _MaskedArray[_NumberT]: ...  # type: ignore[overload-overlap]
  ```
  while `MaskedArray.__rmul__` has
  ```python
  @overload
  def __rmul__(self: _MaskedArray[np.bool], other: _ArrayLike[_NumberT], /) -> _MaskedArray[_NumberT]: ...  # type: ignore[overload-overlap]
  ```

Code after:
assert_type(MAR_o - AR_LIKE_o, Any)

assert_type(AR_LIKE_b - MAR_o, Any)
assert_type(AR_LIKE_u - MAR_o, Any)
assert_type(AR_LIKE_i - MAR_o, Any)
assert_type(AR_LIKE_f - MAR_o, Any)
assert_type(AR_LIKE_c - MAR_o, Any)
assert_type(AR_LIKE_td64 - MAR_o, Any)
assert_type(AR_LIKE_dt64 - MAR_o, Any)
assert_type(AR_LIKE_o - MAR_o, Any)

# Masked Array multiplication

assert_type(MAR_b * AR_LIKE_u, MaskedArray[np.uint32])
assert_type(MAR_b * AR_LIKE_i, MaskedArray[np.signedinteger])
assert_type(MAR_b * AR_LIKE_f, MaskedArray[np.floating])
assert_type(MAR_b * AR_LIKE_c, MaskedArray[np.complexfloating])
assert_type(MAR_b * AR_LIKE_td64, MaskedArray[np.timedelta64])
assert_type(MAR_b * AR_LIKE_o, Any)

# Ignore due to https://github.com/python/mypy/issues/19341
assert_type(AR_LIKE_u * MAR_b, MaskedArray[np.uint32])  # type: ignore[assert-type]
assert_type(AR_LIKE_i * MAR_b, MaskedArray[np.signedinteger])  # type: ignore[assert-type]
assert_type(AR_LIKE_f * MAR_b, MaskedArray[np.floating])  # type: ignore[assert-type]
assert_type(AR_LIKE_c * MAR_b, MaskedArray[np.complexfloating])  # type: ignore[assert-type]
assert_type(AR_LIKE_td64 * MAR_b, MaskedArray[np.timedelta64])  # type: ignore[assert-type]
assert_type(AR_LIKE_o * MAR_b, Any)  # type: ignore[assert-type]

assert_type(MAR_u4 * AR_LIKE_b, MaskedArray[np.uint32])
assert_type(MAR_u4 * AR_LIKE_u, MaskedArray[np.unsignedinteger])
assert_type(MAR_u4 * AR_LIKE_i, MaskedArray[np.signedinteger])
assert_type(MAR_u4 * AR_LIKE_f, MaskedArray[np.floating])
assert_type(MAR_u4 * AR_LIKE_c, MaskedArray[np.complexfloating])
assert_type(MAR_u4 * AR_LIKE_td64, MaskedArray[np.timedelta64])
assert_type(MAR_u4 * AR_LIKE_o, Any)

assert_type(MAR_i8 * AR_LIKE_b, MaskedArray[np.int64])
assert_type(MAR_i8 * AR_LIKE_u, MaskedArray[np.signedinteger])
assert_type(MAR_i8 * AR_LIKE_i, MaskedArray[np.signedinteger])
assert_type(MAR_i8 * AR_LIKE_f, MaskedArray[np.floating])
assert_type(MAR_i8 * AR_LIKE_c, MaskedArray[np.complexfloating])
assert_type(MAR_i8 * AR_LIKE_td64, MaskedArray[np.timedelta64])
assert_type(MAR_i8 * AR_LIKE_o, Any)

assert_type(MAR_f8 * AR_LIKE_b, MaskedArray[np.float64])
assert_type(MAR_f8 * AR_LIKE_u, MaskedArray[np.float64])
assert_type(MAR_f8 * AR_LIKE_i, MaskedArray[np.float64])
assert_type(MAR_f8 * AR_LIKE_f, MaskedArray[np.float64])
assert_type(MAR_f8 * AR_LIKE_c, MaskedArray[np.complexfloating])
assert_type(MAR_f8 * AR_LIKE_o, Any)