-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forbid
super
in static class methods with server function directives
Static class methods that are annotated with `"use cache"` or `"use server"` must not call `super`.
- Loading branch information
1 parent
2575927
commit 989f733
Showing
4 changed files
with
51 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 16 additions & 8 deletions
24
crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/output.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
x "use cache" functions can not use `super`. | ||
| | ||
,-[input.js:14:1] | ||
13 | // super is not allowed here | ||
14 | super.bar() | ||
: ^^^^^ | ||
15 | // arguments is not allowed here | ||
`---- | ||
x "use cache" functions can not use `arguments`. | ||
| | ||
,-[input.js:9:1] | ||
8 | // arguments is not allowed here | ||
9 | console.log(arguments) | ||
,-[input.js:16:1] | ||
15 | // arguments is not allowed here | ||
16 | console.log(arguments) | ||
: ^^^^^^^^^ | ||
10 | // this is not allowed here | ||
17 | // this is not allowed here | ||
`---- | ||
x "use cache" functions can not use `this`. | ||
| | ||
,-[input.js:11:1] | ||
10 | // this is not allowed here | ||
11 | return this.foo() | ||
,-[input.js:18:1] | ||
17 | // this is not allowed here | ||
18 | return this.foo() | ||
: ^^^^ | ||
12 | } | ||
19 | } | ||
`---- |