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

Remove as_bool in Instruction trait #404

Merged
merged 6 commits into from
Dec 3, 2021
Merged

Remove as_bool in Instruction trait #404

merged 6 commits into from
Dec 3, 2021

Conversation

Skallwar
Copy link
Member

@Skallwar Skallwar commented Dec 3, 2021

Fixes #387

@Skallwar Skallwar self-assigned this Dec 3, 2021
@Skallwar Skallwar requested a review from CohenArthur December 3, 2021 22:05
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

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

This is suuuuuch a nice cleanup. Thanks a lot, this is fantastic!

Comment on lines +138 to +146
match self.op {
Operator::Lt
| Operator::Gt
| Operator::LtEq
| Operator::GtEq
| Operator::Equals
| Operator::NotEquals => CheckedType::Resolved(TypeId::from("bool")),
_ => l_type,
}
Copy link
Member

Choose a reason for hiding this comment

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

I think this might be missing checking that both the l_type and r_type are the same? Maybe I'm missing part of the function, I can't check it for now. If that is the case, could you add a test case for this as it is a typechecking error to operate on two types with different types and I should have added one already :)

Copy link
Member Author

@Skallwar Skallwar Dec 3, 2021

Choose a reason for hiding this comment

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

This done line 128. Don't know if this is tested though.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, great thanks for checking!

src/instruction/if_else.rs Show resolved Hide resolved
src/instruction/if_else.rs Outdated Show resolved Hide resolved
Skallwar and others added 2 commits December 4, 2021 00:02
Co-authored-by: CohenArthur <arthur.cohen@epita.fr>
@Skallwar Skallwar requested a review from CohenArthur December 3, 2021 23:08
@CohenArthur CohenArthur merged commit 19e36a8 into master Dec 3, 2021
@CohenArthur CohenArthur deleted the remove_as_bool branch December 3, 2021 23:10
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.

Remove as_bool function in Instruction trait entirely
2 participants