Inline: fix for edge case mapping unbound dims#667
Merged
Conversation
|
Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/667/index.html |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #667 +/- ##
=======================================
Coverage 96.38% 96.38%
=======================================
Files 267 267
Lines 46112 46134 +22
=======================================
+ Hits 44445 44467 +22
Misses 1667 1667
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
reuterbal
reviewed
Apr 16, 2026
Collaborator
reuterbal
left a comment
There was a problem hiding this comment.
Looks good to me, thanks!
reuterbal
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request fixes a bug in how array bounds are remapped when inlining subroutines with mismatched array bounds, and adds a regression test to ensure correct behavior. The most important changes are:
Bug Fix: Array Bound Remapping
_offset_lboundfunction inprocedures.pyto correctly handle cases where the dimension is aRange, ensuring that both lower and upper bounds are individually adjusted rather than wrapping the range in a sum. This prevents incorrect expressions like-1 + (1:n)and instead generates the correct range0:n-1.Testing: Regression Test for 3-Layer Inlining
test_inline_marked_subroutines_3layer_array_offset, intest_procedures.pyto verify that after inlining, array bounds are properly remapped in a three-layer call scenario, specifically checking that the bug does not reappear.Contributor Declaration
By opening this pull request, I affirm the following: