Skip to content

Commit

Permalink
diag(naga): add type info to InvalidBinaryOperandTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichDonGubler committed Nov 12, 2024
1 parent 59897f1 commit 12c9a69
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions naga/src/valid/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,20 @@ pub enum ExpressionError {
IndexableLength(#[from] IndexableLengthError),
#[error("Operation {0:?} can't work with {1:?}")]
InvalidUnaryOperandType(crate::UnaryOperator, Handle<crate::Expression>),
#[error("Operation {op:?} can't work with {lhs:?} and {rhs:?}")]
#[error(
"Operation {:?} can't work with {:?} (of type {:?}) and {:?} (of type {:?})",
op,
lhs_expr,
lhs_type,
rhs_expr,
rhs_type
)]
InvalidBinaryOperandTypes {
op: crate::BinaryOperator,
lhs: Handle<crate::Expression>,
rhs: Handle<crate::Expression>,
lhs_expr: Handle<crate::Expression>,
lhs_type: crate::TypeInner,
rhs_expr: Handle<crate::Expression>,
rhs_type: crate::TypeInner,
},
#[error("Selecting is not possible")]
InvalidSelectTypes,
Expand Down Expand Up @@ -849,8 +858,10 @@ impl super::Validator {
);
return Err(ExpressionError::InvalidBinaryOperandTypes {
op,
lhs: left,
rhs: right,
lhs_expr: left,
lhs_type: left_inner.clone(),
rhs_expr: right,
rhs_type: right_inner.clone(),
});
}
ShaderStages::all()
Expand Down

0 comments on commit 12c9a69

Please sign in to comment.