DeclProvider::type_decl
commit4be6451cb01025f2f891ab40cc7bcff542bbf105
authorEdwin Smith <smith@fb.com>
Tue, 17 May 2022 14:41:39 +0000 (17 07:41 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 17 May 2022 14:41:39 +0000 (17 07:41 -0700)
tree7db151adf1adee8465a7649040b968352f8fcd30
parentd2047c424799703958a277e68da72a9efac0b691
DeclProvider::type_decl

Summary:
Thinking ahead to a world where symbols and decls are typesafe, the primary
interface to DeclProvider should not launder names as strings, and hackc should
be able to expect a decl type that matches the symbol type.

To get started, introduce a provided method to the DeclProvider trait for
getting type decls, and encapsulate some error checking related to unexpected
decl types. Later it can accept a TypeName.

A good litmus test (goal?) is for oxidized_by_ref::Decl (an enum of every kind of decl)
to be an implementation detail and not exposed in significant APIs, because
it bakes in the wrong idea that any symbol can map to any decl.

Reviewed By: shayne-fletcher

Differential Revision: D36395990

fbshipit-source-id: 643f0abc3e06428a859b357979682e8ca4384574
hphp/hack/src/hackc/decl_provider/decl_provider.rs
hphp/hack/src/hackc/decl_provider/external.rs
hphp/hack/src/hackc/emitter/emitter.rs
hphp/hack/src/hackc/emitter/reified_generics_helpers.rs