Summary:
Generic type aliases are registered in a similar way to generic classes.
Their specializations are Type instead of ESTree::Node, and they need to
be resolved through other aliases (unlike classes, which are nominally
typed).
Two important parts of this diff:
completeForwardDeclarations
Instantiating a forward generic may introduce new forward generics,
which means we have to continue rerunning the type completion
until they've all been resolved.
Other than that, the completion pass operates as it did previously,
with extra logic in completeForwardGeneric to resolve generic type
aliases.
DeclareScopeTypes::resolveGenericTypeAlias
DeclareScopeTypes has all the relevant logic for actually handling
all the interdependency between type aliases, so add a second function
to it to make it possible to instantiate a generic type alias from the
typechecking visitor.
This does the same steps as DeclareScopeTypes, just uses a single
generic type instantiation instead of a list of decls as the starting
point.
Summary: Generic type aliases are registered in a similar way to generic classes.
Their specializations are Type instead of ESTree::Node, and they need to be resolved through other aliases (unlike classes, which are nominally typed).
Two important parts of this diff:
completeForwardDeclarations
Instantiating a forward generic may introduce new forward generics, which means we have to continue rerunning the type completion until they've all been resolved.
Other than that, the completion pass operates as it did previously, with extra logic in
completeForwardGeneric
to resolve generic type aliases.DeclareScopeTypes::resolveGenericTypeAlias
DeclareScopeTypes
has all the relevant logic for actually handling all the interdependency between type aliases, so add a second function to it to make it possible to instantiate a generic type alias from the typechecking visitor.This does the same steps as DeclareScopeTypes, just uses a single generic type instantiation instead of a list of decls as the starting point.
Reviewed By: tmikov
Differential Revision: D53449068