Resolve generics in method and standalone-function return types too

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<String> 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).
This commit is contained in:
Graeme Geldenhuys 2026-06-23 19:20:28 +01:00
parent b8de722038
commit 93d7bda739

View file

@ -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''',