Taint positions derived from reasons and report tainted primary error positions
commit2dd246f98db296cf45523422d271990a2f20804f
authorAndrew Kennedy <akenn@fb.com>
Wed, 26 Aug 2020 12:23:04 +0000 (26 05:23 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 26 Aug 2020 12:26:33 +0000 (26 05:26 -0700)
tree8473638c2182a107841cf2707c27520b4f2b7795
parentb55be82b1134419f7cda18b1cbee444f297fcee5
Taint positions derived from reasons and report tainted primary error positions

Summary:
Introduce a new kind of position that is "tainted", meaning that it was derived from reason information inside a type.

Add a new option `--report-pos-from-reason` to `hh_single_type_check`, and `report_pos_from_reason` to `.hhconfig`. When set, this has two effects
(a) It adds a suffix "[FROM REASON]" to the raw error message output (with `--error-format raw`) if such a "tainted" position is the primary location of the error.
(b) It disables `HH_FIXME` having any effect on such errors, and reports it as "unFIXMEable".

The motivation for this is type checking in the absence of reason/position information in types. This will let us remove positions from decls, and still be able to type-check, *and* honour HH_FIXMEs, but with more spartan error messages. But in order to do that we must eliminate all  places where we derive a primary position from the reason info in the type.

Reviewed By: CatherineGasnier

Differential Revision: D23264461

fbshipit-source-id: bfbf7bb5ccc4ca0eaf539c0a80cf4b48f1b0d7bc
18 files changed:
hphp/hack/src/errors/errors.ml
hphp/hack/src/errors/errors.mli
hphp/hack/src/hh_single_type_check.ml
hphp/hack/src/options/globalOptions.ml
hphp/hack/src/options/globalOptions.mli
hphp/hack/src/options/typecheckerOptions.ml
hphp/hack/src/oxidized/gen/global_options.rs
hphp/hack/src/oxidized/manual/global_options_impl.rs
hphp/hack/src/oxidized/manual/pos.rs
hphp/hack/src/oxidized_by_ref/gen/global_options.rs
hphp/hack/src/oxidized_by_ref/manual/global_options_impl.rs
hphp/hack/src/server/serverConfig.ml
hphp/hack/src/typing/typing_reason.ml
hphp/hack/src/utils/pos_embedded.ml
hphp/hack/src/utils/pos_embedded.mli
hphp/hack/test/typecheck/generics_restrictions/report_pos/HH_FLAGS [new file with mode: 0644]
hphp/hack/test/typecheck/generics_restrictions/report_pos/covariance2.php [new file with mode: 0644]
hphp/hack/test/typecheck/generics_restrictions/report_pos/covariance2.php.exp [new file with mode: 0644]