diff --git a/src/proc/typifier.rs b/src/proc/typifier.rs index d41b17f89..2042ff7f3 100644 --- a/src/proc/typifier.rs +++ b/src/proc/typifier.rs @@ -258,7 +258,23 @@ impl Typifier { | crate::BinaryOperator::Greater | crate::BinaryOperator::GreaterEqual | crate::BinaryOperator::LogicalAnd - | crate::BinaryOperator::LogicalOr => self.resolutions[left.index()].clone(), + | crate::BinaryOperator::LogicalOr => { + let kind = crate::ScalarKind::Bool; + let width = 1; + let inner = match *self.get(left, types) { + crate::TypeInner::Scalar { .. } => crate::TypeInner::Scalar { kind, width }, + crate::TypeInner::Vector { size, .. } => { + crate::TypeInner::Vector { size, kind, width } + } + ref other => { + return Err(ResolveError::IncompatibleOperand { + op: "logical".to_string(), + operand: format!("{:?}", other), + }) + } + }; + Resolution::Value(inner) + } crate::BinaryOperator::And | crate::BinaryOperator::ExclusiveOr | crate::BinaryOperator::InclusiveOr diff --git a/tests/snapshots/snapshots__boids.msl.snap b/tests/snapshots/snapshots__boids.msl.snap index 4cc30a553..47cdc704c 100644 --- a/tests/snapshots/snapshots__boids.msl.snap +++ b/tests/snapshots/snapshots__boids.msl.snap @@ -36,6 +36,8 @@ typedef metal::uint3 type4; typedef int type5; +typedef bool type6; + kernel void main1( constant SimParams& params [[buffer(0)]], constant Particles& particlesSrc [[buffer(1)]], diff --git a/tests/snapshots/snapshots__shadow.msl.snap b/tests/snapshots/snapshots__shadow.msl.snap index b8ad9bf19..0d62314ac 100644 --- a/tests/snapshots/snapshots__shadow.msl.snap +++ b/tests/snapshots/snapshots__shadow.msl.snap @@ -41,6 +41,8 @@ typedef int type9; typedef metal::float3 type10; +typedef bool type11; + type7 fetch_shadow( type6 light_id, type2 homogeneous_coords