Address, bytes, string, bool, contract, enum, fixed bytes, integer and struct types can
be used as a KeyType. Struct type can be used as KeyType only if it contains only
integer, boolean, fixed bytes or enum types and fits ~1023 bit.
Still the code from API.md example works only for mapping declaration, if you use such mapping (with struct key) as a function param, this happens:
Error: Key type of the mapping must be any of int<M>/uint<M> types with M from 8 to 256 or std address.
--> \contracts-core\src\main\solidity\SomeContract.sol:40:44:
|
40 | function setExample(uint128 minStake_, mapping(Point => address) checkMap_) external externalMsg checkExtOwnerAndAccept {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
API.md states the following on mappings:
Address, bytes, string, bool, contract, enum, fixed bytes, integer and struct types can be used as a
KeyType
. Struct type can be used asKeyType
only if it contains only integer, boolean, fixed bytes or enum types and fits ~1023 bit.You can read the rest & example here.
Still the code from API.md example works only for mapping declaration, if you use such mapping (with struct key) as a function param, this happens:
Would be great to describe limitations in API.md