diff --git a/compiler/noirc_frontend/src/hir_def/types.rs b/compiler/noirc_frontend/src/hir_def/types.rs index 2504145825b..77221dd6ab7 100644 --- a/compiler/noirc_frontend/src/hir_def/types.rs +++ b/compiler/noirc_frontend/src/hir_def/types.rs @@ -1515,6 +1515,11 @@ impl Type { rhs: Box, inversion: bool, ) -> Type { + // If this infix expression contains an error then it is eventually an error itself. + if matches!(*lhs, Type::Error) || matches!(*rhs, Type::Error) { + return Type::Error; + } + // If an InfixExpr like this is tried to be created: // // a * (b / a)