Skip to content

Transpilation: add ad-hoc typers for map/big_map operations

E. Rivas requested to merge er433/transpilation/external_typers into dev

Motivation and Context

When transpiling, map accesses m[k] are transpiled to Map.find_opt. However, we don't really know whether m is a map or a big_map, which causes an error. Something similar happens with patching/removing from a map.

Description

This MR adds a new module Transpiled with functions map_find_opt that works on both map and big_map (by reducing to a Michelson embedding of { GET } + external typer), map_add and `map_remove .

After we implement a flag for transpiled code, we could include Transpiled module in the stdlib only when --transpiled is passed.

Component

  • compiler
  • website
  • webide
  • vscode-plugin
  • debugger

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement (non-breaking change that improves performance)
  • None (change with no changelog)

Changelog

Checklist:

  • Changes follow the existing coding style (use dune @fmt to check).
  • Tests for the changes have been added (for bug fixes / feature).
  • Documentation has been updated.
  • Changelog description has been added (if appropriate).
  • Start titles under ## Changelog section with #### (if appropriate).
  • There is no image or uploaded file in changelog
  • Examples in changed behaviour have been added to the changelog (for breaking change / feature).
Edited by E. Rivas

Merge request reports