-
Notifications
You must be signed in to change notification settings - Fork 47
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
Generated properties for non-nullable children should not be declared nullable #84
Comments
Did you ever find a way to get this one solved? |
The real answer is this is not possible, as the engine that looks for template parts does not differentiate between nullable or non-nullable tokens. You should open an issue upstream on the ANTLR4 repository, as other languages like Swift are affected. |
To expand and add more context.
The Swift target will generate:
Note the |
Agreed, let's close this one |
@ftomassetti can we reopen? Working in this. |
Sure, reopening |
For a rule like this:
There is no way with that grammar that the nested token could be null, but the property you get after compiling the grammar is:
So now I have to put
!!
all over my code to assert something the grammar is already supposed to be doing for me.The more insidious side of this issue is, I can't just put
!!
on all of them, because some of them really are nullable. And the nullability may change from time to time as the grammar evolves. So it would be nice if the generated code matched the actual grammar.The text was updated successfully, but these errors were encountered: