Consistency pass for error messages in BuildHIR
Lauren Tan committed
Jan 24, 2023 at 12:44 UTC
3da8d52a0fc775cf4dad4c577ca024264a2a6798
3 files changed
+81
-86
compiler/forget/src/HIR/BuildHIR.ts
+41
-55
@@ -72,7 +72,7 @@ export function lower(
72
params.push(place);
73
} else {
74
builder.pushError({
75
- reason: `Support non-identifier params: ${param.node.type}`,
75
+ reason: `(BuildHIR::lower) Handle ${param.node.type} params`,
76
severity: ErrorSeverity.Todo,
77
nodePath: param,
78
});
@@ -93,7 +93,7 @@ export function lower(
93
lowerStatement(builder, body);
94
} else {
95
builder.pushError({
96
- reason: `Unexpected function body kind: ${body.type}}`,
96
+ reason: `(BuildHIR::lower) Unexpected function body kind: ${body.type}}`,
97
severity: ErrorSeverity.InvalidInput,
98
nodePath: body,
99
});
@@ -337,7 +337,8 @@ function lowerStatement(
337
const init = stmt.get("init");
338
if (!init.isVariableDeclaration()) {
339
builder.pushError({
340
- reason: "Support non-variable initialization in for",
340
+ reason:
341
+ "(BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement",
342
severity: ErrorSeverity.Todo,
343
nodePath: stmt,
344
});
@@ -356,7 +357,7 @@ function lowerStatement(
357
const update = stmt.get("update");
358
if (update.node == null) {
359
builder.pushError({
359
- reason: "Handle empty for updater",
360
+ reason: `(BuildHIR::lowerStatement) Handle empty update in ForStatement`,
361
severity: ErrorSeverity.Todo,
362
nodePath: stmt,
363
});
@@ -400,7 +401,7 @@ function lowerStatement(
401
const test = stmt.get("test");
402
if (test.node == null) {
403
builder.pushError({
403
- reason: "ForStatement without test",
404
+ reason: `(BuildHIR::lowerStatement) Handle empty test in ForStatement`,
405
severity: ErrorSeverity.Todo,
406
nodePath: stmt,
407
});
@@ -490,7 +491,7 @@ function lowerStatement(
491
const loc = stmt.node.loc;
492
if (loc == null) {
493
builder.pushError({
493
- reason: "while statement must have a location",
494
+ reason: `(BuildHIR::lowerStatement) Expected WhileStatement to have a location, got ${loc}`,
495
severity: ErrorSeverity.InvalidInput,
496
nodePath: stmt,
497
});
@@ -584,7 +585,7 @@ function lowerStatement(
585
if (hasDefault) {
586
builder.pushError({
587
reason:
587
- "Expected at most one `default` branch, this code should have failed to parse",
588
+ "(BuildHIR::lowerStatement) Expected at most one `default` branch in SwitchStatement, this code should have failed to parse",
589
severity: ErrorSeverity.InvalidInput,
590
nodePath: case_,
591
});
@@ -670,11 +671,10 @@ function lowerStatement(
671
const nodeKind: string = stmt.node.kind;
672
if (nodeKind === "var") {
673
builder.pushError({
673
- reason: "`var` declarations are not supported, use let or const",
674
+ reason: `(BuildHIR::lowerStatement) Handle ${nodeKind} kinds in VariableDeclaration`,
675
severity: ErrorSeverity.Todo,
676
nodePath: stmt,
677
});
677
- // TODO: should we lower this to an error variant
678
return;
679
}
680
const kind =
@@ -754,7 +754,7 @@ function lowerStatement(
754
case "TSTypeAliasDeclaration":
755
case "WithStatement": {
756
builder.pushError({
757
- reason: `Unhandled statement type: ${stmtPath.type}`,
757
+ reason: `(BuildHIR::lowerStatement) Handle ${stmtPath.type} statements`,
758
severity: ErrorSeverity.Todo,
759
nodePath: stmtPath,
760
});
@@ -826,7 +826,7 @@ function lowerExpression(
826
for (const propertyPath of propertyPaths) {
827
if (!propertyPath.isObjectProperty()) {
828
builder.pushError({
829
- reason: "Handle object property spread",
829
+ reason: `(BuildHIR::lowerExpression) Handle ${propertyPath.type} properties in ObjectExpression`,
830
severity: ErrorSeverity.Todo,
831
nodePath: propertyPath,
832
});
@@ -836,7 +836,7 @@ function lowerExpression(
836
const key = propertyPath.node.key;
837
if (key.type !== "Identifier") {
838
builder.pushError({
839
- reason: "Unexpected private name",
839
+ reason: `(BuildHIR::lowerExpression) Expected Identifier, got ${key.type} key in ObjectExpression`,
840
severity: ErrorSeverity.InvalidInput,
841
nodePath: propertyPath,
842
});
@@ -846,7 +846,7 @@ function lowerExpression(
846
const valuePath = propertyPath.get("value");
847
if (!valuePath.isExpression()) {
848
builder.pushError({
849
- reason: "Handle non-expression object values",
849
+ reason: `(BuildHIR::lowerExpression) Handle ${valuePath.type} values in ObjectExpression`,
850
severity: ErrorSeverity.Todo,
851
nodePath: valuePath,
852
});
@@ -871,7 +871,7 @@ function lowerExpression(
871
for (const element of expr.get("elements")) {
872
if (element.node == null || !element.isExpression()) {
873
builder.pushError({
874
- reason: "Handle non-expression array elements",
874
+ reason: `(BuildHIR::lowerExpression) Handle ${element.type} elements in ArrayExpression`,
875
severity: ErrorSeverity.Todo,
876
nodePath: element,
877
});
@@ -895,8 +895,7 @@ function lowerExpression(
895
const calleePath = expr.get("callee");
896
if (!calleePath.isExpression()) {
897
builder.pushError({
898
- reason:
899
- "Call expressions only support callees that are expressions (v8 intrinsics not supported)",
898
+ reason: `(BuildHIR::lowerExpression) Expected Expression, got ${calleePath.type} in NewExpression (v8 intrinsics not supported): ${calleePath.type}`,
899
severity: ErrorSeverity.InvalidInput,
900
nodePath: calleePath,
901
});
@@ -908,7 +907,7 @@ function lowerExpression(
907
for (const argPath of expr.get("arguments")) {
908
if (!argPath.isExpression()) {
909
builder.pushError({
911
- reason: "Support non-expression arguments to NewExpression",
910
+ reason: `(BuildHIR::lowerExpression) Handle ${argPath.type} arguments in NewExpression`,
911
severity: ErrorSeverity.Todo,
912
nodePath: argPath,
913
});
@@ -933,8 +932,7 @@ function lowerExpression(
932
let hasError = false;
933
if (!calleePath.isExpression()) {
934
builder.pushError({
936
- reason:
937
- "Call expressions only support callees that are expressions (v8 intrinsics not supported)",
935
+ reason: `(BuildHIR::lowerExpression) Expected Expression, got ${calleePath.type} in CallExpression (v8 intrinsics not supported)`,
936
severity: ErrorSeverity.InvalidInput,
937
nodePath: calleePath,
938
});
@@ -949,7 +947,7 @@ function lowerExpression(
947
for (const argPath of expr.get("arguments")) {
948
if (!argPath.isExpression()) {
949
builder.pushError({
952
- reason: "Support non-expression arguments to CallExpression",
950
+ reason: `(BuildHIR::lowerExpression) Handle ${argPath.type} arguments in CallExpression`,
951
severity: ErrorSeverity.Todo,
952
nodePath: argPath,
953
});
@@ -981,7 +979,7 @@ function lowerExpression(
979
for (const argPath of expr.get("arguments")) {
980
if (!argPath.isExpression()) {
981
builder.pushError({
984
- reason: "Support non-expression arguments to CallExpression",
982
+ reason: `(BuildHIR::lowerExpression) Handle ${argPath.type} arguments in CallExpression`,
983
severity: ErrorSeverity.Todo,
984
nodePath: argPath,
985
});
@@ -1005,8 +1003,7 @@ function lowerExpression(
1003
const leftPath = expr.get("left");
1004
if (!leftPath.isExpression()) {
1005
builder.pushError({
1008
- reason:
1009
- "Private names may not appear as the left hand side of a binary expression",
1006
+ reason: `(BuildHIR::lowerExpression) Expected Expression, got ${leftPath.type} lval in BinaryExpression`,
1007
severity: ErrorSeverity.InvalidInput,
1008
nodePath: leftPath,
1009
});
@@ -1026,15 +1023,6 @@ function lowerExpression(
1023
case "LogicalExpression": {
1024
const expr = exprPath as NodePath<t.LogicalExpression>;
1025
const leftPath = expr.get("left");
1029
- if (!leftPath.isExpression()) {
1030
- builder.pushError({
1031
- reason:
1032
- "Private names may not appear as the left hand side of a logical expression",
1033
- severity: ErrorSeverity.InvalidInput,
1034
- nodePath: leftPath,
1035
- });
1036
- return { kind: "UnsupportedNode", node: exprNode, loc: exprLoc };
1037
- }
1026
const operator = expr.node.operator;
1027
switch (operator) {
1028
case "||": {
@@ -1139,8 +1127,8 @@ function lowerExpression(
1127
const binaryOperator = operators[operator];
1128
if (binaryOperator == null) {
1129
builder.pushError({
1142
- reason: `Unhandled assignment operator '${operator}'`,
1143
- severity: ErrorSeverity.InvalidInput,
1130
+ reason: `(BuildHIR::lowerExpression) Handle ${operator} operaators in AssignmentExpression`,
1131
+ severity: ErrorSeverity.Todo,
1132
nodePath: expr.get("operator"),
1133
});
1134
return { kind: "UnsupportedNode", node: exprNode, loc: exprLoc };
@@ -1178,8 +1166,7 @@ function lowerExpression(
1166
const property = leftExpr.get("property");
1167
if (!property.isIdentifier()) {
1168
builder.pushError({
1181
- reason:
1182
- "Assignment expression to dynamic properties is not yet supported",
1169
+ reason: `(BuildHIR::lowerExpression) Handle ${property.type} properties in MemberExpression`,
1170
severity: ErrorSeverity.Todo,
1171
nodePath: property,
1172
});
@@ -1237,8 +1224,7 @@ function lowerExpression(
1224
}
1225
default: {
1226
builder.pushError({
1240
- reason:
1241
- "Assignment update expressions require the lvalue to be an identifier or member expression",
1227
+ reason: `(BuildHIR::lowerExpression) Expected Identifier or MemberExpression, got ${expr.type} lval in AssignmentExpression`,
1228
severity: ErrorSeverity.InvalidInput,
1229
nodePath: expr,
1230
});
@@ -1270,7 +1256,7 @@ function lowerExpression(
1256
for (const attribute of opening.get("attributes")) {
1257
if (!attribute.isJSXAttribute()) {
1258
builder.pushError({
1273
- reason: "Handle spread attributes",
1259
+ reason: `(BuildHIR::lowerExpression) Handle ${attribute.type} attributes in JSXElement`,
1260
severity: ErrorSeverity.Todo,
1261
nodePath: attribute,
1262
});
@@ -1280,7 +1266,7 @@ function lowerExpression(
1266
const name = attribute.get("name");
1267
if (!name.isJSXIdentifier()) {
1268
builder.pushError({
1283
- reason: "Handle non-identifier jsx attribute names",
1269
+ reason: `(BuildHIR::lowerExpression) Handle ${name.type} attribute names in JSXElement`,
1270
severity: ErrorSeverity.Todo,
1271
nodePath: name,
1272
});
@@ -1294,7 +1280,7 @@ function lowerExpression(
1280
} else {
1281
if (!valueExpr.isJSXExpressionContainer()) {
1282
builder.pushError({
1297
- reason: "Handle other non expr containers",
1283
+ reason: `(BuildHIR::lowerExpression) Handle ${valueExpr.type} attribute values in JSXElement`,
1284
severity: ErrorSeverity.Todo,
1285
nodePath: valueExpr,
1286
});
@@ -1304,7 +1290,7 @@ function lowerExpression(
1290
const expression = valueExpr.get("expression");
1291
if (!expression.isExpression()) {
1292
builder.pushError({
1307
- reason: "Handle empty expressions",
1293
+ reason: `(BuildHIR::lowerExpression) Handle ${expression.type} expressions in JSXExpressionContainer within JSXElement`,
1294
severity: ErrorSeverity.Todo,
1295
nodePath: valueExpr,
1296
});
@@ -1369,7 +1355,7 @@ function lowerExpression(
1355
for (const p of expr.get("params")) {
1356
if (!p.isIdentifier()) {
1357
builder.pushError({
1372
- reason: `Support non identifier params: ${p.type}`,
1358
+ reason: `(BuildHIR::lowerExpression) Handle ${p.type} params in FunctionExpression`,
1359
severity: ErrorSeverity.Todo,
1360
nodePath: p,
1361
});
@@ -1393,7 +1379,7 @@ function lowerExpression(
1379
}
1380
default: {
1381
builder.pushError({
1396
- reason: `Unhandled expression type: ${exprPath.type}`,
1382
+ reason: `(BuildHIR::lowerExpression) Handle ${exprPath.type} expressions`,
1383
severity: ErrorSeverity.Todo,
1384
nodePath: exprPath,
1385
});
@@ -1413,7 +1399,7 @@ function lowerMemberExpression(
1399
if (!expr.node.computed) {
1400
if (!property.isIdentifier()) {
1401
builder.pushError({
1416
- reason: "Support private names",
1402
+ reason: `(BuildHIR::lowerExpression) Handle ${property.type} property`,
1403
severity: ErrorSeverity.Todo,
1404
nodePath: property,
1405
});
@@ -1433,7 +1419,7 @@ function lowerMemberExpression(
1419
} else {
1420
if (!property.isExpression()) {
1421
builder.pushError({
1436
- reason: "Expected private names to be non-computed",
1422
+ reason: `(BuildHIR::lowerMemberExpression) Expected Expression, got ${property.type} property`,
1423
severity: ErrorSeverity.InvalidInput,
1424
nodePath: property,
1425
});
@@ -1522,7 +1508,7 @@ function lowerJsxElementName(
1508
const exprLoc = exprNode.loc ?? GeneratedSource;
1509
if (!exprPath.isJSXIdentifier()) {
1510
builder.pushError({
1525
- reason: "Handle non-identifier tags",
1511
+ reason: `(BuildHIR::lowerJsxElementName) Handle ${exprPath.type} tags`,
1512
severity: ErrorSeverity.Todo,
1513
nodePath: exprPath,
1514
});
@@ -1583,7 +1569,7 @@ function lowerJsxElement(
1569
const expression = exprPath.get("expression");
1570
if (!expression.isExpression()) {
1571
builder.pushError({
1586
- reason: "Handle empty expressions",
1572
+ reason: `(BuildHIR::lowerJsxElement) Handle ${expression.type} expressions`,
1573
severity: ErrorSeverity.Todo,
1574
nodePath: expression,
1575
});
@@ -1617,7 +1603,7 @@ function lowerJsxElement(
1603
} else {
1604
if (!(t.isJSXFragment(exprNode) || t.isJSXSpreadChild(exprNode))) {
1605
builder.pushError({
1620
- reason: "Expected refinement to work",
1606
+ reason: `(BuildHIR::lowerJsxElement) Expected refinement to work, got: ${exprPath.type}`,
1607
severity: ErrorSeverity.InvalidInput,
1608
nodePath: exprPath,
1609
});
@@ -1744,7 +1730,7 @@ function lowerAssignment(
1730
if (!lvalue.node.computed) {
1731
if (!property.isIdentifier()) {
1732
builder.pushError({
1747
- reason: "Support private names",
1733
+ reason: `(BuildHIR::lowerAssignment) Handle ${property.type} properties in MemberExpression`,
1734
severity: ErrorSeverity.Todo,
1735
nodePath: property,
1736
});
@@ -1795,7 +1781,7 @@ function lowerAssignment(
1781
}
1782
if (element.node.type === "RestElement") {
1783
builder.pushError({
1798
- reason: "Rest elements are not supported yet",
1784
+ reason: `(BuildHIR::lowerAssignment) Handle ${element.type} in ArrayPattern`,
1785
severity: ErrorSeverity.Todo,
1786
nodePath: element,
1787
});
@@ -1843,7 +1829,7 @@ function lowerAssignment(
1829
const property = properties[i];
1830
if (!property.isObjectProperty()) {
1831
builder.pushError({
1846
- reason: "Rest elements are not supported yet",
1832
+ reason: `(BuildHIR::lowerAssignment) Handle ${property.type} properties in ObjectPattern`,
1833
severity: ErrorSeverity.Todo,
1834
nodePath: property,
1835
});
@@ -1853,7 +1839,7 @@ function lowerAssignment(
1839
const key = property.get("key");
1840
if (!key.isIdentifier()) {
1841
builder.pushError({
1856
- reason: "Support non-identifier object property keys",
1842
+ reason: `(BuildHIR::lowerAssignment) Handle ${key.type} keys in ObjectPattern`,
1843
severity: ErrorSeverity.Todo,
1844
nodePath: key,
1845
});
@@ -1863,7 +1849,7 @@ function lowerAssignment(
1849
const element = property.get("value");
1850
if (!element.isLVal()) {
1851
builder.pushError({
1866
- reason: "Expected object property value to be an lvalue",
1852
+ reason: `(BuildHIR::lowerAssignment) Expected object property value to be an LVal, got: ${element.type}`,
1853
severity: ErrorSeverity.InvalidInput,
1854
nodePath: element,
1855
});
@@ -1884,7 +1870,7 @@ function lowerAssignment(
1870
}
1871
default: {
1872
builder.pushError({
1887
- reason: "Support other lvalue types beyond identifier",
1873
+ reason: `(BuildHIR::lowerAssignment) Handle ${lvaluePath.type} assignments`,
1874
severity: ErrorSeverity.Todo,
1875
nodePath: lvaluePath,
1876
});
compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.expect.md
+39
-30
@@ -13,7 +13,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
13
}
14
}
15
16
- const g = { ...a };
16
+ const g = { ...a, b() {}, c: () => {} };
17
const h = [...b];
18
new c(...args);
19
c(...args);
@@ -42,35 +42,35 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
42
## Error
43
44
```
45
-[ReactForget] TodoError: Support non-identifier params: ArrayPattern
45
+[ReactForget] TodoError: (BuildHIR::lower) Handle ArrayPattern params
46
> 1 | function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
47
| ^^^^^^
48
2 | let i = 0;
49
3 | var x = [];
50
4 |
51
52
-[ReactForget] TodoError: Support non-identifier params: ObjectPattern
52
+[ReactForget] TodoError: (BuildHIR::lower) Handle ObjectPattern params
53
> 1 | function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
54
| ^^^^^^^^^^^^^^^^^
55
2 | let i = 0;
56
3 | var x = [];
57
4 |
58
59
-[ReactForget] TodoError: Support non-identifier params: AssignmentPattern
59
+[ReactForget] TodoError: (BuildHIR::lower) Handle AssignmentPattern params
60
> 1 | function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
61
| ^^^^^^^
62
2 | let i = 0;
63
3 | var x = [];
64
4 |
65
66
-[ReactForget] TodoError: Support non-identifier params: RestElement
66
+[ReactForget] TodoError: (BuildHIR::lower) Handle RestElement params
67
> 1 | function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
68
| ^^^^^^^
69
2 | let i = 0;
70
3 | var x = [];
71
4 |
72
73
-[ReactForget] TodoError: `var` declarations are not supported, use let or const
73
+[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration
74
1 | function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
75
2 | let i = 0;
76
> 3 | var x = [];
@@ -79,7 +79,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
79
5 | class Bar {
80
6 | #secretSauce = 42;
81
82
-[ReactForget] TodoError: Unhandled statement type: ClassDeclaration
82
+[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle ClassDeclaration statements
83
3 | var x = [];
84
4 |
85
> 5 | class Bar {
@@ -88,26 +88,35 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
88
7 | constructor() {
89
8 | console.log(this.#secretSauce);
90
91
-[ReactForget] TodoError: Handle object property spread
91
+[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle SpreadElement properties in ObjectExpression
92
10 | }
93
11 |
94
-> 12 | const g = { ...a };
94
+> 12 | const g = { ...a, b() {}, c: () => {} };
95
| ^^^^
96
13 | const h = [...b];
97
14 | new c(...args);
98
15 | c(...args);
99
100
-[ReactForget] TodoError: Handle non-expression array elements
100
+[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle ObjectMethod properties in ObjectExpression
101
+ 10 | }
102
+ 11 |
103
+> 12 | const g = { ...a, b() {}, c: () => {} };
104
+ | ^^^^^^
105
+ 13 | const h = [...b];
106
+ 14 | new c(...args);
107
+ 15 | c(...args);
108
+
109
+[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle SpreadElement elements in ArrayExpression
110
11 |
102
- 12 | const g = { ...a };
111
+ 12 | const g = { ...a, b() {}, c: () => {} };
112
> 13 | const h = [...b];
113
| ^^^^
114
14 | new c(...args);
115
15 | c(...args);
116
16 | g["e"] += 1;
117
109
-[ReactForget] TodoError: Support non-expression arguments to NewExpression
110
- 12 | const g = { ...a };
118
+[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle SpreadElement arguments in NewExpression
119
+ 12 | const g = { ...a, b() {}, c: () => {} };
120
13 | const h = [...b];
121
> 14 | new c(...args);
122
| ^^^^^^^
@@ -115,7 +124,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
124
16 | g["e"] += 1;
125
17 | const [y, ...yy] = useState(0);
126
118
-[ReactForget] TodoError: Support non-expression arguments to CallExpression
127
+[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle SpreadElement arguments in CallExpression
128
13 | const h = [...b];
129
14 | new c(...args);
130
> 15 | c(...args);
@@ -124,7 +133,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
133
17 | const [y, ...yy] = useState(0);
134
18 | const { z, aa = "aa", ...zz } = useCustom();
135
127
-[ReactForget] TodoError: Assignment expression to dynamic properties is not yet supported
136
+[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle StringLiteral properties in MemberExpression
137
14 | new c(...args);
138
15 | c(...args);
139
> 16 | g["e"] += 1;
@@ -133,7 +142,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
142
18 | const { z, aa = "aa", ...zz } = useCustom();
143
19 |
144
136
-[ReactForget] TodoError: Rest elements are not supported yet
145
+[ReactForget] TodoError: (BuildHIR::lowerAssignment) Handle RestElement in ArrayPattern
146
15 | c(...args);
147
16 | g["e"] += 1;
148
> 17 | const [y, ...yy] = useState(0);
@@ -142,7 +151,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
151
19 |
152
20 | <Button {...args}></Button>;
153
145
-[ReactForget] TodoError: Support other lvalue types beyond identifier
154
+[ReactForget] TodoError: (BuildHIR::lowerAssignment) Handle AssignmentPattern assignments
155
16 | g["e"] += 1;
156
17 | const [y, ...yy] = useState(0);
157
> 18 | const { z, aa = "aa", ...zz } = useCustom();
@@ -151,7 +160,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
160
20 | <Button {...args}></Button>;
161
21 | <Button xlink:href="localhost:3000"></Button>;
162
154
-[ReactForget] TodoError: Rest elements are not supported yet
163
+[ReactForget] TodoError: (BuildHIR::lowerAssignment) Handle RestElement properties in ObjectPattern
164
16 | g["e"] += 1;
165
17 | const [y, ...yy] = useState(0);
166
> 18 | const { z, aa = "aa", ...zz } = useCustom();
@@ -160,7 +169,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
169
20 | <Button {...args}></Button>;
170
21 | <Button xlink:href="localhost:3000"></Button>;
171
163
-[ReactForget] TodoError: Handle spread attributes
172
+[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle JSXSpreadAttribute attributes in JSXElement
173
18 | const { z, aa = "aa", ...zz } = useCustom();
174
19 |
175
> 20 | <Button {...args}></Button>;
@@ -169,7 +178,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
178
22 | <Button haha={1}></Button>;
179
23 | <Button>{/** empty */}</Button>;
180
172
-[ReactForget] TodoError: Handle non-identifier jsx attribute names
181
+[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle JSXNamespacedName attribute names in JSXElement
182
19 |
183
20 | <Button {...args}></Button>;
184
> 21 | <Button xlink:href="localhost:3000"></Button>;
@@ -178,7 +187,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
187
23 | <Button>{/** empty */}</Button>;
188
24 | <DesignSystem.Button />;
189
181
-[ReactForget] TodoError: Handle empty expressions
190
+[ReactForget] TodoError: (BuildHIR::lowerJsxElement) Handle JSXEmptyExpression expressions
191
21 | <Button xlink:href="localhost:3000"></Button>;
192
22 | <Button haha={1}></Button>;
193
> 23 | <Button>{/** empty */}</Button>;
@@ -187,7 +196,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
196
25 |
197
26 | const j = function bar([quz, qux], ...args) {};
198
190
-[ReactForget] TodoError: Handle non-identifier tags
199
+[ReactForget] TodoError: (BuildHIR::lowerJsxElementName) Handle JSXMemberExpression tags
200
22 | <Button haha={1}></Button>;
201
23 | <Button>{/** empty */}</Button>;
202
> 24 | <DesignSystem.Button />;
@@ -196,7 +205,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
205
26 | const j = function bar([quz, qux], ...args) {};
206
27 |
207
199
-[ReactForget] TodoError: Support non-identifier params: ArrayPattern
208
+[ReactForget] TodoError: (BuildHIR::lower) Handle ArrayPattern params
209
24 | <DesignSystem.Button />;
210
25 |
211
> 26 | const j = function bar([quz, qux], ...args) {};
@@ -205,7 +214,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
214
28 | for (; i < 3; i += 1) {
215
29 | x.push(i);
216
208
-[ReactForget] TodoError: Support non-identifier params: RestElement
217
+[ReactForget] TodoError: (BuildHIR::lower) Handle RestElement params
218
24 | <DesignSystem.Button />;
219
25 |
220
> 26 | const j = function bar([quz, qux], ...args) {};
@@ -214,7 +223,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
223
28 | for (; i < 3; i += 1) {
224
29 | x.push(i);
225
217
-[ReactForget] TodoError: Support non-variable initialization in for
226
+[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement
227
26 | const j = function bar([quz, qux], ...args) {};
228
27 |
229
> 28 | for (; i < 3; i += 1) {
@@ -223,7 +232,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
232
30 | }
233
31 | for (; i < 3; ) {}
234
226
-[ReactForget] TodoError: Support non-variable initialization in for
235
+[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement
236
29 | x.push(i);
237
30 | }
238
> 31 | for (; i < 3; ) {}
@@ -232,7 +241,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
241
33 | }
242
34 |
243
235
-[ReactForget] TodoError: Handle empty for updater
244
+[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle empty update in ForStatement
245
29 | x.push(i);
246
30 | }
247
> 31 | for (; i < 3; ) {}
@@ -241,7 +250,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
250
33 | }
251
34 |
252
244
-[ReactForget] TodoError: Support non-variable initialization in for
253
+[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement
254
30 | }
255
31 | for (; i < 3; ) {}
256
> 32 | for (;;) {}
@@ -249,7 +258,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
258
33 | }
259
34 |
260
252
-[ReactForget] TodoError: Handle empty for updater
261
+[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle empty update in ForStatement
262
30 | }
263
31 | for (; i < 3; ) {}
264
> 32 | for (;;) {}
@@ -257,7 +266,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
266
33 | }
267
34 |
268
260
-[ReactForget] TodoError: ForStatement without test
269
+[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle empty test in ForStatement
270
30 | }
271
31 | for (; i < 3; ) {}
272
> 32 | for (;;) {}
compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.js
+1
-1
@@ -9,7 +9,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
9
}
10
}
11
12
- const g = { ...a };
12
+ const g = { ...a, b() {}, c: () => {} };
13
const h = [...b];
14
new c(...args);
15
c(...args);