summaryrefslogtreecommitdiff
path: root/tests/tbf
Commit message (Collapse)AuthorAgeFilesLines
* * moved warning about suspicious comp assignment to type check pass, ↵florian2021-04-211-0/+8
| | | | | | | | catches also assignments of constants git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@49242 3ad0048d-3df7-0310-abae-a5850022a9f2
* * apply slightly adjusted patch by Blaise.ru which moves parsing of result ↵svenbarth2020-12-181-0/+8
| | | | | | | | types to a separate functions thus ensuring that File types can't be used for procedure variables (just like they already couldn't be used as a result type for normal functions) + added test git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@47810 3ad0048d-3df7-0310-abae-a5850022a9f2
* * give an error when trying to define a macro/compiler variable withjonas2020-11-031-0/+5
| | | | | | an empty name git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@47300 3ad0048d-3df7-0310-abae-a5850022a9f2
* * Skip the test for aarch64.yury2020-01-271-1/+1
| | | | git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@44049 3ad0048d-3df7-0310-abae-a5850022a9f2
* * check in the internal assembler for references with incorrect use of RIPflorian2019-11-131-0/+7
| | | | | | + test git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@43461 3ad0048d-3df7-0310-abae-a5850022a9f2
* * ensure that the correct amount of parameters is used for an operator ↵svenbarth2019-04-143-0/+39
| | | | | | overload (this is essentially important for unary operators that were declared with two arguments) git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@41868 3ad0048d-3df7-0310-abae-a5850022a9f2
* * stop searching for methods to implement interfaces in parent classes afterjonas2018-12-281-0/+34
| | | | | | | | | | | encountering a method with the correct name that does not have the "overload" directive (same logic as when looking for a call candidate, to avoid errors when using a Pascal-level wrapper to call interface methods, and Delphi-compatible since it always required "overload" for overloaded methods) o also catches calling convention mismatches like in webtbs/tw27349 git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@40683 3ad0048d-3df7-0310-abae-a5850022a9f2
* * a property access list must only consist of record or object fields; ↵svenbarth2018-12-262-0/+52
| | | | | | classes are not allowed git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@40656 3ad0048d-3df7-0310-abae-a5850022a9f2
* Modify tbs/tb0588.pp to check that a warning is issued about ↵pierre2018-12-111-0/+32
| | | | | | non-initialized return value, moved to tbf directory git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@40521 3ad0048d-3df7-0310-abae-a5850022a9f2
* * don't allow constants of the record type that is currently being parsed; ↵svenbarth2018-11-115-0/+97
| | | | | | | | | this would fail as soon as another field is added after the constant declaration + added tests Note: unlike what bug report 27880 suggests Delphi also does *NOT* allow this (at least a current Delphi Tokyo) and fails with a "type is not completely defined" error, so this test belongs into the "failure" category git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@40285 3ad0048d-3df7-0310-abae-a5850022a9f2
* * Further improvement for r40180:yury2018-11-043-5/+75
| | | | | | | | | | | | | | An uninitialized function Result of a managed type needs special handling. When passing it as a var parameter a warning need to be emitted, since a user may expect Result to be empty (nil) by default as it happens with local vars of a managed type. But this is not true for Result and may lead to serious issues. The only exception is SetLength(Result, ?) for a string Result. A user always expects undefined contents of the string after calling SetLength(). In such case a hint need to be emitted. + Tests for this. git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@40216 3ad0048d-3df7-0310-abae-a5850022a9f2
* * disable optimizations for proper warningflorian2018-07-131-1/+1
| | | | git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@39448 3ad0048d-3df7-0310-abae-a5850022a9f2
* * fix test; it of course still fails, but now it fails with the expected ↵svenbarth2018-06-301-1/+1
| | | | | | warning instead of an error git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@39351 3ad0048d-3df7-0310-abae-a5850022a9f2
* * first parameter of SetLength must be valid, as it is readflorian2018-06-301-0/+13
| | | | git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@39347 3ad0048d-3df7-0310-abae-a5850022a9f2
* * extend scanning of $modeswitch to support not only + and -, but also ON ↵svenbarth2018-06-222-0/+50
| | | | | | | | and OFF like other switches + added tests git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@39280 3ad0048d-3df7-0310-abae-a5850022a9f2
* Add %skiptarget=$nothread to tests using threadspierre2018-03-152-0/+2
| | | | git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@38528 3ad0048d-3df7-0310-abae-a5850022a9f2
* * fix for Mantis #30344: applied patch by Mario Ray Mahardhika to add new ↵svenbarth2017-10-091-0/+11
| | | | | | | | command line option -Sj[-|+] to control writeable typed constants (with a small adjustment to the help text) + added test git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@37437 3ad0048d-3df7-0310-abae-a5850022a9f2
* * Virtual methods cannot be declared as static (static virtual method has no ↵maciej2017-04-033-0/+46
| | | | | | | | sense). + added tests git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@35724 3ad0048d-3df7-0310-abae-a5850022a9f2
* + align(<int64>,<int64>) and align(<qword>,<qword>), resolves an issue ↵florian2017-03-262-0/+79
| | | | | | | | | | | reported on the mailing list with large records + tests * trecordsymtable.insertunionst takes a asizeint parameter * changed one aint into a asizeint git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@35662 3ad0048d-3df7-0310-abae-a5850022a9f2
* * leave parse_proc_head() (with some error recovery) if the interface could ↵svenbarth2016-11-281-0/+14
| | | | | | | | | not be found instead of running straight into an access violation + added test git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@35007 3ad0048d-3df7-0310-abae-a5850022a9f2
* * removed accidently committed fileflorian2016-11-201-8/+0
| | | | git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@34927 3ad0048d-3df7-0310-abae-a5850022a9f2
* + support for the PREFETCHTW1 instruction based on a patch by Emelyanov ↵florian2016-11-181-0/+8
| | | | | | Roman, resolves #30933 git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@34917 3ad0048d-3df7-0310-abae-a5850022a9f2
* * give an error when trying to get the address of an element of a dynamicjonas2016-06-123-0/+27
| | | | | | | string in a typed constant, like Delphi (instead of generating a bogus address) git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@33958 3ad0048d-3df7-0310-abae-a5850022a9f2
* + give an error if allocated temps. overflow the normally max. available spaceflorian2015-04-051-0/+11
| | | | git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@30449 3ad0048d-3df7-0310-abae-a5850022a9f2
* * skip test in general for 64 bit cpusjonas2015-02-231-3/+6
| | | | git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@29947 3ad0048d-3df7-0310-abae-a5850022a9f2
* Fix for Mantis #26481. This is a regression.svenbarth2015-01-161-0/+22
| | | | | | | | | nutils.pas, handle_staticfield_access: * generics don't have staticvarsyms for their static fieldvarsyms so we need to simulate a non-static access to avoid 1) an exception and 2) incorrect errors that instance methods can't be accessed + added tests git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@29484 3ad0048d-3df7-0310-abae-a5850022a9f2
* + added test for the error checking for nil-number; tests already exist fornickysn2014-07-181-0/+8
| | | | | | nil+number and number+nil, so this was the only one missing git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@28235 3ad0048d-3df7-0310-abae-a5850022a9f2
* * output a proper error message in case number+nil is encountered (just likenickysn2014-07-151-0/+8
| | | | | | | | it's already done for nil+number and nil-number) git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@28225 3ad0048d-3df7-0310-abae-a5850022a9f2
* Add a new warning message that is generated if an instance of an abstract ↵svenbarth2014-07-011-0/+30
| | | | | | | | | | | | | | | | class is created. This message is disabled by default, but can be switched on by using {$warn 4122 on} or {$warn 4122 error}. Please note that this warning won't be triggered if an instance of that class is created using a class variable of that class type as the compiler can not know the type contained in the variable at compile time (see also the added test). + msg/errore.msg: added disabled message which informs about the instantiation of an abstract class * pexpr.pas, do_member_read: generate the message if we have a constructor call for an abstract class using a loadvmtaddrnode (thus the type name is used and not a class variable) * msg{idx,txt}.inc: updated + added test git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@28127 3ad0048d-3df7-0310-abae-a5850022a9f2
* Added support for partial specialization. This should fix a few problems ↵svenbarth2014-06-057-0/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with generics, the tests for which will be added in the next days after I've verified them. For partial specialization only the declaration is reparsed, but not method bodies. The way generic parameters are passed around inside the compiler is changed: instead of creating new type symbols we keep a (name,def) pair so that the code in insert_generic_parameter_types can decide whether it needs to add a type symbol (for new undefined defs) or not (for real types and undefined defs that were passed on from the parent generic). This required the tfpobjectlist type of the genericlist variables/parameters to be changed to tfphashobjectlist. For correctly parsing Delphi specializations as parameters in functions of records (or objects) the relationship between the def and its typesym must already be established during the parsing. For this the checks for forcing a "type is not completely defined" message needed to be adjusted to correctly handle nested types as well. This should as a sideeffect also allow the usage of nested constants, etc like was fixed for classes some months ago. ToDo: - if a generic is specialized with only fully defined types then we could generate the in the unit where it's used. This is not yet done. - currently we don't specialize generics that are currently parsed; maybe this could be improved in the future for better type compatibility checks - check whether the pausing of token recording for partial specializations works correct in context of hint modifiers pgenutil.pas: * parse_generic_parameters: return a tfphashobjectlist instead of a tfpobjectlist (requires a few type adjustments in various other declarations) * maybe_insert_generic_rename_symbol, insert_generic_parameter_types: change genericlist from tfpobjectlist to tfphashobjectlist * parse_generic_specialization_types_internal: use is_generic instead of checking for df_generic * generate_specialization: + add a nested function to disable the requirement to check for method bodies * use the "simple" parameter parsing only for error recovery * instead of already creating a new type symbol for a parameter we use the found symbol's name and its def and maybe create it later on (therefor the type of tfpobjectlist was changed to tfphashobjectlist) * a partial specialization is specialized into the symtable of the def it is specialized in instead of one of the two global symtables * for now we handle partial specializations of generics we are currently parsing like before * don't continue recording generic tokens while we do a partial specialization * use the new unset_forwarddef function on the newly created defs * insert_generic_parameter_types: only create a new type symbol if the found type symbol does not yet have an owner (thus was freshly created for this generic declaration) pdecobj.pas, object_dec: * change type of genericlist from tfpobjectlist to tfphashobjectlist * set the type sym for all object types that can be generic or inside a generic (needed for correctly parsing Delphi style generic declarations) pdecsub.pas, parse_proc_head: * consume_generic_interface: always generate the specialization name as now all generics are "specialized" inside a generic * the assumption that the def index numbers are the same is no longer true as the genericdef might contain the defs of partial specializations which are not generated for full specializations pdecvar.pas, read_record_fields: * we also need to check nested types whether they contain a not yet completely parsed record or object ptype.pas: * read_named_type: * change genericlist from tfpobjectlist to tfphashobjectlist * pass the typesymbol along to record_dec * resolve_forward_types: use is_generic instead of checking for df_generic * single_type: * use is_generic instead of checking for df_generic * no need to check generic parameters * parse_record_members: + add parameter for the record's type symbol * setup the typesym <=> def relationship + record_dec: add parameter for the type symbol and pass it to parse_record_members * read_named_type, expr_type: use is_generic instead of checking for df_generic * array_dec & procvar_dec: change genericlist from tfpobjectlist to tfphashobjectlist symdef.pas, tstoreddef: * improve the checks used in is_generic and is_specialization to really only work on true generics and true (and partial) specializations respectively * don't search the type parameters in the symtable, but store them in the PPU and load them from there - remove fillgenericparas method (including the calls in the descendants tarraydef, tprocvardef, tobjectdef and trecorddef) defcmp.pas, compare_defs_ext: * handle partial specializations: specializations with only undefineddefs are compatible to generic defs pdecl.pas, types_dec: * switch generictypelist from tfpobjectlist to tfphashobjectlist ppu.pas: * increase PPU version + added tests that ensure that "not completely defined" checks for records (and objects) still work correctly git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@27861 3ad0048d-3df7-0310-abae-a5850022a9f2
* * disallow 64-bit property index specifiers on 64-bit CPUs, since they were notnickysn2014-03-091-0/+18
| | | | | | | | handled correctly there anyway (they were silently truncated to 32-bit) git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@27061 3ad0048d-3df7-0310-abae-a5850022a9f2
* Add support for integer constants to SetPEFlags and SetPEOptFlags. This is ↵svenbarth2013-06-134-0/+42
| | | | | | | | | | | | | Delphi compatible. scandir.pas: + add function "get_peflag_const" to retrieve the value of a constant * dir_setpeflags & dir_setpeoptflags: first check for an identifier (value is retrieved through "get_peflag_const") and then read a value + added messages for illegal parameters for SetPEFlags and SetPEOptFlags respectively + added tests git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@24887 3ad0048d-3df7-0310-abae-a5850022a9f2
* Added a test for a bug that was fixed in Delphi in (maybe XE4) to make sure ↵svenbarth2013-05-013-0/+32
| | | | | | | | | that a similar bug will not be introduced in FPC. Source: http://www.deltics.co.nz/blog/?p=1397 git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@24403 3ad0048d-3df7-0310-abae-a5850022a9f2
* Don't allow "static" for class operators or normal methods (except in objects).svenbarth2013-03-203-0/+59
| | | | | | | | | | | pdecsub.pas, pd_static: * check whether the given pd is an operator or a class method not inside an Object and generate an error if either of these is true msg/errore.msg, msgidx.inc, msgtxt.inc: * add a message to inform that a certain procedure directive is not allowed + added tests git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@23944 3ad0048d-3df7-0310-abae-a5850022a9f2
* Move the handling of "misstyled" floating point constants like "2." or ↵svenbarth2013-01-105-0/+45
| | | | | | | | | | | | | | | | | | | "2.e10" from the scanner to the parser. This way type helpers calls for integer constants can be parsed correctly in the future. Note: the error messages for incorrect "misstyled" floating point numbers (e.g. "2e10foo") have changed because of this. scanner.pas, tscannerfile.readtoken: instead of tokenizing "2.", "2.e10", "2.e+10" and "2.e-10" as "_REALNUMBER" tokenize them as "_INTCONST _POINT", "_INTCONST _POINT _ID", "_INTCONST _POINT _ID _PLUS _INTCONST" "_INTCONST _POINT _ID _PLUS _INTCONST"; tokenizing of normal floating constants is not changed pexpr.pas: factor: * extract the code for creating a new constant floating point from "factor" into a new function "real_const_node_from_pattern" + allow the parsing of postfixoperators for integer constants if a "." is encountered + postfixoperators: check for a "misstyled" floating point number if an ordinal const (not an enum and not a boolean) is encountered (the code is already partially prepared for type helper support) + Added tests git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@23356 3ad0048d-3df7-0310-abae-a5850022a9f2
* Fix one problem type of Mantis #23546. A record must not contain a static ↵svenbarth2013-01-092-0/+31
| | | | | | | | | | | | | array that uses itself as an element type (in can contain a dynamic array however) otherwise an infinite loop is encountered when checking whether the record needs special init/final code. pdecvar.pas, read_record_fields: * if the def of the field is a static array then use the array's element def (the final element def if it is a multi dimensional array) to check for whether this is the current record type + added tests git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@23352 3ad0048d-3df7-0310-abae-a5850022a9f2
* * moved test into the correct location and renamedflorian2012-01-071-0/+6
| | | | git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@20001 3ad0048d-3df7-0310-abae-a5850022a9f2
* * corrected test (only "overload" differences between interface/jonas2011-10-151-1/+1
| | | | | | | implementation should cause compilation to fail) git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@19494 3ad0048d-3df7-0310-abae-a5850022a9f2
* * require that "overload" is present in the interface if it's used in thejonas2011-10-151-0/+16
| | | | | | | | | | | | implementation (Delphi-compatible in case multiple overloads exist in the current unit, and in other cases avoids compiler crashes in case of circular implementation dependencies) * ignore other symbol options (deprecated, legacy, platform, ...) as far as the interface crc is concerned to avoid trouble in case they appear in the implementation but not in the interface (to prevent compiler crashes) git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@19492 3ad0048d-3df7-0310-abae-a5850022a9f2
* * fixed crash when trying to index a record without a default propertyjonas2011-05-171-0/+14
| | | | git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@17480 3ad0048d-3df7-0310-abae-a5850022a9f2
* + new test that should fail to compile, but doesn't yetjonas2011-02-271-0/+8
| | | | git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@17034 3ad0048d-3df7-0310-abae-a5850022a9f2
* compiler: implement generic array type:paul2011-01-021-8/+0
| | | | | | | | | | - add tarraysymtable to store generic type symbols - process generic and specialize declarations similar to generic records and classes - fix insert_generic_parameter_types to use def passed in argument instead of current_structdef because generic array type can't be assigned to the current_structdef variable - increase ppu version because of arraydef changes - tests git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@16681 3ad0048d-3df7-0310-abae-a5850022a9f2
* tests: move tb0070.pp to tbs and change expected behavior to success because ↵paul2010-12-271-13/+0
| | | | | | delphi and fpc both allows this constructions now git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@16647 3ad0048d-3df7-0310-abae-a5850022a9f2
* + additional goto testflorian2010-08-021-0/+8
| | | | git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@15689 3ad0048d-3df7-0310-abae-a5850022a9f2
* * support string constants > 255 charsflorian2010-01-242-8/+40
| | | | | | * don't cut off anymore string constants silently at 255 chars git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@14789 3ad0048d-3df7-0310-abae-a5850022a9f2
* compiler: allow class to have local type sections + testspaul2010-01-111-1/+0
| | | | git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@14605 3ad0048d-3df7-0310-abae-a5850022a9f2
* * turn openstring value parameters into regular shortstring parametersjonas2010-01-101-0/+17
| | | | | | | | | (mantis #14940 and #14941) * only turn var/our shortstring parameters with a length of 255 into openstring parameters with {$p+} (new tbf/tb0217.pp) git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@14602 3ad0048d-3df7-0310-abae-a5850022a9f2
* * fixed more properties, I still wonder how this could be commitedflorian2009-08-162-18/+18
| | | | git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@13543 3ad0048d-3df7-0310-abae-a5850022a9f2
* * disallow placing fields after method/property definitions, because thisjonas2009-06-271-0/+19
| | | | | | | | | can create ambiguities for the parser in case the field names also exist as modifiers (TP- and Delphi-compatible, mantis #13971) + tests * fixed tests that broke because of this change git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@13334 3ad0048d-3df7-0310-abae-a5850022a9f2
* * no longer allow assigning values to typecasted properties, because injonas2009-06-231-0/+23
| | | | | | | | | | case the getter is a function, the result is that first the getter is called, and subsequently the temp holding the function result is overwritten (thus not changing anything). This is Delphi-compatible, and fixes tests/tbf/tb0214* git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@13320 3ad0048d-3df7-0310-abae-a5850022a9f2