aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-09-07 00:59:50 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-09-11 20:52:23 +0800
commit1ce3581a522a94d9e9a4a84cf8cb63f626e1a14f (patch)
tree258433cfc4c6fced543ba9cf968995e09438c851 /test
parent7d5c13981623f5f931444d227b163d9b0d995fd8 (diff)
downloaddexon-solidity-1ce3581a522a94d9e9a4a84cf8cb63f626e1a14f.tar
dexon-solidity-1ce3581a522a94d9e9a4a84cf8cb63f626e1a14f.tar.gz
dexon-solidity-1ce3581a522a94d9e9a4a84cf8cb63f626e1a14f.tar.bz2
dexon-solidity-1ce3581a522a94d9e9a4a84cf8cb63f626e1a14f.tar.lz
dexon-solidity-1ce3581a522a94d9e9a4a84cf8cb63f626e1a14f.tar.xz
dexon-solidity-1ce3581a522a94d9e9a4a84cf8cb63f626e1a14f.tar.zst
dexon-solidity-1ce3581a522a94d9e9a4a84cf8cb63f626e1a14f.zip
Accept ``address payable`` during parsing.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/syntaxTests/parsing/address_constant_payable.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/address_function_arguments_and_returns.sol4
-rw-r--r--test/libsolidity/syntaxTests/parsing/address_invalid_state_mutability.sol26
-rw-r--r--test/libsolidity/syntaxTests/parsing/address_payable_constant.sol3
-rw-r--r--test/libsolidity/syntaxTests/parsing/address_payable_conversion.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/address_payable_function_type.sol6
-rw-r--r--test/libsolidity/syntaxTests/parsing/address_payable_library.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/address_payable_local.sol11
-rw-r--r--test/libsolidity/syntaxTests/parsing/address_payable_state_variable.sol8
-rw-r--r--test/libsolidity/syntaxTests/parsing/address_payable_struct.sol8
-rw-r--r--test/libsolidity/syntaxTests/parsing/address_payable_type_expression.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/address_public_payable_error.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/elemantary_non_address_payable_state_variable.sol29
-rw-r--r--test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_argument.sol29
-rw-r--r--test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_local.sol31
-rw-r--r--test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_return.sol29
-rw-r--r--test/libsolidity/syntaxTests/parsing/mapping_from_address_payable.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/new_address_payable.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/payable_accessor.sol2
19 files changed, 224 insertions, 1 deletions
diff --git a/test/libsolidity/syntaxTests/parsing/address_constant_payable.sol b/test/libsolidity/syntaxTests/parsing/address_constant_payable.sol
new file mode 100644
index 00000000..d98f4ae3
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/address_constant_payable.sol
@@ -0,0 +1,5 @@
+contract C {
+ address constant payable b = address(0);
+}
+// ----
+// ParserError: (34-41): Expected identifier but got 'payable'
diff --git a/test/libsolidity/syntaxTests/parsing/address_function_arguments_and_returns.sol b/test/libsolidity/syntaxTests/parsing/address_function_arguments_and_returns.sol
new file mode 100644
index 00000000..c377600a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/address_function_arguments_and_returns.sol
@@ -0,0 +1,4 @@
+contract C {
+ function f(address) public pure returns (address) {}
+ function g(address payable) public pure returns (address payable) {}
+}
diff --git a/test/libsolidity/syntaxTests/parsing/address_invalid_state_mutability.sol b/test/libsolidity/syntaxTests/parsing/address_invalid_state_mutability.sol
new file mode 100644
index 00000000..606f5cd0
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/address_invalid_state_mutability.sol
@@ -0,0 +1,26 @@
+contract C {
+ address view m_a;
+ address pure m_b;
+ address view[] m_c;
+ mapping(uint => address view) m_d;
+ function f() public pure {
+ address view a;
+ address pure b;
+ a; b;
+ }
+ function g(address view) public pure {}
+ function h(address pure) public pure {}
+ function i() public pure returns (address view) {}
+ function j() public pure returns (address pure) {}
+}
+// ----
+// TypeError: (14-26): Address types can only be payable or non-payable.
+// TypeError: (33-45): Address types can only be payable or non-payable.
+// TypeError: (52-64): Address types can only be payable or non-payable.
+// TypeError: (89-101): Address types can only be payable or non-payable.
+// TypeError: (195-207): Address types can only be payable or non-payable.
+// TypeError: (236-248): Address types can only be payable or non-payable.
+// TypeError: (300-312): Address types can only be payable or non-payable.
+// TypeError: (352-364): Address types can only be payable or non-payable.
+// TypeError: (138-150): Address types can only be payable or non-payable.
+// TypeError: (156-168): Address types can only be payable or non-payable.
diff --git a/test/libsolidity/syntaxTests/parsing/address_payable_constant.sol b/test/libsolidity/syntaxTests/parsing/address_payable_constant.sol
new file mode 100644
index 00000000..154bfb54
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/address_payable_constant.sol
@@ -0,0 +1,3 @@
+contract C {
+ address payable constant a = address(0);
+}
diff --git a/test/libsolidity/syntaxTests/parsing/address_payable_conversion.sol b/test/libsolidity/syntaxTests/parsing/address_payable_conversion.sol
new file mode 100644
index 00000000..bf073a52
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/address_payable_conversion.sol
@@ -0,0 +1,7 @@
+contract C {
+ function f() public pure {
+ address payable a = address payable(this);
+ }
+}
+// ----
+// ParserError: (80-87): Expected ';' but got 'payable'
diff --git a/test/libsolidity/syntaxTests/parsing/address_payable_function_type.sol b/test/libsolidity/syntaxTests/parsing/address_payable_function_type.sol
new file mode 100644
index 00000000..234b528a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/address_payable_function_type.sol
@@ -0,0 +1,6 @@
+contract C {
+ function (address payable) view internal returns (address payable) f;
+ function g(function (address payable) payable external returns (address payable)) public payable returns (function (address payable) payable external returns (address payable)) {
+ function (address payable) payable external returns (address payable) h; h;
+ }
+}
diff --git a/test/libsolidity/syntaxTests/parsing/address_payable_library.sol b/test/libsolidity/syntaxTests/parsing/address_payable_library.sol
new file mode 100644
index 00000000..33787d33
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/address_payable_library.sol
@@ -0,0 +1,5 @@
+library L {
+}
+contract C {
+ using L for address payable;
+} \ No newline at end of file
diff --git a/test/libsolidity/syntaxTests/parsing/address_payable_local.sol b/test/libsolidity/syntaxTests/parsing/address_payable_local.sol
new file mode 100644
index 00000000..544f7c21
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/address_payable_local.sol
@@ -0,0 +1,11 @@
+contract C {
+ mapping(uint => address payable) m;
+ mapping(uint => address payable[]) n;
+ function f() public view {
+ address payable a;
+ address payable[] memory b;
+ mapping(uint => address payable) storage c = m;
+ mapping(uint => address payable[]) storage d = n;
+ a; b; c; d;
+ }
+}
diff --git a/test/libsolidity/syntaxTests/parsing/address_payable_state_variable.sol b/test/libsolidity/syntaxTests/parsing/address_payable_state_variable.sol
new file mode 100644
index 00000000..12c2468d
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/address_payable_state_variable.sol
@@ -0,0 +1,8 @@
+contract C {
+ address payable a;
+ address payable public b;
+ address payable[] c;
+ address payable[] public d;
+ mapping(uint => address payable) e;
+ mapping(uint => address payable[]) f;
+}
diff --git a/test/libsolidity/syntaxTests/parsing/address_payable_struct.sol b/test/libsolidity/syntaxTests/parsing/address_payable_struct.sol
new file mode 100644
index 00000000..6c281bc7
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/address_payable_struct.sol
@@ -0,0 +1,8 @@
+contract C {
+ struct S {
+ address payable a;
+ address payable[] b;
+ mapping(uint => address payable) c;
+ mapping(uint => address payable[]) d;
+ }
+} \ No newline at end of file
diff --git a/test/libsolidity/syntaxTests/parsing/address_payable_type_expression.sol b/test/libsolidity/syntaxTests/parsing/address_payable_type_expression.sol
new file mode 100644
index 00000000..394b39c0
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/address_payable_type_expression.sol
@@ -0,0 +1,7 @@
+contract C {
+ function f() public pure {
+ address payable;
+ }
+}
+// ----
+// ParserError: (67-68): Expected identifier but got ';'
diff --git a/test/libsolidity/syntaxTests/parsing/address_public_payable_error.sol b/test/libsolidity/syntaxTests/parsing/address_public_payable_error.sol
new file mode 100644
index 00000000..0acf5e4b
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/address_public_payable_error.sol
@@ -0,0 +1,5 @@
+contract C {
+ address public payable a;
+}
+// ----
+// ParserError: (32-39): Expected identifier but got 'payable'
diff --git a/test/libsolidity/syntaxTests/parsing/elemantary_non_address_payable_state_variable.sol b/test/libsolidity/syntaxTests/parsing/elemantary_non_address_payable_state_variable.sol
new file mode 100644
index 00000000..41b2762b
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/elemantary_non_address_payable_state_variable.sol
@@ -0,0 +1,29 @@
+contract C {
+ bool payable a;
+ string payable b;
+ int payable c;
+ int256 payable d;
+ uint payable e;
+ uint256 payable f;
+ byte payable g;
+ bytes payable h;
+ bytes32 payable i;
+ fixed payable j;
+ fixed80x80 payable k;
+ ufixed payable l;
+ ufixed80x80 payable m;
+}
+// ----
+// ParserError: (22-29): State mutability can only be specified for address types.
+// ParserError: (44-51): State mutability can only be specified for address types.
+// ParserError: (63-70): State mutability can only be specified for address types.
+// ParserError: (85-92): State mutability can only be specified for address types.
+// ParserError: (105-112): State mutability can only be specified for address types.
+// ParserError: (128-135): State mutability can only be specified for address types.
+// ParserError: (148-155): State mutability can only be specified for address types.
+// ParserError: (169-176): State mutability can only be specified for address types.
+// ParserError: (192-199): State mutability can only be specified for address types.
+// ParserError: (213-220): State mutability can only be specified for address types.
+// ParserError: (239-246): State mutability can only be specified for address types.
+// ParserError: (261-268): State mutability can only be specified for address types.
+// ParserError: (288-295): State mutability can only be specified for address types.
diff --git a/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_argument.sol b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_argument.sol
new file mode 100644
index 00000000..9cb0fb4f
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_argument.sol
@@ -0,0 +1,29 @@
+contract C {
+ function a(bool payable) public pure {}
+ function b(string payable) public pure {}
+ function c(int payable) public pure {}
+ function d(int256 payable) public pure {}
+ function e(uint payable) public pure {}
+ function f(uint256 payable) public pure {}
+ function g(byte payable) public pure {}
+ function h(bytes payable) public pure {}
+ function i(bytes32 payable) public pure {}
+ function j(fixed payable) public pure {}
+ function k(fixed80x80 payable) public pure {}
+ function l(ufixed payable) public pure {}
+ function m(ufixed80x80 payable) public pure {}
+}
+// ----
+// ParserError: (33-40): State mutability can only be specified for address types.
+// ParserError: (79-86): State mutability can only be specified for address types.
+// ParserError: (122-129): State mutability can only be specified for address types.
+// ParserError: (168-175): State mutability can only be specified for address types.
+// ParserError: (212-219): State mutability can only be specified for address types.
+// ParserError: (259-266): State mutability can only be specified for address types.
+// ParserError: (303-310): State mutability can only be specified for address types.
+// ParserError: (348-355): State mutability can only be specified for address types.
+// ParserError: (395-402): State mutability can only be specified for address types.
+// ParserError: (440-447): State mutability can only be specified for address types.
+// ParserError: (490-497): State mutability can only be specified for address types.
+// ParserError: (536-543): State mutability can only be specified for address types.
+// ParserError: (587-594): State mutability can only be specified for address types.
diff --git a/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_local.sol b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_local.sol
new file mode 100644
index 00000000..3d47f1c7
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_local.sol
@@ -0,0 +1,31 @@
+contract C {
+ function f() public pure {
+ bool payable a;
+ string payable b;
+ int payable c;
+ int256 payable d;
+ uint payable e;
+ uint256 payable f;
+ byte payable g;
+ bytes payable h;
+ bytes32 payable i;
+ fixed payable j;
+ fixed80x80 payable k;
+ ufixed payable l;
+ ufixed80x80 payable m;
+ }
+}
+// ----
+// ParserError: (57-64): State mutability can only be specified for address types.
+// ParserError: (83-90): State mutability can only be specified for address types.
+// ParserError: (106-113): State mutability can only be specified for address types.
+// ParserError: (132-139): State mutability can only be specified for address types.
+// ParserError: (156-163): State mutability can only be specified for address types.
+// ParserError: (183-190): State mutability can only be specified for address types.
+// ParserError: (207-214): State mutability can only be specified for address types.
+// ParserError: (232-239): State mutability can only be specified for address types.
+// ParserError: (259-266): State mutability can only be specified for address types.
+// ParserError: (284-291): State mutability can only be specified for address types.
+// ParserError: (314-321): State mutability can only be specified for address types.
+// ParserError: (340-347): State mutability can only be specified for address types.
+// ParserError: (371-378): State mutability can only be specified for address types.
diff --git a/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_return.sol b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_return.sol
new file mode 100644
index 00000000..fc7a3c25
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/elementary_non_address_payable_return.sol
@@ -0,0 +1,29 @@
+contract C {
+ function a() public pure returns (bool payable) {}
+ function b() public pure returns (string payable) {}
+ function c() public pure returns (int payable) {}
+ function d() public pure returns (int256 payable) {}
+ function e() public pure returns (uint payable) {}
+ function f() public pure returns (uint256 payable) {}
+ function g() public pure returns (byte payable) {}
+ function h() public pure returns (bytes payable) {}
+ function i() public pure returns (bytes32 payable) {}
+ function j() public pure returns (fixed payable) {}
+ function k() public pure returns (fixed80x80 payable) {}
+ function l() public pure returns (ufixed payable) {}
+ function m() public pure returns (ufixed80x80 payable) {}
+}
+// ----
+// ParserError: (56-63): State mutability can only be specified for address types.
+// ParserError: (113-120): State mutability can only be specified for address types.
+// ParserError: (167-174): State mutability can only be specified for address types.
+// ParserError: (224-231): State mutability can only be specified for address types.
+// ParserError: (279-286): State mutability can only be specified for address types.
+// ParserError: (337-344): State mutability can only be specified for address types.
+// ParserError: (392-399): State mutability can only be specified for address types.
+// ParserError: (448-455): State mutability can only be specified for address types.
+// ParserError: (506-513): State mutability can only be specified for address types.
+// ParserError: (562-569): State mutability can only be specified for address types.
+// ParserError: (623-630): State mutability can only be specified for address types.
+// ParserError: (680-687): State mutability can only be specified for address types.
+// ParserError: (742-749): State mutability can only be specified for address types.
diff --git a/test/libsolidity/syntaxTests/parsing/mapping_from_address_payable.sol b/test/libsolidity/syntaxTests/parsing/mapping_from_address_payable.sol
new file mode 100644
index 00000000..7e6f98d7
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/mapping_from_address_payable.sol
@@ -0,0 +1,5 @@
+contract C {
+ mapping(address payable => uint) m;
+}
+// ----
+// ParserError: (33-40): Expected '=>' but got 'payable'
diff --git a/test/libsolidity/syntaxTests/parsing/new_address_payable.sol b/test/libsolidity/syntaxTests/parsing/new_address_payable.sol
new file mode 100644
index 00000000..a52001db
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/new_address_payable.sol
@@ -0,0 +1,5 @@
+contract C {
+ function f() public pure returns(address payable[] memory m) {
+ m = new address payable[](10);
+ }
+} \ No newline at end of file
diff --git a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol
index 6504004b..0bc85784 100644
--- a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol
+++ b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol
@@ -2,4 +2,4 @@ contract test {
uint payable x;
}
// ----
-// ParserError: (22-29): Expected identifier but got 'payable'
+// ParserError: (22-29): State mutability can only be specified for address types.