You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both truffle compile (using global truffle) as well as yarn truffle compile (using local truffle) work. However, the second truffle compile that's running inside solidity-coverage throws an error during compilation and I don't understand how this could happen because it seems I'm using the same version everywhere. Is it an issue with the instrumentation?
Versions
macOS 10.13.3
node.js 9.4.0
truffle (global) 4.0.1 with solidity 0.4.18
truffle (local) 4.0.1 with solidity 0.4.18
The Error
This error occurs during the second compilation, if I understand solidity-coverage correctly, this means after instrumentation
smart-contracts/coverageEnv/contracts/Cov.sol:27:9: TypeError: Wrong argument count for function call: 2 arguments given but expected 1.
: balances[_address]
^
Spanning multiple lines.
smart-contracts/coverageEnv/contracts/Cov.sol:25:81: TypeError: True expression's type tuple(tuple(),uint8) doesn't match false expression's type uint256.
uint256 _totalPerTokenUnclaimedConverted; (,_totalPerTokenUnclaimedConverted) = totalPerTokenPayout == 0
^
How To Reproduce
Here's a minimum contract to reproduce:
pragma solidity0.4.18;
import"zeppelin-solidity/contracts/token/PausableToken.sol";
contractTestTokenisPausableToken {
uint256public totalPerTokenPayout;
mapping(address=>uint256) public claimedPerTokenPayouts;
function TestToken () public { }
function currentPayout(address_address)
publicviewreturns (uint256)
{
uint256 _totalPerTokenUnclaimedConverted = totalPerTokenPayout ==0?0 : balances[_address]
.mul(totalPerTokenPayout.sub(claimedPerTokenPayouts[_address]))
.div(1e18);
return _totalPerTokenUnclaimedConverted;
}
}
The text was updated successfully, but these errors were encountered:
@chapati23 This is very likely an instrumentation bug. We try to capture branch data for ternary operators and you are using a relatively complex multiline / chained expression. If you have a chance, could you see if the error is resolved by restructuring the code in your example as a conventional if/else statement?
Indeed. If I get rid of the ternary, the TypeError disappears.
cgewecke
changed the title
TypeError when running solidity-coverage. Doesn't occur when running truffle compile directly
Multiline ternary chains don't instrument correctly
Feb 9, 2018
Description
Both
truffle compile
(using global truffle) as well asyarn truffle compile
(using local truffle) work. However, the secondtruffle compile
that's running insidesolidity-coverage
throws an error during compilation and I don't understand how this could happen because it seems I'm using the same version everywhere. Is it an issue with the instrumentation?Versions
macOS 10.13.3
node.js 9.4.0
truffle (global) 4.0.1 with solidity 0.4.18
truffle (local) 4.0.1 with solidity 0.4.18
The Error
This error occurs during the second compilation, if I understand
solidity-coverage
correctly, this means after instrumentationHow To Reproduce
Here's a minimum contract to reproduce:
The text was updated successfully, but these errors were encountered: