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

Validate literals at a later stage #12449

Open
Vexu opened this issue Aug 14, 2022 · 1 comment
Open

Validate literals at a later stage #12449

Vexu opened this issue Aug 14, 2022 · 1 comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. error message This issue points out an error message that is unhelpful and should be improved. frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone

Comments

@Vexu
Copy link
Member

Vexu commented Aug 14, 2022

Most people would recognize 0x213g as a malformed hex literal and the same goes for '' being an empty char literal but currently Zig validates these kinds of error in the tokenizer, giving out terrible, vague errors like expected expression, found 'invalid bytes' and preventing formatting.

It would instead be better to have the tokenizer only validate things that actually prevent the tokens from being valid such as newlines in string literals (which should also give a proper error message instead of the same invalid bytes one) and leave everything else to AstGen.

@Vexu Vexu added enhancement Solving this issue will likely involve adding new logic or components to the codebase. frontend Tokenization, parsing, AstGen, Sema, and Liveness. error message This issue points out an error message that is unhelpful and should be improved. labels Aug 14, 2022
@Vexu Vexu added this to the 0.11.0 milestone Aug 14, 2022
@moosichu
Copy link
Sponsor Contributor

I'm keen to take a look at this once #12661 has been merged, but currently blocked on waiting for that or otherwise the work might potentially conflict there.

@andrewrk andrewrk modified the milestones: 0.11.0, 0.12.0 Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. error message This issue points out an error message that is unhelpful and should be improved. frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Projects
None yet
Development

No branches or pull requests

3 participants