Merge pull request #11295 from ethereum/semver-parser

Properly reject misformatted version pragmas
This commit is contained in:
chriseth 2021-10-12 16:31:52 +02:00 committed by GitHub
commit 5b3169b5dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 0 deletions

View File

@ -171,6 +171,8 @@ BOOST_AUTO_TEST_CASE(negative_range)
{
// Negative range tests
vector<pair<string, string>> tests = {
{"^0^1", "0.0.0"},
{"^0^1", "1.0.0"},
{"1.0.0 - 2.0.0", "2.2.3"},
{"1.0", "1.0.0-pre"},
{"1", "1.0.0-pre"},

View File

@ -0,0 +1,3 @@
pragma solidity v1.2.3;
// ----
// ParserError 1684: (0-23): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.

View File

@ -0,0 +1,3 @@
pragma solidity >0.5.0<;
// ----
// ParserError 1684: (0-24): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.

View File

@ -0,0 +1,2 @@
pragma solidity >=0.4.0 <0.9.0;
// ----