-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Parse non-fixme /* comments not preceded by newlines #9276
base: master
Are you sure you want to change the base?
Conversation
@muglug has updated the pull request. You must reimport the pull request before landing. |
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@muglug has updated the pull request. You must reimport the pull request before landing. |
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@alexeyt has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Can you tell me more about the hidden-comment behavior you were trying to fix? What were you doing that resulted in the lost comment? If I use |
@viratyosin yes! But you don't see the second |
@muglug I don't think this solves your problem in the general case. You've changed some trailing trivia to be leading trivia, but AFAICS you'll just end up with cases where you can't see the comment associated with a closing bracket rather than an opening one. Have you considered using HH_FIXME itself instead? We could easily reserve some number prefix (say 8XXXX) for your use case, and then you'd get this for free. |
I don't see how that could happen in practice — I never see FIXMEs come after the thing they're intending to fix like this function foo(string $a): void {
echo($a as nonnull /* FIX_PREVIOUS_ELEMENT[4110] */);
// or
echo(
$a as nonnull /* FIX_NEXT_AFTER_COMMA[4110] */,
$b as nonnull,
);
} Instead those FIXMEs always come directly preceding the element they're intended to cover. |
As to the Stuff like /* HAKANA_FIXME[UnusedFunction] */ is really straightforward, and I prefer it to something like /* HH_FIXME[8017] -- Hakana detected an unused function */ |
@muglug has updated the pull request. You must reimport the pull request before landing. |
This fixes an issue where the contents of
/* ... */
comments are swallowed when they appear on the same line as the previous token.Edit: this PR also fixes a test that had incorrect expectations:
Given a type alias with comments
the comment is currently treated as belonging to
'a' => bool
, not'b' => string
, despite thecomma
separating the two.Note: this PR does not affect behaviour for
HH_FIXME
.