From c7cf77021a8eb8270f3c5255c370c83846cc03aa Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Mon, 27 Nov 2023 13:33:38 -0800 Subject: [PATCH] [naga wgsl-in] Clarify match in `automatic_conversion_join`. Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> --- naga/src/front/wgsl/lower/conversion.rs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/naga/src/front/wgsl/lower/conversion.rs b/naga/src/front/wgsl/lower/conversion.rs index 893c425433b..839d05f612a 100644 --- a/naga/src/front/wgsl/lower/conversion.rs +++ b/naga/src/front/wgsl/lower/conversion.rs @@ -330,26 +330,16 @@ impl crate::Scalar { } // AbstractInt converts to AbstractFloat. - (Sk::AbstractFloat | Sk::AbstractInt, Sk::AbstractFloat | Sk::AbstractInt) => { - Some(Self { - kind: Sk::AbstractFloat, - width: crate::ABSTRACT_WIDTH, - }) - } + (Sk::AbstractFloat, Sk::AbstractInt) => Some(other), + (Sk::AbstractInt, Sk::AbstractFloat) => Some(self), // AbstractFloat converts to Float. - (Sk::AbstractFloat, Sk::Float) => Some(Self::float(other.width)), - (Sk::Float, Sk::AbstractFloat) => Some(Self::float(self.width)), + (Sk::AbstractFloat, Sk::Float) => Some(other), + (Sk::Float, Sk::AbstractFloat) => Some(self), // AbstractInt converts to concrete integer or float. - (Sk::AbstractInt, kind @ (Sk::Uint | Sk::Sint | Sk::Float)) => Some(Self { - kind, - width: other.width, - }), - (kind @ (Sk::Uint | Sk::Sint | Sk::Float), Sk::AbstractInt) => Some(Self { - kind, - width: self.width, - }), + (Sk::AbstractInt, Sk::Uint | Sk::Sint | Sk::Float) => Some(other), + (Sk::Uint | Sk::Sint | Sk::Float, Sk::AbstractInt) => Some(self), // AbstractFloat can't be reconciled with concrete integer types. (Sk::AbstractFloat, Sk::Uint | Sk::Sint) | (Sk::Uint | Sk::Sint, Sk::AbstractFloat) => {