Skip to content

Commit

Permalink
Fix IF..ELSE for tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
elprans committed Dec 10, 2018
1 parent caeea01 commit 70de44b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
5 changes: 2 additions & 3 deletions edb/lang/edgeql/compiler/expr.py
Expand Up @@ -31,7 +31,6 @@
from edb.lang.schema import abc as s_abc
from edb.lang.schema import objtypes as s_objtypes
from edb.lang.schema import pointers as s_pointers
from edb.lang.schema import utils as s_utils

from edb.lang.edgeql import ast as qlast
from edb.lang.edgeql import errors
Expand Down Expand Up @@ -358,8 +357,8 @@ def compile_IfElse(
if_expr_type = inference.infer_type(if_expr, ctx.env)
else_expr_type = inference.infer_type(else_expr, ctx.env)

result = s_utils.get_class_nearest_common_ancestor(
ctx.env.schema, [if_expr_type, else_expr_type])
result = if_expr_type.find_common_implicitly_castable_type(
else_expr_type, schema=ctx.env.schema)

if result is None:
raise errors.EdgeQLError(
Expand Down
1 change: 0 additions & 1 deletion tests/test_edgeql_expressions.py
Expand Up @@ -1694,7 +1694,6 @@ async def test_edgeql_expr_if_else_05(self):
]),
])

@unittest.expectedFailure
async def test_edgeql_expr_if_else_06(self):
await self.assert_query_result(r"""
WITH a := {'c', 'a', 't'}
Expand Down
1 change: 0 additions & 1 deletion tests/test_edgeql_views.py
Expand Up @@ -498,7 +498,6 @@ async def test_edgeql_views_if_else_04(self):
[['Alice', 110], ['Bob', 0], ['Carol', 0], ['Dave', 10]],
])

@unittest.expectedFailure
async def test_edgeql_views_if_else_05(self):
await self.assert_query_result(r"""
WITH MODULE test
Expand Down

0 comments on commit 70de44b

Please sign in to comment.