Browse Source

Arrays and procvars inside a generic declaration are not declared as generic/specialization anymore (this partly reverts a previous commit). This reduces the problematic cases in the check whether a found def was specialized inside the class (the changed check in read_named_type.expr_type).
It's still not an ideal solution as the usage of generic classes/records (without specialization!) that are declared inside the current parsed class/record will compromise this check again.

git-svn-id: branches/svenbarth/generics@19434 -

svenbarth 14 years ago
parent
commit
f594e5a3fc
1 changed files with 2 additions and 16 deletions
  1. 2 16
      compiler/ptype.pas

+ 2 - 16
compiler/ptype.pas

@@ -865,10 +865,12 @@ implementation
                            def:=current_genericdef
                          end
                        else if (df_generic in def.defoptions) and
+                           { TODO : check once nested generics are allowed }
                            not
                              (
                                parse_generic and
                                (current_genericdef.typ in [recorddef,objectdef]) and
+                               (def.typ in [recorddef,objectdef]) and
                                is_owned_by(def,tabstractrecorddef(current_genericdef))
                              )
                            then
@@ -1087,16 +1089,8 @@ implementation
                { reject declaration of generic class inside generic class }
                else if assigned(genericlist) then
                  current_genericdef:=arrdef;
-               { nested types of specializations are specializations as well }
-               if assigned(current_structdef) and
-                   (df_specialization in current_structdef.defoptions) then
-                 include(arrdef.defoptions,df_specialization);
                symtablestack.push(arrdef.symtable);
                insert_generic_parameter_types(arrdef,genericdef,genericlist);
-               { when we are parsing a generic already then this is a generic as
-                 well }
-               if old_parse_generic then
-                 include(arrdef.defoptions, df_generic);
                parse_generic:=(df_generic in arrdef.defoptions);
              end;
            consume(_OF);
@@ -1142,16 +1136,8 @@ implementation
             { reject declaration of generic class inside generic class }
             else if assigned(genericlist) then
               current_genericdef:=pd;
-            { nested types of specializations are specializations as well }
-            if assigned(current_structdef) and
-                (df_specialization in current_structdef.defoptions) then
-              include(pd.defoptions,df_specialization);
             symtablestack.push(pd.parast);
             insert_generic_parameter_types(pd,genericdef,genericlist);
-            { when we are parsing a generic already then this is a generic as
-              well }
-            if old_parse_generic then
-              include(pd.defoptions, df_generic);
             parse_generic:=(df_generic in pd.defoptions);
             { don't allow to add defs to the symtable - use it for type param search only }
             tparasymtable(pd.parast).readonly:=true;