summaryrefslogtreecommitdiff
path: root/packages/fcl-passrc/src/pasresolver.pp
diff options
context:
space:
mode:
authormattias <mattias@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-12-28 16:51:02 +0000
committermattias <mattias@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-12-28 16:51:02 +0000
commit69a6d5b902c9b7a8663907eb91209a0b70fc82ee (patch)
tree4a8a6f286662720d78fcb7e83db9e17efa6f4c67 /packages/fcl-passrc/src/pasresolver.pp
parentd1478f77647fc9cb01d5407d1041d63359d4b6f1 (diff)
downloadfpc-69a6d5b902c9b7a8663907eb91209a0b70fc82ee.tar.gz
fcl-passrc: fixed typecast specialized array to specialized type
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@47870 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-passrc/src/pasresolver.pp')
-rw-r--r--packages/fcl-passrc/src/pasresolver.pp15
1 files changed, 10 insertions, 5 deletions
diff --git a/packages/fcl-passrc/src/pasresolver.pp b/packages/fcl-passrc/src/pasresolver.pp
index 2bc195b644..fef050ce41 100644
--- a/packages/fcl-passrc/src/pasresolver.pp
+++ b/packages/fcl-passrc/src/pasresolver.pp
@@ -10993,7 +10993,7 @@ begin
FoundEl:=GetSpecializedEl(NameExpr,FoundEl,TemplParams);
if FoundEl is TPasProcedure then
begin
- // check if params fit the implicit specialized function
+ // check if params fit the explicit specialized function, e.g. Run<Word>()
CheckCallProcCompatibility(TPasProcedure(FoundEl).ProcType,Params,true);
end;
end
@@ -11007,7 +11007,7 @@ begin
try
CheckTemplParams(GenTemplates,InferenceParams);
FoundEl:=GetSpecializedEl(NameExpr,FoundEl,InferenceParams);
- // check if params fit the implicit specialized function
+ // check if params fit the implicit specialized function, e.g. Run()
CheckCallProcCompatibility(TPasProcedure(FoundEl).ProcType,Params,true);
finally
ReleaseElementList(InferenceParams{$IFDEF CheckPasTreeRefCount},RefIdInferenceParamsExpr{$ENDIF});
@@ -11034,13 +11034,12 @@ begin
else
begin
// typecast to user type
- CheckTypeCast(TypeEl,Params,true); // emit warnings
+ CheckTypeCast(TypeEl,Params,true); // emit warnings, and errors for specializations
end;
end;
// FoundEl compatible element -> create reference
Ref:=CreateReference(FoundEl,NameExpr,rraRead);
-
if FindCallData.StartScope.ClassType=ScopeClass_WithExpr then
Ref.WithExprScope:=TPasWithExprScope(FindCallData.StartScope);
FindData:=Default(TPRFindData);
@@ -27255,6 +27254,11 @@ begin
{$IFDEF VerbosePasResolver}
writeln('TPasResolver.CheckTypeCastArray From=',GetTypeDescription(FromType),' ToType=',GetTypeDescription(ToType));
{$ENDIF}
+ if not RaiseOnError then
+ begin
+ if (ToType.GenericTemplateTypes<>nil) and (ToType.GenericTemplateTypes.Count>0) then
+ exit(cCompatible); // is later checked when specialized
+ end;
StartFromType:=FromType;
StartToType:=ToType;
Result:=cIncompatible;
@@ -27284,10 +27288,11 @@ begin
break; // ToType has more dimensions
end;
// have same dimension -> check ElType
+ Include(FromElTypeRes.Flags,rrfReadable);
+ FromElTypeRes.IdentEl:=nil;
{$IFDEF VerbosePasResolver}
writeln('TPasResolver.CheckTypeCastArray check ElType From=',GetResolverResultDbg(FromElTypeRes),' To=',GetResolverResultDbg(ToElTypeRes));
{$ENDIF}
- Include(FromElTypeRes.Flags,rrfReadable);
Result:=CheckTypeCastRes(FromElTypeRes,ToElTypeRes,ErrorEl,false);
break;
end