ruff/crates/ty_python_semantic/src
InSync 46be305ad2
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
[ty] Include synthesized arguments in displayed counts for too-many-positional-arguments (#18098)
## Summary

Resolves [#290](https://github.com/astral-sh/ty/issues/290).

All arguments, synthesized or not, are now accounted for in
`too-many-positional-arguments`'s error message.

For example, consider this example:

```python
class C:
	def foo(self): ...

C().foo(1)  # !!!
```

Previously, ty would say:

> Too many positional arguments to bound method foo: expected 0, got 1

After this change, it will say:

> Too many positional arguments to bound method foo: expected 1, got 2

This is what Python itself does too:

```text
Traceback (most recent call last):
  File "<python-input-0>", line 3, in <module>
    C().foo()
    ~~~~~~~^^
TypeError: C.foo() takes 0 positional arguments but 1 was given
```

## Test Plan

Markdown tests.
2025-05-14 22:51:23 -04:00
..
module_resolver Update --python to accept paths to executables in virtual environments (#17954) 2025-05-12 15:39:04 -05:00
semantic_index [ty] Reduce log level of 'symbol .. (via star import) not found' log message (#18087) 2025-05-14 09:20:23 +02:00
types [ty] Include synthesized arguments in displayed counts for too-many-positional-arguments (#18098) 2025-05-14 22:51:23 -04:00
util Use #[expect(lint)] over #[allow(lint)] where possible (#17822) 2025-05-03 21:20:31 +02:00
ast_node_ref.rs Use #[expect(lint)] over #[allow(lint)] where possible (#17822) 2025-05-03 21:20:31 +02:00
db.rs [ty] Update salsa (#17964) 2025-05-09 11:54:07 +02:00
dunder_all.rs [ty] Update salsa (#17964) 2025-05-09 11:54:07 +02:00
lib.rs [ty] Add support for __all__ (#17856) 2025-05-07 21:42:42 +05:30
lint.rs [ty] Ignore possibly-unresolved-reference by default (#17934) 2025-05-08 17:44:56 +02:00
list.rs Use #[expect(lint)] over #[allow(lint)] where possible (#17822) 2025-05-03 21:20:31 +02:00
module_name.rs Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
node_key.rs Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
program.rs Update --python to accept paths to executables in virtual environments (#17954) 2025-05-12 15:39:04 -05:00
python_platform.rs Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
semantic_index.rs [ty] Update salsa (#17964) 2025-05-09 11:54:07 +02:00
semantic_model.rs Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
site_packages.rs [ty] Do not allow invalid virtual environments from discovered .venv or VIRTUAL_ENV (#18003) 2025-05-10 20:36:12 +00:00
suppression.rs [ty] Update salsa (#17964) 2025-05-09 11:54:07 +02:00
symbol.rs [ty] Check assignments to implicit global symbols are assignable to the types declared on types.ModuleType (#18077) 2025-05-13 16:37:20 -04:00
types.rs [ty] Fix normalization of unions containing instances parameterized with unions (#18112) 2025-05-14 22:48:33 -04:00
unpack.rs [ty] Update salsa (#17964) 2025-05-09 11:54:07 +02:00