@@ -7826,3 +7826,36 @@ class D:
78267826 # and that's what matters.
78277827 a, b = self.f() # E: "C" has no attribute "__iter__" (not iterable)
78287828[builtins fixtures/tuple.pyi]
7829+
7830+ [case testUsingNumbersType]
7831+ from numbers import Number, Complex, Real, Rational, Integral
7832+
7833+ def f1(x: Number) -> None: pass
7834+ f1(1) # E: Argument 1 to "f1" has incompatible type "int"; expected "Number" \
7835+ # N: Types from "numbers" aren't supported for static type checking \
7836+ # N: See https://peps.python.org/pep-0484/#the-numeric-tower \
7837+ # N: Consider using a protocol instead, such as typing.SupportsFloat
7838+
7839+ def f2(x: Complex) -> None: pass
7840+ f2(1) # E: Argument 1 to "f2" has incompatible type "int"; expected "Complex" \
7841+ # N: Types from "numbers" aren't supported for static type checking \
7842+ # N: See https://peps.python.org/pep-0484/#the-numeric-tower \
7843+ # N: Consider using a protocol instead, such as typing.SupportsFloat
7844+
7845+ def f3(x: Real) -> None: pass
7846+ f3(1) # E: Argument 1 to "f3" has incompatible type "int"; expected "Real" \
7847+ # N: Types from "numbers" aren't supported for static type checking \
7848+ # N: See https://peps.python.org/pep-0484/#the-numeric-tower \
7849+ # N: Consider using a protocol instead, such as typing.SupportsFloat
7850+
7851+ def f4(x: Rational) -> None: pass
7852+ f4(1) # E: Argument 1 to "f4" has incompatible type "int"; expected "Rational" \
7853+ # N: Types from "numbers" aren't supported for static type checking \
7854+ # N: See https://peps.python.org/pep-0484/#the-numeric-tower \
7855+ # N: Consider using a protocol instead, such as typing.SupportsFloat
7856+
7857+ def f5(x: Integral) -> None: pass
7858+ f5(1) # E: Argument 1 to "f5" has incompatible type "int"; expected "Integral" \
7859+ # N: Types from "numbers" aren't supported for static type checking \
7860+ # N: See https://peps.python.org/pep-0484/#the-numeric-tower \
7861+ # N: Consider using a protocol instead, such as typing.SupportsFloat
0 commit comments