mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 17:28:14 +02:00

+ globtype.pas: add new modeswitch to modeswitch enum and name array * ptype.pas & pdecobj.pas: check for new modeswitch instead of modeswitch class * ppu.pas: increase ppu version as we've added a new modeswitch which requires correctly compiled units * adjusted tests to enabled the modeswitch when necessary + added three new tests that check for correct functionality of modeswitch typehelpers git-svn-id: trunk@26796 -
34 lines
548 B
ObjectPascal
34 lines
548 B
ObjectPascal
{ this checks that inheritance for type helper is working correctly }
|
|
|
|
program tthlp12;
|
|
|
|
{$mode objfpc}
|
|
{$modeswitch typehelpers}
|
|
|
|
type
|
|
TLongIntHelper = type helper for LongInt
|
|
function Test: Integer;
|
|
end;
|
|
|
|
TLongIntHelperSub = type helper(TLongIntHelper) for LongInt
|
|
function Test: Integer;
|
|
end;
|
|
|
|
function TLongIntHelper.Test: Integer;
|
|
begin
|
|
Result := 21;
|
|
end;
|
|
|
|
function TLongIntHelperSub.Test: Integer;
|
|
begin
|
|
Result := inherited Test * 2;
|
|
end;
|
|
|
|
var
|
|
i: LongInt;
|
|
begin
|
|
if i.Test <> 42 then
|
|
Halt(1);
|
|
Writeln('OK');
|
|
end.
|