mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 04:45:01 +00:00
![]() ## Summary Add better error messages and additional spans for method calls. Can be reviewed commit-by-commit. before: ``` error: lint:invalid-argument-type --> /home/shark/playground/test.py:6:10 | 5 | c = C() 6 | c.square("hello") # error: [invalid-argument-type] | ^^^^^^^ Object of type `Literal["hello"]` cannot be assigned to parameter 2 (`x`); expected type `int` 7 | 8 | # import inspect | ``` after: ``` error: lint:invalid-argument-type --> /home/shark/playground/test.py:6:10 | 5 | c = C() 6 | c.square("hello") # error: [invalid-argument-type] | ^^^^^^^ Object of type `Literal["hello"]` cannot be assigned to parameter 2 (`x`) of bound method `square`; expected type `int` 7 | 8 | # import inspect | ::: /home/shark/playground/test.py:2:22 | 1 | class C: 2 | def square(self, x: int) -> int: | ------ info: parameter declared in function definition here 3 | return x * x | ``` ## Test Plan New snapshot test |
||
---|---|---|
.. | ||
resources | ||
src | ||
tests | ||
build.rs | ||
Cargo.toml | ||
mdtest.py | ||
mdtest.py.lock |