Skip to content

Commit

Permalink
fmt and clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
xunilrj committed Aug 13, 2024
1 parent 83f5cbb commit 9e589a2
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions sway-core/src/language/ty/expression/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,16 @@ impl TypeCheckAnalysis for TyExpression {
ctx: &mut TypeCheckAnalysisContext,
) -> Result<(), ErrorEmitted> {
// Check literal "fits" into assigned typed.
match &self.expression {
TyExpressionVariant::Literal(Literal::Numeric(literal_value)) => {
let t = ctx.engines.te().get(self.return_type);
match &*t {
TypeInfo::UnsignedInteger(bits) => {
if bits.would_overflow(*literal_value) {
handler.emit_err(CompileError::TypeError(
TypeError::ConstrainedNumeric {
expected: format!("{:?}", ctx.engines.help_out(t)),
span: self.span.clone(),
},
));
}
}
_ => {}
if let TyExpressionVariant::Literal(Literal::Numeric(literal_value)) = &self.expression {
let t = ctx.engines.te().get(self.return_type);
if let TypeInfo::UnsignedInteger(bits) = &*t {
if bits.would_overflow(*literal_value) {
handler.emit_err(CompileError::TypeError(TypeError::ConstrainedNumeric {
expected: format!("{:?}", ctx.engines.help_out(t)),
span: self.span.clone(),
}));
}
}
_ => {}
}
self.expression.type_check_analyze(handler, ctx)
}
Expand Down

0 comments on commit 9e589a2

Please sign in to comment.