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 2 #5088

Merged

Conversation

anton-trunov
Copy link
Contributor

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

Description

Partially resolves issue #5050.

All the impl TypeEngine methods from the file type_system/engine.rs that also take Engines and Namespace as parameters have been moved into impl TypeCheckContext.

All the impl Root methods from the file namespace/root.rs that also take Engines as parameters 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:

  • type_engine.monomorphize -> ctx.monomorphize_with_modpath
  • type_engine.resolve -> ctx.resolve
  • type_engine.resolve_with_self -> ctx.resolve_with_self
  • type_engine.MonomorphizeHelper -> ctx.MonomorphizeHelper
  • type_engine.EnforceTypeArguments -> ctx.EnforceTypeArguments
  • namespace.root.resolve_call_path_with_visibility_check -> ctx.resolve_call_path_with_visibility_check_and_modpath

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 the `impl TypeEngine` methods from the file `type_system/engine.rs` that also
take `Engines` and `Namespace` as parameters have been moved into `impl TypeCheckContext`.

All the `impl Root` methods from the file `namespace/root.rs` that also
take `Engines` as parameters 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:

- `type_engine.monomorphize` -> `ctx.monomorphize_with_modpath`
- `type_engine.resolve` -> `ctx.resolve`
- `type_engine.resolve_with_self` -> `ctx.resolve_with_self`
- `type_engine.MonomorphizeHelper` -> `ctx.MonomorphizeHelper`
- `type_engine.EnforceTypeArguments` -> `ctx.EnforceTypeArguments`
- `namespace.root.resolve_call_path_with_visibility_check` -> `ctx.resolve_call_path_with_visibility_check_and_modpath`
@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 5, 2023
@anton-trunov anton-trunov requested a review from a team September 5, 2023 08:09
@anton-trunov anton-trunov self-assigned this Sep 5, 2023
@anton-trunov anton-trunov changed the title Accumulate typechecking methods in impl TypeCheckContext, part 2 Accumulate typechecking methods in impl TypeCheckContext, part 2 Sep 5, 2023
@anton-trunov
Copy link
Contributor Author

I'll check if this PR is already enough to resolve issue #5036. If it is, I'll stop the refactoring at this point, unless someone has more ideas what else should be moved to impl TypeCheckContext

@anton-trunov anton-trunov requested a review from tritao September 6, 2023 14:31
@anton-trunov anton-trunov merged commit e00df8a into master Sep 6, 2023
@anton-trunov anton-trunov deleted the anton-trunov/typecheck-context-consolidation-part-2 branch September 6, 2023 17:35
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