-
Notifications
You must be signed in to change notification settings - Fork 266
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
Conversation
There was a problem hiding this 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
Source/DafnyCore/Resolver.cs
Outdated
// 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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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.