Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix annotation in CodeObjects::Base#files#1178

Merged
lsegal merged 2 commits into
lsegal:masterfrom
gmalette:gm/fix-annotation-of-files
Aug 11, 2018
Merged

Fix annotation in CodeObjects::Base#files#1178
lsegal merged 2 commits into
lsegal:masterfrom
gmalette:gm/fix-annotation-of-files

Conversation

@gmalette

Copy link
Copy Markdown
Contributor

The original annotation incorrectly was Array but the format is

[ [file, line] ]

Therefore the annotation should be Array<Array<String, Integer>>,
given there is no prescribed way to describe tuples

Description

Describe your pull request and problem statement here.

Completed Tasks

  • I have read the Contributing Guide.
  • The pull request is complete (implemented / written).
  • Git commits have been cleaned up (squash WIP / revert commits).
  • I wrote tests and ran bundle exec rake locally (if code is attached to PR).

The original annotation incorrectly was Array<String> but the format is

```
[ [file, line] ]
```

Therefore the annotation should be `Array<Array<String, Integer>>`,
given there is no prescribed way to describe tuples
@coveralls

coveralls commented Jul 20, 2018

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.03%) to 93.633% when pulling 465e1f9 on gmalette:gm/fix-annotation-of-files into 8a0e6ac on lsegal:master.

Comment thread lib/yard/code_objects/base.rb Outdated
class Base
# The files the object was defined in. To add a file, use {#add_file}.
# @return [Array<String>] a list of files
# @return [Array<Array<String, Integer>>] a list of files

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use Array<Array(String, Integer)> to denote ordered tuples. Try it out at https://yardoc.org/types.html

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL! Thanks, fixed 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given X<A, B> means X parameterized by either A or B, how do you annotate X parameterized by both A and B ?

@lsegal lsegal merged commit e46506a into lsegal:master Aug 11, 2018
@lsegal

lsegal commented Aug 11, 2018

Copy link
Copy Markdown
Owner

Thanks!

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 this pull request may close these issues.

3 participants