mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 02:49:19 +02:00
codetools: ctnGenericParam changed form compatible to exact, bug #15317
git-svn-id: trunk@23087 -
This commit is contained in:
parent
1b68eafebe
commit
842f26f8f3
@ -7730,6 +7730,13 @@ begin
|
|||||||
// same base type
|
// same base type
|
||||||
Result:=tcExact;
|
Result:=tcExact;
|
||||||
end
|
end
|
||||||
|
else if (TargetContext.Node.Desc=ctnGenericParameter)
|
||||||
|
or ((ExpressionType.Desc=xtContext)
|
||||||
|
and (ExpressionType.Context.Node.Desc=ctnGenericParameter))
|
||||||
|
then begin
|
||||||
|
// generic type is always preferred
|
||||||
|
Result:=tcExact;
|
||||||
|
end
|
||||||
else if (TargetContext.Node.Desc=ctnSetType) then begin
|
else if (TargetContext.Node.Desc=ctnSetType) then begin
|
||||||
{$IFDEF ShowExprEval}
|
{$IFDEF ShowExprEval}
|
||||||
DebugLn('[TFindDeclarationTool.IsCompatible] TargetContext.Node.Desc=ctnSetType',
|
DebugLn('[TFindDeclarationTool.IsCompatible] TargetContext.Node.Desc=ctnSetType',
|
||||||
@ -7769,12 +7776,18 @@ function TFindDeclarationTool.IsCompatible(TargetType,
|
|||||||
ExpressionType: TExpressionType; Params: TFindDeclarationParams
|
ExpressionType: TExpressionType; Params: TFindDeclarationParams
|
||||||
): TTypeCompatibility;
|
): TTypeCompatibility;
|
||||||
begin
|
begin
|
||||||
if TargetType.Desc=xtContext then
|
if TargetType.Desc=xtContext then begin
|
||||||
|
if TargetType.Context.Node.Desc=ctnGenericParameter then
|
||||||
|
exit(tcExact);
|
||||||
TargetType:=TargetType.Context.Tool.ConvertNodeToExpressionType(
|
TargetType:=TargetType.Context.Tool.ConvertNodeToExpressionType(
|
||||||
TargetType.Context.Node,Params);
|
TargetType.Context.Node,Params);
|
||||||
if ExpressionType.Desc=xtContext then
|
end;
|
||||||
|
if ExpressionType.Desc=xtContext then begin
|
||||||
|
if ExpressionType.Context.Node.Desc=ctnGenericParameter then
|
||||||
|
exit(tcExact);
|
||||||
ExpressionType:=ExpressionType.Context.Tool.ConvertNodeToExpressionType(
|
ExpressionType:=ExpressionType.Context.Tool.ConvertNodeToExpressionType(
|
||||||
ExpressionType.Context.Node,Params);
|
ExpressionType.Context.Node,Params);
|
||||||
|
end;
|
||||||
Result:=IsBaseCompatible(TargetType,ExpressionType,Params);
|
Result:=IsBaseCompatible(TargetType,ExpressionType,Params);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -7996,6 +8009,12 @@ begin
|
|||||||
' ExpressionType=',ExprTypeToString(ExpressionType));
|
' ExpressionType=',ExprTypeToString(ExpressionType));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Result:=tcIncompatible;
|
Result:=tcIncompatible;
|
||||||
|
if (TargetType.Desc=xtContext)
|
||||||
|
and (TargetType.Context.Node.Desc=ctnGenericParameter) then
|
||||||
|
exit(tcExact);
|
||||||
|
if (ExpressionType.Desc=xtContext)
|
||||||
|
and (ExpressionType.Context.Node.Desc=ctnGenericParameter) then
|
||||||
|
exit(tcExact);
|
||||||
if (TargetType.Desc=ExpressionType.Desc) then begin
|
if (TargetType.Desc=ExpressionType.Desc) then begin
|
||||||
case TargetType.Desc of
|
case TargetType.Desc of
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user