mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[cond-expr] change the end to end test
This commit is contained in:
parent
ac3019298a
commit
c8b0533933
@ -758,8 +758,12 @@ bool TypeChecker::visit(Conditional const& _conditional)
|
||||
if (*trueType == *falseType)
|
||||
commonType = trueType;
|
||||
else
|
||||
// we fake it as an equal operator, but any other comparison operator can work.
|
||||
commonType = trueType->binaryOperatorResult(Token::Equal, falseType);
|
||||
{
|
||||
commonType = Type::commonType(trueType, falseType);
|
||||
if (!commonType)
|
||||
// we fake it as an equal operator, but any other comparison operator can work.
|
||||
commonType = trueType->binaryOperatorResult(Token::Equal, falseType);
|
||||
}
|
||||
if (!commonType)
|
||||
{
|
||||
typeError(
|
||||
|
@ -147,20 +147,21 @@ BOOST_AUTO_TEST_CASE(conditional_expression_storage_memory)
|
||||
contract test {
|
||||
bytes2[2] data1;
|
||||
function f(bool cond) returns (uint) {
|
||||
data1[0] = "cc";
|
||||
|
||||
bytes2[2] memory x;
|
||||
x[0] = "aa";
|
||||
bytes2[2] memory y;
|
||||
y[0] = "bb";
|
||||
|
||||
data1 = cond ? x : y;
|
||||
x = cond ? y : data1;
|
||||
|
||||
uint ret = 0;
|
||||
if (data1[0] == "aa")
|
||||
if (x[0] == "bb")
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
if (data1[0] == "bb")
|
||||
if (x[0] == "cc")
|
||||
{
|
||||
ret = 2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user