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

Better error message when consecutive underscores #15049

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion libsolidity/analysis/SyntaxChecker.cpp
Expand Up @@ -300,7 +300,7 @@ bool SyntaxChecker::visit(Literal const& _literal)

if (value.find("__") != ASTString::npos)
{
m_errorReporter.syntaxError(2990_error, _literal.location(), "Invalid use of underscores in number literal. Only one consecutive underscores between digits allowed.");
m_errorReporter.syntaxError(2990_error, _literal.location(), "Invalid use of underscores in number literal. Only one consecutive underscore between digits is allowed.");
return true;
}

Expand Down
Expand Up @@ -8,6 +8,6 @@ contract C {
}
// ----
// SyntaxError 2090: (56-61): Invalid use of underscores in number literal. No trailing underscores allowed.
// SyntaxError 2990: (77-83): Invalid use of underscores in number literal. Only one consecutive underscores between digits allowed.
// SyntaxError 2990: (77-83): Invalid use of underscores in number literal. Only one consecutive underscore between digits is allowed.
// SyntaxError 6415: (99-105): Invalid use of underscores in number literal. No underscore at the end of the mantissa allowed.
// SyntaxError 6165: (121-127): Invalid use of underscores in number literal. No underscore in front of exponent allowed.
Expand Up @@ -10,7 +10,7 @@ contract C {
}
// ----
// SyntaxError 2090: (57-64): Invalid use of underscores in number literal. No trailing underscores allowed.
// SyntaxError 2990: (81-91): Invalid use of underscores in number literal. Only one consecutive underscores between digits allowed.
// SyntaxError 2990: (81-91): Invalid use of underscores in number literal. Only one consecutive underscore between digits is allowed.
// SyntaxError 1023: (108-112): Invalid use of underscores in number literal. No underscores in front of the fraction part allowed.
// SyntaxError 3891: (129-133): Invalid use of underscores in number literal. No underscores in front of the fraction part allowed.
// SyntaxError 6165: (150-157): Invalid use of underscores in number literal. No underscore in front of exponent allowed.
Expand Down
Expand Up @@ -4,4 +4,4 @@ contract C {
}
}
// ----
// SyntaxError 2990: (56-79): Invalid use of underscores in number literal. Only one consecutive underscores between digits allowed.
// SyntaxError 2990: (56-79): Invalid use of underscores in number literal. Only one consecutive underscore between digits is allowed.