Skip to content

Commit a0ad1b9

Browse files
committed
Add a testcase with nested try
1 parent 6fafcde commit a0ad1b9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test-data/unit/check-redefine.test

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,21 @@ def exc_name() -> None:
150150
e = fn_exc(e)
151151
[builtins fixtures/exception.pyi]
152152

153+
[case testRedefineNestedInTry]
154+
# flags: --allow-redefinition
155+
156+
def fn_int(_: int) -> None: ...
157+
158+
try:
159+
try:
160+
...
161+
finally:
162+
a = ""
163+
a = 5 # E: Incompatible types in assignment (expression has type "int", variable has type "str")
164+
fn_int(a) # E: Argument 1 to "fn_int" has incompatible type "str"; expected "int"
165+
except:
166+
pass
167+
153168
[case testRedefineLocalWithinWith]
154169
# flags: --allow-redefinition
155170
def f() -> None:

0 commit comments

Comments
 (0)