aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorChristian Parpart <christian@ethereum.org>2018-07-12 22:17:30 +0800
committerChristian Parpart <christian@ethereum.org>2018-08-01 15:59:06 +0800
commita7150f85a686bd2e96c01aa71f02fb0d762e0dd0 (patch)
treef14d447fe9a3b82c7b58f314bb3d527d766f1bc6 /test
parentbeb66db66feda8ef59176069eea393aa5884c5da (diff)
downloaddexon-solidity-a7150f85a686bd2e96c01aa71f02fb0d762e0dd0.tar.gz
dexon-solidity-a7150f85a686bd2e96c01aa71f02fb0d762e0dd0.tar.zst
dexon-solidity-a7150f85a686bd2e96c01aa71f02fb0d762e0dd0.zip
Ensures an empty use of var keyword is caught with the proper error message.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/syntaxTests/parsing/tuples_decl_without_rhs.sol7
-rw-r--r--test/libsolidity/syntaxTests/types/var_empty_decl_0.sol9
-rw-r--r--test/libsolidity/syntaxTests/types/var_empty_decl_1.sol8
-rw-r--r--test/libsolidity/syntaxTests/types/var_empty_decl_2.sol9
-rw-r--r--test/libsolidity/syntaxTests/types/var_empty_decl_3.sol7
5 files changed, 40 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/parsing/tuples_decl_without_rhs.sol b/test/libsolidity/syntaxTests/parsing/tuples_decl_without_rhs.sol
new file mode 100644
index 00000000..dba3e7ac
--- /dev/null
+++ b/test/libsolidity/syntaxTests/parsing/tuples_decl_without_rhs.sol
@@ -0,0 +1,7 @@
+contract C {
+ function f() public pure {
+ (uint a, uint b, uint c);
+ }
+}
+// ----
+// ParserError: (76-77): Expected '=' but got ';'
diff --git a/test/libsolidity/syntaxTests/types/var_empty_decl_0.sol b/test/libsolidity/syntaxTests/types/var_empty_decl_0.sol
new file mode 100644
index 00000000..51b949de
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/var_empty_decl_0.sol
@@ -0,0 +1,9 @@
+contract C {
+ function f() public pure {
+ var ();
+ var (,);
+ }
+}
+// ----
+// SyntaxError: (52-58): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
+// SyntaxError: (68-75): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
diff --git a/test/libsolidity/syntaxTests/types/var_empty_decl_1.sol b/test/libsolidity/syntaxTests/types/var_empty_decl_1.sol
new file mode 100644
index 00000000..20a004ff
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/var_empty_decl_1.sol
@@ -0,0 +1,8 @@
+contract C {
+ function f() public pure {
+ var a;
+ a.NeverReachedByParser();
+ }
+}
+// ----
+// TypeError: (52-57): Use of the "var" keyword is disallowed.
diff --git a/test/libsolidity/syntaxTests/types/var_empty_decl_2.sol b/test/libsolidity/syntaxTests/types/var_empty_decl_2.sol
new file mode 100644
index 00000000..de2abc9a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/var_empty_decl_2.sol
@@ -0,0 +1,9 @@
+contract C {
+ function f() public pure {
+ var (b, c);
+ b.WeMustNotReachHere();
+ c.FailsToLookupToo();
+ }
+}
+// ----
+// TypeError: (52-62): Use of the "var" keyword is disallowed.
diff --git a/test/libsolidity/syntaxTests/types/var_empty_decl_3.sol b/test/libsolidity/syntaxTests/types/var_empty_decl_3.sol
new file mode 100644
index 00000000..26ee824e
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/var_empty_decl_3.sol
@@ -0,0 +1,7 @@
+contract C {
+ function f() public pure {
+ var (d, e,);
+ }
+}
+// ----
+// TypeError: (52-63): Use of the "var" keyword is disallowed.