Skip to content

Commit ad52b71

Browse files
committed
JS: Update immutable.js test to clarify why it stopped working
The Immutable model uses the 'd' and 'f' properties to model Map content, but the test doesn't actually mention those properties, so they were missing from the PropertyName class. The flow was previously found spuriously by the regular Map model, which also adds flow through the get/set calls. This flow is however no longer found since it relied on a step from post-update back to getALocalSource which is no longer present.
1 parent c0997c2 commit ad52b71

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

javascript/ql/test/library-tests/frameworks/Immutable/immutable.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ sink(map2.get("b")); // OK - but still flagged [INCONSISTENCY]
1414

1515
const map3 = map2.set("d", source("d"));
1616
sink(map1.get("d")); // OK
17-
sink(map3.get("d")); // NOT OK [INCONSISTENCY]
17+
sink(map3.get("d")); // NOT OK
1818

1919

2020
sink(map3.toJS()["a"]); // NOT OK
@@ -34,7 +34,7 @@ List(["safe"]).push(source()).forEach(x => sink(x)); // NOT OK
3434

3535

3636
const map4 = OrderedMap({}).set("f", source());
37-
sink(map4.get("f")); // NOT OK [INCONSISTENCY]
37+
sink(map4.get("f")); // NOT OK
3838

3939
const map5 = Record({a: source(), b: null, c: null})({b: source()});
4040
sink(map5.get("a")); // NOT OK
@@ -55,4 +55,7 @@ Set.of(source()).filter(x => true).toList().forEach(x => sink(x)); // NOT OK
5555

5656
Set([source()]).filter(x => true).toList().forEach(x => sink(x)); // NOT OK
5757

58-
OrderedSet([source()]).filter(x => true).toList().forEach(x => sink(x)); // NOT OK
58+
OrderedSet([source()]).filter(x => true).toList().forEach(x => sink(x)); // NOT OK
59+
60+
x.d; // ensure 'd' property exists
61+
x.f; // ensure 'f' property exists

javascript/ql/test/library-tests/frameworks/Immutable/tests.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
legacyDataFlowDifference
2-
| immutable.js:15:28:15:38 | source("d") | immutable.js:17:6:17:18 | map3.get("d") | only flow with OLD data flow library |
3-
| immutable.js:36:38:36:45 | source() | immutable.js:37:6:37:18 | map4.get("f") | only flow with OLD data flow library |
42
dataFlow
53
| immutable.js:1:16:1:26 | source("a") | immutable.js:2:6:2:13 | obj["a"] |
64
| immutable.js:1:16:1:26 | source("a") | immutable.js:11:6:11:18 | map1.get("a") |
75
| immutable.js:1:16:1:26 | source("a") | immutable.js:12:6:12:18 | map2.get("a") |
86
| immutable.js:1:16:1:26 | source("a") | immutable.js:20:6:20:21 | map3.toJS()["a"] |
97
| immutable.js:1:32:1:43 | source("b1") | immutable.js:8:6:8:18 | map1.get("b") |
108
| immutable.js:1:32:1:43 | source("b1") | immutable.js:13:6:13:18 | map2.get("b") |
9+
| immutable.js:15:28:15:38 | source("d") | immutable.js:17:6:17:18 | map3.get("d") |
1110
| immutable.js:22:19:22:29 | source("e") | immutable.js:22:6:22:40 | fromJS( ... et("e") |
1211
| immutable.js:24:18:24:25 | source() | immutable.js:25:22:25:22 | x |
1312
| immutable.js:29:25:29:32 | source() | immutable.js:29:53:29:53 | x |
1413
| immutable.js:31:7:31:14 | source() | immutable.js:31:75:31:75 | x |
1514
| immutable.js:33:21:33:28 | source() | immutable.js:33:49:33:49 | x |
15+
| immutable.js:36:38:36:45 | source() | immutable.js:37:6:37:18 | map4.get("f") |
1616
| immutable.js:39:25:39:32 | source() | immutable.js:40:6:40:18 | map5.get("a") |
1717
| immutable.js:39:58:39:65 | source() | immutable.js:41:6:41:18 | map5.get("b") |
1818
| immutable.js:44:40:44:47 | source() | immutable.js:45:6:45:18 | map6.get("a") |

0 commit comments

Comments
 (0)