[dx] Consistently use backticks for quoting input in error messages

ghstack-source-id: 34e5507c08fb883c987c88f415158fac781a5f8e
Pull Request resolved: https://github.com/facebook/react-forget/pull/2863
This commit is contained in:
Joe Savona
2024-04-18 09:21:24 -07:00
parent e3d0f4bce8
commit da6c4612a3
31 changed files with 100 additions and 85 deletions
@@ -494,7 +494,7 @@ function getReactFunctionType(
default: {
assertExhaustive(
pass.opts.compilationMode,
`Unexpected compilationMode '${pass.opts.compilationMode}'`
`Unexpected compilationMode \`${pass.opts.compilationMode}\``
);
}
}
@@ -37,7 +37,7 @@ export function assertConsistentIdentifiers(fn: HIRFunction): void {
for (const instr of block.instructions) {
CompilerError.invariant(instr.lvalue.identifier.name === null, {
reason: `Expected all lvalues to be temporaries`,
description: `Found named lvalue '${instr.lvalue.identifier.name}'`,
description: `Found named lvalue \`${instr.lvalue.identifier.name}\``,
loc: instr.lvalue.loc,
suggestions: null,
});
@@ -102,7 +102,7 @@ export function lower(
const identifier = builder.resolveIdentifier(param);
if (identifier === null) {
builder.errors.push({
reason: `(BuildHIR::lower) Could not find binding for param '${param.node.name}'`,
reason: `(BuildHIR::lower) Could not find binding for param \`${param.node.name}\``,
severity: ErrorSeverity.Invariant,
loc: param.node.loc ?? null,
suggestions: null,
@@ -186,7 +186,7 @@ export function lower(
builder.errors.push({
severity: ErrorSeverity.InvalidJS,
reason: `Unexpected function body kind`,
description: `Expected function body to be an expression or a block statement, got '${body.type}'`,
description: `Expected function body to be an expression or a block statement, got \`${body.type}\``,
loc: body.node.loc ?? null,
suggestions: null,
});
@@ -2005,7 +2005,7 @@ function lowerExpression(
propName = namePath.node.name;
if (propName.indexOf(":") !== -1) {
builder.errors.push({
reason: `(BuildHIR::lowerExpression) Unexpected colon in attribute name '${name}'`,
reason: `(BuildHIR::lowerExpression) Unexpected colon in attribute name \`${name}\``,
severity: ErrorSeverity.Todo,
loc: namePath.node.loc ?? null,
suggestions: null,
@@ -2658,7 +2658,7 @@ function lowerReorderableExpression(
): Place {
if (!isReorderableExpression(builder, expr, true)) {
builder.errors.push({
reason: `(BuildHIR::node.lowerReorderableExpression) Expression type '${expr.type}' cannot be safely reordered`,
reason: `(BuildHIR::node.lowerReorderableExpression) Expression type \`${expr.type}\` cannot be safely reordered`,
severity: ErrorSeverity.Todo,
loc: expr.node.loc ?? null,
suggestions: null,
@@ -2987,7 +2987,7 @@ function lowerJsxMemberExpression(
objectPlace = lowerJsxMemberExpression(builder, object);
} else {
CompilerError.invariant(object.isJSXIdentifier(), {
reason: `TypeScript refinement fail: expected 'JsxIdentifier', got '${object.node.type}'`,
reason: `TypeScript refinement fail: expected 'JsxIdentifier', got \`${object.node.type}\``,
description: null,
loc: object.node.loc ?? null,
suggestions: null,
@@ -518,7 +518,7 @@ export class Environment {
if (isHookName(resolvedName)) {
return this.#getCustomHookType();
} else {
log(() => `Undefined global '${name}'`);
log(() => `Undefined global \`${name}\``);
}
}
return resolvedGlobal;
@@ -1088,7 +1088,7 @@ export function makeIdentifierName(name: string): ValidatedIdentifier {
CompilerError.invariant(t.isValidIdentifier(name), {
reason: `Expected a valid identifier name`,
loc: GeneratedSource,
description: `'${name}' is not a valid JavaScript identifier`,
description: `\`${name}\` is not a valid JavaScript identifier`,
suggestions: null,
});
return {
@@ -1104,7 +1104,7 @@ export function promoteTemporary(identifier: Identifier): void {
CompilerError.invariant(identifier.name === null, {
reason: `Expected a temporary (unnamed) identifier`,
loc: GeneratedSource,
description: `Identifier already has a name, '${identifier.name}'`,
description: `Identifier already has a name, \`${identifier.name}\``,
suggestions: null,
});
identifier.name = {
@@ -1125,7 +1125,7 @@ export function promoteTemporaryJsxTag(identifier: Identifier): void {
CompilerError.invariant(identifier.name === null, {
reason: `Expected a temporary (unnamed) identifier`,
loc: GeneratedSource,
description: `Identifier already has a name, '${identifier.name}'`,
description: `Identifier already has a name, \`${identifier.name}\``,
suggestions: null,
});
identifier.name = {
@@ -1246,7 +1246,7 @@ export function isMutableEffect(
return false;
}
default: {
assertExhaustive(effect, `Unexpected effect '${effect}'`);
assertExhaustive(effect, `Unexpected effect \`${effect}\``);
}
}
}
@@ -805,7 +805,7 @@ function getReversePostorderedBlocks(func: HIR): HIR["blocks"] {
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any).kind}'`
`Unexpected terminal kind \`${(terminal as any).kind}\``
);
}
}
@@ -288,7 +288,7 @@ export function printTerminal(terminal: Terminal): Array<string> | string {
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${terminal as any as Terminal}'`
`Unexpected terminal kind \`${terminal as any as Terminal}\``
);
}
}
@@ -680,7 +680,7 @@ export function printLValue(lval: LValue): string {
return `HoistedConst ${lvalue}$`;
}
default: {
assertExhaustive(lval.kind, `Unexpected lvalue kind '${lval.kind}'`);
assertExhaustive(lval.kind, `Unexpected lvalue kind \`${lval.kind}\``);
}
}
}
@@ -733,7 +733,7 @@ export function printPattern(pattern: Pattern | Place | SpreadPattern): string {
default: {
assertExhaustive(
pattern,
`Unexpected pattern kind '${(pattern as any).kind}'`
`Unexpected pattern kind \`${(pattern as any).kind}\``
);
}
}
@@ -147,7 +147,7 @@ export function* eachInstructionValueOperand(
default: {
assertExhaustive(
attribute,
`Unexpected attribute kind '${(attribute as any).kind}'`
`Unexpected attribute kind \`${(attribute as any).kind}\``
);
}
}
@@ -242,7 +242,7 @@ export function* eachInstructionValueOperand(
default: {
assertExhaustive(
instrValue,
`Unexpected instruction kind '${(instrValue as any).kind}'`
`Unexpected instruction kind \`${(instrValue as any).kind}\``
);
}
}
@@ -281,7 +281,7 @@ export function doesPatternContainSpreadElement(pattern: Pattern): boolean {
default: {
assertExhaustive(
pattern,
`Unexpected pattern kind '${(pattern as any).kind}'`
`Unexpected pattern kind \`${(pattern as any).kind}\``
);
}
}
@@ -301,7 +301,7 @@ export function* eachPatternOperand(pattern: Pattern): Iterable<Place> {
} else {
assertExhaustive(
item,
`Unexpected item kind '${(item as any).kind}'`
`Unexpected item kind \`${(item as any).kind}\``
);
}
}
@@ -316,7 +316,7 @@ export function* eachPatternOperand(pattern: Pattern): Iterable<Place> {
} else {
assertExhaustive(
property,
`Unexpected item kind '${(property as any).kind}'`
`Unexpected item kind \`${(property as any).kind}\``
);
}
}
@@ -325,7 +325,7 @@ export function* eachPatternOperand(pattern: Pattern): Iterable<Place> {
default: {
assertExhaustive(
pattern,
`Unexpected pattern kind '${(pattern as any).kind}'`
`Unexpected pattern kind \`${(pattern as any).kind}\``
);
}
}
@@ -458,7 +458,7 @@ export function mapInstructionValueOperands(
default: {
assertExhaustive(
attribute,
`Unexpected attribute kind '${(attribute as any).kind}'`
`Unexpected attribute kind \`${(attribute as any).kind}\``
);
}
}
@@ -601,7 +601,7 @@ export function mapPatternOperands(
default: {
assertExhaustive(
pattern,
`Unexpected pattern kind '${(pattern as any).kind}'`
`Unexpected pattern kind \`${(pattern as any).kind}\``
);
}
}
@@ -851,7 +851,7 @@ export function mapTerminalSuccessors(
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any as Terminal).kind}'`
`Unexpected terminal kind \`${(terminal as any as Terminal).kind}\``
);
}
}
@@ -891,7 +891,7 @@ export function terminalFallthrough(terminal: Terminal): BlockId | null {
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any).kind}'`
`Unexpected terminal kind \`${(terminal as any).kind}\``
);
}
}
@@ -991,7 +991,7 @@ export function mapOptionalFallthroughs(
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any).kind}'`
`Unexpected terminal kind \`${(terminal as any).kind}\``
);
}
}
@@ -1082,7 +1082,7 @@ export function* eachTerminalSuccessor(terminal: Terminal): Iterable<BlockId> {
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any as Terminal).kind}'`
`Unexpected terminal kind \`${(terminal as any as Terminal).kind}\``
);
}
}
@@ -1144,7 +1144,7 @@ export function mapTerminalOperands(
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any).kind}'`
`Unexpected terminal kind \`${(terminal as any).kind}\``
);
}
}
@@ -1201,7 +1201,7 @@ export function* eachTerminalOperand(terminal: Terminal): Iterable<Place> {
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any).kind}'`
`Unexpected terminal kind \`${(terminal as any).kind}\``
);
}
}
@@ -257,7 +257,7 @@ export function inferReactivePlaces(fn: HIRFunction): void {
default: {
assertExhaustive(
operand.effect,
`Unexpected effect kind '${operand.effect}'`
`Unexpected effect kind \`${operand.effect}\``
);
}
}
@@ -237,7 +237,7 @@ export default function inferReferenceEffects(
default:
assertExhaustive(
eff.kind,
`Unexpected function effect kind '${eff.kind}'`
`Unexpected function effect kind \`${eff.kind}\``
);
}
});
@@ -313,7 +313,7 @@ class InferenceState {
}
CompilerError.invariant(mergedKind !== null, {
reason: `InferReferenceEffects::kind: Expected at least one value`,
description: `No value found at '${printPlace(place)}'`,
description: `No value found at \`${printPlace(place)}\``,
loc: place.loc,
suggestions: null,
});
@@ -493,7 +493,7 @@ class InferenceState {
*
* invariant(
* valueKind.kind === ValueKindKind.Mutable,
* `expected valueKind to be 'Mutable' but found to be '${valueKind}'`
* `expected valueKind to be 'Mutable' but found to be \`${valueKind}\``
* );
*/
effect = isObjectType(place.identifier) ? Effect.Store : Effect.Mutate;
@@ -527,7 +527,7 @@ class InferenceState {
default: {
assertExhaustive(
effectKind,
`Unexpected reference kind '${effectKind as any as string}'`
`Unexpected reference kind \`${effectKind as any as string}\``
);
}
}
@@ -931,7 +931,7 @@ function inferBlock(
default: {
assertExhaustive(
property,
`Unexpected property kind '${(property as any).kind}'`
`Unexpected property kind \`${(property as any).kind}\``
);
}
}
@@ -368,7 +368,10 @@ function pruneableValue(value: InstructionValue, state: State): boolean {
return true;
}
default: {
assertExhaustive(value, `Unexepcted value kind '${(value as any).kind}'`);
assertExhaustive(
value,
`Unexepcted value kind \`${(value as any).kind}\``
);
}
}
}
@@ -194,7 +194,7 @@ function visitBlock(context: Context, block: ReactiveBlock): void {
default: {
assertExhaustive(
stmt,
`Unexpected statement kind '${(stmt as any).kind}'`
`Unexpected statement kind \`${(stmt as any).kind}\``
);
}
}
@@ -726,7 +726,7 @@ class Driver {
default: {
assertExhaustive(
terminal.variant,
`Unexpected goto variant '${terminal.variant}'`
`Unexpected goto variant \`${terminal.variant}\``
);
}
}
@@ -991,7 +991,7 @@ class Driver {
const testBlock = this.cx.ir.blocks.get(test.block)!;
if (testBlock.terminal.kind !== "branch") {
CompilerError.throwTodo({
reason: `Unexpected terminal kind '${testBlock.terminal.kind}' for optional test block`,
reason: `Unexpected terminal kind \`${testBlock.terminal.kind}\` for optional test block`,
description: null,
loc: testBlock.terminal.loc,
suggestions: null,
@@ -1033,7 +1033,7 @@ class Driver {
const testBlock = this.cx.ir.blocks.get(test.block)!;
if (testBlock.terminal.kind !== "branch") {
CompilerError.throwTodo({
reason: `Unexpected terminal kind '${testBlock.terminal.kind}' for logical test block`,
reason: `Unexpected terminal kind \`${testBlock.terminal.kind}\` for logical test block`,
description: null,
loc: testBlock.terminal.loc,
suggestions: null,
@@ -1081,7 +1081,7 @@ class Driver {
const testBlock = this.cx.ir.blocks.get(test.block)!;
if (testBlock.terminal.kind !== "branch") {
CompilerError.throwTodo({
reason: `Unexpected terminal kind '${testBlock.terminal.kind}' for ternary test block`,
reason: `Unexpected terminal kind \`${testBlock.terminal.kind}\` for ternary test block`,
description: null,
loc: testBlock.terminal.loc,
suggestions: null,
@@ -1128,7 +1128,7 @@ class Driver {
}
default: {
CompilerError.throwTodo({
reason: `Support '${terminal.kind}' as a value block terminal (conditional, logical, optional chaining, etc)`,
reason: `Support \`${terminal.kind}\` as a value block terminal (conditional, logical, optional chaining, etc)`,
description: null,
loc: terminal.loc,
suggestions: null,
@@ -337,7 +337,10 @@ function codegenBlockNoReset(
break;
}
default: {
assertExhaustive(item, `Unexpected item kind '${(item as any).kind}'`);
assertExhaustive(
item,
`Unexpected item kind \`${(item as any).kind}\``
);
}
}
}
@@ -651,7 +654,7 @@ function codegenTerminal(
case "for-of": {
CompilerError.invariant(terminal.init.kind === "SequenceExpression", {
reason: `Expected a sequence expression init for ForOf`,
description: `Got '${terminal.init.kind}' expression instead`,
description: `Got \`${terminal.init.kind}\` expression instead`,
loc: terminal.init.loc,
suggestions: null,
});
@@ -806,7 +809,7 @@ function codegenTerminal(
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any).kind}'`
`Unexpected terminal kind \`${(terminal as any).kind}\``
);
}
}
@@ -937,7 +940,7 @@ function codegenInstructionNullable(
});
}
default: {
assertExhaustive(kind, `Unexpected instruction kind '${kind}'`);
assertExhaustive(kind, `Unexpected instruction kind \`${kind}\``);
}
}
} else if (
@@ -977,7 +980,7 @@ function codegenForInit(
loc: instr.loc,
description:
instr.value.lvalue.place.identifier.name != null
? `'${instr.value.lvalue.place.identifier.name.value}' is a context variable`
? `\`${instr.value.lvalue.place.identifier.name.value}\` is a context variable`
: null,
suggestions: null,
});
@@ -1346,7 +1349,7 @@ function codegenInstructionValue(
CompilerError.invariant(false, {
reason:
"Expected an optional value to resolve to a call expression or member expression",
description: `Got a '${optionalValue.type}'`,
description: `Got a \`${optionalValue.type}\``,
loc: instrValue.loc,
suggestions: null,
});
@@ -1364,7 +1367,7 @@ function codegenInstructionValue(
{
reason:
"[Codegen] Internal error: MethodCall::property must be an unpromoted + unmemoized MemberExpression. " +
`Got a '${memberExpr.type}'`,
`Got a \`${memberExpr.type}\``,
description: null,
loc: memberExpr.loc ?? null,
suggestions: null,
@@ -1493,7 +1496,7 @@ function codegenInstructionValue(
tag = convertMemberExpressionToJsx(tagValue);
} else {
CompilerError.invariant(tagValue.type === "StringLiteral", {
reason: `Expected JSX tag to be an identifier or string, got '${tagValue.type}'`,
reason: `Expected JSX tag to be an identifier or string, got \`${tagValue.type}\``,
description: null,
loc: tagValue.loc ?? null,
suggestions: null,
@@ -1829,7 +1832,7 @@ function codegenInstructionValue(
default: {
assertExhaustive(
instrValue,
`Unexpected instruction value kind '${(instrValue as any).kind}'`
`Unexpected instruction value kind \`${(instrValue as any).kind}\``
);
}
}
@@ -1881,7 +1884,7 @@ function codegenJsxAttribute(
default: {
assertExhaustive(
attribute,
`Unexpected attribute kind '${(attribute as any).kind}'`
`Unexpected attribute kind \`${(attribute as any).kind}\``
);
}
}
@@ -2057,7 +2060,7 @@ function codegenLValue(
default: {
assertExhaustive(
pattern,
`Unexpected pattern kind '${(pattern as any).kind}'`
`Unexpected pattern kind \`${(pattern as any).kind}\``
);
}
}
@@ -69,7 +69,7 @@ class Transform extends ReactiveFunctionTransform<boolean> {
default: {
assertExhaustive(
stmt.terminal,
`Unexpected terminal kind '${(stmt.terminal as any).kind}'`
`Unexpected terminal kind \`${(stmt.terminal as any).kind}\``
);
}
}
@@ -217,7 +217,10 @@ function mayAllocate(env: Environment, instruction: Instruction): boolean {
return true;
}
default: {
assertExhaustive(value, `Unexpected value kind '${(value as any).kind}'`);
assertExhaustive(
value,
`Unexpected value kind \`${(value as any).kind}\``
);
}
}
}
@@ -270,7 +270,7 @@ class Transform extends ReactiveFunctionTransform<ReactiveScopeDependencies | nu
default: {
assertExhaustive(
instr,
`Unexpected instruction kind '${(instr as any).kind}'`
`Unexpected instruction kind \`${(instr as any).kind}\``
);
}
}
@@ -143,7 +143,7 @@ function writeReactiveInstruction(
default: {
assertExhaustive(
instr,
`Unexpected terminal kind '${(instr as any).kind}'`
`Unexpected terminal kind \`${(instr as any).kind}\``
);
}
}
@@ -718,7 +718,7 @@ class PropagationVisitor extends ReactiveFunctionVisitor<Context> {
CompilerError.invariant(inner.kind === "SequenceExpression", {
reason:
"Expected OptionalExpression value to be a SequenceExpression",
description: `Found a '${value.kind}'`,
description: `Found a \`${value.kind}\``,
loc: value.loc,
suggestions: null,
});
@@ -1028,7 +1028,7 @@ class PropagationVisitor extends ReactiveFunctionVisitor<Context> {
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any).kind}'`
`Unexpected terminal kind \`${(terminal as any).kind}\``
);
}
}
@@ -276,7 +276,7 @@ function computeMemoizedIdentifiers(state: State): Set<IdentifierId> {
function visit(id: IdentifierId, forceMemoize: boolean = false): boolean {
const node = state.identifiers.get(id);
CompilerError.invariant(node !== undefined, {
reason: `Expected a node for all identifiers, none found for '${id}'`,
reason: `Expected a node for all identifiers, none found for \`${id}\``,
description: null,
loc: null,
suggestions: null,
@@ -720,7 +720,10 @@ function computeMemoizationInputs(
});
}
default: {
assertExhaustive(value, `Unexpected value kind '${(value as any).kind}'`);
assertExhaustive(
value,
`Unexpected value kind \`${(value as any).kind}\``
);
}
}
}
@@ -757,7 +760,7 @@ function computePatternLValues(pattern: Pattern): Array<LValueMemoization> {
default: {
assertExhaustive(
pattern,
`Unexpected pattern kind '${(pattern as any).kind}'`
`Unexpected pattern kind \`${(pattern as any).kind}\``
);
}
}
@@ -182,7 +182,7 @@ export class ReactiveFunctionVisitor<TState = void> {
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any).kind}'`
`Unexpected terminal kind \`${(terminal as any).kind}\``
);
}
}
@@ -216,7 +216,7 @@ export class ReactiveFunctionVisitor<TState = void> {
default: {
assertExhaustive(
instr,
`Unexpected instruction kind '${(instr as any).kind}'`
`Unexpected instruction kind \`${(instr as any).kind}\``
);
}
}
@@ -279,7 +279,7 @@ export class ReactiveFunctionTransform<
default: {
assertExhaustive(
instr,
`Unexpected instruction kind '${(instr as any).kind}'`
`Unexpected instruction kind \`${(instr as any).kind}\``
);
}
}
@@ -554,7 +554,7 @@ export class ReactiveFunctionTransform<
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any).kind}'`
`Unexpected terminal kind \`${(terminal as any).kind}\``
);
}
}
@@ -652,7 +652,7 @@ export function mapTerminalBlocks(
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind '${(terminal as any).kind}'`
`Unexpected terminal kind \`${(terminal as any).kind}\``
);
}
}
@@ -147,7 +147,7 @@ export function leaveSSA(fn: HIRFunction): void {
if (name !== null) {
CompilerError.invariant(!declarations.has(name.value), {
reason: `Unexpected duplicate declaration`,
description: `Found duplicate declaration for '${name.value}'`,
description: `Found duplicate declaration for \`${name.value}\``,
loc: value.lvalue.place.loc,
suggestions: null,
});
@@ -220,7 +220,7 @@ export function leaveSSA(fn: HIRFunction): void {
kind === null || kind === InstructionKind.Const,
{
reason: `Expected consistent kind for destructuring`,
description: `other places were '${kind}' but '${printPlace(
description: `other places were \`${kind}\` but '${printPlace(
place
)}' is const`,
loc: place.loc,
@@ -251,7 +251,7 @@ export function leaveSSA(fn: HIRFunction): void {
kind === null || kind === InstructionKind.Const,
{
reason: `Expected consistent kind for destructuring`,
description: `Other places were '${kind}' but '${printPlace(
description: `Other places were \`${kind}\` but '${printPlace(
place
)}' is const`,
loc: place.loc,
@@ -264,7 +264,7 @@ export function leaveSSA(fn: HIRFunction): void {
kind === null || kind === InstructionKind.Reassign,
{
reason: `Expected consistent kind for destructuring`,
description: `Other places were '${kind}' but '${printPlace(
description: `Other places were \`${kind}\` but '${printPlace(
place
)}' is reassigned`,
loc: place.loc,
@@ -286,7 +286,7 @@ export function validateHooksUsage(fn: HIRFunction): void {
break;
}
default: {
assertExhaustive(objectKind, `Unexpected kind '${objectKind}'`);
assertExhaustive(objectKind, `Unexpected kind \`${objectKind}\``);
}
}
setKind(instr.lvalue, kind);
@@ -360,7 +360,10 @@ export function validateHooksUsage(fn: HIRFunction): void {
break;
}
default: {
assertExhaustive(objectKind, `Unexpected kind '${objectKind}'`);
assertExhaustive(
objectKind,
`Unexpected kind \`${objectKind}\``
);
}
}
setKind(lvalue, kind);
@@ -29,7 +29,7 @@ export const FIXTURE_ENTRYPOINT = {
> 4 | return x;
| ^^^^^^^^^^^^^
> 5 | }
| ^^^^ Todo: (BuildHIR::node.lowerReorderableExpression) Expression type 'ArrowFunctionExpression' cannot be safely reordered (3:5)
| ^^^^ Todo: (BuildHIR::node.lowerReorderableExpression) Expression type `ArrowFunctionExpression` cannot be safely reordered (3:5)
6 | ) {
7 | return y();
8 | }
@@ -22,7 +22,7 @@ function Component() {
4 | // NOTE: `i` is a context variable because it's reassigned and also referenced
5 | // within a closure, the `onClick` handler of each item
> 6 | for (let i = MIN; i <= MAX; i += INCREMENT) {
| ^^^^^^^^^^^ Todo: Support for loops where the index variable is a context variable. 'i' is a context variable (6:6)
| ^^^^^^^^^^^ Todo: Support for loops where the index variable is a context variable. `i` is a context variable (6:6)
7 | items.push(<Stringify key={i} onClick={() => data.set(i)} />);
8 | }
9 | return items;
@@ -108,9 +108,9 @@ Todo: (BuildHIR::lowerExpression) Handle UpdateExpression with MemberExpression
Todo: (BuildHIR::lowerExpression) Handle UpdateExpression with MemberExpression argument (50:50)
Todo: (BuildHIR::node.lowerReorderableExpression) Expression type 'MemberExpression' cannot be safely reordered (57:57)
Todo: (BuildHIR::node.lowerReorderableExpression) Expression type `MemberExpression` cannot be safely reordered (57:57)
Todo: (BuildHIR::node.lowerReorderableExpression) Expression type 'BinaryExpression' cannot be safely reordered (53:53)
Todo: (BuildHIR::node.lowerReorderableExpression) Expression type `BinaryExpression` cannot be safely reordered (53:53)
4 |
5 | class Bar {
6 | #secretSauce = 42;
@@ -24,7 +24,7 @@ export const FIXTURE_ENTRYPOINT = {
3 | function Component(props) {
4 | const items = makeArray(0, 1, 2, null, 4, false, 6);
> 5 | const max = Math.max(...items.filter(Boolean));
| ^^^^^^^^ Invariant: [Codegen] Internal error: MethodCall::property must be an unpromoted + unmemoized MemberExpression. Got a 'Identifier' (5:5)
| ^^^^^^^^ Invariant: [Codegen] Internal error: MethodCall::property must be an unpromoted + unmemoized MemberExpression. Got a `Identifier` (5:5)
6 | return max;
7 | }
8 |
@@ -23,7 +23,7 @@ export const FIXTURE_ENTRYPONT = {
3 | function useFoo(props: { value: { x: string; y: string } | null }) {
4 | const value = props.value;
> 5 | return useNoAlias(value?.x, value?.y) ?? {};
| ^^^^^^^^ Todo: Unexpected terminal kind 'optional' for logical test block (5:5)
| ^^^^^^^^ Todo: Unexpected terminal kind `optional` for logical test block (5:5)
6 | }
7 |
8 | export const FIXTURE_ENTRYPONT = {
@@ -25,7 +25,7 @@ export const FIXTURE_ENTRYPONT = {
1 | function useFoo(props: { value: { x: string; y: string } | null }) {
2 | const value = props.value;
> 3 | return createArray(value?.x, value?.y)?.join(", ");
| ^^^^^^^^ Todo: Unexpected terminal kind 'optional' for optional test block (3:3)
| ^^^^^^^^ Todo: Unexpected terminal kind `optional` for optional test block (3:3)
4 | }
5 |
6 | function createArray<T>(...args: Array<T>): Array<T> {
@@ -23,7 +23,7 @@ export const FIXTURE_ENTRYPONT = {
3 | function useFoo(props: { value: { x: string; y: string } | null }) {
4 | const value = props.value;
> 5 | return useNoAlias(value?.x, value?.y) ? {} : null;
| ^^^^^^^^ Todo: Unexpected terminal kind 'optional' for ternary test block (5:5)
| ^^^^^^^^ Todo: Unexpected terminal kind `optional` for ternary test block (5:5)
6 | }
7 |
8 | export const FIXTURE_ENTRYPONT = {
+3 -3
View File
@@ -158,13 +158,13 @@ export async function transformFixture(
let unexpectedError: string | null = null;
if (expectError) {
if (error === null) {
unexpectedError = `Expected an error to be thrown for fixture: '${basename}', remove the 'error.' prefix if an error is not expected.`;
unexpectedError = `Expected an error to be thrown for fixture: \`${basename}\`, remove the 'error.' prefix if an error is not expected.`;
}
} else {
if (error !== null) {
unexpectedError = `Expected fixture '${basename}' to succeed but it failed with error:\n\n${error}`;
unexpectedError = `Expected fixture \`${basename}\` to succeed but it failed with error:\n\n${error}`;
} else if (compileResult == null) {
unexpectedError = `Expected output for fixture '${basename}'.`;
unexpectedError = `Expected output for fixture \`${basename}\`.`;
}
}