mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow UserDefinedValueType.uwrap (and wrap) as RHS of constant decl
Needed to make `MyType.unwrap` and `MyType.unwrap` as pure in the process. This change affected some
existing tests ("statement has no effect").
This commit is contained in:
@@ -2916,7 +2916,10 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
|
||||
// TODO some members might be pure, but for example `address(0x123).balance` is not pure
|
||||
// although every subexpression is, so leaving this limited for now.
|
||||
if (auto tt = dynamic_cast<TypeType const*>(exprType))
|
||||
if (tt->actualType()->category() == Type::Category::Enum)
|
||||
if (
|
||||
tt->actualType()->category() == Type::Category::Enum ||
|
||||
tt->actualType()->category() == Type::Category::UserDefinedValueType
|
||||
)
|
||||
annotation.isPure = true;
|
||||
if (
|
||||
auto const* functionType = dynamic_cast<FunctionType const*>(exprType);
|
||||
|
||||
@@ -3499,7 +3499,9 @@ bool FunctionType::isPure() const
|
||||
m_kind == Kind::ABIEncodeWithSelector ||
|
||||
m_kind == Kind::ABIEncodeWithSignature ||
|
||||
m_kind == Kind::ABIDecode ||
|
||||
m_kind == Kind::MetaType;
|
||||
m_kind == Kind::MetaType ||
|
||||
m_kind == Kind::Wrap ||
|
||||
m_kind == Kind::Unwrap;
|
||||
}
|
||||
|
||||
TypePointers FunctionType::parseElementaryTypeVector(strings const& _types)
|
||||
|
||||
Reference in New Issue
Block a user