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 30
30
31
31
#include < fmt/format.h>
32
32
33
+ #include < range/v3/algorithm/find_if.hpp>
33
34
#include < range/v3/view/reverse.hpp>
34
35
35
36
using namespace solidity ;
@@ -116,19 +117,22 @@ void ContractLevelChecker::checkStorageLayoutSpecifier(ContractDefinition const&
116
117
);
117
118
}
118
119
119
- for (auto const * ancestorContract : _contract.annotation (). linearizedBaseContracts | ranges::views::reverse )
120
+ for (auto const & baseContractSpecifier : _contract.baseContracts () )
120
121
{
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 ())
124
128
m_errorReporter.typeError (
125
129
8894_error,
126
- _contract. location (),
130
+ baseContractSpecifier-> location (),
127
131
SecondarySourceLocation ().append (
128
- " Storage layout was already specified here. " ,
129
- ancestorContract ->storageLayoutSpecifier ()->location ()
132
+ " Custom storage layout defined here: " ,
133
+ baseContract ->storageLayoutSpecifier ()->location ()
130
134
),
131
- " Storage layout can only be specified in the most derived contract ."
135
+ " Cannot inherit from a contract with a custom storage layout ."
132
136
);
133
137
}
134
138
}
You can’t perform that action at this time.
0 commit comments