From 8683565031527cbdbbc89a9d3f5d899cc3ad83c9 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Thu, 20 Jan 2022 11:23:03 +0100 Subject: [PATCH] Don't crash when the file has a self cycle. When there's a self cycle, the compiler.log gives an (out-of-spec) error of the form: ``` FAILED: Tst has a self cycle ``` Notice the compiler is silent when the cycle involves more than one file (the terminal shows an error, but compiler.log is empty). --- CHANGELOG.md | 1 + server/src/utils.ts | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d27e90ad..be76904de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Fixes: - Fix issue in record field autocomplete not working with type aliases. - Fix issue where autocomplete for local values would not work in the presence of `@react.component` annotations. - Fix issue where the server would crash on large output produced by the binary command. +- Fix issue where the server would crash when a file has a self cycle. ## 1.1.3 diff --git a/server/src/utils.ts b/server/src/utils.ts index 10a6c2787..bc1f9b30c 100644 --- a/server/src/utils.ts +++ b/server/src/utils.ts @@ -389,6 +389,14 @@ export let parseCompilerLogOutput = ( tag: undefined, content: [], }); + } else if (line.startsWith("FAILED:")) { + // File with a self cycle + parsedDiagnostics.push({ + code: undefined, + severity: t.DiagnosticSeverity.Error, + tag: undefined, + content: [line], + }); } else if (line.startsWith(" Warning number ")) { let warningNumber = parseInt(line.slice(" Warning number ".length)); let tag: t.DiagnosticTag | undefined = undefined;