diff --git a/compiler/packages/babel-plugin-react-forget/src/Inference/InferReferenceEffects.ts b/compiler/packages/babel-plugin-react-forget/src/Inference/InferReferenceEffects.ts index 5f35ad201c..699c8c7d81 100644 --- a/compiler/packages/babel-plugin-react-forget/src/Inference/InferReferenceEffects.ts +++ b/compiler/packages/babel-plugin-react-forget/src/Inference/InferReferenceEffects.ts @@ -27,6 +27,7 @@ import { } from "../HIR/HIR"; import { FunctionSignature } from "../HIR/ObjectShape"; import { + printIdentifier, printMixedHIR, printPlace, printSourceLocation, @@ -231,10 +232,8 @@ class InferenceState { kind(place: Place): ValueKind { const values = this.#variables.get(place.identifier.id); CompilerError.invariant(values != null, { - reason: `Expected value kind to be initialized at '${printSourceLocation( - place.loc - )}'`, - description: null, + reason: `[hoisting] Expected value kind to be initialized`, + description: `${printPlace(place)}`, loc: place.loc, suggestions: null, }); @@ -256,8 +255,8 @@ class InferenceState { alias(place: Place, value: Place): void { const values = this.#variables.get(value.identifier.id); CompilerError.invariant(values != null, { - reason: `Expected value for identifier \`${value.identifier.id}\` to be initialized.`, - description: null, + reason: `[hoisting] Expected value for identifier to be initialized`, + description: `${printIdentifier(value.identifier)}`, loc: value.loc, suggestions: null, }); diff --git a/compiler/packages/babel-plugin-react-forget/src/SSA/EnterSSA.ts b/compiler/packages/babel-plugin-react-forget/src/SSA/EnterSSA.ts index ab7604a03c..5067088ed7 100644 --- a/compiler/packages/babel-plugin-react-forget/src/SSA/EnterSSA.ts +++ b/compiler/packages/babel-plugin-react-forget/src/SSA/EnterSSA.ts @@ -99,7 +99,7 @@ class SSABuilder { const oldId = oldPlace.identifier; if (this.#unknown.has(oldId)) { CompilerError.throwTodo({ - reason: `EnterSSA: Expected identifier to be defined before being used`, + reason: `[hoisting] EnterSSA: Expected identifier to be defined before being used`, description: `Identifier ${printIdentifier(oldId)} is undefined`, loc: oldPlace.loc, suggestions: null, diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-hoisting-nested-block-statements.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-hoisting-nested-block-statements.expect.md index 307fa788d5..bae5c2c7c2 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-hoisting-nested-block-statements.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-hoisting-nested-block-statements.expect.md @@ -24,7 +24,7 @@ export const FIXTURE_ENTRYPOINT = { ## Error ``` -[ReactForget] Invariant: Expected value kind to be initialized at '8:6:8:7' (8:8) +[ReactForget] Invariant: [hoisting] Expected value kind to be initialized. read x_0$10 (8:8) ``` \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-hoisting.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-hoisting.expect.md index 11e60e79d6..7955f8caf1 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-hoisting.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-hoisting.expect.md @@ -20,7 +20,7 @@ function Component(props) { ## Error ``` -[ReactForget] Invariant: Expected value kind to be initialized at '8:25:8:33' (8:8) +[ReactForget] Invariant: [hoisting] Expected value kind to be initialized. read pathname_0$12 (8:8) ``` \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-hoisting2.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-hoisting2.expect.md index 6a568c660e..aadd2d1f24 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-hoisting2.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-hoisting2.expect.md @@ -18,7 +18,7 @@ function Component() { ## Error ``` -[ReactForget] Todo: EnterSSA: Expected identifier to be defined before being used. Identifier handler$1 is undefined (3:7) +[ReactForget] Todo: [hoisting] EnterSSA: Expected identifier to be defined before being used. Identifier handler$1 is undefined (3:7) ``` \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hoisted-function-declaration.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hoisted-function-declaration.expect.md index 7333f0b22f..ac06951a65 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hoisted-function-declaration.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hoisted-function-declaration.expect.md @@ -17,7 +17,7 @@ function component(a) { ## Error ``` -[ReactForget] Todo: EnterSSA: Expected identifier to be defined before being used. Identifier x$5 is undefined +[ReactForget] Todo: [hoisting] EnterSSA: Expected identifier to be defined before being used. Identifier x$5 is undefined ``` \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hoisting-simple-function-declaration.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hoisting-simple-function-declaration.expect.md index 2418a31da0..535cfe3ec1 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hoisting-simple-function-declaration.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hoisting-simple-function-declaration.expect.md @@ -24,7 +24,7 @@ export const FIXTURE_ENTRYPOINT = { ## Error ``` -[ReactForget] Invariant: Expected value for identifier `5` to be initialized. (5:5) +[ReactForget] Invariant: [hoisting] Expected value for identifier to be initialized. baz$5 (5:5) ``` \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-captured-arg-separately.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-captured-arg-separately.expect.md index 48fa657de1..b850019b53 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-captured-arg-separately.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-captured-arg-separately.expect.md @@ -19,7 +19,7 @@ function component(a) { ## Error ``` -[ReactForget] Todo: EnterSSA: Expected identifier to be defined before being used. Identifier x$1 is undefined (7:7) +[ReactForget] Todo: [hoisting] EnterSSA: Expected identifier to be defined before being used. Identifier x$1 is undefined (7:7) ``` \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.repro-uninitialized-value-kind-with-function-expression-params.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.repro-uninitialized-value-kind-with-function-expression-params.expect.md index 1e5ccbd8b6..3695750acc 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.repro-uninitialized-value-kind-with-function-expression-params.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.repro-uninitialized-value-kind-with-function-expression-params.expect.md @@ -18,7 +18,7 @@ function Component(props) { ## Error ``` -[ReactForget] Invariant: Expected value kind to be initialized at '8:9:8:10' (8:8) +[ReactForget] Invariant: [hoisting] Expected value kind to be initialized. read x_0$21 (8:8) ``` \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-recursive-references-inner-functions.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-recursive-references-inner-functions.expect.md index 6e898fc6ff..f60788ce55 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-recursive-references-inner-functions.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-recursive-references-inner-functions.expect.md @@ -25,7 +25,7 @@ export const FIXTURE_ENTRYPONT = { ## Error ``` -[ReactForget] Todo: EnterSSA: Expected identifier to be defined before being used. Identifier factorial$3 is undefined (2:8) +[ReactForget] Todo: [hoisting] EnterSSA: Expected identifier to be defined before being used. Identifier factorial$3 is undefined (2:8) ``` \ No newline at end of file