mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 14:08:05 +02:00
* provisional fix for Mantis #31076: fail gracefully instead of with an internal error if a generic method is declared inside a generic class or record. This will change once we support nested generics however.
* adjusted error message to reflect that we're not only dealing with generic classes + added test; note: it's added in webtbs, cause the test will loose its %FAIL attribute in the future git-svn-id: trunk@35079 -
This commit is contained in:
parent
70817baf98
commit
d499163ef5
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15292,6 +15292,7 @@ tests/webtbs/tw30978a.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw3101.pp svneol=native#text/plain
|
||||
tests/webtbs/tw31029.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw3104.pp svneol=native#text/plain
|
||||
tests/webtbs/tw31076.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw3109.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3111.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3113.pp svneol=native#text/plain
|
||||
|
@ -1393,11 +1393,11 @@ parser_e_no_procvarnested_const=03296_E_Typed constants of the type 'procedure i
|
||||
% procedural variable contains a reference to a nested procedure/function.
|
||||
% Therefore such typed constants can only be initialized with global
|
||||
% functions/procedures since these do not require a parent frame pointer.
|
||||
parser_f_no_generic_inside_generic=03297_F_Declaration of generic class inside another generic class is not allowed
|
||||
parser_f_no_generic_inside_generic=03297_F_Declaration of generic inside another generic is not allowed
|
||||
% At the moment, scanner supports recording of only one token buffer at the time
|
||||
% (guarded by internal error 200511173 in tscannerfile.startrecordtokens).
|
||||
% Since generics are implemented by recording tokens, it is not possible to
|
||||
% have declaration of generic class inside another generic class.
|
||||
% have declaration of a generic (type or method) inside another generic.
|
||||
parser_e_forward_intf_declaration_must_be_resolved=03298_E_Forward declaration "$1" must be resolved before a class can conform to or implement it
|
||||
% An Objective-C protocol or Java Interface must be fully defined before classes can conform to it.
|
||||
% This error occurs in the following situation (example for Objective-C, but the same goes for Java interfaces):
|
||||
|
@ -911,6 +911,9 @@ implementation
|
||||
exit;
|
||||
end;
|
||||
|
||||
if assigned(genericparams) and assigned(current_genericdef) then
|
||||
Message(parser_f_no_generic_inside_generic);
|
||||
|
||||
{ method ? }
|
||||
srsym:=nil;
|
||||
if not assigned(astruct) and
|
||||
|
19
tests/webtbs/tw31076.pp
Normal file
19
tests/webtbs/tw31076.pp
Normal file
@ -0,0 +1,19 @@
|
||||
{ %FAIL }
|
||||
|
||||
program tw31076;
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
type
|
||||
generic TFClass<TC> = class
|
||||
generic function Res<TF>(): TF; // <<--
|
||||
end;
|
||||
|
||||
generic function TFClass.Res<TF>: TF;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
|
||||
end.
|
Loading…
Reference in New Issue
Block a user