mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9990 from ethereum/issue-4751
Print warning for unnamed return parameters and no return statement
This commit is contained in:
commit
f4525631d7
@ -6,6 +6,8 @@ Language Features:
|
|||||||
|
|
||||||
Compiler Features:
|
Compiler Features:
|
||||||
* SMTChecker: Support inline arrays.
|
* SMTChecker: Support inline arrays.
|
||||||
|
* Control Flow Graph: Print warning for non-empty functions with unnamed return parameters that are not assigned a value in all code paths.
|
||||||
|
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Code generator: Fix internal compiler error when referencing members via module name but not using the reference.
|
* Code generator: Fix internal compiler error when referencing members via module name but not using the reference.
|
||||||
|
@ -424,6 +424,8 @@ operations as long as there is enough gas passed on to it.
|
|||||||
// If someone sends Ether to that contract, the receive function in TestPayable will be called.
|
// If someone sends Ether to that contract, the receive function in TestPayable will be called.
|
||||||
require(address(test).send(2 ether));
|
require(address(test).send(2 ether));
|
||||||
// results in test.x becoming == 2 and test.y becoming 2 ether.
|
// results in test.x becoming == 2 and test.y becoming 2 ether.
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ bool ControlFlowAnalyzer::visit(FunctionDefinition const& _function)
|
|||||||
if (_function.isImplemented())
|
if (_function.isImplemented())
|
||||||
{
|
{
|
||||||
auto const& functionFlow = m_cfg.functionFlow(_function);
|
auto const& functionFlow = m_cfg.functionFlow(_function);
|
||||||
checkUninitializedAccess(functionFlow.entry, functionFlow.exit);
|
checkUninitializedAccess(functionFlow.entry, functionFlow.exit, _function.body().statements().empty());
|
||||||
checkUnreachable(functionFlow.entry, functionFlow.exit, functionFlow.revert, functionFlow.transactionReturn);
|
checkUnreachable(functionFlow.entry, functionFlow.exit, functionFlow.revert, functionFlow.transactionReturn);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlFlowAnalyzer::checkUninitializedAccess(CFGNode const* _entry, CFGNode const* _exit) const
|
void ControlFlowAnalyzer::checkUninitializedAccess(CFGNode const* _entry, CFGNode const* _exit, bool _emptyBody) const
|
||||||
{
|
{
|
||||||
struct NodeInfo
|
struct NodeInfo
|
||||||
{
|
{
|
||||||
@ -95,14 +95,10 @@ void ControlFlowAnalyzer::checkUninitializedAccess(CFGNode const* _entry, CFGNod
|
|||||||
case VariableOccurrence::Kind::Return:
|
case VariableOccurrence::Kind::Return:
|
||||||
if (unassignedVariables.count(&variableOccurrence.declaration()))
|
if (unassignedVariables.count(&variableOccurrence.declaration()))
|
||||||
{
|
{
|
||||||
if (
|
// Merely store the unassigned access. We do not generate an error right away, since this
|
||||||
variableOccurrence.declaration().type()->dataStoredIn(DataLocation::Storage) ||
|
// path might still always revert. It is only an error if this is propagated to the exit
|
||||||
variableOccurrence.declaration().type()->dataStoredIn(DataLocation::CallData)
|
// node of the function (i.e. there is a path with an uninitialized access).
|
||||||
)
|
nodeInfo.uninitializedVariableAccesses.insert(&variableOccurrence);
|
||||||
// Merely store the unassigned access. We do not generate an error right away, since this
|
|
||||||
// path might still always revert. It is only an error if this is propagated to the exit
|
|
||||||
// node of the function (i.e. there is a path with an uninitialized access).
|
|
||||||
nodeInfo.uninitializedVariableAccesses.insert(&variableOccurrence);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VariableOccurrence::Kind::Declaration:
|
case VariableOccurrence::Kind::Declaration:
|
||||||
@ -140,18 +136,26 @@ void ControlFlowAnalyzer::checkUninitializedAccess(CFGNode const* _entry, CFGNod
|
|||||||
ssl.append("The variable was declared here.", variableOccurrence->declaration().location());
|
ssl.append("The variable was declared here.", variableOccurrence->declaration().location());
|
||||||
|
|
||||||
bool isStorage = variableOccurrence->declaration().type()->dataStoredIn(DataLocation::Storage);
|
bool isStorage = variableOccurrence->declaration().type()->dataStoredIn(DataLocation::Storage);
|
||||||
m_errorReporter.typeError(
|
bool isCalldata = variableOccurrence->declaration().type()->dataStoredIn(DataLocation::CallData);
|
||||||
3464_error,
|
if (isStorage || isCalldata)
|
||||||
variableOccurrence->occurrence() ?
|
m_errorReporter.typeError(
|
||||||
*variableOccurrence->occurrence() :
|
3464_error,
|
||||||
|
variableOccurrence->occurrence() ?
|
||||||
|
*variableOccurrence->occurrence() :
|
||||||
|
variableOccurrence->declaration().location(),
|
||||||
|
ssl,
|
||||||
|
"This variable is of " +
|
||||||
|
string(isStorage ? "storage" : "calldata") +
|
||||||
|
" pointer type and can be " +
|
||||||
|
(variableOccurrence->kind() == VariableOccurrence::Kind::Return ? "returned" : "accessed") +
|
||||||
|
" without prior assignment, which would lead to undefined behaviour."
|
||||||
|
);
|
||||||
|
else if (!_emptyBody && variableOccurrence->declaration().name().empty())
|
||||||
|
m_errorReporter.warning(
|
||||||
|
6321_error,
|
||||||
variableOccurrence->declaration().location(),
|
variableOccurrence->declaration().location(),
|
||||||
ssl,
|
"Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable."
|
||||||
"This variable is of " +
|
);
|
||||||
string(isStorage ? "storage" : "calldata") +
|
|
||||||
" pointer type and can be " +
|
|
||||||
(variableOccurrence->kind() == VariableOccurrence::Kind::Return ? "returned" : "accessed") +
|
|
||||||
" without prior assignment, which would lead to undefined behaviour."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/// Checks for uninitialized variable accesses in the control flow between @param _entry and @param _exit.
|
/// Checks for uninitialized variable accesses in the control flow between @param _entry and @param _exit.
|
||||||
void checkUninitializedAccess(CFGNode const* _entry, CFGNode const* _exit) const;
|
void checkUninitializedAccess(CFGNode const* _entry, CFGNode const* _exit, bool _emptyBody) const;
|
||||||
/// Checks for unreachable code, i.e. code ending in @param _exit, @param _revert or @param _transactionReturn
|
/// Checks for unreachable code, i.e. code ending in @param _exit, @param _revert or @param _transactionReturn
|
||||||
/// that can not be reached from @param _entry.
|
/// that can not be reached from @param _entry.
|
||||||
void checkUnreachable(CFGNode const* _entry, CFGNode const* _exit, CFGNode const* _revert, CFGNode const* _transactionReturn) const;
|
void checkUnreachable(CFGNode const* _entry, CFGNode const* _exit, CFGNode const* _revert, CFGNode const* _transactionReturn) const;
|
||||||
|
@ -4,8 +4,8 @@ pragma solidity >=0.0;
|
|||||||
contract Arraysum {
|
contract Arraysum {
|
||||||
uint256[] values;
|
uint256[] values;
|
||||||
|
|
||||||
function sumArray() public view returns(uint) {
|
function sumArray() public view returns(uint sum) {
|
||||||
uint sum = 0;
|
sum = 0;
|
||||||
// The optimizer should read the length of the array only once, because
|
// The optimizer should read the length of the array only once, because
|
||||||
// LoopInvariantCodeMotion can move the `sload` corresponding to the length outside of the
|
// LoopInvariantCodeMotion can move the `sload` corresponding to the length outside of the
|
||||||
// loop.
|
// loop.
|
||||||
|
@ -43,7 +43,7 @@ object "Arraysum_33" {
|
|||||||
vloc_sum := add(vloc_sum, _3)
|
vloc_sum := add(vloc_sum, _3)
|
||||||
}
|
}
|
||||||
let memPos := allocateMemory(_1)
|
let memPos := allocateMemory(_1)
|
||||||
return(memPos, sub(abi_encode_uint(memPos, _1), memPos))
|
return(memPos, sub(abi_encode_uint(memPos, vloc_sum), memPos))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
revert(0, 0)
|
revert(0, 0)
|
||||||
|
@ -7,6 +7,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (117-121): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 2072: (133-143): Unused local variable.
|
// Warning 2072: (133-143): Unused local variable.
|
||||||
// Warning 8364: (146-147): Assertion checker does not yet implement type type(struct C.A storage pointer)
|
// Warning 8364: (146-147): Assertion checker does not yet implement type type(struct C.A storage pointer)
|
||||||
// Warning 4639: (146-163): Assertion checker does not yet implement this expression.
|
// Warning 4639: (146-163): Assertion checker does not yet implement this expression.
|
||||||
|
@ -30,4 +30,5 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (429-442): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6328: (448-465): CHC: Assertion violation happens here.
|
// Warning 6328: (448-465): CHC: Assertion violation happens here.
|
||||||
|
@ -32,4 +32,5 @@ contract C {
|
|||||||
// ----
|
// ----
|
||||||
// Warning 5740: (116-129): Unreachable code.
|
// Warning 5740: (116-129): Unreachable code.
|
||||||
// Warning 5740: (221-234): Unreachable code.
|
// Warning 5740: (221-234): Unreachable code.
|
||||||
|
// Warning 6321: (408-421): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6328: (427-444): CHC: Assertion violation happens here.
|
// Warning 6328: (427-444): CHC: Assertion violation happens here.
|
||||||
|
@ -8,5 +8,6 @@ contract C {
|
|||||||
// ====
|
// ====
|
||||||
// EVMVersion: >=byzantium
|
// EVMVersion: >=byzantium
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (75-79): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 7645: (98-121): Assertion checker does not support try/catch clauses.
|
// Warning 7645: (98-121): Assertion checker does not support try/catch clauses.
|
||||||
// Warning 7645: (124-159): Assertion checker does not support try/catch clauses.
|
// Warning 7645: (124-159): Assertion checker does not support try/catch clauses.
|
||||||
|
@ -13,3 +13,4 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (85-89): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -7,3 +7,4 @@ contract c {
|
|||||||
bool b = (f() > 0) || (f() > 0);
|
bool b = (f() > 0) || (f() > 0);
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (86-90): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -9,3 +9,5 @@ contract C {
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (81-85): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (87-91): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -23,5 +23,18 @@ a;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (163-167): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (171-175): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (179-183): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (187-191): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (195-199): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (203-207): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (211-215): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (219-223): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (227-231): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (235-239): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (241-244): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (246-250): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (252-259): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6133: (72-90): Statement has no effect.
|
// Warning 6133: (72-90): Statement has no effect.
|
||||||
// Warning 6133: (96-107): Statement has no effect.
|
// Warning 6133: (96-107): Statement has no effect.
|
||||||
|
@ -21,6 +21,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (253-260): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 1218: (94-109): CHC: Error trying to invoke SMT solver.
|
// Warning 1218: (94-109): CHC: Error trying to invoke SMT solver.
|
||||||
// Warning 1218: (113-126): CHC: Error trying to invoke SMT solver.
|
// Warning 1218: (113-126): CHC: Error trying to invoke SMT solver.
|
||||||
// Warning 1218: (180-195): CHC: Error trying to invoke SMT solver.
|
// Warning 1218: (180-195): CHC: Error trying to invoke SMT solver.
|
||||||
|
@ -11,4 +11,5 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (83-87): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6328: (203-217): CHC: Assertion violation happens here.
|
// Warning 6328: (203-217): CHC: Assertion violation happens here.
|
||||||
|
@ -11,4 +11,5 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (83-87): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6328: (203-217): CHC: Assertion violation happens here.
|
// Warning 6328: (203-217): CHC: Assertion violation happens here.
|
||||||
|
@ -11,4 +11,5 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (83-87): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6328: (204-221): CHC: Assertion violation happens here.
|
// Warning 6328: (204-221): CHC: Assertion violation happens here.
|
||||||
|
@ -14,6 +14,7 @@ contract C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (87-91): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 4984: (117-122): CHC: Overflow (resulting value larger than 127) happens here.
|
// Warning 4984: (117-122): CHC: Overflow (resulting value larger than 127) happens here.
|
||||||
// Warning 4984: (151-158): CHC: Overflow (resulting value larger than 127) happens here.
|
// Warning 4984: (151-158): CHC: Overflow (resulting value larger than 127) happens here.
|
||||||
// Warning 3944: (197-205): CHC: Underflow (resulting value less than -128) happens here.
|
// Warning 3944: (197-205): CHC: Underflow (resulting value less than -128) happens here.
|
||||||
|
@ -25,4 +25,6 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (280-284): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (430-434): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6328: (440-449): CHC: Assertion violation happens here.
|
// Warning 6328: (440-449): CHC: Assertion violation happens here.
|
||||||
|
@ -36,4 +36,5 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (655-662): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6328: (668-677): CHC: Assertion violation happens here.
|
// Warning 6328: (668-677): CHC: Assertion violation happens here.
|
||||||
|
@ -10,6 +10,7 @@ contract test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (115-119): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6133: (125-126): Statement has no effect.
|
// Warning 6133: (125-126): Statement has no effect.
|
||||||
// Warning 6133: (130-136): Statement has no effect.
|
// Warning 6133: (130-136): Statement has no effect.
|
||||||
// Warning 6133: (140-144): Statement has no effect.
|
// Warning 6133: (140-144): Statement has no effect.
|
||||||
|
@ -7,4 +7,5 @@ contract c {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (80-84): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6328: (128-142): CHC: Assertion violation happens here.
|
// Warning 6328: (128-142): CHC: Assertion violation happens here.
|
||||||
|
@ -8,4 +8,5 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (79-82): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6328: (157-171): CHC: Assertion violation happens here.
|
// Warning 6328: (157-171): CHC: Assertion violation happens here.
|
||||||
|
@ -8,4 +8,5 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (79-82): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6328: (159-173): CHC: Assertion violation happens here.
|
// Warning 6328: (159-173): CHC: Assertion violation happens here.
|
||||||
|
@ -5,3 +5,5 @@ contract C {
|
|||||||
((, a)) = (1, 2);
|
((, a)) = (1, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (80-83): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -5,3 +5,5 @@ contract C {
|
|||||||
(((, a),)) = ((1, 2), 3);
|
(((, a),)) = ((1, 2), 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (80-83): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -5,3 +5,5 @@ contract C {
|
|||||||
(((((((, a),)))))) = ((1, 2), 3);
|
(((((((, a),)))))) = ((1, 2), 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (80-83): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -5,3 +5,5 @@ contract C {
|
|||||||
((((((, a)))),)) = ((1, 2), 3);
|
((((((, a)))),)) = ((1, 2), 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (80-83): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -5,3 +5,5 @@ contract C {
|
|||||||
((((((((((((, a))))))),))))) = ((1, 2), 3);
|
((((((((((((, a))))))),))))) = ((1, 2), 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (80-83): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -10,4 +10,5 @@ contract C {
|
|||||||
// ====
|
// ====
|
||||||
// EVMVersion: >=byzantium
|
// EVMVersion: >=byzantium
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (150-154): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 2072: (166-183): Unused local variable.
|
// Warning 2072: (166-183): Unused local variable.
|
||||||
|
@ -17,3 +17,4 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (399-407): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -4,3 +4,6 @@ contract C {
|
|||||||
function h() public pure returns(uint[] memory) {}
|
function h() public pure returns(uint[] memory) {}
|
||||||
function i() external pure returns(uint[] memory) {}
|
function i() external pure returns(uint[] memory) {}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (51-64): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (134-147): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -4,4 +4,5 @@ contract C {
|
|||||||
struct S { uint x; }
|
struct S { uint x; }
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (22-26): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// TypeError 3464: (45-46): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour.
|
// TypeError 3464: (45-46): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour.
|
||||||
|
@ -4,4 +4,5 @@ contract Test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (54-66): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6133: (78-88): Statement has no effect.
|
// Warning 6133: (78-88): Statement has no effect.
|
||||||
|
@ -4,3 +4,5 @@ contract C {
|
|||||||
a;
|
a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (46-50): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -9,3 +9,7 @@ contract C {
|
|||||||
function g() internal pure returns (uint, uint, uint, D.S[20] storage x, uint) { x = x; }
|
function g() internal pure returns (uint, uint, uint, D.S[20] storage x, uint) { x = x; }
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (176-180): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (182-186): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (188-192): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (213-217): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -10,3 +10,8 @@ contract C {
|
|||||||
function h() internal pure returns (bytes memory, string storage s) { s = s; }
|
function h() internal pure returns (bytes memory, string storage s) { s = s; }
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (51-55): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (57-61): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (63-67): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (69-73): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (250-262): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -8,3 +8,5 @@ contract Second {
|
|||||||
if (First(2).fun() == true) return 1;
|
if (First(2).fun() == true) return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (183-187): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -9,6 +9,7 @@ contract test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (83-87): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 6133: (93-94): Statement has no effect.
|
// Warning 6133: (93-94): Statement has no effect.
|
||||||
// Warning 6133: (98-104): Statement has no effect.
|
// Warning 6133: (98-104): Statement has no effect.
|
||||||
// Warning 6133: (108-112): Statement has no effect.
|
// Warning 6133: (108-112): Statement has no effect.
|
||||||
|
@ -4,3 +4,5 @@ contract C {
|
|||||||
function (address payable) payable external returns (address payable) h; h;
|
function (address payable) payable external returns (address payable) h; h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (197-267): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -4,5 +4,6 @@ contract test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (60-64): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 2072: (109-115): Unused local variable.
|
// Warning 2072: (109-115): Unused local variable.
|
||||||
// Warning 2018: (20-128): Function state mutability can be restricted to pure
|
// Warning 2018: (20-128): Function state mutability can be restricted to pure
|
||||||
|
@ -11,4 +11,6 @@ contract C {
|
|||||||
// ====
|
// ====
|
||||||
// EVMVersion: >=byzantium
|
// EVMVersion: >=byzantium
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (73-77): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (79-83): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
// Warning 2072: (122-134): Unused local variable.
|
// Warning 2072: (122-134): Unused local variable.
|
||||||
|
@ -8,4 +8,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// EVMVersion: >=byzantium
|
// EVMVersion: >=byzantium
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (46-50): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (52-56): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -8,4 +8,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// EVMVersion: >=byzantium
|
// EVMVersion: >=byzantium
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (46-50): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (52-56): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -8,4 +8,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// EVMVersion: >=byzantium
|
// EVMVersion: >=byzantium
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (46-50): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (52-56): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -6,4 +6,7 @@ contract C {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (46-50): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (52-56): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -8,3 +8,6 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (46-50): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (52-56): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -9,3 +9,6 @@ contract C {
|
|||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// EVMVersion: >=byzantium
|
// EVMVersion: >=byzantium
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (46-59): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (61-65): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -8,4 +8,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// EVMVersion: >=byzantium
|
// EVMVersion: >=byzantium
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (46-59): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (61-65): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -11,4 +11,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// EVMVersion: >=byzantium
|
// EVMVersion: >=byzantium
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (46-50): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (52-56): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -21,3 +21,6 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 6321: (194-198): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (200-204): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
// Warning 6321: (206-213): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -6,3 +6,5 @@ contract C {
|
|||||||
g.selector;
|
g.selector;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (51-57): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
@ -4,3 +4,5 @@ contract C {
|
|||||||
function h() public { h(); g(); f(); }
|
function h() public { h(); g(); f(); }
|
||||||
function i() payable public { i(); h(); g(); f(); }
|
function i() payable public { i(); h(); g(); f(); }
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6321: (89-93): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
|
||||||
|
Loading…
Reference in New Issue
Block a user