/// <inheritdoc /> protected override Result <TypeReference, IErrorBuilder> GetExpectedArrayTypeReference( TypeReference expectedTypeReference) { return(expectedTypeReference .CheckAllows(TypeReference.Unit.Instance, StepType, null) .Map(_ => new TypeReference.Array(TypeReference.Any.Instance) as TypeReference)); }
/// <inheritdoc /> protected override Result <TypeReference, IError> GetGenericTypeParameter( TypeReference expectedTypeReference, FreezableStepData freezableStepData, TypeResolver typeResolver) { var checkResult = expectedTypeReference .CheckAllows(TypeReference.Actual.Bool, StepType, typeResolver) .MapError(x => x.WithLocation(freezableStepData)); if (checkResult.IsFailure) { return(checkResult.ConvertFailure <TypeReference>()); } var result = freezableStepData .TryGetStep(nameof(Terms), StepType) .Bind( x => x.TryGetOutputTypeReference( new TypeReference.Array(TypeReference.Any.Instance), typeResolver ) ) .Bind( x => x.TryGetArrayMemberTypeReference(typeResolver) .MapError(e => e.WithLocation(freezableStepData)) ); return(result); }
/// <inheritdoc /> public override Result <TypeReference, IError> TryGetOutputTypeReference( TypeReference expectedTypeReference, FreezableStepData freezableStepData, TypeResolver typeResolver) { var reference = TypeReference.Create(typeof(TOutput)); return(expectedTypeReference .CheckAllows(reference, StepType, typeResolver) .MapError(x => x.WithLocation(freezableStepData)) .Map(_ => reference)); }
/// <inheritdoc /> protected override Result <TypeReference, IErrorBuilder> GetExpectedArrayTypeReference( TypeReference expectedTypeReference) { var r = expectedTypeReference.CheckAllows( TypeReference.Actual.Integer, StepType, null ); if (r.IsFailure) { return(r.ConvertFailure <TypeReference>()); } return(new TypeReference.Array(TypeReference.Any.Instance)); }
/// <inheritdoc /> protected override Result <TypeReference, IError> GetGenericTypeParameter( TypeReference expectedTypeReference, FreezableStepData freezableStepData, TypeResolver typeResolver) { var checkResult = expectedTypeReference.CheckAllows( TypeReference.Unit.Instance, StepType, typeResolver ); if (checkResult.IsFailure) { return(checkResult.ConvertFailure <TypeReference>() .MapError(x => x.WithLocation(freezableStepData))); } var stepTypeReference = freezableStepData.TryGetStep(nameof(Step), StepType) .Bind(x => x.TryGetOutputTypeReference(TypeReference.Any.Instance, typeResolver)); return(stepTypeReference); }