Explicitly set coder to v1 for syntax tests.

This commit is contained in:
chriseth 2020-12-03 18:29:17 +01:00
parent a5bd22795e
commit 72f1e4ea0b
45 changed files with 88 additions and 38 deletions

View File

@ -158,6 +158,7 @@ BOOST_AUTO_TEST_SUITE(Assembly)
BOOST_AUTO_TEST_CASE(location_test)
{
auto sourceCode = make_shared<CharStream>(R"(
pragma abicoder v1;
contract test {
function f() public returns (uint256 a) {
return 16;
@ -191,6 +192,7 @@ BOOST_AUTO_TEST_CASE(location_test)
BOOST_AUTO_TEST_CASE(jump_type)
{
auto sourceCode = make_shared<CharStream>(R"(
pragma abicoder v1;
contract C {
function f(uint a) public pure returns (uint t) {
assembly {

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
struct Item {
uint x;
uint y;

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
struct Item {
uint x;
uint y;
@ -13,5 +14,5 @@ contract D {
}
}
// ----
// TypeError 7364: (202-240): Different number of components on the left hand side (1) than on the right hand side (2).
// TypeError 9574: (202-240): Type uint256 is not implicitly convertible to expected type struct Item memory.
// TypeError 7364: (222-260): Different number of components on the left hand side (1) than on the right hand side (2).
// TypeError 9574: (222-260): Type uint256 is not implicitly convertible to expected type struct Item memory.

View File

@ -9,6 +9,7 @@ library L {
function set(Item storage _item) external view {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract Test {

View File

@ -9,6 +9,7 @@ contract C {
constructor(Item memory _item) {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract Test {
@ -17,4 +18,4 @@ contract Test {
}
}
// ----
// TypeError 2443: (B:71-80): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2443: (B:91-100): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ contract C {
function set(uint _x, string memory _y, Item memory _item, bool _z) external view {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract Test {
@ -17,4 +18,4 @@ contract Test {
}
}
// ----
// TypeError 2443: (B:99-109): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2443: (B:119-129): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ contract C {
function get(Item memory _item) external {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract Test {
@ -19,4 +20,4 @@ contract Test {
}
}
// ----
// TypeError 2443: (B:146-155): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2443: (B:166-175): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -5,6 +5,7 @@ contract C {
function f() external view returns (string[] memory) {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract D {
@ -13,4 +14,4 @@ contract D {
}
}
// ----
// TypeError 2428: (B:65-85): The type of return parameter 1, string[], is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2428: (B:85-105): The type of return parameter 1, string[], is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ contract C {
function get() external view returns(Item memory) {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract Test {
@ -17,4 +18,4 @@ contract Test {
}
}
// ----
// TypeError 2428: (B:70-92): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2428: (B:90-112): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ contract C {
function get() external view returns(Item memory) {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract Test {
@ -17,4 +18,4 @@ contract Test {
}
}
// ----
// TypeError 2428: (B:70-92): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2428: (B:90-112): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -8,6 +8,7 @@ library L {
event E(Item _value);
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract Test {
@ -16,4 +17,4 @@ contract Test {
}
}
// ----
// TypeError 2443: (B:74-84): The type of this parameter, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2443: (B:94-104): The type of this parameter, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ library L {
function f(uint) external view returns (Item memory) {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract D {
@ -19,4 +20,4 @@ contract D {
}
}
// ----
// TypeError 2428: (B:86-97): The type of return parameter 1, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2428: (B:106-117): The type of return parameter 1, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ library L {
function get(Item storage _item) external view {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract Test {

View File

@ -9,6 +9,7 @@ library L {
function get() external view returns(Item memory) {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract Test {
@ -17,4 +18,4 @@ contract Test {
}
}
// ----
// TypeError 2428: (B:70-77): The type of return parameter 1, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2428: (B:90-97): The type of return parameter 1, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -16,6 +16,7 @@ contract B {
}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract C is B {

View File

@ -21,10 +21,12 @@ contract B {
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract C is B {}
==== Source: C ====
pragma abicoder v1;
import "B";
contract D is C {

View File

@ -19,6 +19,7 @@ contract B {
}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract C is B {}

View File

@ -9,6 +9,7 @@ contract C {
event Ev(Item);
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract D is C {}

View File

@ -9,8 +9,9 @@ contract C {
function get(Item memory) external view {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract D is C {}
// ----
// TypeError 6594: (B:13-31): Contract "D" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature.
// TypeError 6594: (B:33-51): Contract "D" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature.

View File

@ -9,8 +9,9 @@ contract C {
function get() external view returns(Item memory) {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract D is C {}
// ----
// TypeError 6594: (B:13-31): Contract "D" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature.
// TypeError 6594: (B:33-51): Contract "D" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature.

View File

@ -15,6 +15,7 @@ contract C {
}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract D is C {}

View File

@ -17,6 +17,7 @@ contract B {
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract C is B {

View File

@ -1,4 +1,5 @@
==== Source: C ====
pragma abicoder v1;
import "X";
import "V1A";
import "V2A";
@ -14,6 +15,7 @@ contract C is V1A, V2A, V1B {
}
}
==== Source: V1A ====
pragma abicoder v1;
import "X";
contract V1A {
@ -22,6 +24,7 @@ contract V1A {
}
}
==== Source: V1B ====
pragma abicoder v1;
import "X";
contract V1B {

View File

@ -9,6 +9,7 @@ contract A {
function get() public view returns (Data memory) {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract B {
@ -18,6 +19,7 @@ contract B {
}
}
==== Source: C ====
pragma abicoder v1;
import "B";
contract C is B {
@ -27,4 +29,4 @@ contract C is B {
{}
}
// ----
// TypeError 2428: (B:60-82): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2428: (B:80-102): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ contract A {
function get() public view returns (Data memory) {}
}
==== Source: B ====
pragma abicoder v1;
import "A";
contract B {
@ -29,4 +30,4 @@ contract C is B {
{}
}
// ----
// TypeError 2428: (B:60-82): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2428: (B:80-102): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,7 +1,8 @@
pragma abicoder v1;
contract Test {
function f(uint[][] calldata) external { }
function g(uint[][1] calldata) external { }
}
// ----
// TypeError 4957: (31-48): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 4957: (78-96): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 4957: (51-68): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 4957: (98-116): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,5 +1,6 @@
pragma abicoder v1;
contract C {
constructor(uint[][][] memory t) {}
}
// ----
// TypeError 4957: (26-45): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. Alternatively, make the contract abstract and supply the constructor arguments from a derived contract.
// TypeError 4957: (46-65): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. Alternatively, make the contract abstract and supply the constructor arguments from a derived contract.

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
abstract contract C {
constructor(uint[][][] memory t) {}
}

View File

@ -1,5 +1,6 @@
pragma abicoder v1;
contract c {
event E(uint[][]);
}
// ----
// TypeError 3061: (25-33): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 3061: (45-53): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,6 +1,7 @@
pragma abicoder v1;
contract c {
struct S { uint x; uint[][] arr; }
event E(S);
}
// ----
// TypeError 3061: (61-62): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 3061: (81-82): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,6 +1,7 @@
pragma abicoder v1;
contract c {
struct S { uint a ; }
event E(S);
}
// ----
// TypeError 3061: (51-52): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 3061: (71-72): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,6 +1,7 @@
pragma abicoder v1;
contract c {
struct S { uint a ; }
event E(S indexed);
}
// ----
// TypeError 3061: (51-60): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 3061: (71-80): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
contract C {
struct Y {
uint b;
@ -8,4 +9,4 @@ contract C {
mapping(uint256 => X) public m;
}
// ----
// TypeError 2763: (88-118): The following types are only supported for getters in ABI coder v2: struct C.Y memory. Either remove "public" or use "pragma abicoder v2;" to enable the feature.
// TypeError 2763: (108-138): The following types are only supported for getters in ABI coder v2: struct C.Y memory. Either remove "public" or use "pragma abicoder v2;" to enable the feature.

View File

@ -13,7 +13,8 @@ pragma abicoder v2;
import "./A.sol";
contract B is A { }
==== Source: C.sol ====
pragma abicoder v1;
import "./B.sol";
contract C is B { }
// ----
// TypeError 6594: (C.sol:18-37): Contract "C" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature.
// TypeError 6594: (C.sol:38-57): Contract "C" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature.

View File

@ -8,10 +8,12 @@ contract A
function f(S memory _s) public returns (S memory,S memory) { }
}
==== Source: B.sol ====
pragma abicoder v1;
import "./A.sol";
contract B is A { }
==== Source: C.sol ====
pragma abicoder v1;
import "./B.sol";
contract C is B { }
// ----
// TypeError 6594: (B.sol:18-37): Contract "B" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature.
// TypeError 6594: (B.sol:38-57): Contract "B" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature.

View File

@ -1,5 +1,6 @@
pragma abicoder v1;
contract C {
function f() public pure returns (string[][] memory) {}
}
// ----
// TypeError 4957: (51-68): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 4957: (71-88): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,5 +1,6 @@
pragma abicoder v1;
contract C {
function f() public pure returns (uint[][2] memory) {}
}
// ----
// TypeError 4957: (51-67): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 4957: (71-87): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,6 +1,7 @@
pragma abicoder v1;
contract C {
struct S { string[] s; }
function f() public pure returns (S memory x) {}
}
// ----
// TypeError 4957: (80-90): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 4957: (100-110): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
contract C {
struct s { uint a; uint b; }
function f() pure public {
@ -5,4 +6,4 @@ contract C {
}
}
// ----
// TypeError 9611: (98-99): Decoding type struct C.s memory not supported.
// TypeError 9611: (118-119): Decoding type struct C.s memory not supported.

View File

@ -6,7 +6,7 @@ contract A {
}
}
// ----
// UnimplementedFeatureError: Not yet implemented - FixedPointType.
// UnimplementedFeatureError: Fixed point types not implemented.
// Warning 5667: (52-60): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning 5667: (62-74): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning 2072: (93-104): Unused local variable.

View File

@ -1,7 +1,8 @@
pragma abicoder v1;
contract C {
function f() public pure {
abi.encodePacked([new uint[](5), new uint[](7)]);
}
}
// ----
// TypeError 9578: (69-99): Type not supported in packed mode.
// TypeError 9578: (89-119): Type not supported in packed mode.

View File

@ -1,7 +1,8 @@
pragma abicoder v1;
contract C {
function test() public pure {
abi.encode([new uint[](5), new uint[](7)]);
}
}
// ----
// TypeError 2056: (66-96): This type cannot be encoded.
// TypeError 2056: (86-116): This type cannot be encoded.

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
contract C {
struct S { uint x; }
S s;
@ -11,7 +12,7 @@ contract C {
}
}
// ----
// TypeError 2056: (131-132): This type cannot be encoded.
// TypeError 2056: (134-135): This type cannot be encoded.
// TypeError 9578: (200-201): Type not supported in packed mode.
// TypeError 9578: (203-204): Type not supported in packed mode.
// TypeError 2056: (151-152): This type cannot be encoded.
// TypeError 2056: (154-155): This type cannot be encoded.
// TypeError 9578: (220-221): Type not supported in packed mode.
// TypeError 9578: (223-224): Type not supported in packed mode.

View File

@ -1,7 +1,8 @@
pragma abicoder v1;
contract C {
function f() public pure {
abi.decode("1234", (uint[][3]));
}
}
// ----
// TypeError 9611: (72-81): Decoding type uint256[] memory[3] memory not supported.
// TypeError 9611: (92-101): Decoding type uint256[] memory[3] memory not supported.

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
struct S {
uint x;
}
@ -8,4 +9,4 @@ contract C {
}
}
// ----
// TypeError 9611: (98-99): Decoding type struct S memory not supported.
// TypeError 9611: (118-119): Decoding type struct S memory not supported.