fix issue 13314 - BinaryHeap assumes Store has dup property #4929
fix issue 13314 - BinaryHeap assumes Store has dup property #4929andralex merged 5 commits intodlang:masterfrom
Conversation
|
|
Please add a unit test. |
|
This is not covered, so codecov is unhappy. You'd need to add a unittest of dup and we're good to go. Thanks! |
|
Done. Also, |
Looks like |
std/container/binaryheap.d
Outdated
| @@ -201,12 +201,14 @@ Returns $(D true) if the heap is _empty, $(D false) otherwise. | |||
| Returns a duplicate of the heap. The underlying store must also | |||
| support a $(D dup) method. | |||
There was a problem hiding this comment.
Please add a note here that this is only available if the underlying type has it.
|
The unit test should also test that using a Store without To catch possible future regressions on issue 13314. |
|
Urgh, a disabled dup will pass the test. @somzzz I think you need to do the static if using __compiles instead... |
|
Updated the tests. Let me know if you have other comments. Also, for some reason So I had to define Similarly, |
| } | ||
|
|
||
| // Assert dup can be used on BinaryHeaps when Store has dup | ||
| assert(__traits(compiles, () |
There was a problem hiding this comment.
I guess here you could simply paste the code in the unittest instead of asserting it compiles.
|
Is there any reason why this has five commits? Wasn't there a "squash-it-up in the end" policy? Now with the new Github PR capabilities this is even easier as the maintainer can do the squashing himself. On the positive side the messages are just sth. like "comment", not Nazi's again :) |
If Store does not have the
dupproperty, then dup is not available for the BinaryHeap either.