Fully expand type variables in Tgenerics
Summary: Typing_expand.fully_expand is used whenever we need to fully expand out any
type variables. One instance where this occurs is making sure we do not store
polymorphic value into a static scoped variable. The reason this is unsound is
demonstrated in the test case I added static_var_no_generic.php
Essientially due to the way static scoped variables, new static(), and
self::method() work, it is possible to trick the type checker that a type
parameter is bound to the improper type. In order to safely use the pattern
in static_var_no_generic.php a type constant should be used instead. Then if we
only know that a type is a ##Singleton## the get method will return an abstract
type.
The reason this is currently not an error is because the "this" type is
represented as a generic so we never expand the type variables that are
substituted for its type parameters. That combined with the fact in
don't detect this error case.
Reviewed By: @int3
Differential Revision:
D2165262