You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 1, 2024. It is now read-only.
The binary pipe operator, |>, evaluates the result of a left-hand expression and stores the result in $$, the pre-defined pipe variable. The right-hand expression must contain at least one occurrence of $$.
If it's a bug that the typechecker does not produce an error for a missing $$, we can close this PR and file an issue in https://github.com/facebook/hhvm.
If it's a bug that the typechecker does not produce an error for a missing $$, we can close this PR and file an issue in https://github.com/facebook/hhvm.
There is already an issue tracking this 😉.
Please don't let this convince you to withdraw this linter. Pipes without $$ are fishy it should be flagged. A lint rule could be deployed far quicker than a language change. I would be surprised if www would typecheck after 2.5 years since the unintentional (?) removal of the check. Strongly in favor of shipping this linter, even if it becomes a language level error later.
Two of the test suites are failing because they could not run hhvm and two are failing with this error:
Server launched with the following command:
'/usr/local/Cellar/hhvm-nightly/2022.05.03/bin/hh_server' '-d' '/Users/runner/work/hhast/hhast' '--waiting-client' '8'
Running in daemon mode
Server connection took over 2.0 seconds. Refreshing...
Typing[4297] Was expecting an array or collection but type is unknown [1]
-> It is unknown because the type of the lambda parameter could not be determined. Please add a type hint to the parameter [2]
src/__Private/XHProf.hack:32:53
30 | invariant(self::$enabled === true, "Can't disable twice");
31 | self::$enabled = false;
[1,2] 32 | $raw = Dict\map(\xhprof_disable(), $v ==> (int) $v['wt']);
33 |
34 | $inclusive = dict[];
1 error found.
Error: Process completed with exit code 2.
Yes, I ran into that too. You can add a dict<arraykey, mixed> before $v and explicitly reformat. This makes the tests pass again without conflict with my branches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces
UnusedPipeVariableLinterto identify bugs where the pipe variable$$is missing from a pipe operation.I recently encountered a bug in a pipe operation where the right-hand side re-used the initial variable, discarding the intended input in
$$:Note that the docs for "Expressions And Operators: Pipe" say:
If it's a bug that the typechecker does not produce an error for a missing
$$, we can close this PR and file an issue in https://github.com/facebook/hhvm.