Skip to content

Conversation

@A5rocks
Copy link
Collaborator

@A5rocks A5rocks commented Oct 9, 2025

Fixes #20018.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@github-actions

This comment has been minimized.

@A5rocks
Copy link
Collaborator Author

A5rocks commented Oct 9, 2025

For the primer, (since I was confused about this for test results) this happens because there's no type annotations in the function signature so everything becomes Any, leading to Too many positional patterns for class pattern. Maybe I should remove that error for Any?

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe see if using type_info_from_type helps

@A5rocks
Copy link
Collaborator Author

A5rocks commented Oct 10, 2025

The issue was moreso that we didn't get __match_args__ for AnyType... but now hopefully the behavior is nicer. (This is an improvement over before, too!)

@A5rocks A5rocks changed the title Check class references to catch non-existant classes Check class references to catch non-existant classes in match cases Oct 10, 2025
@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

ibis (https://github.com/ibis-project/ibis)
- ibis/common/tests/test_grounds_py310.py:38: error: Too many positional patterns for class pattern  [misc]

@hauntsaninja hauntsaninja merged commit e03d3c1 into python:master Oct 10, 2025
20 checks passed
@A5rocks A5rocks deleted the check-class-references branch October 10, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False negative attr-defined in match case

3 participants