mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Report meaningful error if parsing a version pragma failed
This commit is contained in:
@@ -58,11 +58,12 @@ SemVerMatchExpression parseExpression(string const& _input)
|
||||
}
|
||||
|
||||
auto expression = SemVerMatchExpressionParser(tokens, literals).parse();
|
||||
BOOST_REQUIRE(expression.has_value());
|
||||
BOOST_CHECK_MESSAGE(
|
||||
expression.isValid(),
|
||||
expression->isValid(),
|
||||
"Expression \"" + _input + "\" did not parse properly."
|
||||
);
|
||||
return expression;
|
||||
return *expression;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
pragma solidity ^0^1;
|
||||
// ----
|
||||
// ParserError 5333: (0-21): Source file requires different compiler version (current compiler is ....
|
||||
@@ -0,0 +1,3 @@
|
||||
pragma solidity pragma;
|
||||
// ----
|
||||
// ParserError 1684: (0-23): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.
|
||||
@@ -0,0 +1,4 @@
|
||||
pragma solidity #8.0.0;
|
||||
// ----
|
||||
// ParserError 6281: (16-17): Token incompatible with Solidity parser as part of pragma directive.
|
||||
// ParserError 5333: (0-23): Source file requires different compiler version (current compiler is ....
|
||||
@@ -0,0 +1,3 @@
|
||||
pragma solidity (8.0.0);
|
||||
// ----
|
||||
// ParserError 1684: (0-24): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.
|
||||
@@ -0,0 +1,3 @@
|
||||
pragma solidity 88_;
|
||||
// ----
|
||||
// ParserError 1684: (0-20): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.
|
||||
@@ -0,0 +1,3 @@
|
||||
pragma solidity 0.4.3
|
||||
// ----
|
||||
// ParserError 2314: (22-22): Expected ';' but got end of source
|
||||
@@ -0,0 +1,4 @@
|
||||
pragma solidity 0.4.3
|
||||
pragma abicoder v2;
|
||||
// ----
|
||||
// ParserError 1684: (0-41): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.
|
||||
Reference in New Issue
Block a user