mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
LSP test: Minor refactoring and better exception reporting
This commit is contained in:
@@ -8,5 +8,6 @@ contract C
|
||||
function f(uint a, uint b) public pure returns (uint)
|
||||
{
|
||||
return Lib.add(2 * a, b);
|
||||
// ^^^^^^^ @diagnostics
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,16 @@ enum Color {
|
||||
library Lib
|
||||
{
|
||||
function add(uint a, uint b) public pure returns (uint result)
|
||||
// ^( @addFunction
|
||||
{
|
||||
result = a + b;
|
||||
}
|
||||
|
||||
// ^) @addFunction
|
||||
function warningWithUnused() public pure
|
||||
{
|
||||
uint unused;
|
||||
// ^^^^^^^^^^^ @diagnostics
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,16 @@ contract MyContract
|
||||
constructor()
|
||||
{
|
||||
uint unused; // [Warning 2072] Unused local variable.
|
||||
// ^^^^^^^^^^^ @unusedVariable
|
||||
}
|
||||
}
|
||||
|
||||
contract D
|
||||
{
|
||||
function main() public payable returns (uint)
|
||||
// ^^^^ @unusedReturnVariable
|
||||
{
|
||||
MyContract c = new MyContract();
|
||||
// ^^^^^^^^^^^^ @unusedContractVariable
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ contract C
|
||||
function makeSomeError() public pure returns (uint res)
|
||||
{
|
||||
uint x = "hi";
|
||||
// ^^^^^^^^^^^^^ @conversionError
|
||||
return;
|
||||
// ^^^^^^^ @argumentsRequired
|
||||
res = 2;
|
||||
}
|
||||
}
|
||||
@@ -17,5 +19,6 @@ contract D
|
||||
{
|
||||
C c = new C();
|
||||
return c.makeSomeError(2, 3);
|
||||
// ^^^^^^^^^^^^^^^^^^^^^ @wrongArgumentsCount
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,7 @@ abstract contract A {
|
||||
}
|
||||
|
||||
contract B is A
|
||||
// ^( @notAbstract
|
||||
{
|
||||
}
|
||||
// ^) @notAbstract
|
||||
|
||||
Reference in New Issue
Block a user