Pipes refactoring, Fixes in type checker
This commit is contained in:
@@ -629,16 +629,36 @@ begin
|
||||
if Length(sig.ParamTypes) <> Length(argTypes) then
|
||||
continue;
|
||||
match := True;
|
||||
|
||||
var sigIsStatic := sig.ReturnType.Kind <> stUnknown;
|
||||
for j := 0 to High(argTypes) do
|
||||
begin
|
||||
if not TTypeRules.CanAssign(sig.ParamTypes[j], argTypes[j]) then
|
||||
begin
|
||||
match := False;
|
||||
break;
|
||||
end;
|
||||
if sig.ParamTypes[j].Kind = stUnknown then
|
||||
sigIsStatic := false;
|
||||
end;
|
||||
|
||||
if match then
|
||||
begin
|
||||
bestSig := sig;
|
||||
break;
|
||||
if not sigIsStatic then
|
||||
begin
|
||||
if bestSig <> nil then
|
||||
if Assigned(FLog) then
|
||||
FLog.AddError(
|
||||
Format('RTL contains ambiguous signatures for method call on %s', [calleeType.ToString]),
|
||||
Node
|
||||
);
|
||||
bestSig := sig;
|
||||
end
|
||||
else
|
||||
begin
|
||||
bestSig := sig;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -763,19 +783,21 @@ begin
|
||||
baseType := PrepareBaseType(newBase, isOpt);
|
||||
resType := TTypes.Unknown;
|
||||
|
||||
if (baseType.Kind = stRecord) or (baseType.Kind = stRecordSeries) then
|
||||
begin
|
||||
idx := baseType.AsRecord.Definition.IndexOf(M.Member.Value);
|
||||
if idx >= 0 then
|
||||
case baseType.Kind of
|
||||
stRecord, stRecordSeries:
|
||||
begin
|
||||
var fieldType := TTypes.FromScalarKind(baseType.AsRecord.Definition[idx]);
|
||||
if baseType.Kind = stRecordSeries then
|
||||
resType := TTypes.CreateSeries(fieldType)
|
||||
else
|
||||
resType := fieldType;
|
||||
end
|
||||
else if Assigned(FLog) then
|
||||
FLog.AddError('Member not found', Node);
|
||||
idx := baseType.AsRecord.Definition.IndexOf(M.Member.Value);
|
||||
if idx >= 0 then
|
||||
begin
|
||||
var fieldType := TTypes.FromScalarKind(baseType.AsRecord.Definition[idx]);
|
||||
if baseType.Kind = stRecordSeries then
|
||||
resType := TTypes.CreateSeries(fieldType)
|
||||
else
|
||||
resType := fieldType;
|
||||
end
|
||||
else if Assigned(FLog) then
|
||||
FLog.AddError('Member not found', Node);
|
||||
end;
|
||||
end;
|
||||
|
||||
resType := ApplyOptionality(resType, isOpt);
|
||||
@@ -1081,7 +1103,8 @@ begin
|
||||
else
|
||||
inferredType := TTypes.Ordinal;
|
||||
end;
|
||||
paramTypes.Add(inferredType);
|
||||
|
||||
paramTypes.Add(TTypes.CreateSeries(inferredType));
|
||||
end;
|
||||
|
||||
// Reconstruct the typed Input Tuple [StreamIdent, [Selectors]]
|
||||
@@ -1150,7 +1173,7 @@ begin
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (lambdaRetType.Kind <> stUnknown) and (lambdaRetType.Kind <> stVoid) then
|
||||
if lambdaRetType.Kind <> stVoid then
|
||||
begin
|
||||
if Assigned(FLog) then
|
||||
FLog.AddError(
|
||||
@@ -1158,7 +1181,7 @@ begin
|
||||
lambda
|
||||
);
|
||||
end;
|
||||
pipeType := TTypes.Unknown;
|
||||
pipeType := TTypes.Void;
|
||||
end;
|
||||
|
||||
// Reconstruct the Pipe Node with typed Inputs tuple and typed Lambda
|
||||
|
||||
Reference in New Issue
Block a user