2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-21 17:34:03 +08:00
artiq/lit-test/py2llvm/typing/error_locals.py
whitequark 20e0e69358 Add support for function types and LambdaT.
Also fix scoping of Nonlocal.
2015-06-15 11:30:50 +03:00

36 lines
956 B
Python

# RUN: %python -m artiq.py2llvm.typing +diag %s >%t
# RUN: OutputCheck %s --file-to-check=%t
x = 1
def a():
# CHECK-L: ${LINE:+1}: error: cannot declare name 'x' as nonlocal: it is not bound in any outer scope
nonlocal x
def f():
y = 1
def b():
nonlocal y
# CHECK-L: ${LINE:+1}: error: name 'y' cannot be nonlocal and global simultaneously
global y
def c():
global y
# CHECK-L: ${LINE:+1}: error: name 'y' cannot be global and nonlocal simultaneously
nonlocal y
def d(y):
# CHECK-L: ${LINE:+1}: error: name 'y' cannot be a parameter and global simultaneously
global y
def e(y):
# CHECK-L: ${LINE:+1}: error: name 'y' cannot be a parameter and nonlocal simultaneously
nonlocal y
# CHECK-L: ${LINE:+1}: error: duplicate parameter 'x'
def f(x, x):
pass
# CHECK-L: ${LINE:+1}: error: variadic arguments are not supported
def g(*x):
pass