Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for enrich calls bug #141

Merged
merged 1 commit into from
Sep 7, 2023
Merged

Fix for enrich calls bug #141

merged 1 commit into from
Sep 7, 2023

Conversation

awnawab
Copy link
Contributor

@awnawab awnawab commented Sep 5, 2023

This PR fixes the bug highlighted in #134 (in the presence of an explicit interface, call.name still points to symbol defined by interface even after enriching calls).

@github-actions
Copy link

github-actions bot commented Sep 5, 2023

Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/141/index.html

@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Merging #141 (5d3461e) into main (35f8284) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #141      +/-   ##
==========================================
+ Coverage   92.09%   92.11%   +0.02%     
==========================================
  Files          89       89              
  Lines       16512    16516       +4     
==========================================
+ Hits        15207    15214       +7     
+ Misses       1305     1302       -3     
Flag Coverage Δ
lint_rules 96.13% <ø> (ø)
loki 92.04% <100.00%> (+0.02%) ⬆️
transformations 91.68% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
loki/subroutine.py 95.26% <100.00%> (+0.10%) ⬆️

... and 1 file with indirect coverage changes

Copy link
Collaborator

@reuterbal reuterbal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks, well-tested fix for a subtle bug.

As discussed offline, the proper way of fixing this in the future would be to improve the representation of interfaces. While the interface node needs to define a scope, it shouldn't really have a parent because it can't inherit symbols.

However, at the same time we likely want to retain the behaviour of registering the symbols declared by the interface in the parent scope's symbol table.

This is a more invasive change, though, and for a future PR.

for node in [node for intf in self.interfaces for node in intf.body]:
if getattr(node, 'name', None) == call.name:
if node.parent == self:
node.parent = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks with the nested scoping behaviour that we're using normally. However, the root problem is that interface blocks shouldn't really have a parent scope in the first place because they can't inherit symbols, so I'm ok with this temporary solution.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed a follow-up ticket in #147

Copy link
Collaborator

@mlange05 mlange05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with all that was said. GTG from me. :shipit:

@reuterbal reuterbal merged commit 6e4a4e0 into main Sep 7, 2023
11 checks passed
@reuterbal reuterbal deleted the naan-enrich-calls-fix branch September 7, 2023 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enriched call .name reverts to procedure symbol defined in explicit interface
3 participants