New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python target generates code that raises NameError #138

dahlia opened this Issue May 24, 2017 · 1 comment


None yet
2 participants

dahlia commented May 24, 2017

Python target generates code that raises NameError when a referring type is above than a referred type e.g.:

record a (b value);
record b (text value);

The above code generates a Python code like the following (though it's approximated, it shows a point):

class A:
    __nirum_field_types__ = {'value': B}  # B is not defined at the moment.

class B:
    __nirum_field_types__ = {'value': str}

This comment has been minimized.


dahlia commented Jun 21, 2017

We need to encode all forward references as string literals and get types always through typing.get_type_hints() function.

dahlia added a commit to dahlia/nirum-python that referenced this issue Jun 22, 2017

@dahlia dahlia closed this in 679c0a8 Jun 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment