Skip to content
Snippets Groups Projects

Fix type-checking of select to handle non-concrete condition type

Merged Aaron Councilman requested to merge typecheck-select into main
2 files
+ 28
12
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -688,26 +688,19 @@ fn typeflow(
return Error(String::from("Ternary node must have exactly three inputs."));
}
if let Concrete(id) = inputs[0] {
match op {
TernaryOperator::Select => {
match op {
TernaryOperator::Select => {
if let Concrete(id) = inputs[0] {
if !types[id.idx()].is_bool() {
return Error(String::from(
"Select ternary node input cannot have non-bool condition input.",
));
}
let data_ty = TypeSemilattice::meet(inputs[1], inputs[2]);
if let Concrete(data_id) = data_ty {
return Concrete(data_id);
} else {
return data_ty;
}
}
TypeSemilattice::meet(inputs[1], inputs[2])
}
}
Error(String::from("Unhandled ternary types."))
}
Node::Call {
control: _,
Loading