From 4d72da78b032687cb80bc48774216ea46f39697e Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Wed, 29 May 2019 23:48:30 +0300 Subject: [PATCH] fix #1957 --- Configuration/GlobalAssemblyInfo.cs | 4 ++-- Configuration/Version.defs | 4 ++-- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- TestSuite/op_implicit_T.pas | 14 ++++++++++++++ TreeConverter/TreeRealization/type_table.cs | 17 +++++++++++++++-- bin/Lib/Graph3D.pas | 9 ++++++++- 6 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 TestSuite/op_implicit_T.pas diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index a8cd595da..3e2253617 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.CompilerServices; [assembly: AssemblyDelaySign(false)] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PascalABC.NET Compiler")] -[assembly: AssemblyCopyright("Copyright © 2005-2019 by Ivan Bondarev, Stanislav Mihalkovich")] +[assembly: AssemblyCopyright("Copyright © 2005-2018 by Ivan Bondarev, Stanislav Mihalkovich")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion(RevisionClass.FullVersion)] @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "5"; public const string Build = "0"; - public const string Revision = "2067"; + public const string Revision = "2069"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index 04a6a8e16..a51013b8f 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%COREVERSION%=0 -%REVISION%=2066 %MINOR%=5 +%REVISION%=2069 +%COREVERSION%=0 %MAJOR%=3 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 8a433567d..5a8ca6d09 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.5.0.2067' +!define VERSION '3.5.0.2069' diff --git a/TestSuite/op_implicit_T.pas b/TestSuite/op_implicit_T.pas new file mode 100644 index 000000000..47a86274e --- /dev/null +++ b/TestSuite/op_implicit_T.pas @@ -0,0 +1,14 @@ +type + t1 = class + static function operator implicit(o: T): t1; begin Assert(2=1); Result := nil; end; + end; + t2 = class(t1) end; + +procedure p(r: t1); +begin + r := new t2; +end; + +begin + p(new t1); +end. \ No newline at end of file diff --git a/TreeConverter/TreeRealization/type_table.cs b/TreeConverter/TreeRealization/type_table.cs index 4af4772e6..43cc718c9 100644 --- a/TreeConverter/TreeRealization/type_table.cs +++ b/TreeConverter/TreeRealization/type_table.cs @@ -810,6 +810,18 @@ namespace PascalABCCompiler.TreeRealization } } + static bool not_contains_type(type_node right, type_node left) // вызывать только если left - generic parameter + { + System.Diagnostics.Debug.Assert(left.is_generic_parameter); // вроде рекурсивно не надо просматривать right т.к. это обрезается другой проверкой - один из типов должен быть t1 + if (!right.is_generic_type_instance) + return false; + for (int i = 0; i < right.instance_params.Count; i++) + { + if (right.instance_params[i] == left) + return false; + } + return true; + } public static bool is_type_or_original_generics_equal(type_node left, type_node right) { if (left == right) @@ -827,8 +839,9 @@ namespace PascalABCCompiler.TreeRealization } return true; } - if (left.is_generic_parameter) - return true; + if (left.is_generic_parameter) // SSM 29.05.19 надо проверять, что right не содержит T + return not_contains_type(right, left); + //return true; if (left.type_special_kind == SemanticTree.type_special_kind.set_type && right == SystemLibrary.SystemLibInitializer.TypedSetType.sym_info || right.type_special_kind == SemanticTree.type_special_kind.set_type && left == SystemLibrary.SystemLibInitializer.TypedSetType.sym_info) return true; diff --git a/bin/Lib/Graph3D.pas b/bin/Lib/Graph3D.pas index eaa1606b9..078d4047f 100644 --- a/bin/Lib/Graph3D.pas +++ b/bin/Lib/Graph3D.pas @@ -1318,6 +1318,13 @@ type public constructor(params l: array of AnimationBase) := ll := Lst(l); constructor(l: List) := ll := l; + function Clone: AnimationBase; override; + begin + var r := new CompositeAnimation(new List()); + for var i := 0 to ll.Count-1 do + r.ll.Add(ll[i].Clone); + Result := r; + end; end; GroupAnimation = class(CompositeAnimation) @@ -1376,7 +1383,7 @@ type // lf надо в любом случае клонировать // Клонируем. Надо еще списки клонировать! А то в a+a во втором списке последний элемент - клонированный - в обоих списках! - lf := lf.Clone; + //lf := lf.Clone; llf[lli] := lf; lf.Completed += procedure -> begin