fix shape field error mismatch + port int_of_string_opt
commitd3d09142700eacfdc07ccfd1d79596f19e8b14d9
authorSteve Cao <shiqicao@fb.com>
Wed, 23 Oct 2019 18:34:16 +0000 (23 11:34 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 23 Oct 2019 18:43:13 +0000 (23 11:43 -0700)
treec896bd956be0380e254647d923f4b8aac6a00817
parent5b2520fdca33dee2b47ec0536306a91595080e31
fix shape field error mismatch + port int_of_string_opt

Summary:
Ocaml checks shape's field, if it is a number lowerer reports error. Ocaml's `int_of_string_opt` allow "_" and it also allows different bases. To match its behavior. Rust's from_str_radix` dosn't allow it. This diff ports https://github.com/ocaml/ocaml/blob/6efe8fea5b6c3f1db22e50e8b164d6ffec85578d/runtime/ints.c

This is an example Hack semantics inherits from one Ocaml's function. In long run, we need to have a spec of shape field string literal.

Reviewed By: losvald

Differential Revision: D18052500

fbshipit-source-id: d1522da041ce6fbdc8ba442bb328b6f0e74a635a
hphp/hack/Cargo.lock
hphp/hack/src/parser/cargo/lowerer/Cargo.toml
hphp/hack/src/parser/lowerer.rs
hphp/hack/src/utils/ocaml_helper.rs [new file with mode: 0644]
hphp/hack/src/utils/ocaml_helper/Cargo.toml [new file with mode: 0644]