Skip to content

Commit

Permalink
Add warning if base type of extended derived type not found
Browse files Browse the repository at this point in the history
Also don't crash when tracing procedure call chains

Fixes #577
  • Loading branch information
ZedThree committed Oct 30, 2023
1 parent b890f12 commit 26f51f3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ford/sourceform.py
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,8 @@ def get_label_item(context, label):
# extended type
extend_type = context
while extend_type := getattr(extend_type, "extends", None):
if isinstance(extend_type, str):
break
labels[extend_type.name.lower()] = extend_type
# vars
labels.update(getattr(context, "all_vars", {}))
Expand Down Expand Up @@ -1983,6 +1985,16 @@ def correlate(self, project):
# Match variables as needed (recurse)
for v in self.variables:
v.correlate(project)

if self.extends and isinstance(self.extends, str):
warn(
f"Could not find base type ('{self.extends}') of derived type '{self.name}' "
f"(in '{self.filename}').\n"
f" If '{self.extends}' is defined in an external module, you may be "
"able to tell Ford about its documentation\n"
" with the `extra_mods` setting"
)

# Get inherited public components
inherited = [
var
Expand Down

0 comments on commit 26f51f3

Please sign in to comment.