aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

add parser code for lambda types

Open brmataptos opened this issue 4 months ago • 3 comments

Description

Extend syntax

  • lambda expression: |args| body has copy, store
  • function types: |T1, T2| T3: copy+store
  • arbitrary function calls:
    • (expr)(args, ...)
    • func(args, ...)
    • (|x, y| x + y)(2, 3)
  • suppress printing common abilities (all functions have drop)

Attaches attributes to Type::Fun and Exp::Lambda for future use. Adds a new ExpCall operation in parser/expansion ASTs to be able to carry more generalized function calls through to move-model, which already can support this through Invoke, which previously was underutilized. Added basic type checking.

How Has This Been Tested?

Probably need to add more tests before sending out.

Key Areas to Review

Type of Change

  • [x] New feature
  • [ ] Bug fix
  • [ ] Breaking change
  • [ ] Performance improvement
  • [ ] Refactoring
  • [ ] Dependency update
  • [ ] Documentation update
  • [ ] Tests

Which Components or Systems Does This Change Impact?

  • [ ] Validator Node
  • [ ] Full Node (API, Indexer, etc.)
  • [ ] Move/Aptos Virtual Machine
  • [ ] Aptos Framework
  • [ ] Aptos CLI/SDK
  • [ ] Developer Infrastructure
  • [x] Move Compiler
  • [ ] Other (specify)

Checklist

  • [x] I have read and followed the CONTRIBUTING doc
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I identified and added all stakeholders and component owners affected by this change as reviewers
  • [x] I tested both happy and unhappy path of the functionality
  • [x] I have made corresponding changes to the documentation

brmataptos avatar Sep 28 '24 04:09 brmataptos