diff --git a/CodeCompletion/SymTable.cs b/CodeCompletion/SymTable.cs index e1af7fb22..65c143288 100644 --- a/CodeCompletion/SymTable.cs +++ b/CodeCompletion/SymTable.cs @@ -1580,7 +1580,7 @@ public virtual bool IsReintroduce public void MakeDescription() { - si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this); + si.description = CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this); if (!string.IsNullOrEmpty(documentation)) si.description += Environment.NewLine + documentation; } @@ -1686,7 +1686,7 @@ public override bool IsEqual(SymScope ts) public override string ToString() { - return CodeCompletionController.CurrentParser.LanguageInformation.GetSimpleDescription(this); + return CodeCompletionController.CurrentParser?.LanguageInformation.GetSimpleDescription(this); } } @@ -2151,7 +2151,7 @@ public override bool IsEqual(SymScope ts) public override string ToString() { - return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this); + return CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this); } } @@ -2486,7 +2486,7 @@ public virtual bool IsConstructor() public override void MakeSynonimDescription() { //aliased = true; - si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetSynonimDescription(this); + si.description = CodeCompletionController.CurrentParser?.LanguageInformation.GetSynonimDescription(this); } //zavershenie opisanija, vyzyvaetsja kogda parametry razobrany @@ -2494,7 +2494,7 @@ public void Complete() { if (documentation != null && documentation.Length > 0 && documentation[0] == '-') return; this.si.description = this.ToString(); - this.si.addit_name = CodeCompletionController.CurrentParser.LanguageInformation.GetShortName(this); + this.si.addit_name = CodeCompletionController.CurrentParser?.LanguageInformation.GetShortName(this); if (documentation != null) this.si.description += "\n" + this.documentation; } @@ -2720,8 +2720,8 @@ public override string GetDescriptionWithoutDoc() public override string ToString() { - simp_descr = CodeCompletionController.CurrentParser.LanguageInformation.GetSimpleDescription(this); - return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this); + simp_descr = CodeCompletionController.CurrentParser?.LanguageInformation.GetSimpleDescription(this); + return CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this); } } @@ -3775,7 +3775,7 @@ public override TypeScope GetElementType() public override string ToString() { - return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this); + return CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this); } } diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index e51899246..75c3fe3e6 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "9"; public const string Build = "0"; - public const string Revision = "3411"; + public const string Revision = "3412"; 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 f84db8530..b83ccd1f5 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%MINOR%=9 -%REVISION%=3411 %COREVERSION%=0 +%REVISION%=3412 +%MINOR%=9 %MAJOR%=3 diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index 2d8339fd4..69518271b 100644 Binary files a/Localization/DefaultLang.resources and b/Localization/DefaultLang.resources differ diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index 33d4123d6..3e0dc5c2e 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.9.0.3411 +3.9.0.3412 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 5ceeea4b0..608a701c9 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.9.0.3411' +!define VERSION '3.9.0.3412' diff --git a/TestSuite/errors/err0533.pas b/TestSuite/errors/err0533.pas new file mode 100644 index 000000000..3c0dce0c5 --- /dev/null +++ b/TestSuite/errors/err0533.pas @@ -0,0 +1,14 @@ +//exclude +unit err0533; +{$savepcu false} +interface + +type + t1 = class + static function f1: integer; + end; + +implementation + +static function t1.f1 := 1; +end. \ No newline at end of file diff --git a/TestSuite/errors/err0534.pas b/TestSuite/errors/err0534.pas new file mode 100644 index 000000000..5fbaba9a1 --- /dev/null +++ b/TestSuite/errors/err0534.pas @@ -0,0 +1,15 @@ +//!Нельзя реализовывать метод из другого модуля +unit err0534; +interface + +uses err0533; + +function f0: integer; + +implementation + +static function t1.f1 := 2; + +function f0 := t1.f1; + +end. \ No newline at end of file diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index 0682a2ccd..14fead5d6 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -10584,6 +10584,11 @@ private void visit_method_name(SyntaxTree.method_name _method_name) { common_extension_meth = true; common_type_node ctn = def_temp as common_type_node; + if (sil != null && this._compiled_unit.namespaces.IndexOf(tp.comprehensive_namespace) == -1)//static methods cannot be extension methods + { + if (current_function_header.class_keyword) + AddError(get_location(_method_name), "CANNOT_IMPLEMENT_METHODS_IN_OTHER_MODULE"); + } if (ctn.type_special_kind == PascalABCCompiler.SemanticTree.type_special_kind.array_wrapper || ctn.type_special_kind == PascalABCCompiler.SemanticTree.type_special_kind.set_type || ctn.type_special_kind == PascalABCCompiler.SemanticTree.type_special_kind.base_set_type || diff --git a/bin/Lng/Eng/SemanticErrors_ib.dat b/bin/Lng/Eng/SemanticErrors_ib.dat index ff39cb93e..372fa4c9f 100644 --- a/bin/Lng/Eng/SemanticErrors_ib.dat +++ b/bin/Lng/Eng/SemanticErrors_ib.dat @@ -177,6 +177,7 @@ EXPECTED_PROPERTY=Property expected NON_PUBLIC_RECORD_CONSTRUCTORS_NOT_ALLOWED=Records can not have non-public default constructor EXIT_BREAK_CONTINUE_IN_FINALLY_BLOCK=exit, break and continue are not allowed in finally ANONYMOUS_DELEGATES_WITH_GENERIC_PARAMS_NOT_ALLOWED=Cannot deduce type of anonymous delegates with generic parameters. Declare the variable type explicitly. +CANNOT_IMPLEMENT_METHODS_IN_OTHER_MODULE=Can not implement methods in other module %PREFIX%=COMPILATIONERROR_ UNIT_MODULE_EXPECTED_LIBRARY_FOUND=Unit expected, library found ASSEMBLY_{0}_READING_ERROR=Error by reading assembly '{0}' diff --git a/bin/Lng/Rus/SemanticErrors_ib.dat b/bin/Lng/Rus/SemanticErrors_ib.dat index 7a157efb1..d960a405c 100644 --- a/bin/Lng/Rus/SemanticErrors_ib.dat +++ b/bin/Lng/Rus/SemanticErrors_ib.dat @@ -172,6 +172,7 @@ EXPECTED_PROPERTY=Ожидалось свойство NON_PUBLIC_RECORD_CONSTRUCTORS_NOT_ALLOWED=Записи могут иметь только публичный конструктор по умолчанию EXIT_BREAK_CONTINUE_IN_FINALLY_BLOCK=Использование exit, break и continue в блоке finally недопустимо ANONYMOUS_DELEGATES_WITH_GENERIC_PARAMS_NOT_ALLOWED=Нельзя вывести тип анонимного делегата с генерик-параметрами. Укажите тип переменной явно. +CANNOT_IMPLEMENT_METHODS_IN_OTHER_MODULE=Нельзя реализовывать метод из другого модуля %PREFIX%=COMPILATIONERROR_ UNIT_MODULE_EXPECTED_LIBRARY_FOUND=Ожидался модуль, а встречена библиотека ASSEMBLY_{0}_READING_ERROR=Ошибка при чтении сборки '{0}' diff --git a/bin/Lng/Ukr/SemanticErrors_ib.dat b/bin/Lng/Ukr/SemanticErrors_ib.dat index 6e68eca07..a754177d3 100644 --- a/bin/Lng/Ukr/SemanticErrors_ib.dat +++ b/bin/Lng/Ukr/SemanticErrors_ib.dat @@ -169,6 +169,7 @@ EXPECTED_PROPERTY=Ожидалось свойство NON_PUBLIC_RECORD_CONSTRUCTORS_NOT_ALLOWED=Записи могут иметь только публичный конструктор по умолчанию EXIT_BREAK_CONTINUE_IN_FINALLY_BLOCK=Использование exit, break и continue в блоке finally недопустимо ANONYMOUS_DELEGATES_WITH_GENERIC_PARAMS_NOT_ALLOWED=Нельзя вывести тип анонимного делегата с генерик-параметрами. Укажите тип переменной явно. +CANNOT_IMPLEMENT_METHODS_IN_OTHER_MODULE=Нельзя реализовывать метод из другого модуля %PREFIX%=COMPILATIONERROR_ UNIT_MODULE_EXPECTED_LIBRARY_FOUND=Очікувався модуль, а зустріли бібліотеку ASSEMBLY_{0}_READING_ERROR=Помилка при читанні збірки '{0}' diff --git a/bin/Lng/zh_CN/SemanticErrors_ib.dat b/bin/Lng/zh_CN/SemanticErrors_ib.dat index b6949935f..e1dd65b63 100644 --- a/bin/Lng/zh_CN/SemanticErrors_ib.dat +++ b/bin/Lng/zh_CN/SemanticErrors_ib.dat @@ -177,6 +177,7 @@ EXPECTED_PROPERTY=预期的属性 NON_PUBLIC_RECORD_CONSTRUCTORS_NOT_ALLOWED=记录不能有非公共的默认构造函数 EXIT_BREAK_CONTINUE_IN_FINALLY_BLOCK=finally 中不允许退出、中断和继续 ANONYMOUS_DELEGATES_WITH_GENERIC_PARAMS_NOT_ALLOWED=无法推断具有泛型参数的匿名委托的类型。 显式声明变量类型。 +CANNOT_IMPLEMENT_METHODS_IN_OTHER_MODULE=Can not implement methods in other module %PREFIX%=COMPILATIONERROR_ UNIT_MODULE_EXPECTED_LIBRARY_FOUND=需要单元,找到库 ASSEMBLY_{0}_READING_ERROR=读取程序集 '{0}' 时出错