You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
This adds the `--is-subtype` command which allows you to pass JSON via stdin specifying type pairs. A list of results will be returned where each result indicates whether the first type is a subtype of the second type.
The first type can be either a position string (similar to `--type-at-pos`) or a json-representation of a type (same format that `--type-at-pos-batch` returns). e.g.
```
{"kind":"pos", "pos":"file:line:col"}
```
or
```
{"kind":"type", "type":TYPE_JSON}
```
The second type must be a json-representation of a type and must be a type that has an environment-independent definition (e.g. no type variables, this, etc).
While unbound names are checked for, some lack of type-wellformed-ness is not, e.g. arity of class types with generics.
The reason why two positions are not supported is because two positions may have different environments making subtyping a difficult question to answer. If a user is interested in the relationship b/t types at two positions, and one is known to not be environment-dependent, the user can use `--type-at-pos-batch` to get the JSON type of the independent one and then use that with `--is-subtype` and the other position.
Reviewed By: vassilmladenov
Differential Revision: D38393256
fbshipit-source-id: 55410eeec15845ed438a310b56cd69280cf5e217
0 commit comments