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

Fix desugaring foreign primitives #215

Merged
merged 2 commits into from
Aug 28, 2023

Conversation

saulshanabrook
Copy link
Member

Fixes the bug introduced by #176 which made foreign primitives desugar improperly. Closes #212.

It does this by moving the TypeInfo into the Desugar struct, as suggested by @oflatt.

I removed the ProofState struct, since it was just holding both the TypeInfo and Desugar together.

src/lib.rs Outdated
Comment on lines 988 to 986
let etype = self.proof_state.type_info.infer_literal(lit);
let etype = self.desugar.type_info.infer_literal(lit);
Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about making a type_info method on the EGraph, to not have to go through desugar every time, but opted to leave it as is for a minimal change.

Happy to refactor to that though, if that is preferred.

Copy link
Member

Choose a reason for hiding this comment

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

I like the type_info method idea!

Copy link
Member Author

Choose a reason for hiding this comment

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

I gave that a go, refactoring all non-mutable usages of egraph.desugar.type_info.

@saulshanabrook saulshanabrook changed the title Fix Fix desugaring foreign primitives Aug 24, 2023
Copy link
Member

@oflatt oflatt left a comment

Choose a reason for hiding this comment

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

Good fix!

@oflatt oflatt merged commit af0a493 into egraphs-good:main Aug 28, 2023
3 checks passed
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.

Fix type checking custom primitives
2 participants