Fix the typification of logical expressions

This commit is contained in:
Dzmitry Malyshau authored and Dzmitry Malyshau committed 2021-02-15 21:26:29 -05:00
1 parent 537a516ff5
commit 149dc9995f
3 files changed
+21 -1

No files matched your search

+17 -1
View File
@@ -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
@@ -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)]],
@@ -41,6 +41,8 @@ typedef int type9;
typedef metal::float3 type10;
typedef bool type11;
type7 fetch_shadow(
type6 light_id,
type2 homogeneous_coords