Commit 779e488c authored by Robert Bradshaw's avatar Robert Bradshaw

Fix traceback on conditional expression error

parent 257cbde4
...@@ -2766,7 +2766,6 @@ class CondExprNode(ExprNode): ...@@ -2766,7 +2766,6 @@ class CondExprNode(ExprNode):
self.true_val.analyse_types(env) self.true_val.analyse_types(env)
self.false_val.analyse_types(env) self.false_val.analyse_types(env)
self.type = self.compute_result_type(self.true_val.type, self.false_val.type) self.type = self.compute_result_type(self.true_val.type, self.false_val.type)
if self.type:
if self.true_val.type.is_pyobject or self.false_val.type.is_pyobject: if self.true_val.type.is_pyobject or self.false_val.type.is_pyobject:
self.true_val = self.true_val.coerce_to(self.type, env) self.true_val = self.true_val.coerce_to(self.type, env)
self.false_val = self.false_val.coerce_to(self.type, env) self.false_val = self.false_val.coerce_to(self.type, env)
...@@ -2774,7 +2773,7 @@ class CondExprNode(ExprNode): ...@@ -2774,7 +2773,7 @@ class CondExprNode(ExprNode):
self.true_val = self.true_val.coerce_to_temp(env) self.true_val = self.true_val.coerce_to_temp(env)
self.false_val = self.false_val.coerce_to_temp(env) self.false_val = self.false_val.coerce_to_temp(env)
self.is_temp = 1 self.is_temp = 1
else: if self.type == PyrexTypes.error_type:
self.type_error() self.type_error()
def allocate_temps(self, env, result_code = None): def allocate_temps(self, env, result_code = None):
...@@ -2813,7 +2812,7 @@ class CondExprNode(ExprNode): ...@@ -2813,7 +2812,7 @@ class CondExprNode(ExprNode):
elif type2.assignable_from(type1): elif type2.assignable_from(type1):
return type2 return type2
else: else:
return None return PyrexTypes.error_type
def type_error(self): def type_error(self):
if not (self.true_val.type.is_error or self.false_val.type.is_error): if not (self.true_val.type.is_error or self.false_val.type.is_error):
......
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