Skip to content

Commit

Permalink
Fix type definition in block breaking parent scope
Browse files Browse the repository at this point in the history
Fixes #638
  • Loading branch information
ZedThree committed Apr 2, 2024
1 parent 2d5083a commit 7089cbd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ford/sourceform.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ def __init__(
blocklevel -= 1
elif endtype and endtype.lower() == "associate":
associations.remove_last_batch()
else:
elif blocklevel == 0:
self._cleanup()
return

Expand Down
18 changes: 18 additions & 0 deletions test/test_sourceform.py
Original file line number Diff line number Diff line change
Expand Up @@ -2238,3 +2238,21 @@ def test_associate_array(parse_fortran_file):

# Just check we can parse ok
parse_fortran_file(data)


def test_blocks_with_type(parse_fortran_file):
data = """\
module foo
contains
subroutine sub1()
block
type :: t1
end type t1
end block
end subroutine sub1
end module foo
"""

source = parse_fortran_file(data)
module = source.modules[0]
assert len(module.subroutines) == 1

0 comments on commit 7089cbd

Please sign in to comment.