Skip to content
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

Improved mypy type-checking for generated Python3 files. #4407

Closed
wants to merge 1 commit into from
Closed

Improved mypy type-checking for generated Python3 files. #4407

wants to merge 1 commit into from

Conversation

chwmilcon
Copy link

Antlr4's generated code for Python3 target had some misuse of slots. All the base objects were not using slots so derived objects from them didn't correctly enforce slots. slots were added to base objects. Additionally, a number of forward declarations were made as class_name = None, this causes issues with mypy when checking code. Imports and other forward declarations were added to correct this. Furthermore, return types and argument types were added to functions within runtime to contribute to mypy type checking. Emitted code was verified by generating a parser for java8 using python 3.11

@ericvergnaud
Copy link
Contributor

Hi. Thanks for this.
I'm seeing a lot of duplicate code in this PR, I guess this was machine generated ?
It's not currently mergeable, missing DCO, and the python 3 build now fails...

@chwmilcon
Copy link
Author

chwmilcon commented Sep 5, 2023 via email

@ericvergnaud
Copy link
Contributor

Yes I am referring to the duplicate imports
See https://github.com/antlr/antlr4/blob/dev/CONTRIBUTING.md for contributing policy
DCO means you need to sign-off your commits

@chwmilcon
Copy link
Author

This branch appears incomplete. Separation from private branch not done correctly.

@chwmilcon chwmilcon closed this Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants