add more test baselines around enum constraints
commita15bbccffa1cabb3723c64b8e64fd430a5acc272
authorLucian Wischik <ljw@fb.com>
Thu, 22 Apr 2021 01:13:25 +0000 (21 18:13 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 22 Apr 2021 01:15:40 +0000 (21 18:15 -0700)
treee7834a9c84f2b708f17967ed97f474aafdec9eaf
parentd0a0f76d74af19109c2dd0d9c3f9b508b30d3e39
add more test baselines around enum constraints

Summary:
I'm just adding some more baseline tests. Some of them reveal bugs in the direct-decl-parser.

They are all to embody my hard-earned knowledge, which I documented in shallow_decl_defs.ml:
```
type shallow_class_const = {
  scc_abstract: bool;
  scc_name: Typing_defs.pos_id;
  scc_type: decl_ty;
      (** This field is used for two different meanings in two different places...
      enum class A:arraykey {int X="a";} -- here X.scc_type=\HH\MemberOf<A,int>
      enum B:int as arraykey {X="a"; Y=1; Z=B::X;} -- here X.scc_type=string, Y.scc_type=int, Z.scc_type=TAny
      In the later case, the scc_type is just a simple syntactic attempt to retrieve the type from the initializer. *)
  scc_refs: Typing_defs.class_const_ref list;
      (** This is a list of all scope-resolution operators "A::B" that are mentioned in the const initializer,
      for members of regular-enums and enum-class-enums to detect circularity of initializers.
      We don't yet have a similar mechanism for top-level const initializers. *)
}
```

Differential Revision: D27807165

fbshipit-source-id: 98cbfd6564c2df4ba24b501a24040ce67867e199
14 files changed:
hphp/hack/src/decl/shallow_decl_defs.ml
hphp/hack/src/oxidized_by_ref/gen/shallow_decl_defs.rs
hphp/hack/test/decl/const_misc1.php [new file with mode: 0644]
hphp/hack/test/decl/const_misc1.php.exp [new file with mode: 0644]
hphp/hack/test/decl/const_misc1.php.typecheck.exp [new file with mode: 0644]
hphp/hack/test/decl/consts_misc2.php [new file with mode: 0644]
hphp/hack/test/decl/consts_misc2.php.exp [new file with mode: 0644]
hphp/hack/test/decl/consts_misc2.php.typecheck.exp [new file with mode: 0644]
hphp/hack/test/decl/enum_class.php [new file with mode: 0644]
hphp/hack/test/decl/enum_class.php.exp [new file with mode: 0644]
hphp/hack/test/decl/enum_class.php.typecheck.exp [new file with mode: 0644]
hphp/hack/test/decl/enum_constraint.php
hphp/hack/test/decl/enum_constraint.php.exp
hphp/hack/test/decl/enum_constraint.php.typecheck.exp