diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-08-07 09:40:39 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-08-07 20:23:14 +0800 |
commit | b0f9fc5af08a34f3025acf37db170ddca77796e1 (patch) | |
tree | 01bdc222655e0e73893ccfeac6c2fe4599f55c50 /libsolidity/ast | |
parent | 9d3827266cc734ac91368acff010e094f100f850 (diff) | |
download | dexon-solidity-b0f9fc5af08a34f3025acf37db170ddca77796e1.tar.gz dexon-solidity-b0f9fc5af08a34f3025acf37db170ddca77796e1.tar.zst dexon-solidity-b0f9fc5af08a34f3025acf37db170ddca77796e1.zip |
Fix type identifiers for RationalNumberType
Diffstat (limited to 'libsolidity/ast')
-rw-r--r-- | libsolidity/ast/Types.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 7bcae812..eff31b8d 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -1146,7 +1146,14 @@ TypePointer RationalNumberType::binaryOperatorResult(Token::Value _operator, Typ string RationalNumberType::richIdentifier() const { - return "t_rational_" + m_value.numerator().str() + "_by_" + m_value.denominator().str(); + // rational seemingly will put the sign always on the numerator, + // but let just make it deterministic here. + bigint numerator = abs(m_value.numerator()); + bigint denominator = abs(m_value.denominator()); + if (m_value < 0) + return "t_rational_minus_" + numerator.str() + "_by_" + denominator.str(); + else + return "t_rational_" + numerator.str() + "_by_" + denominator.str(); } bool RationalNumberType::operator==(Type const& _other) const |