Distinguish error fixtures for invalid code

Renames some error fixtures for clarity, "error.invalid-*" are fixtures that are 
expected to fail for invalid input, where other "error.*" fixtures are basically 
todos. While i was here i clarified the error messages for invalid useMemo 
callbacks, and changes the error severity from Invariant to InvalidInput.
This commit is contained in:
Joe Savona
2023-06-04 11:41:42 -07:00
parent e41a8d6a1e
commit 084edadaa1
11 changed files with 6 additions and 6 deletions
@@ -100,15 +100,15 @@ export function inlineUseMemo(fn: HIRFunction): void {
}
if (body.loweredFunc.params.length > 0) {
CompilerError.invariant(
"Did not expect any arguments to useMemo callback",
CompilerError.invalidInput(
"useMemo callbacks may not accept any arguments",
body.loc
);
}
if (body.loweredFunc.async || body.loweredFunc.generator) {
CompilerError.invariant(
"Did not expect useMemo callback to be async or a generator",
CompilerError.invalidInput(
"useMemo callbacks may not be async or generator functions",
body.loc
);
}
@@ -15,7 +15,7 @@ function component(a, b) {
## Error
```
[ReactForget] Invariant: Did not expect useMemo callback to be async or a generator (2:4)
[ReactForget] InvalidInput: useMemo callbacks may not be async or generator functions (2:4)
```
@@ -13,7 +13,7 @@ function component(a, b) {
## Error
```
[ReactForget] Invariant: Did not expect any arguments to useMemo callback (2:2)
[ReactForget] InvalidInput: useMemo callbacks may not accept any arguments (2:2)
```