File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 3030
3131#include < fmt/format.h>
3232
33+ #include < range/v3/algorithm/find_if.hpp>
3334#include < range/v3/view/reverse.hpp>
3435
3536using namespace solidity ;
@@ -116,19 +117,22 @@ void ContractLevelChecker::checkStorageLayoutSpecifier(ContractDefinition const&
116117 );
117118 }
118119
119- for (auto const * ancestorContract : _contract.annotation (). linearizedBaseContracts | ranges::views::reverse )
120+ for (auto const & baseContractSpecifier : _contract.baseContracts () )
120121 {
121- if (*ancestorContract == _contract)
122- continue ;
123- if (ancestorContract->storageLayoutSpecifier ())
122+ auto const * baseContract = dynamic_cast <ContractDefinition const *>(
123+ baseContractSpecifier->name ().annotation ().referencedDeclaration
124+ );
125+
126+ solAssert (baseContract);
127+ if (baseContract->storageLayoutSpecifier ())
124128 m_errorReporter.typeError (
125129 8894_error,
126- _contract. location (),
130+ baseContractSpecifier-> location (),
127131 SecondarySourceLocation ().append (
128- " Storage layout was already specified here. " ,
129- ancestorContract ->storageLayoutSpecifier ()->location ()
132+ " Custom storage layout defined here: " ,
133+ baseContract ->storageLayoutSpecifier ()->location ()
130134 ),
131- " Storage layout can only be specified in the most derived contract ."
135+ " Cannot inherit from a contract with a custom storage layout ."
132136 );
133137 }
134138}
You can’t perform that action at this time.
0 commit comments