Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing equality checks to MethodSignatureComparer.EqualSignatureTypes #310

Merged
merged 4 commits into from
Oct 9, 2017

Conversation

stakx
Copy link
Member

@stakx stakx commented Oct 4, 2017

Given two generic types, EqualSignatureTypes only checks whether their generic type arguments match, but it doesn't check whether the actual generic type definition (i.e. the "open" generic type) matches. This PR adds those missing checks.

This should fix #309.

Please beware: I was a bit pressed for time when I put this PR together, so my understanding of MethodSignatureComparer's purpose and exact uses is incomplete. I've relied mostly on the unit test suite to tell me whether I'm introducing any breaking change or not.

@stakx stakx force-pushed the methodsignaturecomparer-bug branch from 9b4f814 to a2efa6b Compare October 4, 2017 12:11
Given two generic types, `EqualSignatureTypes` only checks whether
their generic type arguments match, but it doesn't check whether the
actual type matches. This commits adds those missing checks.
@stakx stakx force-pushed the methodsignaturecomparer-bug branch from a2efa6b to 33ae41a Compare October 4, 2017 15:06

private class GenericClass1<T> { }

private class GenericClass2<T> { }
Copy link
Member Author

@stakx stakx Oct 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I felt it was important to keep the two tests separate:

  • The unit test here deals with some internal cogwheel;
  • The regression unit test acts at the level of the public API.

Yet, declaring the same set of test types (the interface, plus GenericClass1<T> and GenericClass2<T>) twice seems somewhat repetitive. Do you mind? (If so, where would be the best place to put them?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yet, declaring the same set of test types (the interface, plus GenericClass1 and GenericClass2) twice seems somewhat repetitive. Do you mind? (If so, where would be the best place to put them?)

Two tests sounds fine to me, means if the internal implementation changes we'll at least still have the regression one.

@jonorossi jonorossi added this to the vNext milestone Oct 9, 2017
@jonorossi jonorossi merged commit 26ad75d into castleproject:master Oct 9, 2017
@stakx stakx deleted the methodsignaturecomparer-bug branch October 9, 2017 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in 4.2.0 related to MethodSignatureComparer
2 participants