Skip to content
Snippets Groups Projects
Commit 9c5b9bce authored by Richard Angersbach's avatar Richard Angersbach
Browse files

Omit unnecessary type context creations for PsVecHorizontal

parent 508701f6
No related branches found
No related tags found
1 merge request!438Reduction Support
Pipeline #78281 failed
...@@ -584,34 +584,32 @@ class Typifier: ...@@ -584,34 +584,32 @@ class Typifier:
# bin op consisting of a scalar and a vector that is converted to a scalar # bin op consisting of a scalar and a vector that is converted to a scalar
# -> whole expression should be treated as scalar # -> whole expression should be treated as scalar
scalar_op_tc = TypeContext() self.visit_expr(expr.scalar_operand, tc)
self.visit_expr(expr.scalar_operand, scalar_op_tc)
vector_op_tc = TypeContext() self.visit_expr(expr.vector_operand, tc)
self.visit_expr(expr.vector_operand, vector_op_tc)
if scalar_op_tc.target_type is None or vector_op_tc.target_type is None: if tc.target_type is None or tc.target_type is None:
raise TypificationError( raise TypificationError(
f"Unable to determine type of argument to vector horizontal: {expr}" f"Unable to determine type of argument to vector horizontal: {expr}"
) )
if not isinstance(scalar_op_tc.target_type, PsScalarType): if not isinstance(tc.target_type, PsScalarType):
raise TypificationError( raise TypificationError(
f"Illegal type in scalar operand (op1) to vector horizontal: {scalar_op_tc.target_type}" f"Illegal type in scalar operand (op1) to vector horizontal: {tc.target_type}"
) )
if not isinstance(vector_op_tc.target_type, PsVectorType): if not isinstance(tc.target_type, PsVectorType):
raise TypificationError( raise TypificationError(
f"Illegal type in vector operand (op2) to vector horizontal: {vector_op_tc.target_type}" f"Illegal type in vector operand (op2) to vector horizontal: {tc.target_type}"
) )
if vector_op_tc.target_type.scalar_type is not scalar_op_tc.target_type: if tc.target_type.scalar_type is not tc.target_type:
raise TypificationError( raise TypificationError(
f"Scalar type of vector operand {vector_op_tc.target_type} " f"Scalar type of vector operand {tc.target_type} "
f"does not correspond to type of scalar operand {scalar_op_tc.target_type}" f"does not correspond to type of scalar operand {tc.target_type}"
) )
tc.apply_dtype(scalar_op_tc.target_type, expr) tc.apply_dtype(tc.target_type, expr)
case PsBinOp(op1, op2): case PsBinOp(op1, op2):
self.visit_expr(op1, tc) self.visit_expr(op1, tc)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment