-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Cleanup initializer grammar #1441
Conversation
30bce8b
to
b4fb52a
Compare
faaf734
to
332d4ad
Compare
332d4ad
to
b362c31
Compare
The and syntax for parameter assignments are now not handled at all - this causes errors with generic types and is inconsistent with C++ syntax. Todo add warning Default parameters are now not generated anymore instead of copying the expression to the call site
Some things do not work properly now: - out-of-order default parameters - implicit conversion of argument to parameter type These should be fixed by generating the parameters into a struct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR is taking shape now and I will mark it as ready for review. We still have to fix a couple of tests though.
I fixed the C++ tests (for the most parts) and we now have passing tests for C, C++, and Python. There is still a couple of Windows tests failing which I will look into.
@oowekyala There appears to be a problem with multiports in Rust. Cold you take a look? This could be related to the fact that the rust generator uses toCppCode
on the width.
@petervdonovan could I ask you to help with the failing unit tests (round trip) and the failing LSP tests? I don't understand why the unit test fails. It seems to insert some erroneous code into one of our test files but then expects the file to parse. For the LSP test, I was not able to find the actual error in the log. I am not sure what I need to search for her, but 'error' or 'fail' does not work. It would be great if we could further improve the outputs of theses tests so that the log clearly states where the error happened and also points to how it could be fixed.
@lhstrh The TS tests fail and likely the TS generators still need to be updated. Who could help with this?
If they have a chance, perhaps @hokeun or @byeong-gil could have a look at the TypeScript tests? |
Thanks for your fix @petervdonovan! So the round trip tests apply the formatting to our tests and check if the result is still valid LF? |
Actually I just fixed the TS tests. It turned out to be a simple fix. Sorry for the noise! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like all the tests pass now. As far as I am concerned, this is ready to be merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pushing this forward @cmnrd!
org.lflang/src/org/lflang/generator/cpp/CppInstanceGenerator.kt
Outdated
Show resolved
Hide resolved
org.lflang/src/org/lflang/generator/cpp/CppStandaloneCmakeGenerator.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This substantially cleans up and adds tests for some code that I left and the cleanups in the grammar look good to me. I was not able to find mistakes
Changes extracted from #544.
This does not change the LF language, it just introduces the node
Initializer
to fold some duplicated code in the grammar file. Later this can be changed to support the new=
syntax described in #986Since the code generation in the C++ target needed to be updated to adjust to the grammar changes, we also used the opportunity to improve the handling of parameters in C++ and fix a couple of related issues along the way.
Fixes #419
Fixes #657
Fixes #605