aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests/parsing
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-17 05:03:49 +0800
committerGitHub <noreply@github.com>2018-04-17 05:03:49 +0800
commit4cb486ee993cadde5564fb6c611d2bcf4fc44414 (patch)
tree6b971913021037cf28141c38af97c7ecda77719f /test/libsolidity/syntaxTests/parsing
parentdfe3193c7382c80f1814247a162663a97c3f5e67 (diff)
parentb8431c5c4a6795db8c42a1a3389047658bb87301 (diff)
downloaddexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.tar
dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.tar.gz
dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.tar.bz2
dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.tar.lz
dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.tar.xz
dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.tar.zst
dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.zip
Merge pull request #3892 from ethereum/develop
Merge develop into release for 0.4.22
Diffstat (limited to 'test/libsolidity/syntaxTests/parsing')
-rw-r--r--test/libsolidity/syntaxTests/parsing/constructor_allowed_this.sol28
-rw-r--r--test/libsolidity/syntaxTests/parsing/constructor_super.sol10
-rw-r--r--test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/return_var.sol25
-rw-r--r--test/libsolidity/syntaxTests/parsing/smoke_test.sol4
-rw-r--r--test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol25
-rw-r--r--test/libsolidity/syntaxTests/parsing/var_storage_var.sol5
7 files changed, 102 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/parsing/constructor_allowed_this.sol b/test/libsolidity/syntaxTests/parsing/constructor_allowed_this.sol
new file mode 100644
index 00000000..9f714aea
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/constructor_allowed_this.sol
@@ -0,0 +1,28 @@
+contract A {
+ function a() public pure {
+ }
+}
+contract B {
+ constructor(address) public {
+ }
+ function b(address) public returns (A) {
+ return new A();
+ }
+}
+contract C {
+ B m_b;
+ C m_c;
+ constructor(C other_c) public {
+ m_c = other_c;
+ m_b = new B(this);
+ m_b.b(this).a();
+ g(this).f();
+ other_c.f();
+ m_c.f();
+ }
+ function f() public pure {
+ }
+ function g(C) public view returns (C) {
+ return m_c;
+ }
+}
diff --git a/test/libsolidity/syntaxTests/parsing/constructor_super.sol b/test/libsolidity/syntaxTests/parsing/constructor_super.sol
new file mode 100644
index 00000000..fa1be187
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/constructor_super.sol
@@ -0,0 +1,10 @@
+contract A {
+ function x() pure internal {}
+}
+
+contract B is A {
+ constructor() public {
+ // used to trigger warning about using ``this`` in constructor
+ super.x();
+ }
+}
diff --git a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol
new file mode 100644
index 00000000..fd3067e3
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol
@@ -0,0 +1,5 @@
+contract test {
+ uint256 ;
+}
+// ----
+// ParserError: (28-28): Expected identifier, got 'Semicolon'
diff --git a/test/libsolidity/syntaxTests/parsing/return_var.sol b/test/libsolidity/syntaxTests/parsing/return_var.sol
new file mode 100644
index 00000000..47ac9ef0
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/return_var.sol
@@ -0,0 +1,25 @@
+contract C {
+ function f() returns(var) {}
+ function f() returns(var x) {}
+ function f() returns(var x, uint y) {}
+ function f() returns(uint x, var y) {}
+ function f() returns(var x, var y) {}
+ function f() public pure returns (var storage) {}
+ function f() public pure returns (var storage x) {}
+ function f() public pure returns (var storage x, var storage y) {}
+}
+// ----
+// ParserError: (38-38): Expected explicit type name.
+// ParserError: (71-71): Expected explicit type name.
+// ParserError: (106-106): Expected explicit type name.
+// ParserError: (157-157): Expected explicit type name.
+// ParserError: (192-192): Expected explicit type name.
+// ParserError: (199-199): Expected explicit type name.
+// ParserError: (247-247): Expected explicit type name.
+// ParserError: (251-251): Location specifier needs explicit type name.
+// ParserError: (301-301): Expected explicit type name.
+// ParserError: (305-305): Location specifier needs explicit type name.
+// ParserError: (357-357): Expected explicit type name.
+// ParserError: (361-361): Location specifier needs explicit type name.
+// ParserError: (372-372): Expected explicit type name.
+// ParserError: (376-376): Location specifier needs explicit type name.
diff --git a/test/libsolidity/syntaxTests/parsing/smoke_test.sol b/test/libsolidity/syntaxTests/parsing/smoke_test.sol
new file mode 100644
index 00000000..d328b167
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/smoke_test.sol
@@ -0,0 +1,4 @@
+contract test {
+ uint256 stateVariable1;
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol b/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol
new file mode 100644
index 00000000..e041247d
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol
@@ -0,0 +1,25 @@
+contract C {
+ function f(var) public pure {}
+ function f(var x) public pure {}
+ function f(var x, var y) public pure {}
+ function f(uint x, var y) public pure {}
+ function f(var x, uint y) public pure {}
+ function f(var storage) public pure {}
+ function f(var storage x) public pure {}
+ function f(var storage x, var storage y) public pure {}
+}
+// ----
+// ParserError: (28-28): Expected explicit type name.
+// ParserError: (63-63): Expected explicit type name.
+// ParserError: (100-100): Expected explicit type name.
+// ParserError: (107-107): Expected explicit type name.
+// ParserError: (152-152): Expected explicit type name.
+// ParserError: (189-189): Expected explicit type name.
+// ParserError: (234-234): Expected explicit type name.
+// ParserError: (238-238): Location specifier needs explicit type name.
+// ParserError: (277-277): Expected explicit type name.
+// ParserError: (281-281): Location specifier needs explicit type name.
+// ParserError: (322-322): Expected explicit type name.
+// ParserError: (326-326): Location specifier needs explicit type name.
+// ParserError: (337-337): Expected explicit type name.
+// ParserError: (341-341): Location specifier needs explicit type name.
diff --git a/test/libsolidity/syntaxTests/parsing/var_storage_var.sol b/test/libsolidity/syntaxTests/parsing/var_storage_var.sol
new file mode 100644
index 00000000..431d4ca5
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/var_storage_var.sol
@@ -0,0 +1,5 @@
+contract C {
+ var a;
+}
+// ----
+// ParserError: (17-17): Function, variable, struct or modifier declaration expected.