everx-labs / TVM-Solidity-Compiler

Solidity compiler for TVM
GNU General Public License v3.0
125 stars 72 forks source link

API doesn't describe mapping limitations #113

Closed cassandrus closed 2 years ago

cassandrus commented 2 years ago

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 as KeyType 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:

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 {
   |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Would be great to describe limitations in API.md

cassandrus commented 2 years ago

Closing as it is merged now