mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
ast, codegen: disallow conversion between different enum types
This commit is contained in:
parent
4b6e7e0677
commit
20c2ca3992
@ -8,6 +8,7 @@ Features:
|
||||
Bugfixes:
|
||||
|
||||
* Parser: disallow empty enum definitions.
|
||||
* Type checker: disallow conversion between different enum types.
|
||||
|
||||
### 0.4.4 (2016-10-31)
|
||||
|
||||
|
@ -1585,7 +1585,7 @@ size_t EnumType::numberOfMembers() const
|
||||
|
||||
bool EnumType::isExplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
{
|
||||
return _convertTo.category() == category() || _convertTo.category() == Category::Integer;
|
||||
return _convertTo == *this || _convertTo.category() == Category::Integer;
|
||||
}
|
||||
|
||||
unsigned EnumType::memberValue(ASTString const& _member) const
|
||||
|
@ -348,7 +348,7 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp
|
||||
}
|
||||
break;
|
||||
case Type::Category::Enum:
|
||||
solAssert(targetTypeCategory == Type::Category::Integer || targetTypeCategory == Type::Category::Enum, "");
|
||||
solAssert(_targetType == _typeOnStack || targetTypeCategory == Type::Category::Integer, "");
|
||||
break;
|
||||
case Type::Category::FixedPoint:
|
||||
solAssert(false, "Not yet implemented - FixedPointType.");
|
||||
|
Loading…
Reference in New Issue
Block a user