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

Fix Bugzilla 24848 - bad parser diagnostic for a partial MulExp #17055

Merged
merged 2 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dmd/parse.d
Original file line number Diff line number Diff line change
Expand Up @@ -8647,7 +8647,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
error("expression expected, not `%s`", token.toChars());
Lerr:
// Anything for e, as long as it's not NULL
e = new AST.IntegerExp(loc, 0, AST.Type.tint32);
e = AST.ErrorExp.get();
nextToken();
break;
}
Expand Down
14 changes: 14 additions & 0 deletions compiler/test/fail_compilation/binexperr.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
TEST_OUTPUT:
---
fail_compilation/binexperr.d(12): Error: expression expected, not `)`
fail_compilation/binexperr.d(12): Error: missing closing `)` after `if (A1 * (__error)`
---
*/

void main()
{
struct A1 {}
if (A1*) {}
return;
}
2 changes: 1 addition & 1 deletion compiler/test/fail_compilation/e15876_3.d
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fail_compilation/e15876_3.d(29): Error: found `End of File` when expecting `)`
fail_compilation/e15876_3.d(29): Error: no identifier for declarator `d(_error_ = ()
{
for (__error__
0; 0)
__error; __error)
{
__error__
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/test/fail_compilation/e15876_4.d
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fail_compilation/e15876_4.d(27): Error: found `End of File` when expecting `)`
fail_compilation/e15876_4.d(27): Error: no identifier for declarator `typeof(()
{
for (__error__
0; 0)
__error; __error)
{
__error__
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/test/fail_compilation/ice15855.d
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fail_compilation/ice15855.d(28): Error: found `End of File` when expecting `]`
fail_compilation/ice15855.d(28): Error: no identifier for declarator `a[()
{
for (__error__
0; 0)
__error; __error)
{
__error__
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/test/fail_compilation/ice8795.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TEST_OUTPUT:
---
fail_compilation/ice8795.d-mixin-14(14): Error: found `End of File` when expecting `(`
fail_compilation/ice8795.d-mixin-14(14): Error: expression expected, not `End of File`
fail_compilation/ice8795.d-mixin-14(14): Error: missing closing `)` after `switch (0`
fail_compilation/ice8795.d-mixin-14(14): Error: missing closing `)` after `switch (__error`
fail_compilation/ice8795.d-mixin-14(14): Error: found `End of File` instead of statement
fail_compilation/ice8795.d-mixin-15(15): Error: { } expected following `interface` declaration
fail_compilation/ice8795.d-mixin-15(15): Error: anonymous interfaces not allowed
Expand Down
2 changes: 1 addition & 1 deletion compiler/test/fail_compilation/misc_parser_err_cov1.d
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fail_compilation/misc_parser_err_cov1.d(40): Error: identifier or `new` expected
fail_compilation/misc_parser_err_cov1.d(41): Error: identifier or new keyword expected following `(...)`.
fail_compilation/misc_parser_err_cov1.d(41): Error: expression expected, not `;`
fail_compilation/misc_parser_err_cov1.d(42): Error: found `}` when expecting `;` following expression
fail_compilation/misc_parser_err_cov1.d(41): expression: `(__error) + 0`
fail_compilation/misc_parser_err_cov1.d(41): expression: `(__error) + (__error)`
fail_compilation/misc_parser_err_cov1.d(43): Error: matching `}` expected following compound statement, not `End of File`
fail_compilation/misc_parser_err_cov1.d(33): unmatched `{`
---
Expand Down
2 changes: 1 addition & 1 deletion compiler/test/fail_compilation/traits_alone.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TEST_OUTPUT:
---
fail_compilation/traits_alone.d(11): Error: found `End of File` when expecting `(`
fail_compilation/traits_alone.d(11): Error: `__traits(identifier, args...)` expected
fail_compilation/traits_alone.d(11): Error: no identifier for declarator `_error_`
fail_compilation/traits_alone.d(11): Error: no identifier for declarator `$r:_?_error_?$`
---
*/
//used to segfault
Expand Down
Loading