Skip to content

Commit

Permalink
#2642 Fix parent type to UnresolvedInterface and add to symbol table.
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienRemy committed Dec 18, 2024
1 parent 421e546 commit a862a21
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/psyclone/psyir/frontend/fparser2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2025,13 +2025,17 @@ def _process_derived_type_decln(self, parent, decl, visibility_map):
if type(extends_symbol) is Symbol:
extends_symbol.specialise(DataTypeSymbol)
extends_symbol.datatype = StructureType()
# If it is not in the symbol table, create a new
# DataTypeSymbol for it.
# NOTE: this should *not* be added to the symbol table
# as it might be defined somewhere else if it was imported.
else:
extends_symbol = DataTypeSymbol(extends_name,
StructureType())
# If it is not in the symbol table, create a new
# DataTypeSymbol with an UnresolvedInterface for it,
# meaning that we know it exists somewhere but we don't
# know how it is brought into scope, and add it to the
# symbol table.
extends_symbol = DataTypeSymbol(
extends_name,
StructureType(),
interface=UnresolvedInterface())
parent.symbol_table.add(extends_symbol)
# Set it as the extended type of the new type.
dtype.extends = extends_symbol
else:
Expand Down

0 comments on commit a862a21

Please sign in to comment.