mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Print warning for unnamed return parameters and no return statement
This commit is contained in:
+1
@@ -10,4 +10,5 @@ contract C {
|
||||
// ====
|
||||
// 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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
+3
@@ -4,3 +4,6 @@ contract C {
|
||||
function h() public 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; }
|
||||
}
|
||||
// ----
|
||||
// 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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
+2
@@ -4,3 +4,5 @@ contract C {
|
||||
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.
|
||||
|
||||
+4
@@ -9,3 +9,7 @@ contract C {
|
||||
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.
|
||||
|
||||
+5
@@ -10,3 +10,8 @@ contract C {
|
||||
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;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// 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: (98-104): 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;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// 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 2018: (20-128): Function state mutability can be restricted to pure
|
||||
|
||||
@@ -11,4 +11,6 @@ contract C {
|
||||
// ====
|
||||
// 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.
|
||||
|
||||
@@ -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
|
||||
// ----
|
||||
// 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.
|
||||
|
||||
+2
@@ -6,3 +6,5 @@ contract C {
|
||||
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 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.
|
||||
|
||||
Reference in New Issue
Block a user