When parsing an inline specialization inside a generic we need to
respect the "parsedtype" parameter which tells us whether the first
generic parameter was already parsed. This fixes Mantis #20871 .
+ added test for this
git-svn-id: trunk@20251 -
For the solution symbols will now contain a "sp_explicitrename" flag if they
were created through a type rename. This is necessary, because we can't
decide whether a type is a renamed generic para which contains by default a
reference to the default undefined def. Using individual undefined defs will
lead to duplicate identifiers as they are created before a symtable was
pushed (thus they'll ba part of whatever symtable is at the top).
+ symconst.pas, tsymoption:
Add a new option "sp_explicitrename" which will be used to track type
renames.
+ pdecl.pas, type_dec:
Set the new flag if we're dealing with a type rename
* pexpr.pas, factor_read_id:
If we have an undefined def that is also a rename then we assume that
it's a rename of a generic parameter
* utils/ppudump.pp:
Adjustment because of change to tsymoption
* utils/ppu.pp:
Increase PPU version
+ added test
git-svn-id: trunk@20250 -
- Remove unneeded check for "parse_generic" (it's already checked in the outer if-clause).
+ Check whether we are trying to specialize one of the surrounding type declarations of a
nested type (as long as nested generics are forbidden this is always the outermost generic
or specialization). This check can not rely on the symbol, because while parsing the
generic or the specialization the symbol's def is still an errordef. This fixes
Mantis #19498 .
+ Added test from bug report.
git-svn-id: trunk@20247 -
When specializing a generic the references from unitsyms to the loaded modules
needs to be reestablished, so that "unitidentifier.identifier" can be used
inside a generic without leading to an access violation.
Only global units are checked, because a generic must not use symbols from the
static symtable or from units used by the implementation section (the latter is
currently not checked)
+ added tests for the above problem for "normal" units as well as units with a namespace
git-svn-id: trunk@20245 -
skipping this for dynamic libraries (not sure why that was done, but
apparently not passing -arch triggers a bug in Xcode 4.2 Lion linker,
mantis #21159)
git-svn-id: trunk@20211 -
Always define nested types of a generic as generic as well.
* symtable.pas:
+ Add a function which decides whether two defs belong to the same generic.
* Fix sym_is_owned_by as there can be corner cases where childsym becomes Nil.
* ptype.pas:
* record_dec: Always define nested types of a generic as generic as well.
* single_type & read_named_type.expr_type:
Use the newly added function to improve the checks whether a generic
symbol should be rejected as "generics not allowed for types of
variables or fields".
+ Add a test for which the improved checks are necessary.
git-svn-id: trunk@20189 -
if it cannot contain local type definitions before looking up the type of
a field, because the type of a field may be a new type definition (e.g. an
inline record definition) and such type definitions must be added to the
correct symtable for, a.o., correctly resolving uses of the name of a
type that is currently being parsed
git-svn-id: trunk@20187 -
- postpone insertion of hidden params into record methods after the full record parse to prevent interface and implementation difference because of the possible record size change after the method parse (issue #0021044)
- skip hidden arguments during methods search for a property setter because of the above change and also for consistency with getter method search
- test
git-svn-id: trunk@20161 -
* When building the typename for a generic use the full typename
including it's surrounding object- or abstractrecorddefs. This allows
that a nested non-generic type of a generic type A can be used as
type arguments for more than one specialization of another generic B
(there were some problems when B e.g. defined a pointer to the type
argument's type)
* Always CRC the constructed specialization name as otherwise it might
reach the limit of 255 characters (not yet including unit name,
method name or method arguments)
Note: Errors like "expected XYZ, but got ABC" will need to be
adjusted to use the prettyname...
* increased PPU version
+ added test for above's point 1
git-svn-id: trunk@20149 -
of a property with nf_no_lvalue flag, and check that such nodes are
never used in direct assignments (fixes mantis #21087 and a couple of
other cases of invalid assignments to properties)
git-svn-id: trunk@20140 -
* Modified fpc_ansistr_decr_ref and fpc_widestr_decr_ref so they always zero the pointer passed by reference. Other _decr_ref helpers already do it.
- Removed tcg.g_decrrefcount, calling cg.g_finalize instead.
- finalize_data_node and tcg.g_finalize: removed code generation for zeroing locations, because it is now done by RTL helpers. This further reduces code size.
As a total result of this change and r20118, the size of Lazarus executable is reduced by about 12%.
git-svn-id: trunk@20119 -
o allows converting indices to the proper type if required (such as
variant, mantis #20873)
o do not create temporary defs for this type checking anymore if not
necessary
o makes sure that errors are thrown in case of conversions considered
as invalid by the compiler rather than that wrong code is silently
generated (such as in mantis #20873 before this change)
git-svn-id: trunk@20108 -