diff options
author | Lu Guanqun <guanqun.lu@gmail.com> | 2016-01-12 00:00:14 +0800 |
---|---|---|
committer | Lu Guanqun <guanqun.lu@gmail.com> | 2016-01-23 01:14:01 +0800 |
commit | d36537e73720f181fae3e3b82a3d751d27782ca1 (patch) | |
tree | 5e9ce3f9e00bf3987ec79057cf8c9a21b9e9f07b /libsolidity/analysis | |
parent | c8b05339335d8e9166ef6863f7697bcc59f09260 (diff) | |
download | dexon-solidity-d36537e73720f181fae3e3b82a3d751d27782ca1.tar.gz dexon-solidity-d36537e73720f181fae3e3b82a3d751d27782ca1.tar.zst dexon-solidity-d36537e73720f181fae3e3b82a3d751d27782ca1.zip |
cond-expr: use the mobile type instead of the original type
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 016fe66a..0d74ddba 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -751,19 +751,10 @@ bool TypeChecker::visit(Conditional const& _conditional) _conditional.trueExpression().accept(*this); _conditional.falseExpression().accept(*this); - TypePointer const& trueType = type(_conditional.trueExpression()); - TypePointer const& falseType = type(_conditional.falseExpression()); + TypePointer trueType = type(_conditional.trueExpression())->mobileType(); + TypePointer falseType = type(_conditional.falseExpression())->mobileType(); - TypePointer commonType; - if (*trueType == *falseType) - commonType = trueType; - else - { - 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); - } + TypePointer commonType = Type::commonType(trueType, falseType); if (!commonType) { typeError( |