Skip to content

Commit

Permalink
#2845 alter validate to check routine symbol table
Browse files Browse the repository at this point in the history
  • Loading branch information
arporter committed Jan 13, 2025
1 parent 2307ac7 commit 04e347d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/psyclone/psyir/transformations/inline_trans.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ def apply(self, node, options=None):
# the ancestor Routine. This avoids issues like #2424 when
# applying ParallelLoopTrans to loops containing inlined calls.
if ancestor_table is not scope.symbol_table:
ancestor_table.merge(scope.symbol_table)
try:
ancestor_table.merge(scope.symbol_table)
except SymbolError as err:
raise InternalError("No escape") from err
replacement = type(scope.symbol_table)()
scope.symbol_table.detach()
replacement.attach(scope)
Expand Down Expand Up @@ -673,7 +676,8 @@ def validate(self, node, options=None):
f"Routine '{routine.name}' cannot be inlined because it "
f"has a named argument '{arg}' (TODO #924).")

table = node.scope.symbol_table
parent_routine = node.ancestor(Routine)
table = parent_routine.symbol_table # node.scope.symbol_table
routine_table = routine.symbol_table

for sym in routine_table.datasymbols:
Expand All @@ -693,7 +697,10 @@ def validate(self, node, options=None):
raise TransformationError(
f"Routine '{routine.name}' cannot be inlined because it "
f"contains a Symbol '{sym.name}' with an UnknownInterface:"
f" '{sym.datatype.declaration}'")
f" '{sym.datatype.declaration}'. You may be able to work "
f"around this limitation by adding the name of the module "
f"containing this Symbol to RESOLVE_IMPORTS in the "
f"transformation script.")
# Check that there are no static variables in the routine (because
# we don't know whether the routine is called from other places).
if (isinstance(sym.interface, StaticInterface) and
Expand Down

0 comments on commit 04e347d

Please sign in to comment.