diff options
Diffstat (limited to 'compiler/ptype.pas')
-rw-r--r-- | compiler/ptype.pas | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 4b316a47a2..e099261edf 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -340,7 +340,11 @@ implementation ((ttypesym(srsym).typedef.typ=errordef) or (not allowgenericsyms and (ttypesym(srsym).typedef.typ=undefineddef) and - not (sp_generic_para in srsym.symoptions))) then + not (sp_generic_para in srsym.symoptions) and + not (sp_explicitrename in srsym.symoptions) and + not assigned(srsym.owner.defowner) and + { use df_generic instead of is_generic to allow aliases in nested types as well } + not (df_generic in tstoreddef(srsym.owner.defowner).defoptions))) then begin Message1(type_e_type_is_not_completly_defined,ttypesym(srsym).realname); def:=generrordef; @@ -1040,39 +1044,39 @@ implementation without "specialize" or "<T>" of the same type we're currently parsing, so we need to handle that special } newdef:=nil; - if not dospecialize and - assigned(ttypenode(pt1).typesym) and - (ttypenode(pt1).typesym.typ=typesym) and - (sp_generic_dummy in ttypenode(pt1).typesym.symoptions) and - assigned(current_structdef) and + if not dospecialize and + assigned(ttypenode(pt1).typesym) and + (ttypenode(pt1).typesym.typ=typesym) and + (sp_generic_dummy in ttypenode(pt1).typesym.symoptions) and + assigned(current_structdef) and + ( ( - ( - not (m_delphi in current_settings.modeswitches) and - (ttypesym(ttypenode(pt1).typesym).typedef.typ=undefineddef) and - (df_generic in current_structdef.defoptions) and - (ttypesym(ttypenode(pt1).typesym).typedef.owner=current_structdef.owner) and - (upper(ttypenode(pt1).typesym.realname)=copy(current_structdef.objname^,1,pos('$',current_structdef.objname^)-1)) - ) or ( - { this could be a nested specialization which uses - the type name of a surrounding generic to - reference the specialization of said surrounding - class } - (df_specialization in current_structdef.defoptions) and - return_specialization_of_generic(current_structdef,ttypesym(ttypenode(pt1).typesym).typedef,newdef) - ) + not (m_delphi in current_settings.modeswitches) and + (ttypesym(ttypenode(pt1).typesym).typedef.typ=undefineddef) and + (df_generic in current_structdef.defoptions) and + (ttypesym(ttypenode(pt1).typesym).typedef.owner=current_structdef.owner) and + (upper(ttypenode(pt1).typesym.realname)=copy(current_structdef.objname^,1,pos('$',current_structdef.objname^)-1)) + ) or ( + { this could be a nested specialization which uses + the type name of a surrounding generic to + reference the specialization of said surrounding + class } + (df_specialization in current_structdef.defoptions) and + return_specialization_of_generic(current_structdef,ttypesym(ttypenode(pt1).typesym).typedef,newdef) ) - then - begin - if assigned(newdef) then - def:=newdef - else - def:=current_structdef; - if assigned(def) then - { handle nested types } - post_comp_expr_gendef(def) - else - def:=generrordef; - end; + ) + then + begin + if assigned(newdef) then + def:=newdef + else + def:=current_structdef; + if assigned(def) then + { handle nested types } + post_comp_expr_gendef(def) + else + def:=generrordef; + end; if dospecialize then begin generate_specialization(def,false,name); |