mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Restrict experimental solidity to constantinople and above
This commit is contained in:
parent
33e7fc1cba
commit
7a34d34045
@ -248,6 +248,8 @@ ASTPointer<PragmaDirective> Parser::parsePragmaDirective(bool const _finishedPar
|
|||||||
|
|
||||||
if (literals.size() >= 2 && literals[0] == "experimental" && literals[1] == "solidity")
|
if (literals.size() >= 2 && literals[0] == "experimental" && literals[1] == "solidity")
|
||||||
{
|
{
|
||||||
|
if (m_evmVersion < EVMVersion::constantinople())
|
||||||
|
fatalParserError(7637_error, "Experimental solidity requires Constantinople EVM version at the minimum.");
|
||||||
if (_finishedParsingTopLevelPragmas)
|
if (_finishedParsingTopLevelPragmas)
|
||||||
fatalParserError(8185_error, "Experimental pragma \"solidity\" can only be set at the beginning of the source unit.");
|
fatalParserError(8185_error, "Experimental pragma \"solidity\" can only be set at the beginning of the source unit.");
|
||||||
m_experimentalSolidityEnabledInCurrentSourceUnit = true;
|
m_experimentalSolidityEnabledInCurrentSourceUnit = true;
|
||||||
|
@ -110,7 +110,7 @@ do
|
|||||||
SOL_FILES+=("$line")
|
SOL_FILES+=("$line")
|
||||||
done < <(
|
done < <(
|
||||||
grep --include "*.sol" -riL -E \
|
grep --include "*.sol" -riL -E \
|
||||||
"^\/\/ (Syntax|Type|Declaration)Error|^\/\/ ParserError (1684|2837|3716|3997|5333|6275|6281|6933|7319|8185)|^==== Source:" \
|
"^\/\/ (Syntax|Type|Declaration)Error|^\/\/ ParserError (1684|2837|3716|3997|5333|6275|6281|6933|7319|8185|7637)|^==== Source:" \
|
||||||
"${ROOT_DIR}/test/libsolidity/syntaxTests" \
|
"${ROOT_DIR}/test/libsolidity/syntaxTests" \
|
||||||
"${ROOT_DIR}/test/libsolidity/semanticTests" |
|
"${ROOT_DIR}/test/libsolidity/semanticTests" |
|
||||||
# Skipping the unicode tests as I couldn't adapt the lexical grammar to recursively counting RLO/LRO/PDF's.
|
# Skipping the unicode tests as I couldn't adapt the lexical grammar to recursively counting RLO/LRO/PDF's.
|
||||||
|
@ -17,5 +17,5 @@
|
|||||||
"src": "0:29:1"
|
"src": "0:29:1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"src": "0:30:1"
|
"src": "0:70:1"
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
pragma experimental solidity;
|
pragma experimental solidity;
|
||||||
|
// ====
|
||||||
|
// EVMVersion: >=constantinople
|
||||||
// ----
|
// ----
|
||||||
|
@ -16,5 +16,5 @@
|
|||||||
"src": "0:29:1"
|
"src": "0:29:1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"src": "0:30:1"
|
"src": "0:70:1"
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
pragma experimental solidity;
|
pragma experimental solidity;
|
||||||
|
// ====
|
||||||
|
// EVMVersion: >=constantinople
|
||||||
// ----
|
// ----
|
||||||
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
|
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
|
||||||
|
@ -18,6 +18,8 @@ import "A.sol";
|
|||||||
contract D {
|
contract D {
|
||||||
A a;
|
A a;
|
||||||
}
|
}
|
||||||
|
// ====
|
||||||
|
// EVMVersion: >=constantinople
|
||||||
// ----
|
// ----
|
||||||
// ParserError 2141: (B.sol:0-29): File declares "pragma experimental solidity". If you want to enable the experimental mode, all source units must include the pragma.
|
// ParserError 2141: (B.sol:0-29): File declares "pragma experimental solidity". If you want to enable the experimental mode, all source units must include the pragma.
|
||||||
// ParserError 2141: (C.sol:0-29): File declares "pragma experimental solidity". If you want to enable the experimental mode, all source units must include the pragma.
|
// ParserError 2141: (C.sol:0-29): File declares "pragma experimental solidity". If you want to enable the experimental mode, all source units must include the pragma.
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
contract A {}
|
contract A {}
|
||||||
|
|
||||||
pragma experimental solidity;
|
pragma experimental solidity;
|
||||||
|
// ====
|
||||||
|
// EVMVersion: >=constantinople
|
||||||
// ----
|
// ----
|
||||||
// ParserError 8185: (45-45): Experimental pragma "solidity" can only be set at the beginning of the source unit.
|
// ParserError 8185: (45-45): Experimental pragma "solidity" can only be set at the beginning of the source unit.
|
||||||
|
@ -9,5 +9,7 @@ struct A
|
|||||||
{
|
{
|
||||||
uint256 x;
|
uint256 x;
|
||||||
}
|
}
|
||||||
|
// ====
|
||||||
|
// EVMVersion: >=constantinople
|
||||||
// ----
|
// ----
|
||||||
// ParserError 8185: (83-89): Experimental pragma "solidity" can only be set at the beginning of the source unit.
|
// ParserError 8185: (83-89): Experimental pragma "solidity" can only be set at the beginning of the source unit.
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
pragma experimental solidity;
|
||||||
|
|
||||||
|
contract C {}
|
||||||
|
|
||||||
|
// ====
|
||||||
|
// EVMVersion: <constantinople
|
||||||
|
// ----
|
||||||
|
// ParserError 7637: (31-39): Experimental solidity requires Constantinople EVM version at the minimum.
|
Loading…
Reference in New Issue
Block a user