This commit is contained in:
Ivan Bondarev 2021-04-18 11:06:16 +02:00
parent 8a8ab9a272
commit 9020b84b98
2 changed files with 21 additions and 3 deletions

15
TestSuite/records22.pas Normal file
View file

@ -0,0 +1,15 @@
type
r1 = record
val: integer;
static function operator=(o1: r1; o2: integer) := o1.val = o2;
static function operator<>(o1: r1; o2: integer) := o1.val <> o2;
end;
begin
var o: r1;
assert(o = o);
assert(o = 0);
assert(o <> 2);
o.val := 2;
assert(o = 2);
end.

View file

@ -1038,9 +1038,11 @@ namespace PascalABCCompiler.TreeConverter
if (si2.sym_info is common_method_node)
{
cmn = si2.sym_info as common_method_node;
if (cmn.function_code != null)
if (cmn.function_code != null && cmn.parameters.Count == 2 && cmn.parameters[0].type == cmn.parameters[1].type)
return;
}
if (cmn != null && cmn.function_code != null)
cmn = null;
SymbolInfo si = si_list[0];
SymbolTable.ClassMethodScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassMethodScope(_ctn.scope, _cmn.scope, null, si.ToString());
if (cmn == null)
@ -1092,10 +1094,11 @@ namespace PascalABCCompiler.TreeConverter
if (si2.sym_info is common_method_node)
{
cmn = si2.sym_info as common_method_node;
if (cmn.function_code != null)
if (cmn.function_code != null && cmn.parameters.Count == 2 && cmn.parameters[0].type == cmn.parameters[1].type)
return;
}
if (cmn != null && cmn.function_code != null)
cmn = null;
SymbolInfo si = si_list[0];
SymbolTable.ClassMethodScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassMethodScope( _ctn.scope, _cmn.scope, null, si.ToString());
if (cmn == null)