aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorErik Kundt <bitshift@posteo.org>2018-04-22 22:54:33 +0800
committerErik Kundt <bitshift@posteo.org>2018-04-22 22:54:33 +0800
commitf2b58de92cdffe9d6e70aff2f0198277a5da335a (patch)
treef59cb999beb8a37d9b7a316702a9bb785a790ec6 /test
parentd674cde34cc0f9a8e8a520c8eddd2090384fb739 (diff)
downloaddexon-solidity-f2b58de92cdffe9d6e70aff2f0198277a5da335a.tar.gz
dexon-solidity-f2b58de92cdffe9d6e70aff2f0198277a5da335a.tar.zst
dexon-solidity-f2b58de92cdffe9d6e70aff2f0198277a5da335a.zip
Prevents null type from being used in tuple.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/syntaxTests/types/empty_tuple_event.sol10
-rw-r--r--test/libsolidity/syntaxTests/types/empty_tuple_event_050.sol10
-rw-r--r--test/libsolidity/syntaxTests/types/empty_tuple_function.sol11
-rw-r--r--test/libsolidity/syntaxTests/types/empty_tuple_function_self.sol8
-rw-r--r--test/libsolidity/syntaxTests/types/empty_tuple_lvalue.sol11
5 files changed, 50 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_event.sol b/test/libsolidity/syntaxTests/types/empty_tuple_event.sol
new file mode 100644
index 00000000..10b9f345
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/empty_tuple_event.sol
@@ -0,0 +1,10 @@
+pragma solidity ^0.4.3;
+contract C {
+ event SomeEvent();
+ function a() public {
+ (SomeEvent(), 7);
+ }
+}
+// ----
+// Warning: (95-106): Invoking events without "emit" prefix is deprecated.
+// TypeError: (95-106): Type of tuple component cannot be null.
diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_event_050.sol b/test/libsolidity/syntaxTests/types/empty_tuple_event_050.sol
new file mode 100644
index 00000000..072234cb
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/empty_tuple_event_050.sol
@@ -0,0 +1,10 @@
+pragma experimental "v0.5.0";
+contract C {
+ event SomeEvent();
+ function a() public {
+ (SomeEvent(), 7);
+ }
+}
+// ----
+// TypeError: (101-112): Event invocations have to be prefixed by "emit".
+// TypeError: (101-112): Type of tuple component cannot be null.
diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_function.sol b/test/libsolidity/syntaxTests/types/empty_tuple_function.sol
new file mode 100644
index 00000000..33a55b95
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/empty_tuple_function.sol
@@ -0,0 +1,11 @@
+pragma solidity ^0.4.3;
+contract C {
+ function f() {}
+ function a() public {
+ bool x = true;
+ bool y = true;
+ (x) ? (f(), y = false) : (f(), y = false);
+ }
+}
+// ----
+// TypeError: (144-147): Type of tuple component cannot be null.
diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_function_self.sol b/test/libsolidity/syntaxTests/types/empty_tuple_function_self.sol
new file mode 100644
index 00000000..27ab1131
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/empty_tuple_function_self.sol
@@ -0,0 +1,8 @@
+pragma solidity ^0.4.3;
+contract C {
+ function a() public {
+ (a(), 7);
+ }
+}
+// ----
+// TypeError: (72-75): Type of tuple component cannot be null.
diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_lvalue.sol b/test/libsolidity/syntaxTests/types/empty_tuple_lvalue.sol
new file mode 100644
index 00000000..e7ae4b29
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/empty_tuple_lvalue.sol
@@ -0,0 +1,11 @@
+pragma solidity ^0.4.3;
+contract C {
+ function f() public pure {}
+ function a() public {
+ uint x;
+ uint y;
+ (x, y) = (f(), f());
+ }
+}
+// ----
+// TypeError: (145-148): Type of tuple component cannot be null.