Skip to content
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

Wrong documentation for order-dependent lists. #1523

Closed
frsantos opened this issue Dec 27, 2023 · 1 comment · Fixed by #1524
Closed

Wrong documentation for order-dependent lists. #1523

frsantos opened this issue Dec 27, 2023 · 1 comment · Fixed by #1524

Comments

@frsantos
Copy link
Contributor

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.

yard/docs/Tags.md

Lines 206 to 209 in 2d197a3

An order dependent list is a set of types surrounded by "()" and separated by
commas. This list must contain exactly those types in exactly the order specified.
For instance, an Array containing a String, Fixnum and Hash in that order (and
having exactly those 3 elements) would be listed as: `Array<(String, Fixnum, Hash)>`.

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:

  • OS: Ubuntu 23.10
  • Ruby version (ruby -v): ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux]
  • YARD version (yard -v): yard 0.9.34
  • Relevant software dependency/versions:

I have read the Contributing Guide.

@frsantos
Copy link
Contributor Author

frsantos commented Dec 27, 2023

I created a PR for the docs.

@frsantos frsantos changed the title Wrong documentation on order-dependent lists. Wrong documentation for order-dependent lists. Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant