Skip to content

Commit

Permalink
Ensure nested type matchers implement protocol correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
stakx committed Nov 1, 2020
1 parent cc1b2e5 commit 1e8fda9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Moq/ExpressionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,13 @@ void Split(Expression e, out Expression r /* remainder */, out InvocationShape p
{
foreach (var typeArgument in methodCallExpression.Method.GetGenericArguments())
{
if (typeArgument.IsTypeMatcher(out var typeMatcherType))
if (typeArgument.IsOrContainsTypeMatcher())
{
Guard.ImplementsTypeMatcherProtocol(typeMatcherType);
// This is a (somewhat roundabout) way of ensuring that the type matchers used
// will be usable. They will not be usable if they don't implement the type
// matcher protocol correctly; and `SubstituteTypeMatchers` tests for that, so
// we'll reuse its recursive logic instead of having to reimplement our own.
_ = typeArgument.SubstituteTypeMatchers(typeArgument);
}
}
}
Expand Down

0 comments on commit 1e8fda9

Please sign in to comment.