Skip to content

Commit

Permalink
Handle error context when inferring multiplicity and cardinality..
Browse files Browse the repository at this point in the history
  • Loading branch information
dnwpark committed May 31, 2024
1 parent 542ebb1 commit 06e32b7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions edb/edgeql/compiler/inference/cardinality.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,11 @@ def __infer_typecast(
scope_tree: irast.ScopeTreeNode,
ctx: inference_context.InfCtx,
) -> qltypes.Cardinality:
if ir.error_message_context is not None:
infer_cardinality(
ir.error_message_context, scope_tree=scope_tree, ctx=ctx
)

card = infer_cardinality(
ir.expr, scope_tree=scope_tree, ctx=ctx,
)
Expand Down
5 changes: 5 additions & 0 deletions edb/edgeql/compiler/inference/multiplicity.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,11 @@ def __infer_typecast(
scope_tree: irast.ScopeTreeNode,
ctx: inf_ctx.InfCtx,
) -> inf_ctx.MultiplicityInfo:
if ir.error_message_context is not None:
infer_multiplicity(
ir.error_message_context, scope_tree=scope_tree, ctx=ctx
)

return infer_multiplicity(
ir.expr, scope_tree=scope_tree, ctx=ctx,
)
Expand Down
3 changes: 0 additions & 3 deletions edb/edgeql/compiler/stmtctx.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@ def fini_expression(
if p.sub_params and p.sub_params.decoder_ir
]
extra_exprs += [trigger.expr for stage in ir_triggers for trigger in stage]
for type_cast in find_children(ir, irast.TypeCast):
if type_cast.error_message_context is not None:
extra_exprs.append(type_cast.error_message_context)

all_exprs = [ir] + extra_exprs

Expand Down

0 comments on commit 06e32b7

Please sign in to comment.