Skip to content

Commit

Permalink
Remove C# 7.2 features to make it C# 7.0 compliant.
Browse files Browse the repository at this point in the history
  • Loading branch information
KeRNeLith committed Jan 24, 2019
1 parent 707570a commit 9574c41
Show file tree
Hide file tree
Showing 39 changed files with 850 additions and 852 deletions.
2 changes: 0 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ deploy:
api_key:
secure: H9AFeC6uNE88rUiZxmDQNt50bhQ0ilMCua/X9s1++dNB0wMHWrKY8xjfM/M2xFja
on:
branch: master
configuration: Release
APPVEYOR_REPO_TAG: true
# GitHub
Expand All @@ -124,6 +123,5 @@ deploy:
prerelease: false
force_update: true
on:
branch: master
configuration: Release
APPVEYOR_REPO_TAG: true
28 changes: 14 additions & 14 deletions src/Here/Either/Either.Constructor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class Either
/// <returns>An <see cref="Either{TLeft, TRight}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="value"/> is null.</exception>
[PublicAPI, Pure]
public static Either<TLeft, TRight> Left<TLeft, TRight>([NotNull] in TLeft value)
public static Either<TLeft, TRight> Left<TLeft, TRight>([NotNull] TLeft value)
{
return Either<TLeft, TRight>.Left(value);
}
Expand All @@ -34,7 +34,7 @@ public static Either<TLeft, TRight> Left<TLeft, TRight>([NotNull] in TLeft value
/// <returns>An <see cref="Either{TLeft, TRight}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="nullable"/> is null.</exception>
[PublicAPI, Pure]
public static Either<TLeft, TRight> Left<TLeft, TRight>([NotNull] in TLeft? nullable)
public static Either<TLeft, TRight> Left<TLeft, TRight>([NotNull] TLeft? nullable)
where TLeft : struct
{
if (nullable == null)
Expand Down Expand Up @@ -65,7 +65,7 @@ public static Either<TLeft, TRight> ToEither<TLeft, TRight>([NotNull] this TLeft
/// <returns>An <see cref="Either{TLeft, TRight}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="nullable"/> is null.</exception>
[PublicAPI, Pure]
public static Either<TLeft, TRight> ToEither<TLeft, TRight>([NotNull] in this TLeft? nullable)
public static Either<TLeft, TRight> ToEither<TLeft, TRight>([NotNull] this TLeft? nullable)
where TLeft : struct
{
return Left<TLeft, TRight>(nullable);
Expand All @@ -79,7 +79,7 @@ public static Either<TLeft, TRight> ToEither<TLeft, TRight>([NotNull] in this TL
/// <returns>An <see cref="EitherLeft{TLeft}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="value"/> is null.</exception>
[PublicAPI, Pure]
public static EitherLeft<TLeft> Left<TLeft>([NotNull] in TLeft value)
public static EitherLeft<TLeft> Left<TLeft>([NotNull] TLeft value)
{
return new EitherLeft<TLeft>(value);
}
Expand All @@ -92,7 +92,7 @@ public static EitherLeft<TLeft> Left<TLeft>([NotNull] in TLeft value)
/// <returns>An <see cref="EitherLeft{TLeft}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="nullable"/> is null.</exception>
[PublicAPI, Pure]
public static EitherLeft<TLeft> Left<TLeft>([NotNull] in TLeft? nullable)
public static EitherLeft<TLeft> Left<TLeft>([NotNull] TLeft? nullable)
where TLeft : struct
{
if (nullable == null)
Expand All @@ -113,7 +113,7 @@ public static EitherLeft<TLeft> Left<TLeft>([NotNull] in TLeft? nullable)
/// <returns>An <see cref="Either{TLeft, TRight}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="value"/> is null.</exception>
[PublicAPI, Pure]
public static Either<TLeft, TRight> Right<TLeft, TRight>([NotNull] in TRight value)
public static Either<TLeft, TRight> Right<TLeft, TRight>([NotNull] TRight value)
{
return Either<TLeft, TRight>.Right(value);
}
Expand All @@ -127,7 +127,7 @@ public static Either<TLeft, TRight> Right<TLeft, TRight>([NotNull] in TRight val
/// <returns>An <see cref="Either{TLeft, TRight}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="nullable"/> is null.</exception>
[PublicAPI, Pure]
public static Either<TLeft, TRight> Right<TLeft, TRight>([NotNull] in TRight? nullable)
public static Either<TLeft, TRight> Right<TLeft, TRight>([NotNull] TRight? nullable)
where TRight : struct
{
if (nullable == null)
Expand Down Expand Up @@ -158,7 +158,7 @@ public static Either<TLeft, TRight> ToEither<TLeft, TRight>([NotNull] this TRigh
/// <returns>An <see cref="Either{TLeft, TRight}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="nullable"/> is null.</exception>
[PublicAPI, Pure]
public static Either<TLeft, TRight> ToEither<TLeft, TRight>([NotNull] in this TRight? nullable)
public static Either<TLeft, TRight> ToEither<TLeft, TRight>([NotNull] this TRight? nullable)
where TRight : struct
{
return Right<TLeft, TRight>(nullable);
Expand All @@ -172,7 +172,7 @@ public static Either<TLeft, TRight> ToEither<TLeft, TRight>([NotNull] in this TR
/// <returns>An <see cref="EitherRight{TRight}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="value"/> is null.</exception>
[PublicAPI, Pure]
public static EitherRight<TRight> Right<TRight>([NotNull] in TRight value)
public static EitherRight<TRight> Right<TRight>([NotNull] TRight value)
{
return new EitherRight<TRight>(value);
}
Expand All @@ -185,7 +185,7 @@ public static EitherRight<TRight> Right<TRight>([NotNull] in TRight value)
/// <returns>An <see cref="EitherRight{TRight}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="nullable"/> is null.</exception>
[PublicAPI, Pure]
public static EitherRight<TRight> Right<TRight>([NotNull] in TRight? nullable)
public static EitherRight<TRight> Right<TRight>([NotNull] TRight? nullable)
where TRight : struct
{
if (nullable == null)
Expand All @@ -209,7 +209,7 @@ public static EitherRight<TRight> Right<TRight>([NotNull] in TRight? nullable)
/// <returns>An <see cref="Either{TLeft, TRight}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="defaultLeftValue"/> is null.</exception>
[PublicAPI, Pure]
public static Either<TLeft, TRight> ToEither<TLeft, TRight>([CanBeNull] this TRight value, [NotNull] in TLeft defaultLeftValue)
public static Either<TLeft, TRight> ToEither<TLeft, TRight>([CanBeNull] this TRight value, [NotNull] TLeft defaultLeftValue)
where TRight : class
{
Throw.IfArgumentNull(defaultLeftValue, nameof(defaultLeftValue));
Expand All @@ -232,7 +232,7 @@ public static Either<TLeft, TRight> ToEither<TLeft, TRight>([CanBeNull] this TRi
/// <exception cref="ArgumentNullException">If the <paramref name="leftValueFactory"/> is null.</exception>
/// <exception cref="ArgumentNullException">If the value returned by the <paramref name="leftValueFactory"/> is null.</exception>
[PublicAPI, Pure]
public static Either<TLeft, TRight> ToEither<TLeft, TRight>([CanBeNull] this TRight value, [NotNull, InstantHandle] in Func<TLeft> leftValueFactory)
public static Either<TLeft, TRight> ToEither<TLeft, TRight>([CanBeNull] this TRight value, [NotNull, InstantHandle] Func<TLeft> leftValueFactory)
where TRight : class
{
Throw.IfArgumentNull(leftValueFactory, nameof(leftValueFactory));
Expand All @@ -254,7 +254,7 @@ public static Either<TLeft, TRight> ToEither<TLeft, TRight>([CanBeNull] this TRi
/// <returns>An <see cref="Either{TLeft, TRight}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="defaultLeftValue"/> is null.</exception>
[PublicAPI, Pure]
public static Either<TLeft, TRight> ToEither<TLeft, TRight>([CanBeNull] in this TRight? nullable, [NotNull] in TLeft defaultLeftValue)
public static Either<TLeft, TRight> ToEither<TLeft, TRight>([CanBeNull] this TRight? nullable, [NotNull] TLeft defaultLeftValue)
where TRight : struct
{
Throw.IfArgumentNull(defaultLeftValue, nameof(defaultLeftValue));
Expand All @@ -277,7 +277,7 @@ public static Either<TLeft, TRight> ToEither<TLeft, TRight>([CanBeNull] in this
/// <exception cref="ArgumentNullException">If the <paramref name="leftValueFactory"/> is null.</exception>
/// <exception cref="ArgumentNullException">If the value returned by the <paramref name="leftValueFactory"/> is null.</exception>
[PublicAPI, Pure]
public static Either<TLeft, TRight> ToEither<TLeft, TRight>([CanBeNull] in this TRight? nullable, [NotNull, InstantHandle] in Func<TLeft> leftValueFactory)
public static Either<TLeft, TRight> ToEither<TLeft, TRight>([CanBeNull] this TRight? nullable, [NotNull, InstantHandle] Func<TLeft> leftValueFactory)
where TRight : struct
{
Throw.IfArgumentNull(leftValueFactory, nameof(leftValueFactory));
Expand Down
50 changes: 25 additions & 25 deletions src/Here/Either/Either.Operations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public partial struct Either<TLeft, TRight>
/// <exception cref="InvalidOperationException">If this <see cref="Either{TLeft,TRight}"/> is in <see cref="EitherStates.None"/> state without providing a <paramref name="none"/> action.</exception>
[PublicAPI, Pure]
public Unit Match(
[NotNull, InstantHandle] in Action<TRight> onRight,
[NotNull, InstantHandle] in Action<TLeft> onLeft,
[CanBeNull, InstantHandle] in Action none = null)
[NotNull, InstantHandle] Action<TRight> onRight,
[NotNull, InstantHandle] Action<TLeft> onLeft,
[CanBeNull, InstantHandle] Action none = null)
{
Throw.IfArgumentNull(onRight, nameof(onRight));
Throw.IfArgumentNull(onLeft, nameof(onLeft));
Expand Down Expand Up @@ -64,9 +64,9 @@ public Unit Match(
/// <exception cref="InvalidOperationException">If this <see cref="Either{TLeft,TRight}"/> is in <see cref="EitherStates.None"/> state without providing a <paramref name="none"/> action.</exception>
[PublicAPI, CanBeNull, Pure]
public TOut MatchNullable<TOut>(
[NotNull, InstantHandle] in Func<TRight, TOut> onRight,
[NotNull, InstantHandle] in Func<TLeft, TOut> onLeft,
[CanBeNull, InstantHandle] in Func<TOut> none = null)
[NotNull, InstantHandle] Func<TRight, TOut> onRight,
[NotNull, InstantHandle] Func<TLeft, TOut> onLeft,
[CanBeNull, InstantHandle] Func<TOut> none = null)
{
Throw.IfArgumentNull(onRight, nameof(onRight));
Throw.IfArgumentNull(onLeft, nameof(onLeft));
Expand Down Expand Up @@ -99,9 +99,9 @@ public TOut MatchNullable<TOut>(
/// <exception cref="NullResultException">If the result of the match is null.</exception>
[PublicAPI, NotNull, Pure]
public TOut Match<TOut>(
[NotNull, InstantHandle] in Func<TRight, TOut> onRight,
[NotNull, InstantHandle] in Func<TLeft, TOut> onLeft,
[CanBeNull, InstantHandle] in Func<TOut> none = null)
[NotNull, InstantHandle] Func<TRight, TOut> onRight,
[NotNull, InstantHandle] Func<TLeft, TOut> onLeft,
[CanBeNull, InstantHandle] Func<TOut> none = null)
{
TOut result = MatchNullable(onRight, onLeft, none);
return Throw.IfResultNull(result);
Expand Down Expand Up @@ -369,7 +369,7 @@ public TState BiFold<TState>(
/// <returns>The result of the applied treatment.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="onLeft"/> is null.</exception>
[PublicAPI]
public Unit IfLeft([NotNull, InstantHandle] in Action<TLeft> onLeft)
public Unit IfLeft([NotNull, InstantHandle] Action<TLeft> onLeft)
{
return Match(DoNothing, onLeft, DoNothing);
}
Expand All @@ -384,7 +384,7 @@ public Unit IfLeft([NotNull, InstantHandle] in Action<TLeft> onLeft)
#if SUPPORTS_AGGRESSIVE_INLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public Unit IfFailure([NotNull, InstantHandle] in Action<TLeft> onFailure)
public Unit IfFailure([NotNull, InstantHandle] Action<TLeft> onFailure)
{
return IfLeft(onFailure);
}
Expand Down Expand Up @@ -501,7 +501,7 @@ public TOut IfLeft<TOut>(
/// <returns>This <see cref="Either{TLeft,TRight}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="onLeft"/> is null.</exception>
[PublicAPI]
public Either<TLeft, TRight> OnLeft([NotNull, InstantHandle] in Action<TLeft> onLeft)
public Either<TLeft, TRight> OnLeft([NotNull, InstantHandle] Action<TLeft> onLeft)
{
Throw.IfArgumentNull(onLeft, nameof(onLeft));

Expand All @@ -520,7 +520,7 @@ public Either<TLeft, TRight> OnLeft([NotNull, InstantHandle] in Action<TLeft> on
#if SUPPORTS_AGGRESSIVE_INLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public Either<TLeft, TRight> OnFailure([NotNull, InstantHandle] in Action<TLeft> onFailure)
public Either<TLeft, TRight> OnFailure([NotNull, InstantHandle] Action<TLeft> onFailure)
{
return OnLeft(onFailure);
}
Expand All @@ -536,7 +536,7 @@ public Either<TLeft, TRight> OnFailure([NotNull, InstantHandle] in Action<TLeft>
/// <returns>A <see cref="Unit"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="onRight"/> is null.</exception>
[PublicAPI]
public Unit IfRight([NotNull, InstantHandle] in Action<TRight> onRight)
public Unit IfRight([NotNull, InstantHandle] Action<TRight> onRight)
{
return Match(onRight, DoNothing, DoNothing);
}
Expand All @@ -551,7 +551,7 @@ public Unit IfRight([NotNull, InstantHandle] in Action<TRight> onRight)
#if SUPPORTS_AGGRESSIVE_INLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public Unit IfSuccess([NotNull, InstantHandle] in Action<TRight> onSuccess)
public Unit IfSuccess([NotNull, InstantHandle] Action<TRight> onSuccess)
{
return IfRight(onSuccess);
}
Expand Down Expand Up @@ -668,7 +668,7 @@ public TOut IfRight<TOut>(
/// <returns>This <see cref="Either{TLeft,TRight}"/>.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="onRight"/> is null.</exception>
[PublicAPI]
public Either<TLeft, TRight> OnRight([NotNull, InstantHandle] in Action<TRight> onRight)
public Either<TLeft, TRight> OnRight([NotNull, InstantHandle] Action<TRight> onRight)
{
Throw.IfArgumentNull(onRight, nameof(onRight));

Expand All @@ -687,7 +687,7 @@ public Either<TLeft, TRight> OnRight([NotNull, InstantHandle] in Action<TRight>
#if SUPPORTS_AGGRESSIVE_INLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public Either<TLeft, TRight> OnSuccess([NotNull, InstantHandle] in Action<TRight> onSuccess)
public Either<TLeft, TRight> OnSuccess([NotNull, InstantHandle] Action<TRight> onSuccess)
{
return OnRight(onSuccess);
}
Expand All @@ -707,8 +707,8 @@ public Either<TLeft, TRight> OnSuccess([NotNull, InstantHandle] in Action<TRight
/// <exception cref="ArgumentNullException">If the <paramref name="onLeft"/> is null.</exception>
[PublicAPI]
public Either<TLeft, TRight> OnRightOrLeft(
[NotNull, InstantHandle] in Action<TRight> onRight,
[NotNull, InstantHandle] in Action<TLeft> onLeft)
[NotNull, InstantHandle] Action<TRight> onRight,
[NotNull, InstantHandle] Action<TLeft> onLeft)
{
Throw.IfArgumentNull(onRight, nameof(onRight));
Throw.IfArgumentNull(onLeft, nameof(onLeft));
Expand Down Expand Up @@ -739,8 +739,8 @@ public Either<TLeft, TRight> OnRightOrLeft(
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public Either<TLeft, TRight> OnSuccessOrFailure(
[NotNull, InstantHandle] in Action<TRight> onSuccess,
[NotNull, InstantHandle] in Action<TLeft> onFailure)
[NotNull, InstantHandle] Action<TRight> onSuccess,
[NotNull, InstantHandle] Action<TLeft> onFailure)
{
return OnRightOrLeft(onSuccess, onFailure);
}
Expand Down Expand Up @@ -768,7 +768,7 @@ public TRight RightOrDefault()
/// <returns>The either right value, otherwise the provided default value.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="defaultValue"/> is null.</exception>
[PublicAPI, Pure, NotNull]
public TRight RightOr([NotNull] in TRight defaultValue)
public TRight RightOr([NotNull] TRight defaultValue)
{
Throw.IfArgumentNull(defaultValue, nameof(defaultValue));

Expand All @@ -790,7 +790,7 @@ public TRight RightOr([NotNull] in TRight defaultValue)
/// <exception cref="ArgumentNullException">If the <paramref name="valueFactory"/> is null.</exception>
/// <exception cref="NullResultException">If the result of the <paramref name="valueFactory"/> function is null.</exception>
[PublicAPI, Pure, NotNull]
public TRight RightOr([NotNull, InstantHandle] in Func<TRight> valueFactory)
public TRight RightOr([NotNull, InstantHandle] Func<TRight> valueFactory)
{
Throw.IfArgumentNull(valueFactory, nameof(valueFactory));

Expand Down Expand Up @@ -823,7 +823,7 @@ public TLeft LeftOrDefault()
/// <returns>The either left value, otherwise the provided default value.</returns>
/// <exception cref="ArgumentNullException">If the <paramref name="defaultValue"/> is null.</exception>
[PublicAPI, Pure, NotNull]
public TLeft LeftOr([NotNull] in TLeft defaultValue)
public TLeft LeftOr([NotNull] TLeft defaultValue)
{
Throw.IfArgumentNull(defaultValue, nameof(defaultValue));

Expand All @@ -845,7 +845,7 @@ public TLeft LeftOr([NotNull] in TLeft defaultValue)
/// <exception cref="ArgumentNullException">If the <paramref name="valueFactory"/> is null.</exception>
/// <exception cref="NullResultException">If the result of the <paramref name="valueFactory"/> function is null.</exception>
[PublicAPI, Pure, NotNull]
public TLeft LeftOr([NotNull, InstantHandle] in Func<TLeft> valueFactory)
public TLeft LeftOr([NotNull, InstantHandle] Func<TLeft> valueFactory)
{
Throw.IfArgumentNull(valueFactory, nameof(valueFactory));

Expand Down
Loading

0 comments on commit 9574c41

Please sign in to comment.