-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeclarationError: Function with same name and parameter types defined twice. #769
Comments
I got the same error. Anyone please help. I have flattened a solidity file in hardhat project. Ran the below command: It is giving the error same as in the screenshot #769 (comment) @cgewecke and @area please help on this. The tool is really good. But just stuck on this error. |
Does anyone have reproduction steps for this? |
the problem with redefinition was not working with virtual and ovveride |
@Bubble7777 So it's still an issue? Could you give a simple example to help me understand what's going wrong? |
I understood the root cause. Example: Here my contract A inherits contracts B and C. Internally lets say B and C inherits same contract D. Now if you run solidity-coverage on this file, this error occurs. |
Have tried to reproduce this in #836 following the advice the comment above but ... no luck. Everything compiles. If anyone can provide a simple reproduction case for this to investigate, will re-open and take another look. |
Was able to replicate this problem for a basic contract and gives the same error when running Here is how to replicate:
HardhatPluginError: HardhatError: HH600: Compilation failed
at SimpleTaskDefinition.action (/Users/tj/Developer/simpleContract/node_modules/solidity-coverage/plugins/hardhat.plugin.js:274:35)
at Environment._runTaskDefinition (/Users/tj/Developer/simpleContract/node_modules/hardhat/src/internal/core/runtime-environment.ts:358:14)
at Environment.run (/Users/tj/Developer/simpleContract/node_modules/hardhat/src/internal/core/runtime-environment.ts:191:14)
at main (/Users/tj/Developer/simpleContract/node_modules/hardhat/src/internal/cli/cli.ts:323:7) Additional Information:
|
@tanujdamani Nice work, thank you. Will take a look... |
A patch for this has been merged in #865 and will be published in the next release (0.8.8). A workaround before then is to make sure there is only a single pragma at the top of the flattened file. The coverage plugin has a bug where it (incorrectly) assumes it will only encounter one and injects illegal duplicate instrumentation when this is not the case. Thanks again @tanujdamani for reproducing this! |
Thanks @cgewecke for the quick action! I've done a check on the coverage by removing all the additional pragma lines. I still think there might be an issue. Thought the errors have reduced drastically.
HardhatPluginError: HardhatError: HH600: Compilation failed
at SimpleTaskDefinition.action (/Users/tj/Developer/simpleContract/node_modules/solidity-coverage/plugins/hardhat.plugin.js:274:35)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Environment._runTaskDefinition (/Users/tj/Developer/simpleContract/node_modules/hardhat/src/internal/core/runtime-environment.ts:358:14)
at Environment.run (/Users/tj/Developer/simpleContract/node_modules/hardhat/src/internal/core/runtime-environment.ts:191:14)
at main (/Users/tj/Developer/simpleContract/node_modules/hardhat/src/internal/cli/cli.ts:323:7) |
@tanujdamani Ah! There are still a couple stray pragmas in your updated file. (I found these in text editor, the gist is a little difficult to search).
If those are removed it looks like it will compile after being instrumented |
@cgewecke You are absolutely right. Sorry for that. After removing those pragma lines, it worked as expected. This definitely is a decent workaround while we wait for the merge. Thanks again! |
Published with 0.8.8 |
Hi, I get an error with np hardhat coverage, I also used 0.7.2
The text was updated successfully, but these errors were encountered: