MCPcopy Index your code
hub / github.com/python/mypy / visit_int_op

Method visit_int_op

mypyc/analysis/ircheck.py:432–450  ·  view source on GitHub ↗
(self, op: IntOp)

Source from the content-addressed store, hash-verified

430 pass
431
432 def visit_int_op(self, op: IntOp) -> None:
433 self.expect_primitive_type(op, op.lhs)
434 self.expect_primitive_type(op, op.rhs)
435 self.expect_non_float(op, op.lhs)
436 self.expect_non_float(op, op.rhs)
437 left = op.lhs.type
438 right = op.rhs.type
439 op_str = op.op_str[op.op]
440 if (
441 isinstance(left, RPrimitive)
442 and isinstance(right, RPrimitive)
443 and left.is_signed != right.is_signed
444 and (
445 op_str in ("+", "-", "*", "/", "%")
446 or (op_str not in ("<<", ">>") and left.size != right.size)
447 )
448 and not is_pointer_arithmetic(op)
449 ):
450 self.fail(op, f"Operand types have incompatible signs: {left}, {right}")
451
452 def visit_comparison_op(self, op: ComparisonOp) -> None:
453 self.check_compatibility(op, op.lhs.type, op.rhs.type)

Callers

nothing calls this directly

Calls 5

expect_primitive_typeMethod · 0.95
expect_non_floatMethod · 0.95
failMethod · 0.95
isinstanceFunction · 0.85
is_pointer_arithmeticFunction · 0.85

Tested by

no test coverage detected