Introduce solidity-next pragma

Exclude pragma experimental error from ANTLR tests

Test for first pragma after non-pragma declaration

Resolve import pragmas

Change pragma name from next to solidity

Add Changelog entries

Address review comments
This commit is contained in:
Nikola Matic
2023-05-15 19:25:13 +02:00
parent 9804085934
commit 8a41f4ac7e
18 changed files with 163 additions and 14 deletions
@@ -0,0 +1,21 @@
{
"absolutePath": "a",
"experimentalSolidity": true,
"exportedSymbols": {},
"id": 2,
"nodeType": "SourceUnit",
"nodes":
[
{
"id": 1,
"literals":
[
"experimental",
"solidity"
],
"nodeType": "PragmaDirective",
"src": "0:29:1"
}
],
"src": "0:30:1"
}
@@ -0,0 +1,3 @@
pragma experimental solidity;
// ----
@@ -0,0 +1,20 @@
{
"absolutePath": "a",
"experimentalSolidity": true,
"id": 2,
"nodeType": "SourceUnit",
"nodes":
[
{
"id": 1,
"literals":
[
"experimental",
"solidity"
],
"nodeType": "PragmaDirective",
"src": "0:29:1"
}
],
"src": "0:30:1"
}
+1 -1
View File
@@ -213,7 +213,7 @@ BOOST_AUTO_TEST_CASE(type_identifiers)
ModifierDefinition mod(++id, SourceLocation{}, make_shared<string>("modif"), SourceLocation{}, {}, emptyParams, {}, {}, {});
BOOST_CHECK_EQUAL(ModifierType(mod).identifier(), "t_modifier$__$");
SourceUnit su(++id, {}, {}, {});
SourceUnit su(++id, {}, {}, {}, {});
BOOST_CHECK_EQUAL(ModuleType(su).identifier(), "t_module_7");
BOOST_CHECK_EQUAL(MagicType(MagicType::Kind::Block).identifier(), "t_magic_block");
BOOST_CHECK_EQUAL(MagicType(MagicType::Kind::Message).identifier(), "t_magic_message");
@@ -0,0 +1,3 @@
pragma experimental solidity;
// ----
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
@@ -0,0 +1,24 @@
==== Source: A.sol ====
contract A {}
==== Source: B.sol ====
pragma experimental solidity;
import "A.sol";
contract B {
A a;
}
==== Source: C.sol ====
pragma experimental solidity;
import "A.sol";
contract C {
A a;
}
==== Source: D.sol ====
pragma experimental solidity;
import "A.sol";
contract D {
A a;
}
// ----
// 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: (D.sol:0-29): File declares "pragma experimental solidity". If you want to enable the experimental mode, all source units must include the pragma.
@@ -0,0 +1,5 @@
contract A {}
pragma experimental solidity;
// ----
// ParserError 8185: (45-45): Experimental pragma "solidity" can only be set at the beginning of the source unit.
@@ -0,0 +1,13 @@
function f() pure returns (uint)
{
return 1;
}
pragma experimental solidity;
struct A
{
uint256 x;
}
// ----
// ParserError 8185: (83-89): Experimental pragma "solidity" can only be set at the beginning of the source unit.