diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index bbc94e031..dfa7629da 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -332,12 +332,19 @@ bool CompilerStack::analyze() if (!resolver.resolveNamesAndTypes(*node)) return false; if (ContractDefinition* contract = dynamic_cast(node.get())) + { // 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 - // already causes a double-declaration error elsewhere, so we do not report - // an error here and instead silently drop any additional contracts we find. + // thus contracts can only conflict if declared in the same source file. This + // should already cause a double-declaration error elsewhere. if (m_contracts.find(contract->fullyQualifiedName()) == m_contracts.end()) 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