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

System.Object methods should always work. #279

Merged
merged 1 commit into from
Aug 10, 2016

Conversation

kolomanschaft
Copy link

Even in strict mode if none of them were set up. Fixes #273 and closes #248.

@kolomanschaft
Copy link
Author

@kzu: I solved it by extending the ToString intercept strategy. I'm not sure about the choice I've made with the return value of GetHashCode though. What do you think?

// Only if there is no corresponding setup
if (IsObjectToStringMethod(method) && !ctx.OrderedCalls.Select(c => IsObjectToStringMethod(c.Method)).Any())
// Only if there is no corresponding setup for `ToString()`
if (IsObjectMethod(method, "ToString") && !ctx.OrderedCalls.Select(c => IsObjectMethod(c.Method, "ToString")).Any())
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably switch to using nameof(object.ToString) now that C# 6 is here :)

@kzu
Copy link
Contributor

kzu commented Aug 10, 2016

Looks good to me, thanks @kolomanschaft !

@kzu kzu merged commit 7fa32a8 into devlooped:master Aug 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants