From de5af35fcadd19f873a8cf77fc53e0fa0996622c Mon Sep 17 00:00:00 2001 From: Anton Bukov Date: Mon, 2 Oct 2023 12:46:10 +0200 Subject: [PATCH] Some fixes for PR comments --- libsolidity/ast/AST.cpp | 7 +++---- libsolidity/ast/Types.h | 6 +++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index 3c9c64196..5ef986bdc 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -403,12 +403,11 @@ void StructDefinition::insertEip712EncodedSubtypes(std::set& subtyp declaration = m_members[i]->type()->typeDefinition(); break; case Type::Category::Array: + if (auto const* arrayType = dynamic_cast(m_members[i]->type())) { - auto const* arrayType = dynamic_cast(m_members[i]->type()); - solAssert(!!arrayType); - if (auto finalyBaseType = dynamic_cast(arrayType->finalBaseType(false))) + if (auto finalBaseType = dynamic_cast(arrayType->finalBaseType(false))) { - declaration = finalyBaseType->typeDefinition(); + declaration = finalBaseType->typeDefinition(); } } break; diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 37cb843e8..667ff3be4 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -357,7 +357,11 @@ public: /// @returns the canonical name of this type for use in library function signatures. virtual std::string canonicalName() const { return toString(true); } virtual std::string humanReadableName() const { return toString(); } - virtual std::string eip712TypeName() const { return encodingType()->toString(true); } + virtual std::string eip712TypeName() const + { + solAssert(isEIP712AllowedStructMemberType(), "Invalid type ..."); + return encodingType()->toString(true); + } virtual bool isEIP712AllowedStructMemberType() const { return false; } /// @returns the signature of this type in external functions, i.e. `uint256` for integers /// or `(uint256,bytes8)[2]` for an array of structs. If @a _structsByName,