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

Fix: Function by method with the same name as a method won't crash resolver #2995

Merged
merged 6 commits into from
Nov 8, 2022

Conversation

MikaelMayer
Copy link
Member

This PR fixes #2019
I added the corresponding test.
The story was that, if a function by method and a method had the same name, the function by method's resolved method was null. However, there were two places in the resolver, before it gives up, that were asserting that the function by method's method was not null, so I added a conditional instead and ensured that the number of reported errors was greater than zero.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@MikaelMayer MikaelMayer requested a review from alex-chew November 7, 2022 22:15
alex-chew
alex-chew previously approved these changes Nov 8, 2022
Copy link
Contributor

@alex-chew alex-chew left a comment

Choose a reason for hiding this comment

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

LGTM, added one non-blocking comment

// method should have been filled in by now,
// unless there was a function by method and a method of the same name
// but then this error must have been reported.
Contract.Assert(reporter.ErrorCount >= 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Why >= 1 here but > 0 in the other case?

Copy link
Member Author

Choose a reason for hiding this comment

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

nit: Why >= 1 here but > 0 in the other case?

i did not do them at the same time :-) will fix it for consistency.

@MikaelMayer MikaelMayer enabled auto-merge (squash) November 8, 2022 16:51
@MikaelMayer MikaelMayer requested a review from alex-chew November 8, 2022 16:51
@MikaelMayer MikaelMayer merged commit ac3d9f7 into master Nov 8, 2022
@MikaelMayer MikaelMayer deleted the fix-2019-function-by-method-crash branch November 8, 2022 20:06
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.

function-by-method crash
2 participants