Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkexpr: broader fast path for literal container expressions #14274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

huguesb
Copy link
Contributor

@huguesb huguesb commented Dec 10, 2022

The original implementation was very conservative and bailed whenever a type context
was present, drastically limiting its reach.

There are a number of type contexts where the fast path can safely be taken.
Most importantly:

  • Any
  • matching container types

Fixes #14271

@github-actions

This comment has been minimized.

The original implementation was very conservative and bailed whenever a type context
was present, drastically limiting its reach.

There are a number of type contexts where the fast path can safely be taken.
Most importantly:
 - Any
 - matching container types
@github-actions
Copy link
Contributor

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

cwltool (https://github.com/common-workflow-language/cwltool)
+ cwltool/builder.py: note: In member "generate_arg" of class "Builder":
+ cwltool/builder.py:625:24: error: Redundant cast to "List[str]"  [redundant-cast]

core (https://github.com/home-assistant/core)
- homeassistant/components/litterrobot/sensor.py:83: error: Returning Any from function declared to return "bool"  [no-any-return]
- homeassistant/components/litterrobot/sensor.py:89: error: Returning Any from function declared to return "bool"  [no-any-return]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wildly inconsistent performance for seemingly trivial changes to source code
3 participants