Skip to content
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] Generate suitable error messages for current misuse of function-typed values, lay groundwork for implementing and testing more general lambdas. #14732

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Sep 24, 2024

  1. Generate suitable error messages for current misuse of function-typed…

    … values,
    
    lay groundwork for implementing and testing more general lambdas.
    
    Fixes #14633.
    
    Catch all errors in test/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.
    
    - add checking for function-typed function results in `function_checker`
    - Change `internal_error` to `error` in `bytecode_generator` and `module_generator`
      to properly show "error" rather than "bug" if lambdas are mistakenly used as values today.
    - tag some code to show where changes are needed to support lambda: // TODO(LAMBDA)
    - fix unused_params_checker and recursive_struct_checker to tolerate lambda types
    - add experiments to control enabling of various aspects of lambda support:
      - LAMBDA_PARAMS, LAMBDA_RESULTS to allow lambdas as general function params or results
      - LAMBDA_FIELDS - support lambdas in struct fields
      - LAMBDA_VALUES - support lambdas in general-purpose values
      - may add LAMBDA_TYPE_PARAMS later
    - update lambda-lifting test config to use those flags rather than disabling checks
    - add a `result_type_loc` field to move-model's `FunctionData` (and model-builder's `FunEntry`)
      to more precisely locate errors in function result types.
    - Fix `GlobalEnv::internal_dump_env` to use function- and struct-specific type contexts
      so that types are shown with correct type parameter names.
    - Check that struct fields are not functions.
    brmataptos committed Sep 24, 2024
    Configuration menu
    Copy the full SHA
    e1c6588 View commit details
    Browse the repository at this point in the history