/// <inheritdoc /> protected override Result <TypeReference, IError> GetGenericTypeParameter( TypeReference expectedTypeReference, FreezableStepData freezableStepData, TypeResolver typeResolver) { var variableName = freezableStepData .TryGetVariableName(nameof(GetVariable <object> .Variable), StepType); if (variableName.IsFailure) { return(variableName.ConvertFailure <TypeReference>()); } if (expectedTypeReference != TypeReference.Unknown.Instance && typeResolver.Dictionary.TryGetValue(variableName.Value, out var tr)) { if (tr.Allow(expectedTypeReference, typeResolver)) { return(expectedTypeReference); } else if (expectedTypeReference.Allow(tr, typeResolver)) { return(tr); } return(Result.Failure <TypeReference, IError>( ErrorCode.WrongOutputType .ToErrorBuilder(TypeName, tr.Name, expectedTypeReference.Name) .WithLocation(freezableStepData) )); } return(new TypeReference.Variable(variableName.Value)); }
/// <inheritdoc /> protected override Result <TypeReference, IError> GetGenericTypeParameter( TypeReference expectedTypeReference, FreezableStepData freezableStepData, TypeResolver typeResolver) { if (!expectedTypeReference.Allow(TypeReference.Actual.Entity, typeResolver)) { return(Result.Failure <TypeReference, IError>( ErrorCode.WrongParameterType.ToErrorBuilder( StepType.Name, expectedTypeReference.Name, nameof(Entity) ) .WithLocation(freezableStepData) )); } var r1 = freezableStepData.TryGetStep(nameof(EntitySetValue <object> .Value), StepType) .Bind(x => x.TryGetOutputTypeReference(TypeReference.Any.Instance, typeResolver)); return(r1); }