2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-21 17:34:03 +08:00
artiq/lit-test/test/inferencer/error_locals.py
whitequark 862ac1f90d lit-test/compiler -> lit-test/test.
Other directories in lit-test will host various parts of
the test harness.
2015-07-27 04:13:29 +03:00

36 lines
971 B
Python

# RUN: %python -m artiq.compiler.testbench.inferencer +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