Fix issue 17502: Allow no parameters in out contract for auto methods#6906
Fix issue 17502: Allow no parameters in out contract for auto methods#6906WalterBright merged 1 commit intodlang:masterfrom
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.
I'm not sure using that private identifier is something we want to advocate / test :D
There was a problem hiding this comment.
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.
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.