mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 16:19:35 +02:00
* better error message in case of self-referencing generics specialization, resolves #17181
git-svn-id: trunk@15850 -
This commit is contained in:
parent
e6277f6633
commit
deef8dfa33
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10624,6 +10624,7 @@ tests/webtbs/tw1709.pp svneol=native#text/plain
|
||||
tests/webtbs/tw17118.pp svneol=native#text/plain
|
||||
tests/webtbs/tw17164.pp svneol=native#text/plain
|
||||
tests/webtbs/tw17180.pp svneol=native#text/plain
|
||||
tests/webtbs/tw17181.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1720.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1735.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1737.pp svneol=native#text/plain
|
||||
|
@ -1678,6 +1678,8 @@ type_w_procvar_univ_conflicting_para=04095_W_Coerced univ parameter type in proc
|
||||
% floating point values on the stack, because then the stack will be unbalanced.
|
||||
% Note that this warning will not flagg all potentially dangerous situations.
|
||||
% when \var{test} returns.
|
||||
type_e_generics_cannot_reference_itself=04096_E_Type parameters of specializations of generics cannot reference the currently specialized type
|
||||
% Recursive specializations of generics like \var{Type MyType = specialize MyGeneric<MyType>;} are not possible.
|
||||
%
|
||||
% \end{description}
|
||||
#
|
||||
|
@ -471,6 +471,7 @@ const
|
||||
type_e_class_or_objcclass_type_expected=04093;
|
||||
type_e_objcclass_type_expected=04094;
|
||||
type_w_procvar_univ_conflicting_para=04095;
|
||||
type_e_generics_cannot_reference_itself=04096;
|
||||
sym_e_id_not_found=05000;
|
||||
sym_f_internal_error_in_symtablestack=05001;
|
||||
sym_e_duplicate_id=05002;
|
||||
@ -867,9 +868,9 @@ const
|
||||
option_info=11024;
|
||||
option_help_pages=11025;
|
||||
|
||||
MsgTxtSize = 57194;
|
||||
MsgTxtSize = 57297;
|
||||
|
||||
MsgIdxMax : array[1..20] of longint=(
|
||||
24,88,297,96,82,53,110,22,202,63,
|
||||
24,88,297,97,82,53,110,22,202,63,
|
||||
49,20,1,1,1,1,1,1,1,1
|
||||
);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -234,8 +234,9 @@ implementation
|
||||
generictype:=ttypesym.create(sym.realname,pt2.resultdef);
|
||||
generictypelist.add(generictype);
|
||||
if not assigned(pt2.resultdef.typesym) then
|
||||
internalerror(200710172);
|
||||
specializename:=specializename+'$'+pt2.resultdef.typesym.realname;
|
||||
message(type_e_generics_cannot_reference_itself)
|
||||
else
|
||||
specializename:=specializename+'$'+pt2.resultdef.typesym.realname;
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
14
tests/webtbs/tw17181.pp
Normal file
14
tests/webtbs/tw17181.pp
Normal file
@ -0,0 +1,14 @@
|
||||
{ %fail }
|
||||
{$MODE OBJFPC}
|
||||
program Test;
|
||||
|
||||
type
|
||||
generic IList<IItem, IItemList> = interface end;
|
||||
IPointerList = specialize IList<Pointer, IPointerList>;
|
||||
|
||||
type
|
||||
generic TList<TItem, TItemList> = class end;
|
||||
TPointerList = specialize TList<Pointer, TPointerList>;
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user