You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ChocoPy/pa2-tests/core/bad_nonlocal_global.py

26 lines
433 B

4 years ago
x:int = 1
y:int = 2
z:int = 3
def foo() -> object:
global x # OK
nonlocal y # No such nonlocal var
global w # No such global var
global int # No such global var
z:bool = True # OK
def bar() -> object:
global x # OK
nonlocal z # OK
nonlocal y # No such nonlocal var
global foo # No such global var
nonlocal bar # No such nonlocal var
pass
bar()
foo()