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

Accumulate typechecking methods in impl TypeCheckContext, part 1 #5087

Merged

Conversation

anton-trunov
Copy link
Contributor

@anton-trunov anton-trunov commented Sep 4, 2023

Description

Partially resolves issue #5050

All methods from impl Namespace from the file namespace.rs that also take Engines as a parameter have been moved into impl TypeCheckContext.

I'm splitting the refactoring into several PRs to solicit early feedback, make review process a bit easier and potentially create fewer merge conflicts.

List of changes:

  • ctx.namespace.find_method_for_type -> ctx.find_method_for_type
  • ctx.namespace.find_constant_for_type -> ctx.find_constant_for_type
  • ctx.namespace.get_items_for_type_and_trait_name -> ctx.get_items_for_type_and_trait_name
  • ctx.namespace.insert_trait_implementation -> ctx.insert_trait_implementation
  • ctx.namespace.variant_import -> ctx.variant_import
  • ctx.namespace.item_import -> ctx.item_import
  • ctx.namespace.self_import -> ctx.self_import
  • ctx.namespace.variant_star_import -> ctx.variant_star_import
  • ctx.namespace.star_import -> ctx.star_import
  • ctx.namespace.find_items_for_type -> ctx.find_items_for_type
  • ctx.namespace.resolve_call_path_with_visibility_check -> ctx.resolve_call_path_with_visibility_check
  • ctx.namespace.resolve_type_with_self -> ctx.resolve_type_with_self (and the previous specialized version in ctx removed)
  • ctx.namespace.resolve_type_without_self -> ctx.resolve_type_without_self (and the previous specialized version in ctx removed)

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

All methods from `impl Namespace` that also take `Engines` as a parameter
have been moved into `impl TypeCheckContext`.

List of changes:

- `ctx.namespace.find_method_for_type` -> `ctx.find_method_for_type`
- `ctx.namespace.find_constant_for_type` -> `ctx.find_constant_for_type`
- `ctx.namespace.get_items_for_type_and_trait_name` -> `ctx.get_items_for_type_and_trait_name`
- `ctx.namespace.insert_trait_implementation` -> `ctx.insert_trait_implementation`
- `ctx.namespace.variant_import` -> `ctx.variant_import`
- `ctx.namespace.item_import` -> `ctx.item_import`
- `ctx.namespace.self_import` -> `ctx.self_import`
- `ctx.namespace.variant_star_import` -> `ctx.variant_star_import`
- `ctx.namespace.star_import` -> `ctx.star_import`
- `ctx.namespace.find_items_for_type` -> `ctx.find_items_for_type`
- `ctx.namespace.resolve_call_path_with_visibility_check` -> `ctx.resolve_call_path_with_visibility_check`
- `ctx.namespace.resolve_type_with_self` -> `ctx.resolve_type_with_self` (and the previous specialized version in `ctx` removed)
- `ctx.namespace.resolve_type_without_self` -> `ctx.resolve_type_without_self` (and the previous specialized version in `ctx` removed)

Partially resolves issue #5050
@anton-trunov anton-trunov force-pushed the anton-trunov/typecheck-context-consolidation-part-1 branch from c5b3bb2 to c070619 Compare September 4, 2023 15:09
@anton-trunov anton-trunov self-assigned this Sep 4, 2023
@anton-trunov anton-trunov requested a review from a team September 4, 2023 21:21
@anton-trunov anton-trunov added the compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen label Sep 4, 2023
@anton-trunov anton-trunov merged commit 36ccf52 into master Sep 5, 2023
31 checks passed
@anton-trunov anton-trunov deleted the anton-trunov/typecheck-context-consolidation-part-1 branch September 5, 2023 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants