Port FlattenSmartConstructors functor to Rust
commitf4e570f8a4ab625bc3a43dfec20eb3188beafe6b
authorLeo Osvald <leoo@fb.com>
Fri, 19 Apr 2019 17:09:52 +0000 (19 10:09 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Fri, 19 Apr 2019 17:15:13 +0000 (19 10:15 -0700)
tree07ef7f8665f269d637524ff7968e591ff42d1593
parentacff58982b743a89ca3f8dd6bcbf6899b5d80b9f
Port FlattenSmartConstructors functor to Rust

Summary:
In OCaml, Flatten SmartConstructors (SC) is a SC specialization with:

    type r = Op.r

which is parameterized by `Op: Op_S`, where:

    module type Op_S = sig
      type r
      val is_zero: r -> bool
      val flatten: r list -> r
      val zero: r
    end

and provides a default implementation of `make_*` methods.  In Rust,
model this as a subtrait of SC with corresponding *default* methods that flatten:

    trait FlattenSmartConstructors<State>
    : SmartConstructors<State>
    + FlattenOp<S=<Self as SmartConstructors<State>>::R>

Reviewed By: dabek

Differential Revision: D14736865

fbshipit-source-id: 743d9c616aa088e1c731c98e1cf449d2728fd9b5
hphp/hack/src/generate_full_fidelity.ml
hphp/hack/src/parser/flatten_smart_constructors.rs [new file with mode: 0644]
hphp/hack/src/parser/lib.rs