Skip to content

Fix inline selected_kind parsing (issue #353)#9

Merged
krystophny merged 3 commits into
masterfrom
fix/issue353-selected-kind
Jun 14, 2026
Merged

Fix inline selected_kind parsing (issue #353)#9
krystophny merged 3 commits into
masterfrom
fix/issue353-selected-kind

Conversation

@krystophny

Copy link
Copy Markdown
Member

Fixes jameskermode#353.

Problem

  • Declarations like integer(kind=selected_int_kind(9)) and real(kind=selected_real_kind(13,300)) were parsed with a missing closing parenthesis, leading to invalid wrapper declarations:
    • integer(selected_int_kind(9), intent(out) :: i
    • real(selected_real_kind(13,300), intent(out) :: a

Fix

  • Teach the parser’s type-match extraction to include the final ) when the kind expression contains nested parentheses.

Regression

  • Added example examples/issue353_selected_kind that runs f90wrap and asserts the generated f90wrap_toplevel.f90 contains:
    • integer(selected_int_kind(9)), intent(out) :: i
    • real(selected_real_kind(13,300)), intent(out) :: a

Evidence

  • Example test run (once): see /tmp/f90wrap_examples_issue353.log.

@krystophny krystophny force-pushed the fix/issue353-selected-kind branch from 2110ae5 to 99a5cfb Compare December 26, 2025 19:15
@krystophny krystophny force-pushed the fix/issue353-selected-kind branch from 99a5cfb to 60c0c54 Compare January 5, 2026 10:33
The issue353_selected_kind example was missing Makefile.meson needed for
Direct-C mode testing. Also updated run.py to search for any f90wrap_*.f90
file rather than hardcoding f90wrap_toplevel.f90, since Direct-C mode
generates differently named wrapper files.
@krystophny krystophny merged commit 37763b7 into master Jun 14, 2026
26 checks passed
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.

Inline selected_real/int_kind bug introduced in 0.3.0

1 participant