mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 18:24:19 +02:00
* Allow for "record constraint" in Delphi mode more types like: ordinal, float, classical objects, enumerations (instead of just record). Delphi compatibility. Fix for mantis #24073.
git-svn-id: trunk@35739 -
This commit is contained in:
parent
07c98e816f
commit
e4565378db
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -14966,6 +14966,7 @@ tests/webtbs/tw23980.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw24007.pp svneol=native#text/plain
|
tests/webtbs/tw24007.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw24071.pp svneol=native#text/pascal
|
tests/webtbs/tw24071.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw24072.pp svneol=native#text/pascal
|
tests/webtbs/tw24072.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw24073.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw2409.pp svneol=native#text/plain
|
tests/webtbs/tw2409.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw24129.pp svneol=native#text/pascal
|
tests/webtbs/tw24129.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw24131.pp svneol=native#text/plain
|
tests/webtbs/tw24131.pp svneol=native#text/plain
|
||||||
|
@ -144,7 +144,22 @@ uses
|
|||||||
begin
|
begin
|
||||||
case formaldef.typ of
|
case formaldef.typ of
|
||||||
recorddef:
|
recorddef:
|
||||||
MessagePos(filepos,type_e_record_type_expected);
|
{ delphi has own fantasy about record constraint
|
||||||
|
(almost non-nullable/non-nilable value type) }
|
||||||
|
if m_delphi in current_settings.modeswitches then
|
||||||
|
case paradef.typ of
|
||||||
|
floatdef,enumdef,orddef:
|
||||||
|
continue;
|
||||||
|
objectdef:
|
||||||
|
if tobjectdef(paradef).objecttype=odt_object then
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
MessagePos(filepos,type_e_record_type_expected);
|
||||||
|
else
|
||||||
|
MessagePos(filepos,type_e_record_type_expected);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
MessagePos(filepos,type_e_record_type_expected);
|
||||||
objectdef:
|
objectdef:
|
||||||
case tobjectdef(formaldef).objecttype of
|
case tobjectdef(formaldef).objecttype of
|
||||||
odt_class,
|
odt_class,
|
||||||
|
30
tests/webtbs/tw24073.pp
Normal file
30
tests/webtbs/tw24073.pp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{ %NORUN }
|
||||||
|
|
||||||
|
{$MODE DELPHI}
|
||||||
|
|
||||||
|
type
|
||||||
|
TA<T: record> = record
|
||||||
|
end;
|
||||||
|
|
||||||
|
TUnamanagedRec = record
|
||||||
|
x: integer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TManagedRec = record
|
||||||
|
s: string;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TEnum = (e1, e2, e3);
|
||||||
|
|
||||||
|
TObj = object
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
a: TA<TUnamanagedRec>;
|
||||||
|
b: TA<TManagedRec>;
|
||||||
|
d: TA<Single>;
|
||||||
|
e: TA<Integer>;
|
||||||
|
f: TA<TEnum>;
|
||||||
|
g: TA<TObj>;
|
||||||
|
begin
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user