aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-25 18:44:28 +0800
committerGitHub <noreply@github.com>2018-10-25 18:44:28 +0800
commitf714b0dd7c0b48ea2b93855e1cda9d1101b3f35c (patch)
treec207622e955dba0a4a9839dc42bbba7d9b86a329 /test/libsolidity
parent4076875927b279342dacf690f86bfc16af03dd67 (diff)
parenta9a414bd0f6ba89bfd719ea6b6c8501861e0ece6 (diff)
downloaddexon-solidity-f714b0dd7c0b48ea2b93855e1cda9d1101b3f35c.tar.gz
dexon-solidity-f714b0dd7c0b48ea2b93855e1cda9d1101b3f35c.tar.zst
dexon-solidity-f714b0dd7c0b48ea2b93855e1cda9d1101b3f35c.zip
Merge pull request #5242 from ethereum/someChecks
Some well-formedness checks for the Yul AST.
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol13
-rw-r--r--test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol10
-rw-r--r--test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol10
-rw-r--r--test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol11
4 files changed, 44 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol
new file mode 100644
index 00000000..e05277de
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol
@@ -0,0 +1,13 @@
+contract C {
+ function f() public pure {
+ assembly {
+ function f(a, b) {}
+ f()
+ f(1,)
+ f(,1)
+ }
+ }
+}
+// ----
+// ParserError: (113-114): Literal, identifier or instruction expected.
+// ParserError: (113-114): Expected primary expression.
diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol
new file mode 100644
index 00000000..17995b09
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol
@@ -0,0 +1,10 @@
+contract C {
+ function f() public pure {
+ assembly {
+ function (a, b) {}
+ }
+ }
+}
+// ----
+// ParserError: (72-73): Expected identifier but got '('
+// ParserError: (79-80): Expected ';' but got '{'
diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol
new file mode 100644
index 00000000..715913de
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol
@@ -0,0 +1,10 @@
+contract C {
+ function f() public pure {
+ assembly {
+ let x := 0100
+ }
+ }
+}
+// ----
+// ParserError: (72-73): Literal, identifier or instruction expected.
+// ParserError: (72-73): Expected primary expression.
diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol
new file mode 100644
index 00000000..c8984333
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol
@@ -0,0 +1,11 @@
+contract C {
+ function f() public pure {
+ assembly {
+ let x := mload(0)
+ := 1
+ }
+ }
+}
+// ----
+// ParserError: (87-88): Literal, identifier or instruction expected.
+// ParserError: (87-88): Expected primary expression.