# mode: error
# tag: cpp, cpp11, pthread
# cython: experimental_cpp_class_def=True, language_level=2

cdef cypclass A checklock:
    int a
    int getter(const self):
        return self.a
    void setter(self, int a):
        self.a = a

def incorrect_locks():
    obj = A()
    obj.a = 3
    obj.getter()
    with rlocked obj:
        obj.setter(42)
    return obj.a


_ERRORS = u"""
8:15: Reference 'self' is not correctly locked in this expression (read lock required)
10:8: Reference 'self' is not correctly locked in this expression (write lock required)
14:4: Reference 'obj' is not correctly locked in this expression (write lock required)
18:11: Reference 'obj' is not correctly locked in this expression (read lock required)
"""
