Implement syntax checks for pocket universes
commitc3f942bda83b905d645a835bd86f3cfbeb431753
authorVincent Siles <vsiles@fb.com>
Mon, 1 Apr 2019 15:51:45 +0000 (1 08:51 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Mon, 1 Apr 2019 15:55:01 +0000 (1 08:55 -0700)
treeba078aaae2e4a4a05bb96f695a33f5a7437e5af9
parent437b77100a7b367eaac65a8feee75aa7b2ea362b
Implement syntax checks for pocket universes

Summary:
Implement some local (per file) check for Pocket Universes syntax:

- In a class, each `enum` definition must be uniquely named
- In a single enum definition, each case type must be uniquely named
- In a single enum definition, each case expr must be uniquely named
- In a single enum definition, each atom mapping must be uniquely named
- In a single atom mapping each type definition must be uniquely named
- In a single atom mapping each expr definition must be uniquely named

Things we don't test here:
- that each definition is complete (all symbols are defined exactly one,
  it requires information for the parent).
- that there is not incompatibilities with the parent's definitions.

It will be done during typing or decl.

Reviewed By: CatherineGasnier

Differential Revision: D14621055

fbshipit-source-id: 719f6a52a1e45fb6581b40cfd47b29ada0f676be
hphp/hack/src/errors/error_codes.ml
hphp/hack/src/errors/errors.ml
hphp/hack/src/errors/errors.mli
hphp/hack/src/parser/full_fidelity_parser_errors.ml
hphp/hack/src/typing/nast_check/nast_check.ml
hphp/hack/src/typing/nast_check/pocket_universes_check.ml [new file with mode: 0644]
hphp/hack/test/errors/error_map.ml
hphp/hack/test/pocket_universes/naming/dup_check.bad.php [new file with mode: 0644]
hphp/hack/test/pocket_universes/naming/dup_check.bad.php.expect [new file with mode: 0644]