diff options
author | Gav Wood <g@ethdev.com> | 2014-11-07 07:43:03 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2014-11-07 07:43:03 +0800 |
commit | 8eb6675bc69258163a25a9518b76c3176e378121 (patch) | |
tree | 388a6b6bc11c972ad22215c52ca44bd15aa70076 /solidityNameAndTypeResolution.cpp | |
parent | c5d0481836b59f3eb957e549b72ef9df3b92df96 (diff) | |
parent | 1dfc8d9f2bafa593174446f96a37139d552809b7 (diff) | |
download | dexon-solidity-8eb6675bc69258163a25a9518b76c3176e378121.tar.gz dexon-solidity-8eb6675bc69258163a25a9518b76c3176e378121.tar.zst dexon-solidity-8eb6675bc69258163a25a9518b76c3176e378121.zip |
Merge pull request #478 from chriseth/sol_typePromotion
Type promotion
Diffstat (limited to 'solidityNameAndTypeResolution.cpp')
-rw-r--r-- | solidityNameAndTypeResolution.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/solidityNameAndTypeResolution.cpp b/solidityNameAndTypeResolution.cpp index 9e34e6d0..f46ad673 100644 --- a/solidityNameAndTypeResolution.cpp +++ b/solidityNameAndTypeResolution.cpp @@ -162,6 +162,22 @@ BOOST_AUTO_TEST_CASE(type_checking_function_call) BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); } +BOOST_AUTO_TEST_CASE(type_conversion_for_comparison) +{ + char const* text = "contract test {\n" + " function f() { uint32(2) == int64(2); }" + "}\n"; + BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); +} + +BOOST_AUTO_TEST_CASE(type_conversion_for_comparison_invalid) +{ + char const* text = "contract test {\n" + " function f() { int32(2) == uint64(2); }" + "}\n"; + BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); +} + BOOST_AUTO_TEST_CASE(type_inference_explicit_conversion) { char const* text = "contract test {\n" |