From fdab8e09554c15b7f3e257a38bbd255fe8104bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=BE=D0=BD=D0=B4=D0=B0=D1=80=D0=B5=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD?= Date: Mon, 10 Jun 2019 19:55:44 +0200 Subject: [PATCH] fixed fix #1980 --- CodeCompletion/Properties/AssemblyInfo.cs | 2 +- Optimizer/Properties/AssemblyInfo.cs | 2 +- TestSuite/generics27.pas | 1 + TreeConverter/TreeConversion/syntax_tree_visitor.cs | 6 +++--- TreeConverter/TreeRealization/generics.cs | 2 +- doc/License_en.txt | 2 +- doc/copyright.txt | 2 +- doc/license.txt | 2 +- pabcnetc/AssemblyInfo.cs | 2 +- pabcnetc_clear/AssemblyInfo.cs | 2 +- 10 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CodeCompletion/Properties/AssemblyInfo.cs b/CodeCompletion/Properties/AssemblyInfo.cs index 904e04f2d..126a535a8 100644 --- a/CodeCompletion/Properties/AssemblyInfo.cs +++ b/CodeCompletion/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CodeCompletion")] -[assembly: AssemblyCopyright("Copyright © 2005-2018 by Ivan Bondarev, Stanislav Mihalkovich")] +[assembly: AssemblyCopyright("Copyright © 2005-2019 by Ivan Bondarev, Stanislav Mihalkovich")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/Optimizer/Properties/AssemblyInfo.cs b/Optimizer/Properties/AssemblyInfo.cs index f76b301d3..551c96a6a 100644 --- a/Optimizer/Properties/AssemblyInfo.cs +++ b/Optimizer/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Optimizer")] -[assembly: AssemblyCopyright("Copyright © 2005-2018 by Ivan Bondarev, Stanislav Mihalkovich")] +[assembly: AssemblyCopyright("Copyright © 2005-2019 by Ivan Bondarev, Stanislav Mihalkovich")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/TestSuite/generics27.pas b/TestSuite/generics27.pas index b8b63e1b7..5d5f52076 100644 --- a/TestSuite/generics27.pas +++ b/TestSuite/generics27.pas @@ -12,6 +12,7 @@ begin var b: t1; a := b as T; p2&(b); + p2&(a); assert(a = nil); end; diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index 0a0ad1a2a..54f00d8da 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -3048,7 +3048,7 @@ namespace PascalABCCompiler.TreeConverter } else { - if (tp.is_generic_parameter && !tp.is_class) + if (tp.is_generic_parameter && !tp.is_class && !(tp.base_type != null && tp.base_type.is_class)) AddError(get_location(node.type_def), "OPERATOR_AS_CAN_NOT_BE_USED_WITH_GENERIC_PARAMETER_{0}_WITHOUT_CLASS_CONSTRAINT", tp.name); if (tp.is_value_type) AddError(get_location(node.type_def), "OPERATOR_AS_MUST_BE_USED_WITCH_A_REFERENCE_TYPE_VALUETYPE{0}", tp.PrintableName); @@ -12361,8 +12361,8 @@ namespace PascalABCCompiler.TreeConverter type_node spec_type = ret.visit(ntr); if (spec_type is ref_type_node || spec_type == SystemLibrary.SystemLibrary.void_type || spec_type == SystemLibrary.SystemLibrary.pointer_type) AddError(new SimpleSemanticError(get_location(specificators[i]), "INAVLID_TYPE")); - if (spec_type.is_class) - param.is_class = true; + //if (spec_type.is_class) + // param.is_class = true; if (spec_type.IsInterface) { if (used_interfs[spec_type] != null) diff --git a/TreeConverter/TreeRealization/generics.cs b/TreeConverter/TreeRealization/generics.cs index 3f0148626..a338c7146 100644 --- a/TreeConverter/TreeRealization/generics.cs +++ b/TreeConverter/TreeRealization/generics.cs @@ -145,7 +145,7 @@ namespace PascalABCCompiler.TreeRealization { generic_parameter_eliminations gpe = gpe_list[i]; type_node tn = tparams[i]; - if (gpe.is_class && !tn.is_class) + if (gpe.is_class && !tn.is_class && !(tn.base_type != null && tn.base_type.is_class)) { return new SimpleSemanticError(null, "PARAMETER_{0}_MUST_BE_REFERENCE_TYPE", tn.PrintableName); } diff --git a/doc/License_en.txt b/doc/License_en.txt index 54db173c7..1e4668c53 100644 --- a/doc/License_en.txt +++ b/doc/License_en.txt @@ -3,7 +3,7 @@ A copy of the GNU GPL is appended to this file. IMPORTANT PascalABC.NET LICENSE TERMS -Copyright (C) 2005-2018 by Ivan Bondarev, Stanislav Mihalkovich +Copyright (C) 2005-2019 by Ivan Bondarev, Stanislav Mihalkovich This program is free software; you may redistribute and/or modify it under the terms of the GNU LGPL version 3 with the clarifications and exceptions described below. PascalABC.NET can be linked with non-free modules and libraries. This condition is mainly concerned with possibility of adding foreign modules and libraries to PascalABC.NET, aimed at education. In particular, PascalABC.NET includes as a part PROGRAMMING TASKBOOK FOR PASCALABC.NET (in agreement with the author of this product), which is distributed under the terms of proprietary license (see \bin\PT4) diff --git a/doc/copyright.txt b/doc/copyright.txt index 304d5314f..99df38615 100644 --- a/doc/copyright.txt +++ b/doc/copyright.txt @@ -1 +1 @@ -Copyright (C) 2005-2018 by Ivan Bondarev, Stanislav Mihalkovich \ No newline at end of file +Copyright (C) 2005-2019 by Ivan Bondarev, Stanislav Mihalkovich \ No newline at end of file diff --git a/doc/license.txt b/doc/license.txt index 25fe9693e..c9360328f 100644 --- a/doc/license.txt +++ b/doc/license.txt @@ -3,7 +3,7 @@ ВАЖНЕЙШИЕ УСЛОВИЯ РАСПРОСТРАНЕНИЯ ПРОДУКТА PascalABC.NET -Copyright (C) 2005-2018 by Ivan Bondarev, Stanislav Mihalkovich +Copyright (C) 2005-2019 by Ivan Bondarev, Stanislav Mihalkovich Это программное обеспечение является свободным; вы можете распространять и/или модифицировать его на условиях GNU LGPL версии 3 с разъяснениями и исключениями, данными ниже. diff --git a/pabcnetc/AssemblyInfo.cs b/pabcnetc/AssemblyInfo.cs index bac76625e..674f01bd6 100644 --- a/pabcnetc/AssemblyInfo.cs +++ b/pabcnetc/AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Runtime.CompilerServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("Copyright © 2005-2018 by Ivan Bondarev, Stanislav Mihalkovich")] +[assembly: AssemblyCopyright("Copyright © 2005-2019 by Ivan Bondarev, Stanislav Mihalkovich")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/pabcnetc_clear/AssemblyInfo.cs b/pabcnetc_clear/AssemblyInfo.cs index 4fc391754..417c35e8d 100644 --- a/pabcnetc_clear/AssemblyInfo.cs +++ b/pabcnetc_clear/AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Runtime.CompilerServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("Copyright © 2005-2018 by Ivan Bondarev, Stanislav Mihalkovich")] +[assembly: AssemblyCopyright("Copyright © 2005-2019 by Ivan Bondarev, Stanislav Mihalkovich")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]