Skip to content

Commit 881572b

Browse files
committed
Bug fix
Signed-off-by: Louis Mandel <[email protected]>
1 parent 3056322 commit 881572b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/pdl/pdl_interpreter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,9 +1122,9 @@ def process_contribution(
11221122
scope: ScopeType,
11231123
loc: PdlLocationType,
11241124
) -> tuple[ScopeType, ContributeElement]:
1125-
if elem in set(ContributeTarget):
1126-
return scope, elem
11271125
if isinstance(elem, str):
1126+
if elem in set(ContributeTarget):
1127+
return scope, elem
11281128
target = elem
11291129
aggregator = get_var(elem, scope, loc)
11301130
elif isinstance(elem, dict):
@@ -1139,14 +1139,14 @@ def process_contribution(
11391139
target, contribute_value = list(elem.items()).pop()
11401140
aggregator = get_var(target, scope, loc)
11411141
try:
1142-
result = process_expr(scope, contribute_value.value, loc)
1142+
result, value_trace = process_expr(scope, contribute_value.value, loc)
11431143
except PDLRuntimeExpressionError as exc:
11441144
raise PDLRuntimeError(
11451145
exc.message,
11461146
loc=exc.loc or loc,
11471147
trace=ErrorBlock(msg=exc.message, pdl__location=loc, program=block),
11481148
) from exc
1149-
elem = {target: result}
1149+
elem = {target: ContributeValue(value=value_trace)}
11501150
else:
11511151
msg = "Contributions are expected to be strings or dictionaries of length 1 but got {elem}"
11521152
raise PDLRuntimeError(

0 commit comments

Comments
 (0)