mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adjust code to review findings
This commit is contained in:
+1
-3
@@ -6,7 +6,5 @@ contract C {
|
||||
y;
|
||||
}
|
||||
}
|
||||
// ---
|
||||
|
||||
// ----
|
||||
// TypeError 3464: (137-138): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour.
|
||||
// TypeError 3464: (141-142): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour.
|
||||
|
||||
@@ -17,7 +17,6 @@ contract C {
|
||||
S storage s;
|
||||
get() + s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
+1
-1
@@ -7,4 +7,4 @@ contract test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2271: (79-85): Operator == not compatible with types struct test.s storage ref and struct test.s storage ref. A user-defined operator not found.
|
||||
// TypeError 2271: (79-85): Operator == not compatible with types struct test.s storage ref and struct test.s storage ref. Operator has not been user-defined.
|
||||
|
||||
@@ -10,4 +10,4 @@ function add(E, E) pure returns (E) {
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 9921: (0-23): The "using" directive cannot be used to attach functions to the enum type.
|
||||
// TypeError 9921: (0-23): The "using" directive cannot be used to attach functions to enum types.
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
struct S { uint v; }
|
||||
|
||||
using {add as +} for S;
|
||||
|
||||
function add(S memory _a, S memory) pure returns (S memory) {
|
||||
return _a;
|
||||
}
|
||||
|
||||
function g() pure returns (S memory) {
|
||||
S memory a = S(0);
|
||||
S memory b = S(1);
|
||||
S memory c = S(2);
|
||||
return a + b + c;
|
||||
}
|
||||
@@ -14,4 +14,4 @@ function test() {
|
||||
Int.wrap(0) + Int.wrap(1);
|
||||
}
|
||||
// ----
|
||||
// TypeError 2271: (213-238): Operator + not compatible with types Int and Int. A user-defined operator not unique.
|
||||
// TypeError 2271: (213-238): Operator + not compatible with types Int and Int. Multiple user-defined functions provided for this operator.
|
||||
|
||||
Reference in New Issue
Block a user