Skip to content

Commit b6b1dfb

Browse files
committed
add internal test making sure dict labels dont stack
1 parent 8b40ba0 commit b6b1dfb

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

jscomp/test/DictInternalRepresentation.js

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Make sure labels matched don't "stick" on the builtin dict type
2+
let stringDict = dict{
3+
"first": "hello",
4+
}
5+
6+
let intDict = dict{
7+
"first": 1,
8+
}
9+
10+
let foo = () => {
11+
let first = switch stringDict {
12+
| @res.dictPattern {first} => first ++ "2"
13+
| _ => "hello"
14+
}
15+
Js.log(first)
16+
let second = switch intDict {
17+
| @res.dictPattern {first} => first + 2
18+
| _ => 1
19+
}
20+
Js.log(second)
21+
let third = switch stringDict {
22+
| @res.dictPattern {first} => first ++ "2"
23+
| _ => "hello"
24+
}
25+
Js.log(third)
26+
}

0 commit comments

Comments
 (0)