Skip to content

Commit

Permalink
Use is_integer instead of is_signed || is_unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Jul 5, 2024
1 parent 1dcd073 commit 2418975
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/elaborator/statements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<'context> Elaborator<'context> {
expr_span,
}
});
if annotated_type.is_unsigned() || annotated_type.is_signed() {
if annotated_type.is_integer() {
let errors = lints::overflowing_int(self.interner, &expression, &annotated_type);
for error in errors {
self.push_err(error);
Expand Down
4 changes: 4 additions & 0 deletions compiler/noirc_frontend/src/hir_def/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,10 @@ impl Type {
matches!(self.follow_bindings(), Type::Bool)
}

pub fn is_integer(&self) -> bool {
matches!(self.follow_bindings(), Type::Integer(_, _))
}

pub fn is_signed(&self) -> bool {
matches!(self.follow_bindings(), Type::Integer(Signedness::Signed, _))
}
Expand Down

0 comments on commit 2418975

Please sign in to comment.