-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/141/index.html |
Codecov Report
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
|
0bc6824
to
5d3461e
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this 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.
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).