Add type annotation quickfix for global constant variable (#8944)
commit7d920c05c6ee561feac8a4a7edf06332403f2c2d
authorLong Phan <pvlong2000@gmail.com>
Wed, 8 Dec 2021 18:41:23 +0000 (8 10:41 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 8 Dec 2021 18:42:59 +0000 (8 10:42 -0800)
treeff3990dedb1750ad5eae9aa003d2f0e51d1f0d6a
parent6c810fce0547903307dfbfdf77b7e590b3c9a275
Add type annotation quickfix for global constant variable (#8944)

Summary:
This PR does:
- Provide a quickfix when a global constant is declared without a type annotation, the quickfix currently supports `int`, `float` and `string` literals
- Add test files for respective type annotation
- https://github.com/facebook/hhvm/issues/8919

Pull Request resolved: https://github.com/facebook/hhvm/pull/8944

Reviewed By: shayne-fletcher

Differential Revision: D32924257

Pulled By: Wilfred

fbshipit-source-id: 42869a977745b862b181f07f1350e7004d1bf9fd
hphp/hack/src/errors/errors.ml
hphp/hack/src/errors/errors.mli
hphp/hack/src/typing/nast_check/global_const_check.ml
hphp/hack/test/quickfixes/type_annotation_float.php [new file with mode: 0644]
hphp/hack/test/quickfixes/type_annotation_float.php.exp [new file with mode: 0644]
hphp/hack/test/quickfixes/type_annotation_int.php [new file with mode: 0644]
hphp/hack/test/quickfixes/type_annotation_int.php.exp [new file with mode: 0644]
hphp/hack/test/quickfixes/type_annotation_mixed.php [new file with mode: 0644]
hphp/hack/test/quickfixes/type_annotation_mixed.php.exp [new file with mode: 0644]
hphp/hack/test/quickfixes/type_annotation_string.php [new file with mode: 0644]
hphp/hack/test/quickfixes/type_annotation_string.php.exp [new file with mode: 0644]