aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-06-27 05:55:22 +0800
committerGitHub <noreply@github.com>2017-06-27 05:55:22 +0800
commit9d201a086c13b6d6bf036b60aac9e614a5ebc961 (patch)
tree3cd14891d676fb8718ab0210bc18e8ab4a16d436 /test
parentb0ab9aaee0b4629b08ba2ada7e67b4c5d728fd8c (diff)
parent6b05bbbbb42dafdbf38661fd9c2c3c3e88a425a2 (diff)
downloaddexon-solidity-9d201a086c13b6d6bf036b60aac9e614a5ebc961.tar
dexon-solidity-9d201a086c13b6d6bf036b60aac9e614a5ebc961.tar.gz
dexon-solidity-9d201a086c13b6d6bf036b60aac9e614a5ebc961.tar.bz2
dexon-solidity-9d201a086c13b6d6bf036b60aac9e614a5ebc961.tar.lz
dexon-solidity-9d201a086c13b6d6bf036b60aac9e614a5ebc961.tar.xz
dexon-solidity-9d201a086c13b6d6bf036b60aac9e614a5ebc961.tar.zst
dexon-solidity-9d201a086c13b6d6bf036b60aac9e614a5ebc961.zip
Merge pull request #2459 from ethereum/noComparisonForSomeTypes
No comparison for some types
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index a6027812..eb1cf0dc 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -554,6 +554,51 @@ BOOST_AUTO_TEST_CASE(comparison_bitop_precedence)
CHECK_SUCCESS(text);
}
+BOOST_AUTO_TEST_CASE(comparison_of_function_types)
+{
+ char const* text = R"(
+ contract C {
+ function f() returns (bool ret) {
+ return this.f < this.f;
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Operator < not compatible");
+ text = R"(
+ contract C {
+ function f() returns (bool ret) {
+ return f < f;
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Operator < not compatible");
+ text = R"(
+ contract C {
+ function f() returns (bool ret) {
+ return f == f;
+ }
+ function g() returns (bool ret) {
+ return f != f;
+ }
+ }
+ )";
+ CHECK_SUCCESS(text);
+}
+
+BOOST_AUTO_TEST_CASE(comparison_of_mapping_types)
+{
+ char const* text = R"(
+ contract C {
+ mapping(uint => uint) x;
+ function f() returns (bool ret) {
+ var y = x;
+ return x == y;
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Operator == not compatible");
+}
+
BOOST_AUTO_TEST_CASE(function_no_implementation)
{
ASTPointer<SourceUnit> sourceUnit;