diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index b96743ebc..b8ccf7044 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -2048,6 +2048,24 @@ type constructor(ptr: pointer); end; +type + ///-- + __ConceptSingleton = class where T: constructor; + class _instance: T; + class inited: boolean := false; + public + class function &Instance: T; + begin + if inited = false then + begin + inited := true; + _instance := new T; + end; + + Result := _instance; + end; + end; + // ----------------------------------------------------- // Internal procedures for PABCRTL.dll // ----------------------------------------------------- diff --git a/TestSuite/formatter_tests/input/PABCSystem.pas b/TestSuite/formatter_tests/input/PABCSystem.pas index d27a5405f..cdc02c0c0 100644 --- a/TestSuite/formatter_tests/input/PABCSystem.pas +++ b/TestSuite/formatter_tests/input/PABCSystem.pas @@ -1966,6 +1966,24 @@ type constructor(ptr: pointer); end; +type + ///-- + __ConceptSingleton = class where T: constructor; + class _instance: T; + class inited: boolean := false; + public + class function &Instance: T; + begin + if inited = false then + begin + inited := true; + _instance := new T; + end; + + Result := _instance; + end; + end; + // ----------------------------------------------------- // Internal procedures for PABCRTL.dll // ----------------------------------------------------- diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index b96743ebc..b8ccf7044 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -2048,6 +2048,24 @@ type constructor(ptr: pointer); end; +type + ///-- + __ConceptSingleton = class where T: constructor; + class _instance: T; + class inited: boolean := false; + public + class function &Instance: T; + begin + if inited = false then + begin + inited := true; + _instance := new T; + end; + + Result := _instance; + end; + end; + // ----------------------------------------------------- // Internal procedures for PABCRTL.dll // -----------------------------------------------------