tact-lang / tact

Tact compiler main repository
https://tact-lang.org
MIT License
267 stars 53 forks source link

Compilation of `map<Address, Int as coins>` in persistent state fails #407

Closed novusnota closed 5 days ago

novusnota commented 6 days ago

Consider the following:

import "@stdlib/deploy";

contract Example with Deployable {
    c: map<Address, Int as coins>;
}

It produces a following compilation error:

Tact compilation failed
Error: /TactPlayground/contracts/playground.tact:4:5: Unsupported format coins for map value
Line 4, col 5:
  3 | contract Example with Deployable {
> 4 |     c: map<Address, Int as coins>;
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5 |

    at throwError (/TactPlayground/node_modules/@tact-lang/compiler/dist/grammar/ast.js:66:15)
    at resolveABIType (/TactPlayground/node_modules/@tact-lang/compiler/dist/types/resolveABITypeRef.js:223:42)
    at buildFieldDescription (/TactPlayground/node_modules/@tact-lang/compiler/dist/types/resolveDescriptors.js:267:61)
    at resolveDescriptors (/TactPlayground/node_modules/@tact-lang/compiler/dist/types/resolveDescriptors.js:299:38)
    at precompile (/TactPlayground/node_modules/@tact-lang/compiler/dist/pipeline/precompile.js:18:55)

Note, that the same map declared via let inside a function body compiles and works fine.

Expected: normal compilation. Observed: failure of compilation. Found by: @howardpen9