From f0c0961a1d26e6c010af4d003c6d7008157e73a2 Mon Sep 17 00:00:00 2001 From: Lucian Wischik Date: Mon, 13 Sep 2021 23:39:51 -0700 Subject: [PATCH] I think env should be preserved out of do_naming Summary: Error streaming was introduced in D29454477 (https://github.com/facebook/hhvm/commit/6805e3fbe5e5ced2cd3ecbf1ab49418839d81f7f). A comment on that diff says: > This is to mirror the signature of do_naming, do_typing, do_decling and so on. These never access env.errorl. env.errorl is read at the beginning of the outer function, is threaded through do_parsing, do_naming, do_typing, etc., then is put back into env.errorl. But looking at the code, I think that env is in fact NOT being threading out of do_naming. The result would be that env isn't aware we've already pushed out some "duplicate name" errors. Reviewed By: CatherineGasnier Differential Revision: D30882983 fbshipit-source-id: fc1acf88dc21ab48730100db25fba6da0e13089e --- hphp/hack/src/server/serverTypeCheck.ml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hphp/hack/src/server/serverTypeCheck.ml b/hphp/hack/src/server/serverTypeCheck.ml index cc80f179496..7b2913538bd 100644 --- a/hphp/hack/src/server/serverTypeCheck.ml +++ b/hphp/hack/src/server/serverTypeCheck.ml @@ -804,6 +804,7 @@ functor } ) type naming_result = { + env: env; errors_after_naming: Errors.t; failed_naming: Relative_path.Set.t; fast: Naming_table.fast; @@ -839,7 +840,13 @@ functor in let fast = extend_fast genv fast naming_table failed_decl in let fast = add_old_decls env.naming_table fast in - { errors_after_naming = errors; failed_naming; fast; time_errors_pushed } + { + env; + errors_after_naming = errors; + failed_naming; + fast; + time_errors_pushed; + } type redecl_phase1_result = { changed: Typing_deps.DepSet.t; @@ -1368,6 +1375,7 @@ functor module is something of a historical artifact and is slated for removal, but for now, it is run immediately before typechecking. *) let { + env; errors_after_naming = errors; failed_naming; fast; -- 2.11.4.GIT