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

Propagate type narrowing to nested functions#15133

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
JukkaL merged 30 commits intomasterfromnested-func-optional
May 3, 2023
Merged
Changes from1 commit
Commits
Show all changes
30 commits
Select commitHold shift + click to select a range
e4ecb91
Add test case
JukkaLApr 24, 2023
05e3958
WIP debugging stuff
JukkaLApr 24, 2023
f3c87ca
Propagate narrowed types to nested functions in some cases
JukkaLApr 24, 2023
01e044d
Add test cases
JukkaLApr 24, 2023
eecc877
Support for and with statements
JukkaLApr 24, 2023
030457e
Test more
JukkaLApr 24, 2023
7968859
Fix nested functions
JukkaLApr 25, 2023
7603f24
Add unit tests
JukkaLApr 25, 2023
a81856a
More testing
JukkaLApr 25, 2023
c503b3c
Check if a match statement assigns to a variable
JukkaLApr 25, 2023
a601098
Support walrus expression
JukkaLApr 25, 2023
fe05131
Fix self check and isort
JukkaLApr 25, 2023
9d0b478
Add docstrings
JukkaLApr 25, 2023
639a9a1
Minor tweak to test
JukkaLApr 25, 2023
6dbf9f1
Refactoring and comment updates
JukkaLApr 25, 2023
d463240
More refactoring
JukkaLApr 25, 2023
77b67df
Test narrowing multiple variables
JukkaLApr 25, 2023
339ae64
Add another test case
JukkaLApr 25, 2023
56c3f3a
Don't leak frames + add assert to find frame leaks
JukkaLApr 25, 2023
24faaa5
Test method
JukkaLApr 25, 2023
ecc2d34
Fix mypyc build
JukkaLApr 25, 2023
67098aa
Update mypy/literals.py
JukkaLApr 25, 2023
25cafbd
Fix tests when using compiled mypy
JukkaLApr 25, 2023
40f3b53
Fix unused import
JukkaLApr 25, 2023
4bfb5f1
Actually fix compiled mypy
JukkaLApr 25, 2023
0c4dce4
Add more tests for reading narrowed variable after nested function
JukkaLApr 26, 2023
4fe08c2
Fix dealing with member and index expressions after nested function
JukkaLApr 26, 2023
dc6516e
Merge branch 'master' into nested-func-optional
JukkaLMay 2, 2023
c323e06
Fix test case
JukkaLMay 2, 2023
c350905
More tests
JukkaLMay 3, 2023
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
NextNext commit
Add test case
  • Loading branch information
@JukkaL
JukkaL committedApr 25, 2023
commite4ecb91ea868c20c022daf1edbd76426bfce32a2
18 changes: 18 additions & 0 deletionstest-data/unit/check-optional.test
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1040,3 +1040,21 @@ x: Optional[List[int]]
if 3 in x:
pass

[case testNestedFunction]
from typing import Optional

def f1(x: Optional[str]) -> None:
if x is None:
x = "a"
def nested() -> str:
return reveal_type(x)
nested()

def f2(x: Optional[str]) -> None:
if x is None:
x = "a"
def nested() -> str:
return x # E: Incompatible return value type (got "Optional[str]", expected "str")
if int():
x = None
nested()

[8]ページ先頭

©2009-2025 Movatter.jp