-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move-compiler-v2] add parser code for lambda types (#14792)
Add parser code for function values and non-inline lambdas Extend syntax - for lambda: `move |args| body with copy+store` - Add function types: `|T1, T2| T3 with copy+store` - curry construction: - from lambda: `|a, b| f(x, 3, a, b)` - `EarlyBind` operation takes a function value and values for any number of leading parameters. - arbitrary function calls: - `(|x, y| x + y)(2, 3)` - suppress printing common abilities (all functions have drop) Modify exp_builder and lambda_lifter to generate function values, model to track "used" functions in addition to "called" functions. Attaches an `AbilitySet` to `Type::Fun` and `Exp::Lambda` based on source. 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 for function abilities. Added more lambda tests under `move-compiler-v2/tests/lambda/` which are run "with" and "without" lambda features enabled. Currently, many things pass through to hit "not yet implemented" errors in bytecode gen, etc. Tricky features are: - In some cases, abilities may not be inferred well yet, so examples may need to be over-annotated with abilities. - in `ty.rs`: unification checks `Fun` abilities as well as other things. - in `lambda_lifter.rs`, we (1) reject lambdas without `move` free-var handling, (2) try to reduce lambda to curry, by checking for a simple function call with simple args, the last of which are identical to the lambda parameters.
- Loading branch information
1 parent
1e926ed
commit 5d87d94
Showing
147 changed files
with
5,915 additions
and
5,496 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.