From 4053d59a2c9745af6f84fbca70293cae81a05006 Mon Sep 17 00:00:00 2001 From: Sven/Sarah Barth Date: Thu, 21 Apr 2022 21:04:25 +0200 Subject: [PATCH] * fix #39673: also resolve the dummy symbol in case this isn't a reuse of the current generic's name + added test --- compiler/ptype.pas | 3 +-- tests/webtbs/tw39673.pp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 tests/webtbs/tw39673.pp diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 67a9799fb5..cc9fba088d 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -644,8 +644,7 @@ implementation end else begin - Message(parser_e_no_generics_as_types); - def:=generrordef; + def:=handle_dummysym(srsym); end; end else if is_classhelper(def) and diff --git a/tests/webtbs/tw39673.pp b/tests/webtbs/tw39673.pp new file mode 100644 index 0000000000..c5707b842d --- /dev/null +++ b/tests/webtbs/tw39673.pp @@ -0,0 +1,30 @@ +{ %NORUN } + +program tw39673; + +{$ifdef fpc} +{$mode delphi} +{$else} +{$APPTYPE CONSOLE} +{$endif} + +uses + Types, + Classes, + contnrs, + generics.collections; + +Type tsomeclass =class + function readarray:TObjectList; +end; + +{ tsomeclass } + +function tsomeclass.readarray: TObjectList; +begin + result:=nil; +end; + +begin +end. +