mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update tests after code review
This commit is contained in:
parent
c61d5b457e
commit
c89eecf52b
@ -989,11 +989,16 @@ ASTPointer<UsingForDirective> Parser::parseUsingDirective()
|
|||||||
Token::BitNot
|
Token::BitNot
|
||||||
};
|
};
|
||||||
if (!util::contains(overridable, operator_))
|
if (!util::contains(overridable, operator_))
|
||||||
|
{
|
||||||
parserError(
|
parserError(
|
||||||
4403_error,
|
4403_error,
|
||||||
("The operator " + string{TokenTraits::toString(operator_)} + " cannot be user-implemented. This is only possible for the following operators: ") +
|
(
|
||||||
|
"The operator " + (TokenTraits::toString(operator_) ? string(TokenTraits::toString(operator_)) + " " : "")
|
||||||
|
+ "cannot be user-implemented. This is only possible for the following operators: "
|
||||||
|
) +
|
||||||
util::joinHumanReadable(overridable | ranges::views::transform([](Token _t) { return string{TokenTraits::toString(_t)}; }))
|
util::joinHumanReadable(overridable | ranges::views::transform([](Token _t) { return string{TokenTraits::toString(_t)}; }))
|
||||||
);
|
);
|
||||||
|
}
|
||||||
operators.emplace_back(operator_);
|
operators.emplace_back(operator_);
|
||||||
advance();
|
advance();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
using {add as +} for E;
|
||||||
|
|
||||||
|
error E();
|
||||||
|
|
||||||
|
function add(E, E) pure returns (E) {
|
||||||
|
return E.E1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----
|
||||||
|
// TypeError 5172: (21-22): Name has to refer to a user-defined value type, struct, enum or contract.
|
@ -1,10 +1,14 @@
|
|||||||
using {
|
using {
|
||||||
shiftL as <<, shiftR as >>,
|
shiftL as <<,
|
||||||
exp as **, neg as !
|
shiftR as >>,
|
||||||
|
exp as **,
|
||||||
|
neg as !,
|
||||||
|
f as x
|
||||||
} for int256;
|
} for int256;
|
||||||
|
|
||||||
// ----
|
// ----
|
||||||
// ParserError 4403: (22-24): The operator << cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
// ParserError 4403: (22-24): The operator << cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||||
// ParserError 4403: (36-38): The operator >> cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
// ParserError 4403: (40-42): The operator >> cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||||
// ParserError 4403: (51-53): The operator ** cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
// ParserError 4403: (55-57): The operator ** cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||||
// ParserError 4403: (62-63): The operator ! cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
// ParserError 4403: (70-71): The operator ! cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||||
|
// ParserError 4403: (82-83): The operator cannot be user-implemented. This is only possible for the following operators: |, &, ^, +, -, *, /, %, ==, !=, <, >, <=, >=, ~
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
using {add as +} for S;
|
||||||
|
|
||||||
|
struct S {
|
||||||
|
uint x;
|
||||||
|
}
|
||||||
|
|
||||||
|
function add(S calldata, S calldata) pure returns (S calldata r) {
|
||||||
|
assembly {
|
||||||
|
r := 0
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using {add as +} for S;
|
||||||
|
|
||||||
|
struct S {
|
||||||
|
uint x;
|
||||||
|
}
|
||||||
|
|
||||||
|
function add(S storage a, S storage) pure returns (S storage) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
contract C {
|
||||||
|
S a;
|
||||||
|
S b;
|
||||||
|
|
||||||
|
function test() public view {
|
||||||
|
a + b;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user