Skip to content

Remove as_bool in Instruction trait#404

Merged
CohenArthur merged 6 commits into
masterfrom
remove_as_bool
Dec 3, 2021
Merged

Remove as_bool in Instruction trait#404
CohenArthur merged 6 commits into
masterfrom
remove_as_bool

Conversation

@Skallwar

@Skallwar Skallwar commented Dec 3, 2021

Copy link
Copy Markdown
Member

Fixes #387

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

@CohenArthur CohenArthur left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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 :)

@Skallwar Skallwar Dec 3, 2021

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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!

Comment thread src/instruction/if_else.rs
Comment thread src/instruction/if_else.rs Outdated
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