Skip to content

Commit 7cd84c8

Browse files
committed
JS: Add type-tracking test
1 parent ca1a27d commit 7cd84c8

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| summarize.js:30:14:30:26 | // track: obj | Failed to track obj here. |
2+
| summarize.js:33:14:33:26 | // track: obj | Failed to track obj here. |
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import 'dummy';
2+
3+
function identity(x) {
4+
return x;
5+
}
6+
function load(x) {
7+
return x.loadProp;
8+
}
9+
function store(x) {
10+
return { storeProp: x };
11+
}
12+
function loadStore(x) {
13+
return { storeProp: x.loadProp };
14+
}
15+
16+
identity({});
17+
load({});
18+
store({});
19+
loadStore({});
20+
21+
const obj = {}; // name: obj
22+
23+
let x = identity(obj);
24+
x; // track: obj
25+
26+
x = load({ loadProp: obj });
27+
x; // track: obj
28+
29+
x = store(obj);
30+
x.storeProp; // track: obj
31+
32+
x = loadStore({ loadProp: obj });
33+
x.storeProp; // track: obj

0 commit comments

Comments
 (0)