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

chore: move delayed_type_checks field from NodeInterner to TypeChecker #1679

Merged
merged 2 commits into from Jun 15, 2023
Merged

chore: move delayed_type_checks field from NodeInterner to TypeChecker #1679

merged 2 commits into from Jun 15, 2023

Conversation

ghost
Copy link

@ghost ghost commented Jun 13, 2023

Problem

The current implementation of the node interner in the codebase appears to be handling multiple responsibilities and exhibiting signs of complexity.

PR Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

Copy link
Contributor

@jfecher jfecher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I'm not sure why we didn't do it this way to begin with.

@jfecher jfecher enabled auto-merge June 15, 2023 14:38
@jfecher jfecher added this pull request to the merge queue Jun 15, 2023
Merged via the queue into noir-lang:master with commit 65b91f2 Jun 15, 2023
@ghost ghost deleted the delayed_type_checks branch June 16, 2023 07:03
@ghost
Copy link
Author

ghost commented Jun 16, 2023

Hey, @jfecher! How do you think there is a sense to move fields into separate structures:

  • next_type_variable_id
  • globals
  • primitive_methods, struct_methods

@jfecher
Copy link
Contributor

jfecher commented Jun 16, 2023

In general anything that is used across both name resolution and type inference (+ potentially monomorphization) belongs in the node interner. Since the interner is the general context object that accompanies the HIR.

  • next_type_variable_id - also referenced by name resolution when translating types, so it is fine in the node interner.
  • globals - I believe these are referenced in name resolution until they're later inlined during monomorphization. So they should be fine as well.
  • primitive_methods/struct_methods - they're populated during name resolution and resolved during type checking so the node interner is fine for these as well.

So in summary, I think each of these are fine where they are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant