fix #1014
This commit is contained in:
Бондарев Иван 2018-08-06 11:45:17 +02:00
parent 5276f920aa
commit 8be06920d6
3 changed files with 12 additions and 2 deletions

View file

@ -0,0 +1,9 @@
type
t1=class end;
procedure operator+=<T>(a,b:t1) := exit;
begin
var a := new t1;
a += new t1;
end.

View file

@ -9784,10 +9784,11 @@ namespace PascalABCCompiler.TreeConverter
}
else
{
if (is_operator && context.converted_type == null && context.converted_template_type == null && !(current_function_header != null && current_function_header.proc_attributes != null && has_extensionmethod_attr(current_function_header.proc_attributes.proc_attributes)) && !(current_function_header != null && current_function_header.template_args != null && current_function_header.template_args.idents.Count > 0))
if (is_operator && context.converted_type == null && context.converted_template_type == null && !(current_function_header != null && current_function_header.proc_attributes != null && has_extensionmethod_attr(current_function_header.proc_attributes.proc_attributes)) /*&& !(current_function_header != null && current_function_header.template_args != null && current_function_header.template_args.idents.Count > 0)*/)
{
AddError(get_location(_method_name), "OVERLOADED_OPERATOR_MUST_BE_STATIC_FUNCTION");
}
}
convertion_data_and_alghoritms.check_node_parser_error(_method_name.meth_name);
location loc_name = get_location(_method_name.meth_name);

View file

@ -95,7 +95,7 @@ INHERITED_EXPECTED_IN_CLASS=Ключевое слово inherited должно
NO_BASE_CLASS_DEFINED_BUT_INHERITED_MEET=Ключевое слово inherited в методе класса, который не имеет предка
NO_METHOD_{0}_IN_CLASS_{1}=Нет метода {0} в классе {1}
OVERLOAD_OPERATOR_CAN_NOT_BE_PROCEDURE=Перегруженная операция не может быть процедурой
OVERLOADED_OPERATOR_MUST_BE_STATIC_FUNCTION=Перегруженная операция должна быть статической функцией
OVERLOADED_OPERATOR_MUST_BE_STATIC_FUNCTION=Перегруженная операция должна быть статической функцией класса либо методом расширения
NOT_SUPPORTED_BY_THIS_VERSION_OF_COMPILER=Данная конструкция не поддерживается текущей версией компилятора
NEGATIVE_ARRAY_LENGTH_({0})_NOT_ALLOWED=Отрицательная длина массива ({0}) не допустима
INCOMPATIBLE_ARRAY_BOUNDS_TYPES=Несовместимые типы границ диапазона массива