-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
12c483a
commit 7d04347
Showing
4 changed files
with
47 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
12 changes: 11 additions & 1 deletion
12
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
11 changes: 10 additions & 1 deletion
11
crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/output.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
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 cannot use `super`. | ||
| | ||
,-[input.js:15:1] | ||
14 | // super is not allowed here | ||
15 | return [super.bar()] | ||
: ^^^^^ | ||
16 | } | ||
`---- | ||
x "use cache" functions cannot use `arguments`. | ||
| | ||
,-[input.js:9:1] | ||
8 | // arguments is not allowed here | ||
9 | console.log(arguments) | ||
,-[input.js:19:1] | ||
18 | // arguments is not allowed here | ||
19 | console.log(arguments) | ||
: ^^^^^^^^^ | ||
10 | // this is not allowed here | ||
20 | // this is not allowed here | ||
`---- | ||
x "use cache" functions cannot use `this`. | ||
| | ||
,-[input.js:11:1] | ||
10 | // this is not allowed here | ||
11 | return this.foo() | ||
,-[input.js:21:1] | ||
20 | // this is not allowed here | ||
21 | return this.foo() | ||
: ^^^^ | ||
12 | } | ||
22 | } | ||
`---- |