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

Add diagnostics for type alias to a wildcard, closes #357 #360

Conversation

filipsajdak
Copy link
Contributor

@filipsajdak filipsajdak commented Apr 11, 2023

In the current implementation of cppfront (f83ca9), the following code:

alias5: type == _;
alias6: type == auto;

Generates succesfuly:

using alias5 = auto;
using alias6 = auto;

Which is an invalid cpp1 code.

After this change, the alias to wildcard will generate the following error:

error: a 'type ==' alias declaration must be followed by a type name (not a wildcard _ nor auto)

All regression tests pass. Closes #357

@filipsajdak filipsajdak force-pushed the fsajdak-add-diagnostics-for-alias-with-wildcard branch from 41051bd to f50639e Compare April 12, 2023 00:45
In the current implementation of cppfront (f83ca9) the following code:
```cpp
alias5: type == _;
alias6: type == auto;
```
Generates succesfuly:
```cpp
using alias5 = auto;
using alias6 = auto;
```
Which is invalid cpp1 code.

After this change the alias to wildcard will generate the following error:
```
error: a 'type ==' alias declaration must be followed by a type name (not a wildcard _ nor auto)
```

All regression tests pass. Closes hsutter#357
@filipsajdak filipsajdak force-pushed the fsajdak-add-diagnostics-for-alias-with-wildcard branch from f50639e to 6de944b Compare April 16, 2023 00:01
@hsutter hsutter merged commit 65fcd0f into hsutter:main Apr 16, 2023
@hsutter
Copy link
Owner

hsutter commented Apr 16, 2023

Thanks!

@filipsajdak filipsajdak deleted the fsajdak-add-diagnostics-for-alias-with-wildcard branch April 16, 2023 00:17
zaucy pushed a commit to zaucy/cppfront that referenced this pull request Dec 5, 2023
…tter#360)

In the current implementation of cppfront (f83ca9) the following code:
```cpp
alias5: type == _;
alias6: type == auto;
```
Generates succesfuly:
```cpp
using alias5 = auto;
using alias6 = auto;
```
Which is invalid cpp1 code.

After this change the alias to wildcard will generate the following error:
```
error: a 'type ==' alias declaration must be followed by a type name (not a wildcard _ nor auto)
```

All regression tests pass. Closes hsutter#357
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.

[BUG] alias: type == _ generates invalid cpp1
2 participants