Skip to content

Commit

Permalink
fix: detect if a key provided by a plugin would overwrite a registrat…
Browse files Browse the repository at this point in the history
…ion (#27)
  • Loading branch information
fubuloubu authored Apr 19, 2021
1 parent 02e16c4 commit a1d4418
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ape/managers/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def registered_compilers(self) -> Dict[str, CompilerAPI]:
compiler = compiler_class()

for extension in extensions:

if extension in registered_compilers:
raise # Extension already registered!

registered_compilers[extension] = compiler

return registered_compilers
Expand Down
4 changes: 4 additions & 0 deletions src/ape/managers/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def contracts(self) -> Dict[str, ContractType]:
contract_types = {}
for filepath in self.sources:
contract_type = self.compilers.compile(filepath)

if contract_type.contractName in contract_types:
raise # ContractType collision across compiler plugins

contract_types[contract_type.contractName] = contract_type

return contract_types
Expand Down

0 comments on commit a1d4418

Please sign in to comment.