mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7583 from HenryRLee/issue5081
Version Checker: 0.5.x-prerelease will match `pragma solidity ^0.5` #5081
This commit is contained in:
commit
1fe1459b7d
@ -23,7 +23,7 @@ Bugfixes:
|
||||
* SMTChecker: Fix internal error when using arrays or mappings of functions.
|
||||
* SMTChecker: Fix internal error in array of structs type.
|
||||
* Yul: Consider infinite loops and recursion to be not removable.
|
||||
|
||||
* Version Checker: 0.5.x-prerelease will match `pragma solidity ^0.5`.
|
||||
|
||||
|
||||
### 0.5.13 (2019-11-14)
|
||||
|
@ -105,8 +105,19 @@ bool SemVerMatchExpression::MatchComponent::matches(SemVerVersion const& _versio
|
||||
didCompare = true;
|
||||
cmp = _version.numbers[i] - version.numbers[i];
|
||||
}
|
||||
|
||||
if (cmp == 0 && !_version.prerelease.empty() && didCompare)
|
||||
{
|
||||
cmp = -1;
|
||||
for (unsigned i = levelsPresent; i < 3; i++)
|
||||
{
|
||||
if (_version.numbers[i] > 0)
|
||||
{
|
||||
cmp = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (prefix)
|
||||
{
|
||||
|
@ -70,6 +70,8 @@ BOOST_AUTO_TEST_CASE(positive_range)
|
||||
{"*", "1.2.3-foo"},
|
||||
{"1.0.0 - 2.0.0", "1.2.3"},
|
||||
{"1.0.0", "1.0.0"},
|
||||
{"1.0", "1.0.0"},
|
||||
{"1", "1.0.0"},
|
||||
{">=*", "0.2.4"},
|
||||
{"*", "1.2.3"},
|
||||
{">=1.0.0", "1.0.0"},
|
||||
@ -82,6 +84,8 @@ BOOST_AUTO_TEST_CASE(positive_range)
|
||||
{"<=2.0.0", "0.2.9"},
|
||||
{"<2.0.0", "1.9999.9999"},
|
||||
{"<2.0.0", "0.2.9"},
|
||||
{"<1.0", "1.0.0-pre"},
|
||||
{"<1", "1.0.0-pre"},
|
||||
{">= 1.0.0", "1.0.0"},
|
||||
{">= 1.0.0", "1.0.1"},
|
||||
{">= 1.0.0", "1.1.0"},
|
||||
@ -137,6 +141,10 @@ BOOST_AUTO_TEST_CASE(positive_range)
|
||||
{"^0.1.2", "0.1.2"},
|
||||
{"^0.1", "0.1.2"},
|
||||
{"^1.2", "1.4.2"},
|
||||
{"^1.2", "1.2.1-pre"},
|
||||
{"^1.2", "1.2.0"},
|
||||
{"^1", "1.2.0-pre"},
|
||||
{"^1", "1.2.0"},
|
||||
{"<=1.2.3", "1.2.3-beta"},
|
||||
{">1.2", "1.3.0-beta"},
|
||||
{"<1.2.3", "1.2.3-beta"},
|
||||
@ -158,6 +166,8 @@ BOOST_AUTO_TEST_CASE(negative_range)
|
||||
// Positive range tests
|
||||
vector<pair<string, string>> tests = {
|
||||
{"1.0.0 - 2.0.0", "2.2.3"},
|
||||
{"1.0", "1.0.0-pre"},
|
||||
{"1", "1.0.0-pre"},
|
||||
{"^1.2.3", "1.2.3-pre"},
|
||||
{"^1.2", "1.2.0-pre"},
|
||||
{"^1.2.3", "1.2.3-beta"},
|
||||
|
Loading…
Reference in New Issue
Block a user