* apply patch by Blaise.ru to allow record methods to be assigned to method variables as well (this is Delphi compatible)

+ added test

git-svn-id: trunk@47794 -
This commit is contained in:
svenbarth 2020-12-16 21:43:25 +00:00
parent 9a0107a19d
commit 32938dde1c
3 changed files with 25 additions and 1 deletions

1
.gitattributes vendored
View File

@ -13433,6 +13433,7 @@ tests/tbs/tb0677.pp svneol=native#text/pascal
tests/tbs/tb0678.pp svneol=native#text/pascal
tests/tbs/tb0679.pp svneol=native#text/pascal
tests/tbs/tb0680.pp svneol=native#text/pascal
tests/tbs/tb0681.pp svneol=native#text/pascal
tests/tbs/ub0060.pp svneol=native#text/plain
tests/tbs/ub0069.pp svneol=native#text/plain
tests/tbs/ub0119.pp svneol=native#text/plain

View File

@ -6636,7 +6636,7 @@ implementation
begin
{ don't check assigned(_class), that's also the case for nested
procedures inside methods }
result:=(owner.symtabletype=ObjectSymtable)and not no_self_node;
result:=(owner.symtabletype in [recordsymtable,ObjectSymtable]) and not no_self_node;
end;

23
tests/tbs/tb0681.pp Normal file
View File

@ -0,0 +1,23 @@
program tb0681;
{$Mode Delphi}
type R = record
var X: Integer;
function Foo: Integer;
end;
function R.Foo: Integer;
begin
result := X
end;
var F: function : Integer of object;
Z: R = (X:42);
begin
// EXPECTED: gets compiled
// ACTUAL: 'Error: Incompatible types'
F := Z.Foo;
if F() <> 42 then
Halt(1);
end.