Commit e84e7fad authored by Giuseppe Ottaviano's avatar Giuseppe Ottaviano Committed by Facebook Github Bot 2

Port easy instances to folly::dynamic::array

Summary:The vast majority of `folly::dynamic` array initializations are
single-line and with no nested arrays, so we can fix them with a
syntactic codemod. This also fixes a couple of singletons.

For empty arrays:
```
codemod '((?:folly::)?)(dynamic\s+\w+\s*=\s*)({\s*})' '\1\2\1dynamic::array'
```

For non-empty ones:
```
codemod '((?:folly::)?)(dynamic\s+\w+\s*=\s*)(?:{\s*([^{}]+?)\s*})' '\1\2\1dynamic::array(\3)'
```

Reviewed By: igorsugak

Differential Revision: D3030338

fb-gh-sync-id: 3e56704a6c6294d6f6270e42a1776d991a7938df
shipit-source-id: 3e56704a6c6294d6f6270e42a1776d991a7938df
parent d00a7c52
......@@ -998,7 +998,7 @@ TEST(Gen, CopyCount) {
// test dynamics with various layers of nested arrays.
TEST(Gen, Dynamic) {
dynamic array1 = {1, 2};
dynamic array1 = dynamic::array(1, 2);
EXPECT_EQ(dynamic(3), from(array1) | sum);
dynamic array2 = {{1}, {1, 2}};
EXPECT_EQ(dynamic(4), from(array2) | rconcat | sum);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment