Content-Length: 347392 | pFad | http://github.com/python/mypy/pull/18727/commits/69fd839512f0f67f08a917a677d784cf95f805df

AC Add flag to allow more flexible variable redefinition by JukkaL · Pull Request #18727 · python/mypy · GitHub
Skip to content

Add flag to allow more flexible variable redefinition #18727

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

Merged
merged 84 commits into from
Mar 19, 2025
Merged
Changes from 1 commit
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
9735391
WIP some initial prototyping
JukkaL Jan 3, 2025
946d4d5
WIP add failing test case
JukkaL Jan 28, 2025
7f7e25f
WIP minimal support for merging control flow
JukkaL Jan 29, 2025
0c9f049
Add globals test case
JukkaL Jan 29, 2025
9935537
Add class body test case
JukkaL Jan 29, 2025
fd12f85
Require --local-partial-types
JukkaL Jan 29, 2025
b489b6a
Fix optional types
JukkaL Jan 29, 2025
d2b7558
Add partial type test cases
JukkaL Jan 29, 2025
63bf0af
Pass options consistently
JukkaL Jan 29, 2025
ec02654
Fix interaction with Final
JukkaL Jan 29, 2025
4290857
Add annotated variable test case
JukkaL Jan 29, 2025
5c8ab17
Add test
JukkaL Jan 29, 2025
c116451
Add failing test
JukkaL Jan 29, 2025
9794308
Only use type context in assignment if inference fails without type c…
JukkaL Jan 30, 2025
a355473
Always use type annotation as context
JukkaL Jan 30, 2025
8162a45
Add while loop test case
JukkaL Jan 31, 2025
b1f75a7
Fix type inference in loops
JukkaL Jan 31, 2025
62dfbb0
Update tests
JukkaL Feb 5, 2025
bb6a246
Remove underscore special case
JukkaL Feb 5, 2025
51c61c7
Don't perform renaming when using new semantics
JukkaL Feb 5, 2025
0384795
Fix for loops
JukkaL Feb 6, 2025
a003c83
WIP failing tests
JukkaL Feb 6, 2025
a35870e
Add try/except test case
JukkaL Feb 6, 2025
dea9148
Add match statement test
JukkaL Feb 6, 2025
2b104dc
Add simple nested function test case
JukkaL Feb 6, 2025
6a05baf
Update globals tests case
JukkaL Feb 6, 2025
b58be6a
Add assignment expression test case
JukkaL Feb 6, 2025
5b31950
Add lambda test case
JukkaL Feb 6, 2025
bcaace1
Tests for imports
JukkaL Feb 6, 2025
ad90125
Add operator assignment test case
JukkaL Feb 6, 2025
106577d
WIP add break/continue tests (failing)
JukkaL Feb 6, 2025
ea6f13b
WIP del test (failing)
JukkaL Feb 6, 2025
71deb24
Add return test (failing)
JukkaL Feb 7, 2025
b3cc74a
Fix binder issues
JukkaL Feb 7, 2025
172bcf2
Various binder fixes and test updates
JukkaL Feb 10, 2025
9353132
Add default arg test case
JukkaL Feb 10, 2025
13b7aa3
Add max iterations check to processing loops
JukkaL Feb 10, 2025
f1223df
Fix try statement within loop
JukkaL Feb 10, 2025
d4445de
Fix indexed literals
JukkaL Feb 10, 2025
b3b1e9e
Put types of parameters and annotated variables to the binder
JukkaL Feb 10, 2025
06ed1e9
Fix self check
JukkaL Feb 10, 2025
9f48a19
Update tests
JukkaL Feb 10, 2025
f5a1915
Improve repr of Var nodes
JukkaL Feb 12, 2025
6ca4d76
Fix match statements by reusing dummy Var node
JukkaL Feb 12, 2025
9fde15f
Fix crash from inferring union with partial type item
JukkaL Feb 12, 2025
abf4eac
Add tests
JukkaL Feb 12, 2025
71cdb61
Add test cases for "del"
JukkaL Feb 12, 2025
69fca07
Rename flag to --allow-redefinition-new
JukkaL Feb 20, 2025
5ee1868
Rename tests
JukkaL Feb 20, 2025
b8a106d
Suppress from --help, since this is experimental
JukkaL Feb 20, 2025
bf75cc4
Add and update tests
JukkaL Feb 20, 2025
9585353
Minor tweaks
JukkaL Feb 20, 2025
0efa85d
Refactor
JukkaL Feb 20, 2025
4af080c
Black and ruff
JukkaL Feb 20, 2025
c478514
More tweaks
JukkaL Feb 20, 2025
fb9421f
Prevent wideding of variable defined in outer scope
JukkaL Feb 21, 2025
a29a3dc
Add comment
JukkaL Feb 21, 2025
ff7557b
Fix issue
JukkaL Feb 21, 2025
10b6082
Some polish
JukkaL Feb 21, 2025
e8789e0
Don't widen final variables
JukkaL Feb 21, 2025
9494ddc
Fix incremental mode
JukkaL Feb 21, 2025
fed6d45
Simplify
JukkaL Feb 21, 2025
aaefd4b
Detect invalid per-module options
JukkaL Feb 21, 2025
d7c35e4
Fix typo
JukkaL Feb 24, 2025
5bd6def
Skip failing match statement test on 3.9
JukkaL Feb 24, 2025
3e38e7d
Don't infer infinitely complex types in loops
JukkaL Feb 27, 2025
65f4785
WIP add failing test cases
JukkaL Mar 12, 2025
179b846
Avoid inferring a partial type for "_"
JukkaL Mar 12, 2025
2b711e2
Fix binder issue with unions containing Any
JukkaL Mar 12, 2025
14524fe
Improve error message
JukkaL Mar 12, 2025
37098d6
Address review
JukkaL Mar 12, 2025
808f6e3
Address more review comments
JukkaL Mar 12, 2025
4317961
Update comment
JukkaL Mar 12, 2025
460ebe4
Update comments
JukkaL Mar 12, 2025
2c6a144
Address more comments
JukkaL Mar 12, 2025
daf9c75
Add TODO comments
JukkaL Mar 12, 2025
69fd839
TEMPORARY: Enable --allow-redefinition-new and --local-partial-types
JukkaL Mar 12, 2025
a5adfd7
Preserve TypedDicty type context more aggressively for backward compat
JukkaL Mar 14, 2025
2dba308
Backward compatibility fix
JukkaL Mar 14, 2025
ac852e6
Fix self check
JukkaL Mar 14, 2025
a64fe4d
Don't allow globals to be widened in other modules
JukkaL Mar 17, 2025
24afddd
TEMPORARY: enable --local-partial-types in mypy_primer
JukkaL Mar 17, 2025
089fb79
Revert "TEMPORARY: enable --local-partial-types in mypy_primer"
JukkaL Mar 17, 2025
04fe416
Revert "TEMPORARY: Enable --allow-redefinition-new and --local-partia…
JukkaL Mar 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TEMPORARY: Enable --allow-redefinition-new and --local-partial-types
This lets us see the impact on mypy primer.
  • Loading branch information
JukkaL committed Mar 12, 2025
commit 69fd839512f0f67f08a917a677d784cf95f805df
4 changes: 2 additions & 2 deletions mypy/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def __init__(self) -> None:

# Allow flexible variable redefinition with an arbitrary type, in different
# blocks and and at different nesting levels
self.allow_redefinition_new = False
self.allow_redefinition_new = True

# Prohibit equality, identity, and container checks for non-overlapping types.
# This makes 1 == '1', 1 in ['1'], and 1 is '1' errors.
Expand Down Expand Up @@ -361,7 +361,7 @@ def __init__(self) -> None:
self.dump_deps = False
self.logical_deps = False
# If True, partial types can't span a module top level and a function
self.local_partial_types = False
self.local_partial_types = True
# Some behaviors are changed when using Bazel (https://bazel.build).
self.bazel = False
# If True, export inferred types for all expressions as BuildResult.types
Expand Down
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/mypy/pull/18727/commits/69fd839512f0f67f08a917a677d784cf95f805df

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy