Skip to content

Commit d63d838

Browse files
author
Esben Sparre Andreasen
committed
JS: add regression test for ODASA-7506
1 parent b418968 commit d63d838

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

javascript/ql/test/query-tests/React/UnusedOrUndefinedStateProperty/UnusedOrUndefinedStateProperty.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
| issue7506.js:12:1:12:34 | class C ... e\\n }\\n} | Component state property 'p1' is $@, but it is never read. | issue7506.js:15:5:15:10 | p1: '' | written |
12
| undefined.js:1:1:1:34 | class C ... }\\n} | Component state property 'notWritten' is $@, but it is never written. | undefined.js:8:9:8:29 | this.st ... Written | read |
23
| undefined.js:1:1:1:34 | class C ... }\\n} | Component state property 'notWrittenButReadInChain' is $@, but it is never written. | undefined.js:9:9:9:43 | this.st ... InChain | read |
34
| undefined.js:32:1:32:34 | class C ... }\\n} | Component state property 'notWrittenThrougExternalPropertyAccess' is $@, but it is never written. | undefined.js:35:9:35:57 | this.st ... yAccess | read |
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class C1 extends React.Component {
2+
3+
state = {
4+
p1: ''
5+
}
6+
7+
static getDerivedStateFromProps(props, state) {
8+
const { p1: p2 } = state
9+
}
10+
}
11+
12+
class C2 extends React.Component {
13+
14+
state = {
15+
p1: ''
16+
}
17+
18+
static getDerivedStateFromProps_unmodeled(props, state) {
19+
const { p1: p2 } = state
20+
}
21+
}
22+
23+
// semmle-extractor-options: --experimental

0 commit comments

Comments
 (0)