diff --git a/TestSuite/errors/err0519_format_string.pas b/TestSuite/errors/err0519_format_string.pas index 0b89595c4..09b8ed341 100644 --- a/TestSuite/errors/err0519_format_string.pas +++ b/TestSuite/errors/err0519_format_string.pas @@ -1,3 +1,4 @@ -begin +//!Встречена неправильная форматная строка +begin var s := $'{{{'; end. \ No newline at end of file diff --git a/TestSuite/errors/err0520_override_reintroduce.pas b/TestSuite/errors/err0520_override_reintroduce.pas new file mode 100644 index 000000000..4f510de3f --- /dev/null +++ b/TestSuite/errors/err0520_override_reintroduce.pas @@ -0,0 +1,12 @@ +//!Совместное использование модификаторов override и reintroduce недопустимо +type + c1 = abstract class + procedure p1; abstract; + end; + + c2 = class (c1) + procedure p1; reintroduce; override; + begin end; + end; + +begin end. \ No newline at end of file diff --git a/TestSuite/errors/err0521_override_reintroduce.pas b/TestSuite/errors/err0521_override_reintroduce.pas new file mode 100644 index 000000000..6854d9361 --- /dev/null +++ b/TestSuite/errors/err0521_override_reintroduce.pas @@ -0,0 +1,12 @@ +//!Совместное использование модификаторов override и reintroduce недопустимо +type + c1 = abstract class + procedure p1; abstract; + end; + + c2 = class (c1) + procedure p1; override;reintroduce; + begin end; + end; + +begin end. \ No newline at end of file diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index 0302830a2..1de65161c 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -14078,9 +14078,11 @@ namespace PascalABCCompiler.TreeConverter bool is_override = false; bool is_virtual = false; bool is_abstract = false; + bool is_reintroduce = false; string override_proc_attr=null; string virtual_proc_attr=null; string abstract_proc_attr = null; + string reintroduce_proc_attr = null; for (int i = 0; i < _procedure_attributes_list.proc_attributes.Count; i++) { switch (_procedure_attributes_list.proc_attributes[i].attribute_type) @@ -14103,6 +14105,12 @@ namespace PascalABCCompiler.TreeConverter virtual_proc_attr = _procedure_attributes_list.proc_attributes[i].name; } break; + case SyntaxTree.proc_attribute.attr_reintroduce: + { + is_reintroduce = true; + reintroduce_proc_attr = _procedure_attributes_list.proc_attributes[i].name; + } + break; } } context.top_function.is_overload = true; // SSM 12/08/15 @@ -14221,6 +14229,10 @@ namespace PascalABCCompiler.TreeConverter { AddError(get_location(_procedure_attributes_list.proc_attributes[i]),"USING_MODIFIERS{0}_{1}_TOGETHER_NOT_ALLOWED", _procedure_attributes_list.proc_attributes[i].name,virtual_proc_attr); } + if (_procedure_attributes_list.proc_attributes[i].attribute_type == SyntaxTree.proc_attribute.attr_override && is_reintroduce) + { + AddError(get_location(_procedure_attributes_list.proc_attributes[i]), "USING_MODIFIERS{0}_{1}_TOGETHER_NOT_ALLOWED", _procedure_attributes_list.proc_attributes[i].name, reintroduce_proc_attr); + } if (_procedure_attributes_list.proc_attributes[i].attribute_type == SyntaxTree.proc_attribute.attr_override) { is_override = true;