From a862a218da9bffa7d915f467f3366d856cf8dbbb Mon Sep 17 00:00:00 2001 From: JulienRemy Date: Wed, 18 Dec 2024 16:06:05 +0100 Subject: [PATCH] #2642 Fix parent type to UnresolvedInterface and add to symbol table. --- src/psyclone/psyir/frontend/fparser2.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/psyclone/psyir/frontend/fparser2.py b/src/psyclone/psyir/frontend/fparser2.py index 58185e40da..efcdeee182 100644 --- a/src/psyclone/psyir/frontend/fparser2.py +++ b/src/psyclone/psyir/frontend/fparser2.py @@ -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: