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(refactor): Remove optional global_id from methods that can get it from the definition #6283

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

aakoshh
Copy link
Contributor

@aakoshh aakoshh commented Oct 11, 2024

Description

Problem*

Followup to #6282

Summary*

Some methods in the Elaborator received a global_id: Option<GlobalId> and a definition: DefinitionKind parameter. We found that Elaborator::elaborate_let actually created definition to carry the same global ID as it was given, so global_id: Some(id) and definition: DefinitionKind::Global(id) always carried the same value. We added an assertion that checked that they are never different.

The next logical step is to remove the possibility of confusion by only carrying the ID in the definition.

Additional Context

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist*

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

@aakoshh aakoshh merged commit 11c7d74 into 5001-global-index Oct 11, 2024
45 of 47 checks passed
@aakoshh aakoshh deleted the 5001-remove-global-id-use-definition branch October 11, 2024 16:03
aakoshh added a commit that referenced this pull request Oct 11, 2024
…it from the definition (#6283)

# Description

## Problem\*

Followup to #6282

## Summary\*
Some methods in the `Elaborator` received a `global_id:
Option<GlobalId>` and a `definition: DefinitionKind` parameter. We found
that `Elaborator::elaborate_let` actually created `definition` to carry
the same global ID as it was given, so `global_id: Some(id)` and
`definition: DefinitionKind::Global(id)` always carried the same value.
We added an
[assertion](1d2bd36)
that checked that they are never different.

The next logical step is to remove the possibility of confusion by only
carrying the ID in the definition.

## Additional Context

## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [ ] I have tested the changes locally.
- [ ] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
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