Skip to content

[TM-350] Remove parameter and storage aliases

Ivan Gromakovskii requested to merge gromak/tm350-type-parameter-storage into master

Description

Problem: Morley language supports implicit Parameter and Storage type aliases, so one can write parameter and it will be replaced with concrete parameter type of the current contract. This feature causes some inconvenience: most of the code is written with assumption that Untyped.Type is concrete, i. e. does not contain aliases. However, it is not know statically, so we have to use error everywhere.

Moreover, this assumption does not necessarily hold everywhere. It can be easily violated if we parse an instruction (not a contract) containing such an alias. In this case we just can't replace aliases with anything concrete.

This feature is not really useful: one can write type Param = … in let block and use it anywhere (including parameter statement). Moreover, usefulness of the Morley language is questionable as there are more powerful alternatives (e. g. one can use Lorentz). Since usefulness of this feature is close to 0 and inconvenience caused by it is really above 0, it seems better to remove it completely.

Solution:

  1. Remove TypeParameter and TypeStorage constructor, parsers.
  2. Remove description of this feature from docs.
  3. Remove 'explicitType' tests (because we don't distinguish explicit and implicit types anymore) and replace Storage/Parameter types in other parser tests with concrete types.
  4. Remove/update test contracts with this feature.
  5. Permit Storage and Parameter type aliases.

Related issue(s)

https://issues.serokell.io/issue/TM-350

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:

Stylistic guide (mandatory)

Edited by Ivan Gromakovskii

Merge request reports