You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix removing parentheses when using deducing assignement
The issue is caused by `emit(expression_list_node)` that skips parentheses
when node is inside initializer - that serves cases like:
```cpp
v : std::vector<int> = (1,2,3);
```
Where it generates:
```cpp
std::vector<int> v{1,2,3};
```
When `:=` is used in the following cases:
```cpp
d := (1 + 2) * (3 + 4) * (5 + 6);
```
It removes first parentheses and we end up with:
```cpp
auto d = {1 + 2 * (3 + 4) * ( 5 + 6)};
```
This change corrects this behaviour on the parsing side it checks if it
is initializer with a explicit type or is the type deduced
(it is done by checking if before `Assignement` there is a `Colon`).
```cpp
bool inside_initializer = (
peek(-1) && peek(-1)->type() == lexeme::Assignment
&& peek(-2) && peek(-2)->type() != lexeme::Colon
);
```
0 commit comments