This repository has been archived by the owner on Dec 1, 2024. It is now read-only.
4.14.0: removal of `Missing`, much stricter typing
This release contains several major breaking changes:
- the
Facebook\HHAST\Linters\
andFacebook\HHAST\Migrations\
namespaces have been removed - the contents are now directly in theFacebook\HHAST\
namespace. This may require changes to blacklist/whitelist rules inhhast-lint.json
- the
Missing
node type has been removed; fileds that containSomeSpecifcNode
orMissing
are now typed as returning?SomeSpecificNode
instead of justNode
- fields are now consistently typed, including in constructors; for example, it is no longer possible to create an
ElseifClause
with a keyword that is anything other than anElseifToken
, andLeading
/Trailing
trivia on tokens is always aNodeList<Trivia>
- HHAST is now less willing to handle invalid Hack code
UnparsedReplacementCodeNode
has been removed.Node::insertAfter()
,::insertBefore()
, and::without()
have been removed, as they can not be implemented in such a root class with the changes to typing.
These breaking changes seem to have more impact on unit tests than on real code; for example, tests for methods have often included code like class Foo { function bar(): void {}
with a missing closing brace for the class, leading to expected nonnull
errors; missing semicolons are also common in test cases. These kind of errors do not often occur in real code, as they lead to immediate errors in both the typechecker and runtime.
Non-breaking improvements include:
NodeList::insertBefore()
,::insertAfter()
,::withoutChild()
and::withoutItemWithChild()
have been addedNodeList::isEmpty()
andNodeList::getCount()
have been added- empty namespace bodies are now correctly processed when resolving namespace uses
- error messages for invalid trees now include code snippets