From 47babf6dda106973d80924623db55fb98c33aea0 Mon Sep 17 00:00:00 2001 From: Lucian Wischik Date: Thu, 19 Oct 2017 13:44:39 -0700 Subject: [PATCH] attempt to reduce flakiness in LSP test Summary: We have a function function a_didchange(): int {...} We send a didChange event to hh_server to replace its the first three letters with asterisks: function ***idchange(): int {...} Normally hh_server publishes this error: 1002 expected identifier [underscoring the first two asterisks] But sometimes it ends up publishing different errors: 2049 Unbound name: *Unknown* (an object type) [on the first asterisk] 4030 Was expecting a return type hint [on the first asterisk] 2049 Unbound name: *Unknown* (an object type) [on the first asterisk] What's up? Is hh_server non-deterministic in the errors it publishes in response to IDE changes? In this diff I've switched over to a different change, with the hope that maybe hh_server will be less non-deterministic with this new change... from this: return 42; to this: return 42a; I expect it will squiggle the `a` and say `Expected ;`. I'm hoping that this is a simpler parse failure with a unique determinstic error. Differential Revision: D6101340 fbshipit-source-id: 7d9e7dd561fa47635ecda40883927a6604e1429f --- .../test/integration/data/lsp_exchanges/didchange.expected | 10 +++++----- hphp/hack/test/integration/data/lsp_exchanges/didchange.json | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hphp/hack/test/integration/data/lsp_exchanges/didchange.expected b/hphp/hack/test/integration/data/lsp_exchanges/didchange.expected index 56bfde8721c..3389d7c932f 100644 --- a/hphp/hack/test/integration/data/lsp_exchanges/didchange.expected +++ b/hphp/hack/test/integration/data/lsp_exchanges/didchange.expected @@ -46,18 +46,18 @@ { "range": { "start": { - "line": 2, - "character": 9 + "line": 7, + "character": 11 }, "end": { - "line": 2, - "character": 11 + "line": 7, + "character": 12 } }, "severity": 1, "code": 1002, "source": "Hack", - "message": "Expected identifier", + "message": "Expected ;", "relatedLocations": [] } ] diff --git a/hphp/hack/test/integration/data/lsp_exchanges/didchange.json b/hphp/hack/test/integration/data/lsp_exchanges/didchange.json index 44bedb788cb..efcc8ef7737 100644 --- a/hphp/hack/test/integration/data/lsp_exchanges/didchange.json +++ b/hphp/hack/test/integration/data/lsp_exchanges/didchange.json @@ -39,10 +39,10 @@ }, "contentChanges": [{ "range": { - "start": {"line":2, "character":9}, - "end": {"line":2, "character":12} + "start": {"line":7, "character":11}, + "end": {"line":7, "character":11} }, - "text":"***" + "text":"a" }] } } -- 2.11.4.GIT