Independently gate call & local op coeffects, untie from experimental
commit589b7d1324d23007f5aad619a76604658d9b04bf
authorLeo Osvald <leoo@fb.com>
Sun, 13 Dec 2020 21:47:55 +0000 (13 13:47 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Sun, 13 Dec 2020 21:50:12 +0000 (13 13:50 -0800)
tree00186ee298f81a9c4b508e15444868f3af7bdeb1
parent28be8f0f3e0e956b9101d49b41b397c47c7d3c47
Independently gate call & local op coeffects, untie from experimental

Summary:
Presently, when a file contains file attribute

  <<file: __EnableUnstableFeatures('coeffects_provisional')>>

the parser does not bail out when a context annotation syntax is parsed.

**Previously**, the typechecker read the same file-level attributes
to determine whether to do checks (and extra logic that is not free!)
associated with coeffects -- both calling conventions and local operations.
This is problematic for the rollout of coeffects, namely our first targeted
use case of reactivity/purity because it ties the parser-enabled logic with
typechecker logic that shouldn't be used in WWW before it's extensively tested.
Specifically, we can't have both coeffect annotations (syntax) but fall back
to some old pre-coeffects checks (when require ad-hoc patch due to a bug).

**As of this revision**, the above mechanism no longer *implicitly* sets
`GlobalOptions.*coeffects` but the following flags are added:

- `--call-coeffects` - to enforce calling conventions
- `--local-coeffects` - to enforce local operations (non-calls)

In typechecker tests under subdirectory `coeffect/`, enable those via `HH_FLAGS`.

This change enables tests under `reactive/` to test *both* the old and new
(coeffect-based) checks for reactivity **without losing coverage** for rx/pure;
see the new `typecheck_coeffects` target, which runs tests with the 2 new flags
and requires adding new expected files only when they differ from `.exp` files.

Reviewed By: DavidSnider

Differential Revision: D25457558

fbshipit-source-id: 7ccbc37feac96d50b258ad8d999e281c5f9fa394
15 files changed:
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_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.ml
hphp/hack/src/typing/typing_local_ops.ml
hphp/hack/src/typing/typing_subtype.ml
hphp/hack/test/decl/rx_example_provisional.php [deleted file]
hphp/hack/test/typecheck/coeffects/HH_FLAGS [new file with mode: 0644]
hphp/hack/test/typecheck/coeffects/local/HH_FLAGS [new file with mode: 0644]