Merge pull request #10999 from ethereum/hash-collision-throw

Converted hash collision error into a fatal type error.
This commit is contained in:
chriseth 2021-02-23 17:33:41 +01:00 committed by GitHub
commit 92b52cbf84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -14,6 +14,7 @@ Bugfixes:
* SMTChecker: Fix missing type constraints on block and transaction variables in the deployment phase.
* AST: Added ``referencedDeclaration`` for enum members.
* Code Generator: Fix internal error when functions are passed as parameters of other callables, when the function types can be implicitly converted, but not identical.
* Type Checker: Make function-hash collision errors into fatal type errors.
AST Changes:

View File

@ -426,7 +426,7 @@ void ContractLevelChecker::checkHashCollisions(ContractDefinition const& _contra
{
util::FixedHash<4> const& hash = it.first;
if (hashes.count(hash))
m_errorReporter.typeError(
m_errorReporter.fatalTypeError(
1860_error,
_contract.location(),
string("Function signature hash collision for ") + it.second->externalSignature()

View File

@ -0,0 +1,13 @@
// This contract used to throw
abstract contract D {
function gsf() public {}
function tgeo() public {}
}
contract C {
D d;
function g() public returns (uint) {
d.d;
}
}
// ----
// TypeError 1860: (31-113): Function signature hash collision for tgeo()