JoinColony / solcover

Code coverage for solidity
MIT License
64 stars 8 forks source link

Conditional assignment to VariableDeclaration. #44

Closed cgewecke closed 7 years ago

cgewecke commented 7 years ago

I really like the tuple solution for conditional statements.

Theres an uncovered edge case for Variable initializations because solidity wont allow you to reference a var before its type is decided. Basically this:

Error: Instrumented solidity invalid: :26:5: Error: Assignment necessary for type detection.
    var z; (,z) = y ? (y,false) : (y,true);
    ^----^

To fix this you'd have to look down the tree and figure out what the type of the result of the ConditionalExpression is and initialize the var statement with it. It would be incredibly complicated.