Skip to content

Fix Io_Implied_Do rejecting a minimal-length io-implied-do (closes #524) - #525

Merged
arporter merged 2 commits into
stfc:masterfrom
DisciplinedSoftware:524_io_implied_do
Aug 24, 2026
Merged

Fix Io_Implied_Do rejecting a minimal-length io-implied-do (closes #524)#525
arporter merged 2 commits into
stfc:masterfrom
DisciplinedSoftware:524_io_implied_do

Conversation

@DisciplinedSoftware

Copy link
Copy Markdown

Closes #524.

The length guard in Io_Implied_Do.match used <= 9, but the shortest legal io-implied-do, e.g. (i,i=1,n), is exactly 9 characters, so statements such as WRITE (IOUT,10) N,(I,I=1,J) failed to parse (found while parsing MODFLOW-2005, gwf2swr7.f:4074). The guard is changed to < 9 and a minimal-length case is added to test_io_implied_do.

  • pytest src/fparser passes (2950 passed, 24 xfailed, 1 pre-existing xpassed)
  • black clean
  • CHANGELOG.md updated (the PR-number placeholder will be filled in once this PR's number is known)

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings August 18, 2026 05:25
The length guard in Io_Implied_Do.match used '<= 9' but the shortest
legal io-implied-do, e.g. '(i,i=1,n)', is exactly 9 characters, so
statements such as 'WRITE (IOUT,10) N,(I,I=1,J)' failed to parse.
Found while parsing MODFLOW-2005 (gwf2swr7.f).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes an off-by-one length check in Io_Implied_Do.match that incorrectly rejected the shortest valid io-implied-do form (9 characters, e.g. (i,i=1,n)), causing valid WRITE statements to fail to parse (as reported in issue #524).

Changes:

  • Adjust Io_Implied_Do.match guard from len(string) <= 9 to len(string) < 9 to allow minimal-length io-implied-do constructs.
  • Add a regression test covering the 9-character minimal-length case in test_io_implied_do.
  • Add a corresponding entry to CHANGELOG.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/fparser/two/Fortran2003.py Fixes the io-implied-do length guard off-by-one so minimal valid constructs are accepted.
src/fparser/two/tests/test_fortran2003.py Adds a regression test for a minimal-length io-implied-do string.
CHANGELOG.md Records the bugfix and references the associated issue/PR.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.25%. Comparing base (18ff788) to head (59c0e2d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #525   +/-   ##
=======================================
  Coverage   92.25%   92.25%           
=======================================
  Files          89       89           
  Lines       13891    13891           
=======================================
  Hits        12815    12815           
  Misses       1076     1076           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arporter arporter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All looks good, thanks very much @DisciplinedSoftware.
Please note that it is the code reviewer who updates the changelog as that's the last thing that must be done before the final merge. We get conflicts otherwise.

@arporter
arporter merged commit 2c3c98e into stfc:master Aug 24, 2026
6 checks passed
arporter added a commit that referenced this pull request Aug 24, 2026
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.

Io_Implied_Do rejects a minimal-length io-implied-do such as (i,i=1,n)

3 participants