mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add user operator tests for builtin types
This commit is contained in:
parent
6feb8aea73
commit
e0c688d55d
@ -3943,7 +3943,7 @@ void TypeChecker::endVisit(UsingForDirective const& _usingFor)
|
|||||||
m_errorReporter.typeError(
|
m_errorReporter.typeError(
|
||||||
5332_error,
|
5332_error,
|
||||||
path->location(),
|
path->location(),
|
||||||
"Operators can only be implemented for user-defined types and not for contracts."
|
"Operators can only be implemented for user-defined value types and structs."
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,21 @@
|
|||||||
using {f as +} for uint;
|
using {f as +} for uint;
|
||||||
|
using {f as +} for uint[2];
|
||||||
|
using {f as +} for mapping(uint => uint);
|
||||||
|
using {f as +} for function (uint) pure returns (uint);
|
||||||
|
using {f as +} for I;
|
||||||
|
using {f as +} for C;
|
||||||
|
using {f as +} for string;
|
||||||
|
|
||||||
function f(uint, uint) pure returns (uint) {}
|
function f(uint, uint) pure returns (uint) {}
|
||||||
|
|
||||||
|
interface I {}
|
||||||
|
contract C {}
|
||||||
|
|
||||||
// ----
|
// ----
|
||||||
// TypeError 5332: (7-8): Operators can only be implemented for user-defined types and not for contracts.
|
// TypeError 5332: (7-8): Operators can only be implemented for user-defined value types and structs.
|
||||||
|
// TypeError 5332: (32-33): Operators can only be implemented for user-defined value types and structs.
|
||||||
|
// TypeError 5332: (60-61): Operators can only be implemented for user-defined value types and structs.
|
||||||
|
// TypeError 5332: (102-103): Operators can only be implemented for user-defined value types and structs.
|
||||||
|
// TypeError 5332: (158-159): Operators can only be implemented for user-defined value types and structs.
|
||||||
|
// TypeError 5332: (180-181): Operators can only be implemented for user-defined value types and structs.
|
||||||
|
// TypeError 5332: (202-203): Operators can only be implemented for user-defined value types and structs.
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
using {f as +} for L;
|
||||||
|
|
||||||
|
function f() {}
|
||||||
|
library L {}
|
||||||
|
|
||||||
|
// ----
|
||||||
|
// TypeError 1130: (19-20): Invalid use of a library name.
|
Loading…
Reference in New Issue
Block a user