* since we already allow inline specializations in mode ObjFPC due to generic functions it's only consequential to also allow specializations after pointers (they are already allowed in mode Delphi).

+ added tests
* tgeneric87.pp and tgeneric88.pp are no longer considered as tests that should fail

git-svn-id: trunk@35078 -
This commit is contained in:
svenbarth 2016-12-06 21:37:22 +00:00
parent db976a3a3e
commit 70817baf98
6 changed files with 58 additions and 7 deletions

2
.gitattributes vendored
View File

@ -11051,6 +11051,8 @@ tests/tbs/tb0619.pp svneol=native#text/pascal
tests/tbs/tb0620.pp svneol=native#text/pascal
tests/tbs/tb0621.pp svneol=native#text/plain
tests/tbs/tb0622.pp svneol=native#text/plain
tests/tbs/tb0623.pp svneol=native#text/pascal
tests/tbs/tb0624.pp svneol=native#text/pascal
tests/tbs/tb205.pp svneol=native#text/plain
tests/tbs/tb610.pp svneol=native#text/pascal
tests/tbs/tb613.pp svneol=native#text/plain

View File

@ -1562,7 +1562,6 @@ implementation
const
SingleTypeOptionsInTypeBlock:array[Boolean] of TSingleTypeOptions = ([],[stoIsForwardDef]);
SingleTypeOptionsIsDelphi:array[Boolean] of TSingleTypeOptions = ([],[stoAllowSpecialization]);
var
p : tnode;
hdef : tdef;
@ -1695,8 +1694,7 @@ implementation
begin
consume(_CARET);
single_type(tt2,
SingleTypeOptionsInTypeBlock[block_type=bt_type]+
SingleTypeOptionsIsDelphi[m_delphi in current_settings.modeswitches]
SingleTypeOptionsInTypeBlock[block_type=bt_type]+[stoAllowSpecialization]
);
{ in case of e.g. var or const sections we need to especially
check that we don't use a generic dummy symbol }

28
tests/tbs/tb0623.pp Normal file
View File

@ -0,0 +1,28 @@
{ %NORUN }
program tb0623;
{$mode objfpc}
{$modeswitch advancedrecords}
type
generic TTest<T> = record
public type
PSelf = ^specialize TTest<T>;
public
Next: PSelf;
end;
generic TTest2<T> = record
Next: ^specialize TTest2<T>;
end;
TTestLongInt = specialize TTest<LongInt>;
TTestString = specialize TTest<String>;
TTest2LongInt = specialize TTest2<LongInt>;
TTest2String = specialize TTest2<String>;
begin
end.

27
tests/tbs/tb0624.pp Normal file
View File

@ -0,0 +1,27 @@
{ %NORUN }
program tb0624;
{$mode delphi}
type
TTest<T> = record
public type
PSelf = ^TTest<T>;
public
Next: PSelf;
end;
TTest2<T> = record
Next: ^TTest<T>;
end;
TTestLongInt = TTest<LongInt>;
TTestString = TTest<String>;
TTest2LongInt = TTest2<LongInt>;
TTest2String = TTest2<String>;
begin
end.

View File

@ -1,5 +1,3 @@
{ %FAIL }
program tgeneric87;
{$mode objfpc}

View File

@ -1,5 +1,3 @@
{ %FAIL }
program tgeneric88;
{$mode objfpc}