|
@@ -1710,7 +1710,8 @@ type
|
|
|
function CreateClassIntfMap(El: TPasClassType; Index: integer): TPasClassIntfMap;
|
|
|
procedure CheckConditionExpr(El: TPasExpr; const ResolvedEl: TPasResolverResult); virtual;
|
|
|
procedure CheckProcSignatureMatch(DeclProc, ImplProc: TPasProcedure;
|
|
|
- IsOverride: boolean);
|
|
|
+ IsOverride: boolean // override or class intf implementation
|
|
|
+ );
|
|
|
procedure CheckPointerCycle(El: TPasPointerType);
|
|
|
procedure CheckGenericTemplateTypes(El: TPasGenericType); virtual;
|
|
|
procedure ComputeUnaryNot(El: TUnaryExpr; var ResolvedEl: TPasResolverResult;
|
|
@@ -6453,6 +6454,10 @@ begin
|
|
|
RaiseMsg(20180322143202,nNoMatchingImplForIntfMethodXFound,
|
|
|
sNoMatchingImplForIntfMethodXFound,
|
|
|
[GetProcTypeDescription(IntfProc.ProcType,[prptdUseName,prptdAddPaths,prptdResolveSimpleAlias])],El); // ToDo: jump to interface list
|
|
|
+ // check calling conventions
|
|
|
+ //writeln('TPasResolver.FinishClassType Intf=',GetObjPath(IntfProc),' Found=',GetObjPath(FindData.Found));
|
|
|
+ CheckProcSignatureMatch(IntfProc,TPasProcedure(FindData.Found),true);
|
|
|
+
|
|
|
Map.Procs[j]:=FindData.Found;
|
|
|
end;
|
|
|
Map:=Map.AncestorMap;
|
|
@@ -9396,7 +9401,7 @@ var
|
|
|
DeclName, ImplName: String;
|
|
|
ImplResult, DeclResult: TPasType;
|
|
|
ImplTemplType, DeclTemplType: TPasGenericTemplateType;
|
|
|
- NewImplPTMods: TProcTypeModifiers;
|
|
|
+ NewImplPTMods, DeclPTMods, ImplPTMods: TProcTypeModifiers;
|
|
|
ptm: TProcTypeModifier;
|
|
|
NewImplProcMods: TProcedureModifiers;
|
|
|
pm: TProcedureModifier;
|
|
@@ -9409,6 +9414,9 @@ begin
|
|
|
if DeclArgs.Count<>ImplArgs.Count then
|
|
|
RaiseNotYetImplemented(20190912110642,ImplProc);
|
|
|
|
|
|
+ DeclPTMods:=DeclProc.ProcType.Modifiers;
|
|
|
+ ImplPTMods:=ImplProc.ProcType.Modifiers;
|
|
|
+
|
|
|
DeclTemplates:=GetProcTemplateTypes(DeclProc);
|
|
|
ImplTemplates:=GetProcTemplateTypes(ImplProc);
|
|
|
if DeclTemplates<>nil then
|
|
@@ -9465,33 +9473,36 @@ begin
|
|
|
if CheckElTypeCompatibility(ImplResult,DeclResult,prraSimple)>cGenericExact then
|
|
|
RaiseIncompatibleType(20170216151734,nResultTypeMismatchExpectedButFound,
|
|
|
[],DeclResult,ImplResult,ImplProc);
|
|
|
-
|
|
|
- if ImplProc.IsAsync and not DeclProc.IsAsync then
|
|
|
- RaiseMsg(20200524111856,nXModifierMismatchY,sXModifierMismatchY,['procedure type','async'],ImplProc);
|
|
|
end;
|
|
|
|
|
|
// calling convention
|
|
|
if ImplProc.CallingConvention<>DeclProc.CallingConvention then
|
|
|
RaiseMsg(20170216151731,nCallingConventionMismatch,sCallingConventionMismatch,[],ImplProc);
|
|
|
|
|
|
- // proc modifiers
|
|
|
- NewImplProcMods:=ImplProc.Modifiers-DeclProc.Modifiers-[pmAssembler];
|
|
|
- if not IsOverride then
|
|
|
+ // modifiers
|
|
|
+ if IsOverride then
|
|
|
+ begin
|
|
|
+ // override/class-intf-impl: calling conventions must match
|
|
|
+ NewImplPTMods:=ImplPTMods><DeclPTMods;
|
|
|
+ for ptm in NewImplPTMods do
|
|
|
+ RaiseMsg(20201227213020,nXModifierMismatchY,sXModifierMismatchY,
|
|
|
+ ['procedure type',ProcTypeModifiers[ptm]],ImplProc.ProcType);
|
|
|
+ end
|
|
|
+ else
|
|
|
begin
|
|
|
// implementation proc must not add modifiers, except "assembler"
|
|
|
+ NewImplProcMods:=ImplProc.Modifiers-DeclProc.Modifiers-[pmAssembler];
|
|
|
if NewImplProcMods<>[] then
|
|
|
for pm in NewImplProcMods do
|
|
|
RaiseMsg(20200518182445,nDirectiveXNotAllowedHere,sDirectiveXNotAllowedHere,
|
|
|
[ModifierNames[pm]],ImplProc.ProcType);
|
|
|
+ // implementation proc must not add modifiers
|
|
|
+ NewImplPTMods:=ImplPTMods-DeclPTMods;
|
|
|
+ if NewImplPTMods<>[] then
|
|
|
+ for ptm in NewImplPTMods do
|
|
|
+ RaiseMsg(20200425154821,nDirectiveXNotAllowedHere,sDirectiveXNotAllowedHere,
|
|
|
+ [ProcTypeModifiers[ptm]],ImplProc.ProcType);
|
|
|
end;
|
|
|
-
|
|
|
- // proc type modifiers
|
|
|
- NewImplPTMods:=ImplProc.ProcType.Modifiers-DeclProc.ProcType.Modifiers;
|
|
|
- // implementation proc must not add modifiers
|
|
|
- if NewImplPTMods<>[] then
|
|
|
- for ptm in NewImplPTMods do
|
|
|
- RaiseMsg(20200425154821,nDirectiveXNotAllowedHere,sDirectiveXNotAllowedHere,
|
|
|
- [ProcTypeModifiers[ptm]],ImplProc.ProcType);
|
|
|
end;
|
|
|
|
|
|
procedure TPasResolver.ResolveImplBlock(Block: TPasImplBlock);
|