mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 14:09:20 +02:00
compiler: allow access other record symbols than fields, first extended records tests
git-svn-id: branches/paul/extended_records@16516 -
This commit is contained in:
parent
902a78eec1
commit
d7c8d9e620
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -9203,6 +9203,10 @@ tests/test/tenum3.pp svneol=native#text/plain
|
|||||||
tests/test/tenum4.pp svneol=native#text/plain
|
tests/test/tenum4.pp svneol=native#text/plain
|
||||||
tests/test/tenum5.pp svneol=native#text/plain
|
tests/test/tenum5.pp svneol=native#text/plain
|
||||||
tests/test/tenumerators1.pp svneol=native#text/pascal
|
tests/test/tenumerators1.pp svneol=native#text/pascal
|
||||||
|
tests/test/terecs1.pp svneol=native#text/pascal
|
||||||
|
tests/test/terecs2.pp svneol=native#text/pascal
|
||||||
|
tests/test/terecs3.pp svneol=native#text/pascal
|
||||||
|
tests/test/terecs_u1.pp svneol=native#text/pascal
|
||||||
tests/test/testcmem.pp svneol=native#text/plain
|
tests/test/testcmem.pp svneol=native#text/plain
|
||||||
tests/test/testda1.pp svneol=native#text/plain
|
tests/test/testda1.pp svneol=native#text/plain
|
||||||
tests/test/testfpuc.pp svneol=native#text/plain
|
tests/test/testfpuc.pp svneol=native#text/plain
|
||||||
|
@ -2061,7 +2061,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
structh:=tabstractrecorddef(p1.resultdef);
|
structh:=tabstractrecorddef(p1.resultdef);
|
||||||
searchsym_in_record(structh,pattern,srsym,srsymtable);
|
searchsym_in_record(structh,pattern,srsym,srsymtable);
|
||||||
if assigned(srsym) and (srsym.typ=fieldvarsym) then
|
if assigned(srsym) then
|
||||||
begin
|
begin
|
||||||
check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
|
check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
|
||||||
consume(_ID);
|
consume(_ID);
|
||||||
|
18
tests/test/terecs1.pp
Normal file
18
tests/test/terecs1.pp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{ %fail}
|
||||||
|
{ %norun}
|
||||||
|
program terecs1;
|
||||||
|
|
||||||
|
{$mode delphi}
|
||||||
|
{$apptype console}
|
||||||
|
|
||||||
|
uses
|
||||||
|
terecs_u1;
|
||||||
|
|
||||||
|
var
|
||||||
|
F: TFoo;
|
||||||
|
begin
|
||||||
|
// we can't access private fields
|
||||||
|
F.F1 := 0;
|
||||||
|
F.F2 := 1;
|
||||||
|
end.
|
||||||
|
|
19
tests/test/terecs2.pp
Normal file
19
tests/test/terecs2.pp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{ %fail}
|
||||||
|
{ %norun}
|
||||||
|
program terecs2;
|
||||||
|
|
||||||
|
{$mode delphi}
|
||||||
|
type
|
||||||
|
TFoo = record
|
||||||
|
private
|
||||||
|
F1: Integer;
|
||||||
|
F2: Byte;
|
||||||
|
public
|
||||||
|
F3: Integer;
|
||||||
|
F4: Byte;
|
||||||
|
published // record can't have published fields
|
||||||
|
F5: String;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
21
tests/test/terecs3.pp
Normal file
21
tests/test/terecs3.pp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
program terecs3;
|
||||||
|
|
||||||
|
{$mode delphi}
|
||||||
|
{$apptype console}
|
||||||
|
|
||||||
|
uses
|
||||||
|
terecs_u1;
|
||||||
|
|
||||||
|
var
|
||||||
|
F: TFoo;
|
||||||
|
begin
|
||||||
|
F.F3 := 0;
|
||||||
|
F.F4 := 1;
|
||||||
|
if F.F3 <> 0 then
|
||||||
|
halt(1);
|
||||||
|
if F.F4 <> 1 then
|
||||||
|
halt(2);
|
||||||
|
if F.C <> 1 then
|
||||||
|
halt(3);
|
||||||
|
WriteLn('ok');
|
||||||
|
end.
|
24
tests/test/terecs_u1.pp
Normal file
24
tests/test/terecs_u1.pp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{ %norun }
|
||||||
|
unit terecs_u1;
|
||||||
|
|
||||||
|
{$mode delphi}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
type
|
||||||
|
TFoo = record
|
||||||
|
private
|
||||||
|
F1: Integer;
|
||||||
|
F2: Byte;
|
||||||
|
public
|
||||||
|
const
|
||||||
|
C = 1;
|
||||||
|
var
|
||||||
|
F3: Integer;
|
||||||
|
F4: Byte;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user