-
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
df5ac0f
commit cdf1961
Showing
4 changed files
with
69 additions
and
12 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
28 changes: 18 additions & 10 deletions
28
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 `arguments`. | ||
x "use cache" functions cannot use `super`. | ||
| | ||
,-[input.js:9:1] | ||
8 | // arguments is not allowed here | ||
9 | console.log(arguments) | ||
,-[input.js:14:1] | ||
13 | // super is not allowed here | ||
14 | super.bar() | ||
: ^^^^^ | ||
15 | // arguments is not allowed here | ||
`---- | ||
x "use cache" functions cannot use `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`. | ||
x "use cache" functions cannot 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 | } | ||
`---- |