Skip to content
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

chore: Fix parent scope issue in FortranAST class #392

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

### Fixed

- Fixed bug where parent scope for includes in AST could be `None`
([#329](https://github.com/fortran-lang/fortls/issues/329))
- Fixed preprocessor bug with `if` and `elif` conditionals
([#322](https://github.com/fortran-lang/fortls/issues/322))
- Fixed bug where type fields or methods were not detected if spaces were
Expand Down
5 changes: 3 additions & 2 deletions fortls/parsers/internal/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,9 @@ def resolve_includes(self, workspace, path: str | None = None):
added_entities = []
for child in include_ast.inc_scope.children:
added_entities.append(child)
parent_scope.add_child(child)
child.update_fqsn(parent_scope.FQSN)
if parent_scope is not None:
parent_scope.add_child(child)
child.update_fqsn(parent_scope.FQSN)
include_ast.none_scope = parent_scope
inc.scope_objs = added_entities

Expand Down