-
-
Notifications
You must be signed in to change notification settings - Fork 609
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 issue 17502: Allow no parameters in out contract for auto methods #6906
Conversation
|
|
It may be worth including another test function that returns a concrete type such as int, as functions with a return type of |
|
Good point, updated with more test cases. |
Even in case of non-void methods, their out contract should be able to accept no arguments. For the methods with auto return type, there was oversight where one argument to `out` was always assumed.
| body {} | ||
|
|
||
| auto bar() | ||
| out { assert (__result > 5); } |
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.
I'm not sure using that private identifier is something we want to advocate / test :D
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.
Well, it's an internal compiler test, I guess, so I was going with the thoughts that whoever removes __result, should do it contently and remove this test. Reason I've added it here in the first place is that this patch touches the code responsible for the generation of this identifier.
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.
As far as the test suite goes, it is not intended to be an example of best practices. It's sole purpose is to test the compiler - so whatever works is fair game. (In fact, it's often terrible style.)
|
Damn Jenkins, why can't he leave me alone? |
|
@Burgos: The Jenkins error is not due to your PR; |
[REG2.064] Fix issue 17502: Allow no parameters in out contract for auto methods cherry-picked-by: Martin Krejcirik <mk@krej.cz>
Even in case of non-void methods, their out contract should
be able to accept no arguments. For the methods with auto return type,
there was oversight where one argument to
outwas always assumed.