Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove unnecessary error message for match class patterns#19708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@cdce8p
Copy link
Collaborator

RemoveCannot determine type of ... error for class patterns if the class to match cannot be resolved. In these cases aName ... is not defined error is already emitted. The captured variable should simply be inferred asAny.

Previously, this was especially an issue for class matches to a class from an untyped library together with a MemberExpr. An example from pylint / astroid which shouldn't emit any errors:

fromtypingimportAnyfromastroidimportnodesdeffunc(var:Any)->None:matchvar:casenodes.Assign(targets=t):reveal_type(t)# Any

@cdce8pcdce8p added the topic-match-statementPython 3.10's match statement labelAug 21, 2025
@cdce8pcdce8pforce-pushed thematch-class-pattern-error branch from1026b0e toa9aa418CompareAugust 21, 2025 18:34
@github-actions
Copy link
Contributor

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

core (https://github.com/home-assistant/core)- homeassistant/components/onkyo/media_player.py:354: error: Cannot determine type of "volume"  [has-type]- homeassistant/components/onkyo/media_player.py:360: error: Cannot determine type of "muting"  [has-type]- homeassistant/components/onkyo/media_player.py:363: error: Cannot determine type of "source"  [has-type]- homeassistant/components/onkyo/media_player.py:364: error: Cannot determine type of "source"  [has-type]- homeassistant/components/onkyo/media_player.py:366: error: Cannot determine type of "source"  [has-type]- homeassistant/components/onkyo/media_player.py:383: error: Cannot determine type of "sound_mode"  [has-type]- homeassistant/components/onkyo/media_player.py:384: error: Cannot determine type of "sound_mode"  [has-type]- homeassistant/components/onkyo/media_player.py:386: error: Cannot determine type of "sound_mode"  [has-type]- homeassistant/components/onkyo/media_player.py:398: error: Cannot determine type of "hdmi_output"  [has-type]- homeassistant/components/onkyo/media_player.py:403: error: Cannot determine type of "preset"  [has-type]
cdce8p reacted with thumbs up emoji

@hauntsaninjahauntsaninja merged commit15b8ca9 intopython:masterAug 23, 2025
20 checks passed
@cdce8pcdce8p deleted the match-class-pattern-error branchAugust 23, 2025 04:32
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@hauntsaninjahauntsaninjahauntsaninja approved these changes

Assignees

No one assigned

Labels

topic-match-statementPython 3.10's match statement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@cdce8p@hauntsaninja

[8]ページ先頭

©2009-2025 Movatter.jp