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

Implement OrdWithEngines for some types #4082

Merged
merged 4 commits into from
Feb 15, 2023

Conversation

emilyaherbert
Copy link
Contributor

Description

This PR is a subset of #3744. It adds a OrdWithEngines for the types required in #3744. Note---this isn't a necessary change into master right at this current moment, just simply a way of breaking up #3744 😄

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.

@emilyaherbert emilyaherbert added code quality compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels Feb 14, 2023
@emilyaherbert emilyaherbert requested a review from a team February 14, 2023 23:01
@emilyaherbert emilyaherbert self-assigned this Feb 14, 2023
@emilyaherbert emilyaherbert marked this pull request as ready for review February 14, 2023 23:01
@emilyaherbert emilyaherbert enabled auto-merge (squash) February 14, 2023 23:01
Copy link
Contributor

@otrho otrho left a comment

Choose a reason for hiding this comment

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

Do you need Ord to put stuff into BTreeMaps or something? What's the general need for ordering types?

sway-core/src/engine_threading.rs Show resolved Hide resolved
@emilyaherbert
Copy link
Contributor Author

emilyaherbert commented Feb 15, 2023

Do you need Ord to put stuff into BTreeMaps or something? What's the general need for ordering types?

Yeah, that is the reason! More specifically #3744 introduces a classic constraint solver that uses types in the constraints. The BTreeMap is used to both avoid duplicate constraints and ensure that constraints are solved in the same order every time the compiler compiles the same bit of code.

@emilyaherbert emilyaherbert merged commit d3d6d33 into master Feb 15, 2023
@emilyaherbert emilyaherbert deleted the emilyaherbert/ord-with-engines branch February 15, 2023 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality 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.

4 participants