From 93d7bda7396728081fc343718b90b66d2db2ec43 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 23 Jun 2026 19:20:28 +0100 Subject: [PATCH] Resolve generics in method and standalone-function return types too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to the interface free-function fix: the remaining return-type resolution sites — two method paths and the standalone/program-body function path — still used FTable.FindType, so a generic return like TList on a program-level function or certain method paths failed 'Unknown return type'. Switch them to FindTypeOrInstantiate for consistency; additive, so non-generic returns are unaffected. 3743 compiler tests pass (20 pre-existing toolchain-dependent failures unchanged). --- compiler/src/main/pascal/uSemantic.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/src/main/pascal/uSemantic.pas b/compiler/src/main/pascal/uSemantic.pas index a180c8b..f48d476 100644 --- a/compiler/src/main/pascal/uSemantic.pas +++ b/compiler/src/main/pascal/uSemantic.pas @@ -4993,7 +4993,7 @@ begin end; if MDecl.ReturnTypeName <> '' then begin - ParType := FTable.FindType(MDecl.ReturnTypeName); + ParType := FindTypeOrInstantiate(MDecl.ReturnTypeName); if ParType = nil then SemanticError( Format('Unknown return type ''%s'' for method ''%s''', @@ -5125,7 +5125,7 @@ begin end; if MDecl.ReturnTypeName <> '' then begin - ParType := FTable.FindType(MDecl.ReturnTypeName); + ParType := FindTypeOrInstantiate(MDecl.ReturnTypeName); if ParType = nil then SemanticError( Format('Unknown return type ''%s'' for method ''%s''', @@ -5881,7 +5881,7 @@ begin { Resolve return type for functions } if ADecl.ReturnTypeName <> '' then begin - RetType := FTable.FindType(ADecl.ReturnTypeName); + RetType := FindTypeOrInstantiate(ADecl.ReturnTypeName); if RetType = nil then SemanticError( Format('Unknown return type ''%s'' for function ''%s''',