Skip to content
Open
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
4 changes: 2 additions & 2 deletions libsolidity/analysis/SyntaxChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ bool SyntaxChecker::visit(Literal const& _literal)
if (value.find("_.") != ASTString::npos)
m_errorReporter.syntaxError(1023_error, _literal.location(), "Invalid use of underscores in number literal. No underscores in front of the fraction part allowed.");

if (value.find("_e") != ASTString::npos)
if (value.find("_e") != ASTString::npos || value.find("_E") != ASTString::npos)
m_errorReporter.syntaxError(6415_error, _literal.location(), "Invalid use of underscores in number literal. No underscore at the end of the mantissa allowed.");

if (value.find("e_") != ASTString::npos)
if (value.find("e_") != ASTString::npos || value.find("E_") != ASTString::npos)
m_errorReporter.syntaxError(6165_error, _literal.location(), "Invalid use of underscores in number literal. No underscore in front of exponent allowed.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ contract C {
uint D2 = 12__34;
uint D3 = 12_e34;
uint D4 = 12e_34;
uint D5 = 12_E34;
uint D6 = 12E_34;
}
}
// ----
// 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 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.
// SyntaxError 6415: (143-149): Invalid use of underscores in number literal. No underscore at the end of the mantissa allowed.
// SyntaxError 6165: (165-171): Invalid use of underscores in number literal. No underscore in front of exponent allowed.