ddoc doesn't generate template constraints or does so very inconsistently : in http://dlang.org/phobos/std_algorithm.html we have: template map(fun...) if (fun.length >= 1); but all other template constraints are omitted, eg: void fill(Range, Value)(Range range, Value filler); // template constraint omitted. I originally reported this in http://forum.dlang.org/post/mailman.1006.1370836279.13711.digitalmars-d@puremagic.com. In that link I also suggested a concise way to write those template constraints.
(In reply to comment #0) > ddoc doesn't generate template constraints or does so very inconsistently : > in http://dlang.org/phobos/std_algorithm.html we have: > template map(fun...) if (fun.length >= 1); > but all other template constraints are omitted, eg: > void fill(Range, Value)(Range range, Value filler); // template constraint > omitted. I suggest you to write here a little test case program that imports nothing from Phobos, usable as test case. It should cover various cases, to make it usable as test case for the person that will write the patch that fixes the bug.
It's my understanding that template constraints are never supposed to show up in the docs, but right now, it does look they show up some of the time when it's specifically a template in the docs rather than a function, and templated functions do indeed not have template constraints on them in the docs. Regardless, what's currently showing up in the docs is indeed inconsistent.
Test-case: ----- module ddoc10325; /** */ template templ(T...) if (someConstraint!T) { } /** */ void foo(T)(T t) if (someConstraint!T) { } void main() { } ----- The constraints for 'foo' are not shown. Constraints should be part of the documentation, they form part of the interface. When a user gets an error about instantiating a template, he will get the name of the template and its constraints, it only makes sense to also include the constraints in the documentation.
https://github.com/D-Programming-Language/dmd/pull/2161
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/3f9d50b12f9d1d7d7149d4bc2692322754e3c5d0 Fixes Issue 10325 - Constraints should be emitted for templated declarations. https://github.com/D-Programming-Language/dmd/commit/4bbef4f21141c6b21f35d133f348a3b215ad6513 Merge pull request #2161 from AndrejMitrovic/Fix10325 Issue 10325 - Constraints should be emitted for templated declarations