mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-08 11:19:36 +02:00
* don't internalerror when a property is hidden by a method in a child class
(mantis #17675) git-svn-id: trunk@16191 -
This commit is contained in:
parent
dd8fd7cd4a
commit
5e84c557fa
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -10708,6 +10708,8 @@ tests/webtbs/tw17550.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1758.pp svneol=native#text/plain
|
||||
tests/webtbs/tw17604.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1765.pp svneol=native#text/plain
|
||||
tests/webtbs/tw17675.pp svneol=native#text/plain
|
||||
tests/webtbs/tw17675a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1779.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1780.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1792.pp svneol=native#text/plain
|
||||
|
@ -1729,10 +1729,10 @@ implementation
|
||||
while assigned(objdef) do
|
||||
begin
|
||||
srsym:=tprocsym(objdef.symtable.FindWithHash(hashedid));
|
||||
if assigned(srsym) then
|
||||
if assigned(srsym) and
|
||||
{ Delphi allows hiding a property by a procedure with the same name }
|
||||
(srsym.typ=procsym) then
|
||||
begin
|
||||
if (srsym.typ<>procsym) then
|
||||
internalerror(200111022);
|
||||
{ add all definitions }
|
||||
hasoverload:=false;
|
||||
for j:=0 to tprocsym(srsym).ProcdefList.Count-1 do
|
||||
|
45
tests/webtbs/tw17675.pp
Normal file
45
tests/webtbs/tw17675.pp
Normal file
@ -0,0 +1,45 @@
|
||||
program project1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Classes;
|
||||
|
||||
type
|
||||
|
||||
TBase = class
|
||||
private
|
||||
function GetCount: Integer;
|
||||
public
|
||||
property Count: Integer read GetCount;
|
||||
end;
|
||||
|
||||
TSub = class(TBase)
|
||||
public
|
||||
function Count: Integer; overload;
|
||||
end;
|
||||
|
||||
function TSub.Count: Integer;
|
||||
begin
|
||||
Result := 2;
|
||||
end;
|
||||
|
||||
{ TBase }
|
||||
|
||||
function TBase.GetCount: Integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
var
|
||||
MySub: TSub;
|
||||
i : Integer;
|
||||
begin
|
||||
MySub := TSub.Create;
|
||||
// uncomment the next line for Fatal Internal error 200111022:
|
||||
if MySub.Count <> 2 then
|
||||
halt(1);
|
||||
end.
|
46
tests/webtbs/tw17675a.pp
Normal file
46
tests/webtbs/tw17675a.pp
Normal file
@ -0,0 +1,46 @@
|
||||
{ %fail }
|
||||
|
||||
program project1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Classes;
|
||||
|
||||
type
|
||||
|
||||
TBase = class
|
||||
public
|
||||
function Count: Integer; overload;
|
||||
end;
|
||||
|
||||
TSub = class(TBase)
|
||||
private
|
||||
function GetCount: Integer;
|
||||
public
|
||||
property Count: Integer read GetCount;
|
||||
end;
|
||||
|
||||
function TSub.Count: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
{ TBase }
|
||||
|
||||
function TBase.GetCount: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
var
|
||||
MySub: TSub;
|
||||
i : Integer;
|
||||
begin
|
||||
MySub := TSub.Create;
|
||||
// uncomment the next line for Fatal Internal error 200111022:
|
||||
for i := 0 to MySub.Count do begin end;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user