Represent inferred type as an unused type parameter
Summary:
The runtime value representing an expression tree has no type information associated with it. The type information is an erased type parameter that is not used in the expression (some languages call this a "phantom type").
For example, an `ExampleLocalVar` might occur in an `ExprTree<Example, ExampleAst, ExampleInt>` or an `ExprTree<Example, ExampleAst, ExampleString>`. The `ExampleLocalVar` will just have the name of the variable at runtime (e.g. `'$x'`).
If a user constructs an `ExprTree` directly, we can require them to annotate the type of their expression.
```
class Example {
public static function makeTree<<<__Explicit>> TInfer>>(...) { ... }
}
// Construct an AST that represents an integer in the Example DSL.
$et = Example::makeTree<ExampleInt>(...);
```
When we desugar to `makeTree` internally, generate a type parameter and add it to the `makeTree` call.
```
// User writes
$et = Example`1`;
// et_virtualized_expr after desugaring:
Example::intType();
// et_runtime_expr after desugaring (ignoring metadata arguments):
Example::makeTree((Example $v) ==> $v->visitInt(1));
// et_runtime_expr when typechecking (ignoring metadata arguments):
Example::makeTree<_>((Example $v) ==> $v->visitInt(1))
where _ as type_of_et_virtualized_expr
```
Reviewed By: vassilmladenov
Differential Revision:
D27610682
fbshipit-source-id:
3391c69908313374949e142e8b2446ba9ff0860c