question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

    function payInterest(uint256 amount) public payable {
        uint256 interest = calculateInterestAmount(amount);
        require(
            msg.value == interest,
            "Not the entire interest amount deposited"
        );
        interestPaid[msg.sender][amount] = true;
    }

The tool throws an unreachable code error at the require statement and the statement following it. calculateInterestAmount returns just the number 10.

Also, the code is working fine in the truffle test suits.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:29 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
pcaversacciocommented, Jun 22, 2021

Confirmed, after restarting VS Code I got 0.8.6. Cache issues remain one of the major challenges in modern software engineering 😜

2reactions
cameelcommented, Jun 22, 2021

Great. I created an issue on our side to fix it in a more permanent manner (https://github.com/ethereum/solidity/issues/11572). The problem is that outright disabling caching for this file might not be a good idea (it got 5 TB of traffic last month) so we might have to modify our mirroring to just invalidate stuff after every update.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning: unreachable code after return statement - JavaScript
When an expression exists after a valid return statement, a warning is given to indicate that the code after the return statement is...
Read more >
Unreachable Code Error in Java - GeeksforGeeks
The Unreachable statements refers to statements that won't get executed during the execution of the program are called Unreachable ...
Read more >
Unreachable Code - Tutorialspoint
Unreachable code, a part of the source code that will never be executed due to inappropriate exit points/control flow. The other kind of...
Read more >
Why is this code giving an "unreachable code" error?
All i'm doing is declaring an integer and it's telling me that the code is unreachable. private class myStack{ Object [] myStack =...
Read more >
Unreachable code - Go Systems Programming [Book] - O'Reilly
Unreachable code Unreachable code is code that can never be executed and is a logical kind of error. As the Go compiler itself...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found