mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 20:29:17 +02:00
* give an error when trying to call an interface/protocol/category method
using the type name of the interface/protcol/category (they are not entities themselves on which you can invoke those methods, mantis #20661) git-svn-id: trunk@19651 -
This commit is contained in:
parent
836da25e81
commit
84bf45f0e2
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -11003,6 +11003,7 @@ tests/webtbf/tw2046.pp svneol=native#text/plain
|
|||||||
tests/webtbf/tw2053.pp svneol=native#text/plain
|
tests/webtbf/tw2053.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw2053b.pp svneol=native#text/plain
|
tests/webtbf/tw2053b.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw20580.pp svneol=native#text/pascal
|
tests/webtbf/tw20580.pp svneol=native#text/pascal
|
||||||
|
tests/webtbf/tw20661.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw2070.pp svneol=native#text/plain
|
tests/webtbf/tw2070.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw2128.pp svneol=native#text/plain
|
tests/webtbf/tw2128.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw2129.pp svneol=native#text/plain
|
tests/webtbf/tw2129.pp svneol=native#text/plain
|
||||||
|
@ -2971,6 +2971,14 @@ implementation
|
|||||||
CGMessage(cg_e_cant_call_abstract_method);
|
CGMessage(cg_e_cant_call_abstract_method);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ directly calling an interface/protocol/category/class helper
|
||||||
|
method via its type is not possible (always must be called via
|
||||||
|
the actual instance) }
|
||||||
|
if (methodpointer.nodetype=typen) and
|
||||||
|
(is_interface(methodpointer.resultdef) or
|
||||||
|
is_objc_protocol_or_category(methodpointer.resultdef)) then
|
||||||
|
CGMessage1(type_e_class_type_expected,methodpointer.resultdef.typename);
|
||||||
|
|
||||||
{ if an inherited con- or destructor should be }
|
{ if an inherited con- or destructor should be }
|
||||||
{ called in a con- or destructor then a warning }
|
{ called in a con- or destructor then a warning }
|
||||||
{ will be made }
|
{ will be made }
|
||||||
|
40
tests/webtbf/tw20661.pp
Normal file
40
tests/webtbf/tw20661.pp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{ %fail }
|
||||||
|
|
||||||
|
unit tw20661;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
const
|
||||||
|
PrescriptionStorageIntfId = '{C2F3C9F6-657C-4974-841A-4EBFF33B2180}';//'blik.prescriptionstorage';
|
||||||
|
DatasetProviderIntfId = '{B0B1501A-9266-48EA-B2E0-7EF23511D799}';
|
||||||
|
|
||||||
|
type
|
||||||
|
IDatasetPool = interface
|
||||||
|
['{F866EB5B-5B32-438E-918E-A56B031C73DA}']
|
||||||
|
procedure ReleaseDataset(Instance: pointer);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TBlikServices }
|
||||||
|
|
||||||
|
TBlikServices = class
|
||||||
|
public
|
||||||
|
procedure ReleaseDataset(Instance: pointer);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Services: TBlikServices;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{ TBlikServices }
|
||||||
|
|
||||||
|
procedure TBlikServices.ReleaseDataset(Instance: pointer);
|
||||||
|
begin
|
||||||
|
IDatasetPool.ReleaseDataset(Instance);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user