diff --git a/tensor-shapes/pyrefly-numpy-stubs/numpy-stubs/__init__.pyi b/tensor-shapes/pyrefly-numpy-stubs/numpy-stubs/__init__.pyi index 7cf497070f..bb897617cb 100644 --- a/tensor-shapes/pyrefly-numpy-stubs/numpy-stubs/__init__.pyi +++ b/tensor-shapes/pyrefly-numpy-stubs/numpy-stubs/__init__.pyi @@ -510,7 +510,13 @@ class bool_(generic): class float16(floating): ... class float32(floating): ... -class float64(floating): ... + +class float64(floating): + @overload + def __sub__(self, other: float, /) -> float64: ... + @overload + def __sub__(self, other: _NumberScalar, /) -> number: ... + class longdouble(floating): ... class complex64(complexfloating): ... class complex128(complexfloating): ... diff --git a/tensor-shapes/pyrefly-numpy-stubs/test/test_dtype_properties.py b/tensor-shapes/pyrefly-numpy-stubs/test/test_dtype_properties.py index 8a6ad3710e..24f37ec146 100644 --- a/tensor-shapes/pyrefly-numpy-stubs/test/test_dtype_properties.py +++ b/tensor-shapes/pyrefly-numpy-stubs/test/test_dtype_properties.py @@ -74,6 +74,7 @@ def test_numeric_scalar_operations() -> None: assert_type(float(real), float) assert_type(complex(complex_), complex) assert_shape((real**2).shape, ()) + assert_type(real - 1.0, np.float64) assert_shape((real * 1j).shape, ()) assert_type(1j * real, np.number | complex) assert_shape((complex_ / integer).shape, ())