pascalabcnet/TestSuite/patterns-extended-is-short.pas

24 lines
430 B
ObjectPascal
Raw Normal View History

2019-05-28 09:21:59 +03:00
type
t1=class end;
t2=class(t1) end;
begin
var l: List<t1> := nil;
if (l <> nil) and (l[0] is t2(var a)) then ;
2022-02-06 16:30:31 +03:00
l := new List<t1>();
var o := new t2;
l.Add(o);
if (l <> nil) and (l[0] is t2(var a)) then
begin
assert(a = o);
o := nil;
end;
assert(o = nil);
l := new List<t1>();
l.Add(new t1);
if (l <> nil) and (l[0] is t2(var a)) then
begin
o := new t2;
end;
assert(o = nil);
2019-05-28 09:21:59 +03:00
end.