symconst.pas:
+ extend "tdefoptions" by a "df_genconstraint" which will be used to mark dummy defs that should mainly satisfy the compiler's type checking without to much changes
symsym.pas:
+ add a class "tgenericconstraintdata" which will hold information about the constraints associated with a specific generic type parameter (designed for future extensions)
+ extend "ttypesym" by a reference to a "tgenericconstraintdata" which is written to the ppu only if needed
symtype.pas:
+ add a pointer to "tderef" as this is needed for the ppu reading/writing code for the "tgenericconstraintdata"
pdecl.pas, types_dec:
+ call "parse_generic_parameters" so that constraints are allowed
pgenutil.pas:
+ extend "generate_specialization" by a "parsedpos" to give in the file position of the first parsed parameter (needed for correct error locations when checking the constraints)
+ add an overloaded call of "generate_specialization" to differentiate between the use cases "first parameter parsed by generate_specialization" and "first parameter parsed by other code"; this also allows to write the "fillchar" for the "parampos" parameter only once ( => otherwise a warning is triggered => error in compilation)
+ extend the "parse_generic_specialization_types" by a "poslist" parameter which will contain the positions of all parsed type parameters (can only be used in the case that all parameters are parsed)
* move the original code of "parse_generic_specialization_types" to a new procedure "parse_generic_specialization_types_internal" which take an additional "parsedpos" parameter which will be added to the "poslist" before all others; "parse_generic_specialization_types" calls this new procedure with a dummy argument (which won't be used)
+ extend "parse_generic_parameters" by the parsing of generic constraints which constructs correct defs for the parameters and fills in the new "tgenericconstraintdata" object for each parameter (note: the "constructor" constraint is only parsed for Delphi compatibility and basically means the same as a "class" constraint... (it's a relict of Delphi.NET))
* adjust "insert_generic_parameter_types" as specializations and generics can no longer be differed by whether the type parameters are of type "undefineddef"
pdecsub.pas, parse_proc_head, consume_generic_interface:
* adjust call to "generate_specialization"
+ add a new function "check_generic_constraints" which is used from within "generate_specialization" to ensure that the given specialization parameters are compatible with the constraints of the generic parameters
ptype.pas:
* single_type: adjust call to "generate_specialization"
* read_named_type, expr_type: adjust call to "generate_specialization"
+ write_persistent_type_info: don't write typeinfo for constraints
pexpr.pas, sub_expr:
* adjust call to "generate_specialization"
* adjusted ppudump, because of added "tdefoptions.df_genconstraint" value
+ added tests for generic constraints
* modified test for class helper inside a generic which extends a class type parameter
+ added test for record helper inside a generic which extends a record type parameter
git-svn-id: trunk@23158 -
* general tests for the helper feature (thlp*)
* tests for class helpers (tchlp*)
* tests for record helpers (trhlp*)
With my current yet-to-be-commited implementation nearly all tests pass, but some fail because of missing FPC features:
* thlp30.pp currently fails because of generic constraints, but should fail despite the constraints
* thlp29.pp fails, because generic methods are not yet supported
* trhlp8.pp, trhlp9.pp, trhlp10.pp fail, because one can't use default properties using the abbreviated syntax
* trhlp17.pp, trhlp18.pp, trhlp19.pp fail, because nested types are not supported for records
git-svn-id: branches/svenbarth/classhelpers@17237 -