aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-12-06 01:40:50 +0800
committerchriseth <c@ethdev.com>2016-12-12 18:12:12 +0800
commit2df60bec923e1bac74cde00ae9bda641ca29d6c1 (patch)
treebc774c90fca8f0feca215ca498458a71f22e25c9 /test
parentb8b4f5e9f9a89eac1218551b5da322b41c7813f4 (diff)
downloaddexon-solidity-2df60bec923e1bac74cde00ae9bda641ca29d6c1.tar
dexon-solidity-2df60bec923e1bac74cde00ae9bda641ca29d6c1.tar.gz
dexon-solidity-2df60bec923e1bac74cde00ae9bda641ca29d6c1.tar.bz2
dexon-solidity-2df60bec923e1bac74cde00ae9bda641ca29d6c1.tar.lz
dexon-solidity-2df60bec923e1bac74cde00ae9bda641ca29d6c1.tar.xz
dexon-solidity-2df60bec923e1bac74cde00ae9bda641ca29d6c1.tar.zst
dexon-solidity-2df60bec923e1bac74cde00ae9bda641ca29d6c1.zip
Type after shift should be type of left operand.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 837caa2d..0ac88a81 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -8505,6 +8505,21 @@ BOOST_AUTO_TEST_CASE(shift_left_uint8)
BOOST_CHECK(callContractFunction("f(uint8,uint8)", u256(0x66), u256(8)) == encodeArgs(u256(0)));
}
+BOOST_AUTO_TEST_CASE(shift_left_larger_type)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function f() returns (int8) {
+ uint8 x = 255;
+ int8 y = 1;
+ return a << b;
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(1) << 255));
+}
+
BOOST_AUTO_TEST_CASE(shift_left_assignment)
{
char const* sourceCode = R"(