From 04337988d9623b9ed69b71b666904d5ad38e6590 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 6 Mar 2023 16:53:27 +0100 Subject: [PATCH] Codetools, tests: Add test for issue #32252 --- .../codetools/tests/laztests/bug32252.pas | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 components/codetools/tests/laztests/bug32252.pas diff --git a/components/codetools/tests/laztests/bug32252.pas b/components/codetools/tests/laztests/bug32252.pas new file mode 100644 index 0000000000..711e32e0cd --- /dev/null +++ b/components/codetools/tests/laztests/bug32252.pas @@ -0,0 +1,32 @@ +program bug32252; +{$MODE DELPHI} +{$MACRO ON} +{$DEFINE CUSTOM_DICTIONARY_CONSTRAINTS := TKey, TValue, THashFactory} +{$DEFINE OPEN_ADDRESSING_CONSTRAINTS := TKey, TValue, THashFactory, TProbeSequence} +type + // The following types are copied and simplified from Generics.Collections. + // They are enough to generate the cycle error. + TDummy = class + end; + TCustomDictionary = class abstract + procedure Foo; virtual; abstract; + end; + TOpenAddressing = class abstract(TCustomDictionary) + end; + TOpenAddressingLP = class(TOpenAddressing) + procedure Bar; virtual; abstract; + end; + TOpenAddressingLP = class(TOpenAddressingLP); + TOpenAddressingLP = class(TOpenAddressingLP); + TDictionary = class(TOpenAddressingLP); + + // This would be a user defined type when using Generics.Collections. + // In mode Delphi there is no "specialize" keyword but it makes no difference for the error. + TestType = TDictionary; +var + TestVar: TestType; +begin + TestVar:=TestType.a{completion:Create;Bar;Foo;TKey;TValue;THashFactory} +end. + +