-
Notifications
You must be signed in to change notification settings - Fork 249
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
Correction for short function syntax, closes #356 #359
Correction for short function syntax, closes #356 #359
Conversation
I can confirm that the original issue is solved with this. Thank you. |
Let me add that I'm not sure of the implications of this solution. I hadn't thought of IIFE for simple function expressions. I tested the following on branch Cpp2 code demonstrating the issue.
Should I open an issue for this? |
No need for a new issue as this is not yet merged. |
For the following code: c0: std::any = :() -> _ = { return 0; }
(); first line is cpp2, the second cpp1:
Nevertheless it should just inform that there is an issue with missing semicolon. |
I have pushed the fix - the issue is with the Line 2760 in f83ca9b
Lines 2787 to 2795 in f83ca9b
|
Now the error looks like the following:
|
Yes, with the build from 2b730e8. |
Current implementation does not work for the following code: ```cpp main: () = { :() = 1; [[assert: 1]] } ``` It fails with error: ``` error: subscript expression [ ] must not be empty (if you were trying to name a C-style array type, use 'std::array' instead) (at '[') ``` This change introduce small correction that moves back parsing to semicolon (to simulate double semicolon) for short syntax. It is not done in the following cases: ```cpp :() = 1;(); // imediatelly called lambda f(a,b,:() = 1;); // last argument in function call f(a,:() = 1;,c); // first or in the middle argument ``` After this change the original issue is solved. All regression tests pass. Closes hsutter#356
4b3283f
to
d737f9e
Compare
Looks good, thanks! |
Current implementation does not work for the following code: ```cpp main: () = { :() = 1; [[assert: 1]] } ``` It fails with error: ``` error: subscript expression [ ] must not be empty (if you were trying to name a C-style array type, use 'std::array' instead) (at '[') ``` This change introduce small correction that moves back parsing to semicolon (to simulate double semicolon) for short syntax. It is not done in the following cases: ```cpp :() = 1;(); // imediatelly called lambda f(a,b,:() = 1;); // last argument in function call f(a,:() = 1;,c); // first or in the middle argument ``` After this change the original issue is solved. All regression tests pass. Closes hsutter#356
The current implementation does not work for the following code:
It fails with the error:
This change introduces a minor correction that moves back parsing to a semicolon (to simulate a double semicolon) for short syntax.
It is not done in the following cases:
After this change, the original issue is solved.
All regression tests pass. Closes #356