Commit 0f627698 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix bug in coercing conditional to an integer.

When used in a range operation, it may be coerced to an object,
and then back to an int.  If the operands were already integer
types we should preserve these rather than coercing to the
default int type of long.
parent 02234c6a
......@@ -11150,6 +11150,12 @@ class CondExprNode(ExprNode):
self.type_error()
return self
def coerce_to_integer(self, env):
self.true_val = self.true_val.coerce_to_integer(env)
self.false_val = self.false_val.coerce_to_integer(env)
self.result_ctype = None
return self.analyse_result_type(env)
def coerce_to(self, dst_type, env):
self.true_val = self.true_val.coerce_to(dst_type, env)
self.false_val = self.false_val.coerce_to(dst_type, env)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment