-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[move-compiler-v2] fix #14633: fix error messages for lambdas, identify change points for more complete lambda implementation #14742
Conversation
⏱️ 2h 7m total CI duration on this PR
|
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @brmataptos and the rest of your teammates on Graphite |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14742 +/- ##
========================================
Coverage 60.1% 60.1%
========================================
Files 856 856
Lines 210640 210845 +205
========================================
+ Hits 126615 126742 +127
- Misses 84025 84103 +78 ☔ View full report in Codecov by Sentry. |
cac57d5
to
61459eb
Compare
61459eb
to
0f3224a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, can approve once the comment in unused_params_checker.rs
is addressed.
|
||
type QualifiedFunId = QualifiedId<FunId>; | ||
|
||
/// check that non-inline function parameters do not have function type. | ||
fn type_has_function(ty: &Type) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be useful to move this into impl Type
, alongside is_function
(and we can call is just has_function
).
} | ||
|
||
// Takes a list of function types, returns those which have a function type in their argument type | ||
fn identify_function_types_with_functions_in_args(func_returns: Vec<Type>) -> Vec<Type> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this function a list of function types, could we call the param func_types
or even just types
? Not clear from the local context why this param is called func_returns
.
third_party/move/move-compiler-v2/src/env_pipeline/unused_params_checker.rs
Show resolved
Hide resolved
a050828
to
8a317b8
Compare
…r more complete lambda implementation
8a317b8
to
f72846f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
Description
Catch all errors in
move-compiler-v2/tests/checking/typing/lambda.move
in Compiler V2,after splitting and gradually commenting out code as
lambda[2-5].move
,to avoid shadowing by other errors. Lay groundwork for support of lambdas in various capacities.
Fixes #14633.
function_checker
, and functions in parameters and results of function types in both args and results to functions there.internal_error
toerror
inbytecode_generator
andmodule_generator
to properly show "error" rather than "bug" if lambdas are mistakenly used as values today.
LAMBDA_IN_PARAMS
,LAMBDA_IN_RETURNS
to allow lambdas as general function params or resultsLAMBDA_FIELDS
- support lambdas in struct fieldsLAMBDA_VALUES
- support lambdas in general-purpose valuesLAMBDA_TYPE_PARAMS
laterresult_type_loc
field to move-model'sFunctionData
(and model-builder'sFunEntry
)to more precisely locate errors in function result types.
GlobalEnv::internal_dump_env
to use function- and struct-specific type contextsso that types are shown with correct type parameter names.
How Has This Been Tested?
Running the usual tests.
Key Areas to Review
Note that a few errors are caught quite late, in
bytecode-generator
,and the order in which we catch errors may be a bit surprising to
users (errors in
exp_builder
come first, then errors caught byfunction_checker
, then (much later)bytecode_generator
.).Actually supporting particular subsets of the "experiments" mentioned
above would be difficult, but it seems useful to have the labels to
help understand just what features are supported by the implementation
as we go.
Type of Change
Which Components or Systems Does This Change Impact?
Checklist