Skip to content

Commit

Permalink
Eliminate false positives on unsurfaced lambda
Browse files Browse the repository at this point in the history
Summary:
Lints are check on TASTs both under normal and dynamic assumptions.

Unsurfaced exception lint was producing false positives because the `dynamic` run had all lambdas replaced with `Omitted` expressions and the lint rule relies on finding references to the exception binding.

This diff opts the lint into sound linting which means that we require an agreement between the normal and dynamic pass. Since no lint is produced in the normal pass, the false positives are prevented.

Reviewed By: andrewjkennedy

Differential Revision: D68631579

fbshipit-source-id: 38efae1606fdc37250cb33e41da566183b2962f4
  • Loading branch information
Mistral Contrastin authored and facebook-github-bot committed Jan 24, 2025
1 parent a117baa commit 527a1dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions hphp/hack/test/lint/unsurfaced_exception_lambda.good.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?hh

class Box<T> {}

function unsurfaced_exception_lambda_good(Box<int> $_): void {
try {
42;
} catch (Exception $ex) {
() ==> $ex;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No lint errors

0 comments on commit 527a1dc

Please sign in to comment.