mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow Mapping keys to have type UserDefinedValueType.
Also added syntax and semantic test.
This commit is contained in:
@@ -5,4 +5,4 @@ contract c {
|
||||
mapping(S => uint) data;
|
||||
}
|
||||
// ----
|
||||
// TypeError 7804: (47-48): Only elementary types, contract types or enums are allowed as mapping keys.
|
||||
// TypeError 7804: (47-48): Only elementary types, user defined value types, contract types or enums are allowed as mapping keys.
|
||||
|
||||
@@ -5,4 +5,4 @@ contract c {
|
||||
mapping(S => uint) data;
|
||||
}
|
||||
// ----
|
||||
// TypeError 7804: (49-50): Only elementary types, contract types or enums are allowed as mapping keys.
|
||||
// TypeError 7804: (49-50): Only elementary types, user defined value types, contract types or enums are allowed as mapping keys.
|
||||
|
||||
@@ -6,4 +6,4 @@ contract C {
|
||||
function g (S calldata) external view {}
|
||||
}
|
||||
// ----
|
||||
// TypeError 7804: (56-57): Only elementary types, contract types or enums are allowed as mapping keys.
|
||||
// TypeError 7804: (56-57): Only elementary types, user defined value types, contract types or enums are allowed as mapping keys.
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
type MyInt is int;
|
||||
contract C {
|
||||
mapping(MyInt => int) m;
|
||||
}
|
||||
Reference in New Issue
Block a user