lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.92k stars 394 forks source link

Wrong documentation for order-dependent lists. #1523

Closed frsantos closed 4 months ago

frsantos commented 6 months ago

The documentation for order-dependent lists (a.k.a tuples), is misleading, as it says to use Array<(String, Fixnum, Hash)>, when that is a mixed of long and short syntax, which is interpreted differently.

https://github.com/lsegal/yard/blob/2d197a381c5d4cc5c55b2c60fff992b31c986361/docs/Tags.md?plain=1#L206-L209

Steps to reproduce

Use the explain_types on a param tag

::YARD::DocstringParser.new.parse("@param [Array<(Date, Integer)>]").tags.first.explain_types

Actual Output

::YARD::DocstringParser.new.parse("@param [Array<(Date, Integer)>]").tags.first.explain_types
=> "an Array of (an Array containing (a Date followed by an Integer))"

Expected Output

# Long syntax
::YARD::DocstringParser.new.parse("@param [Array(Date, Integer)]").tags.first.explain_types
=> "an Array containing (a Date followed by an Integer)"

# Short syntax
::YARD::DocstringParser.new.parse("@param [(Date, Integer)]").tags.first.explain_types
=> "an Array containing (a Date followed by an Integer)"

Environment details:

I have read the Contributing Guide.

frsantos commented 6 months ago

I created a PR for the docs.