mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add assertion for contract name clash in the resolver in CompilerStack
This commit is contained in:
parent
d577a768ab
commit
b85d478931
@ -310,12 +310,19 @@ bool CompilerStack::analyze()
|
|||||||
if (!resolver.resolveNamesAndTypes(*node))
|
if (!resolver.resolveNamesAndTypes(*node))
|
||||||
return false;
|
return false;
|
||||||
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
||||||
|
{
|
||||||
// Note that we now reference contracts by their fully qualified names, and
|
// Note that we now reference contracts by their fully qualified names, and
|
||||||
// thus contracts can only conflict if declared in the same source file. This
|
// thus contracts can only conflict if declared in the same source file. This
|
||||||
// already causes a double-declaration error elsewhere, so we do not report
|
// should already cause a double-declaration error elsewhere.
|
||||||
// an error here and instead silently drop any additional contracts we find.
|
|
||||||
if (m_contracts.find(contract->fullyQualifiedName()) == m_contracts.end())
|
if (m_contracts.find(contract->fullyQualifiedName()) == m_contracts.end())
|
||||||
m_contracts[contract->fullyQualifiedName()].contract = contract;
|
m_contracts[contract->fullyQualifiedName()].contract = contract;
|
||||||
|
else
|
||||||
|
solAssert(
|
||||||
|
m_errorReporter.hasErrors(),
|
||||||
|
"Contract already present (name clash?), but no error was reported."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next, we check inheritance, overrides, function collisions and other things at
|
// Next, we check inheritance, overrides, function collisions and other things at
|
||||||
|
Loading…
Reference in New Issue
Block a user