diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index 6a900a0df..999f9677a 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -19,3 +19,4 @@ - Fix importing a file with nested boards [#1998](https://github.com/terrastruct/d2/pull/1998) - Fix importing a file with underscores in links [#1999](https://github.com/terrastruct/d2/pull/1999) - Replace a panic with an error message resulting from invalid `link` usage [#2011](https://github.com/terrastruct/d2/pull/2011) +- Fix globs not applying to scenarios on keys that were applied in earlier scenarios [#2021](https://github.com/terrastruct/d2/pull/2021) diff --git a/d2compiler/compile_test.go b/d2compiler/compile_test.go index df0ca4c45..0e9646537 100644 --- a/d2compiler/compile_test.go +++ b/d2compiler/compile_test.go @@ -4699,6 +4699,50 @@ z.link: https://yahoo.com assert.Equal(t, (*d2graph.Scalar)(nil), g.Objects[2].Attributes.Style.Underline) }, }, + { + name: "reapply-scenario", + run: func(t *testing.T) { + g, _ := assertCompile(t, ` +*.b*.shape: circle +x: { + b +} + +scenarios: { + k: { + x: { + b + } + } +} +`, ``) + assert.Equal(t, "circle", g.Objects[1].Attributes.Shape.Value) + assert.Equal(t, "circle", g.Scenarios[0].Objects[1].Attributes.Shape.Value) + }, + }, + { + name: "second-scenario", + run: func(t *testing.T) { + g, _ := assertCompile(t, ` +*.b*.shape: circle + +scenarios: { + k: { + x: { + b + } + } + z: { + x: { + b + } + } +} +`, ``) + assert.Equal(t, "circle", g.Scenarios[0].Objects[1].Attributes.Shape.Value) + assert.Equal(t, "circle", g.Scenarios[1].Objects[1].Attributes.Shape.Value) + }, + }, } for _, tc := range tca { diff --git a/d2ir/compile.go b/d2ir/compile.go index a4580716e..2dad21fbb 100644 --- a/d2ir/compile.go +++ b/d2ir/compile.go @@ -382,6 +382,17 @@ func (g *globContext) copy() *globContext { return &g2 } +func (g *globContext) copyApplied(from *globContext) { + g.appliedFields = make(map[string]struct{}) + for k, v := range from.appliedFields { + g.appliedFields[k] = v + } + g.appliedEdges = make(map[string]struct{}) + for k, v := range from.appliedEdges { + g.appliedEdges[k] = v + } +} + func (g *globContext) prefixed(dst *Map) *globContext { g2 := g.copy() prefix := d2ast.MakeKeyPath(RelIDA(g2.refctx.ScopeMap, dst)) @@ -447,8 +458,19 @@ func (c *compiler) compileMap(dst *Map, ast, scopeAST *d2ast.Map) { globs = append(globs, g.prefixed(dst)) } } - } else if NodeBoardKind(dst) != "" { - // Make all globs relative to the scenario or step. + } else if NodeBoardKind(dst) == BoardScenario { + for _, g := range previousGlobs { + g2 := g.prefixed(dst) + // We don't want globs applied in a given scenario to affect future boards + // Copying the applied fields and edges keeps the applications scoped to this board + // Note that this is different from steps, where applications carry over + if !g.refctx.Key.HasTripleGlob() { + // Triple globs already apply independently to each board + g2.copyApplied(g) + } + globs = append(globs, g2) + } + } else if NodeBoardKind(dst) == BoardStep { for _, g := range previousGlobs { globs = append(globs, g.prefixed(dst)) } diff --git a/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.exp.json b/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.exp.json new file mode 100644 index 000000000..78bcd3139 --- /dev/null +++ b/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.exp.json @@ -0,0 +1,687 @@ +{ + "graph": { + "name": "", + "isFolderOnly": true, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,0:0:0-15:0:105", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,1:0:1-1:19:20", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,1:0:1-1:11:12", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,1:0:1-1:2:3", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,1:3:4-1:5:6", + "value": [ + { + "string": "b*", + "raw_string": "b*" + } + ], + "pattern": [ + "b", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,1:6:7-1:11:12", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,1:13:14-1:19:20", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,3:0:22-14:1:104", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,3:0:22-3:9:31", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,3:0:22-3:9:31", + "value": [ + { + "string": "scenarios", + "raw_string": "scenarios" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,3:11:33-14:1:104", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,4:2:37-8:3:68", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,4:2:37-4:3:38", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,4:2:37-4:3:38", + "value": [ + { + "string": "k", + "raw_string": "k" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,4:5:40-8:3:68", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,5:4:46-7:5:64", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,5:4:46-5:5:47", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,5:4:46-5:5:47", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,5:7:49-7:5:64", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,6:6:57-6:7:58", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,6:6:57-6:7:58", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,6:6:57-6:7:58", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,9:2:71-13:3:102", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,9:2:71-9:3:72", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,9:2:71-9:3:72", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,9:5:74-13:3:102", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,10:4:80-12:5:98", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,10:4:80-10:5:81", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,10:4:80-10:5:81", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,10:7:83-12:5:98", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,11:6:91-11:7:92", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,11:6:91-11:7:92", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,11:6:91-11:7:92", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + "edges": null, + "objects": null, + "scenarios": [ + { + "name": "k", + "isFolderOnly": false, + "ast": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "shape" + } + ] + } + } + ] + }, + "primary": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,1:13:14-1:19:20", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + }, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,5:4:46-5:5:47", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,5:4:46-5:5:47", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + { + "id": "b", + "id_val": "b", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,6:6:57-6:7:58", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,6:6:57-6:7:58", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "circle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + } + ] + }, + { + "name": "z", + "isFolderOnly": false, + "ast": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": ",0:0:0-1:0:0", + "nodes": null + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,10:4:80-10:5:81", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,10:4:80-10:5:81", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + { + "id": "b", + "id_val": "b", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,11:6:91-11:7:92", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/double-glob-second-scenario.d2,11:6:91-11:7:92", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + } + ] + } + ] + }, + "err": null +} diff --git a/testdata/d2compiler/TestCompile2/globs/reapply-scenario.exp.json b/testdata/d2compiler/TestCompile2/globs/reapply-scenario.exp.json new file mode 100644 index 000000000..80e132917 --- /dev/null +++ b/testdata/d2compiler/TestCompile2/globs/reapply-scenario.exp.json @@ -0,0 +1,607 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,0:0:0-13:0:81", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,1:0:1-1:18:19", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,1:0:1-1:10:11", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,1:0:1-1:1:2", + "value": [ + { + "string": "*", + "raw_string": "*" + } + ], + "pattern": [ + "*" + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,1:2:3-1:4:5", + "value": [ + { + "string": "b*", + "raw_string": "b*" + } + ], + "pattern": [ + "b", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,1:5:6-1:10:11", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,1:12:13-1:18:19", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,2:0:20-4:1:30", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,2:0:20-2:1:21", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,2:0:20-2:1:21", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,2:3:23-4:1:30", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,3:2:27-3:3:28", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,3:2:27-3:3:28", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,3:2:27-3:3:28", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,6:0:32-12:1:80", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,6:0:32-6:9:41", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,6:0:32-6:9:41", + "value": [ + { + "string": "scenarios", + "raw_string": "scenarios" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,6:11:43-12:1:80", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,7:2:47-11:3:78", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,7:2:47-7:3:48", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,7:2:47-7:3:48", + "value": [ + { + "string": "k", + "raw_string": "k" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,7:5:50-11:3:78", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,8:4:56-10:5:74", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,8:4:56-8:5:57", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,8:4:56-8:5:57", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,8:7:59-10:5:74", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,9:6:67-9:7:68", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,9:6:67-9:7:68", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,9:6:67-9:7:68", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,2:0:20-2:1:21", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,2:0:20-2:1:21", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + { + "id": "b", + "id_val": "b", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,3:2:27-3:3:28", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,3:2:27-3:3:28", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "circle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + } + ], + "scenarios": [ + { + "name": "k", + "isFolderOnly": false, + "ast": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "shape" + } + ] + } + } + ] + }, + "primary": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,1:12:13-1:18:19", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + }, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,2:0:20-2:1:21", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,2:0:20-2:1:21", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,8:4:56-8:5:57", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,8:4:56-8:5:57", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + { + "id": "b", + "id_val": "b", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,3:2:27-3:3:28", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,3:2:27-3:3:28", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,9:6:67-9:7:68", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/reapply-scenario.d2,9:6:67-9:7:68", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "circle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + } + ] + } + ] + }, + "err": null +} diff --git a/testdata/d2compiler/TestCompile2/globs/second-scenario.exp.json b/testdata/d2compiler/TestCompile2/globs/second-scenario.exp.json new file mode 100644 index 000000000..727036175 --- /dev/null +++ b/testdata/d2compiler/TestCompile2/globs/second-scenario.exp.json @@ -0,0 +1,718 @@ +{ + "graph": { + "name": "", + "isFolderOnly": true, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,0:0:0-15:0:104", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,1:0:1-1:18:19", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,1:0:1-1:10:11", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,1:0:1-1:1:2", + "value": [ + { + "string": "*", + "raw_string": "*" + } + ], + "pattern": [ + "*" + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,1:2:3-1:4:5", + "value": [ + { + "string": "b*", + "raw_string": "b*" + } + ], + "pattern": [ + "b", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,1:5:6-1:10:11", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,1:12:13-1:18:19", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,3:0:21-14:1:103", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,3:0:21-3:9:30", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,3:0:21-3:9:30", + "value": [ + { + "string": "scenarios", + "raw_string": "scenarios" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,3:11:32-14:1:103", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,4:2:36-8:3:67", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,4:2:36-4:3:37", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,4:2:36-4:3:37", + "value": [ + { + "string": "k", + "raw_string": "k" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,4:5:39-8:3:67", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,5:4:45-7:5:63", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,5:4:45-5:5:46", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,5:4:45-5:5:46", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,5:7:48-7:5:63", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,6:6:56-6:7:57", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,6:6:56-6:7:57", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,6:6:56-6:7:57", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,9:2:70-13:3:101", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,9:2:70-9:3:71", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,9:2:70-9:3:71", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,9:5:73-13:3:101", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,10:4:79-12:5:97", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,10:4:79-10:5:80", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,10:4:79-10:5:80", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,10:7:82-12:5:97", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,11:6:90-11:7:91", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,11:6:90-11:7:91", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,11:6:90-11:7:91", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + "edges": null, + "objects": null, + "scenarios": [ + { + "name": "k", + "isFolderOnly": false, + "ast": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "shape" + } + ] + } + } + ] + }, + "primary": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,1:12:13-1:18:19", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + }, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,5:4:45-5:5:46", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,5:4:45-5:5:46", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + { + "id": "b", + "id_val": "b", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,6:6:56-6:7:57", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,6:6:56-6:7:57", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "circle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + } + ] + }, + { + "name": "z", + "isFolderOnly": false, + "ast": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": ",0:0:0-1:0:0", + "nodes": [ + { + "map_key": { + "range": ",0:0:0-0:0:0", + "key": { + "range": ",0:0:0-0:0:0", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:0:0", + "value": [ + { + "string": "shape" + } + ] + } + } + ] + }, + "primary": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,1:12:13-1:18:19", + "value": [ + { + "string": "circle", + "raw_string": "circle" + } + ] + } + }, + "value": {} + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "root": { + "id": "", + "id_val": "", + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + "edges": null, + "objects": [ + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,10:4:79-10:5:80", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,10:4:79-10:5:80", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + { + "id": "b", + "id_val": "b", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,11:6:90-11:7:91", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/second-scenario.d2,11:6:90-11:7:91", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "circle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + } + ] + } + ] + }, + "err": null +} diff --git a/testdata/d2ir/TestCompile/patterns/alixander-review/5.exp.json b/testdata/d2ir/TestCompile/patterns/alixander-review/5.exp.json index d7c15fa34..a23a2b133 100644 --- a/testdata/d2ir/TestCompile/patterns/alixander-review/5.exp.json +++ b/testdata/d2ir/TestCompile/patterns/alixander-review/5.exp.json @@ -186,6 +186,240 @@ }, "due_to_glob": true, "due_to_lazy_glob": true + }, + { + "string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:9:10-1:13:14", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:13:14", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:2:3", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:3:4-1:8:9", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:9:10-1:13:14", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:18:19", + "key": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:13:14", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:2:3", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:3:4-1:8:9", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:9:10-1:13:14", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:15:16-1:18:19", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + "due_to_glob": true, + "due_to_lazy_glob": true + }, + { + "string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:9:10-1:13:14", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:13:14", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:2:3", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:3:4-1:8:9", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:9:10-1:13:14", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:18:19", + "key": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:13:14", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:2:3", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:3:4-1:8:9", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:9:10-1:13:14", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:15:16-1:18:19", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + "due_to_glob": true, + "due_to_lazy_glob": true } ] } @@ -1353,6 +1587,240 @@ }, "due_to_glob": true, "due_to_lazy_glob": true + }, + { + "string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:9:10-1:13:14", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:13:14", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:2:3", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:3:4-1:8:9", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:9:10-1:13:14", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:18:19", + "key": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:13:14", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:2:3", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:3:4-1:8:9", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:9:10-1:13:14", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:15:16-1:18:19", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + "due_to_glob": true, + "due_to_lazy_glob": true + }, + { + "string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:9:10-1:13:14", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:13:14", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:2:3", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:3:4-1:8:9", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:9:10-1:13:14", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:18:19", + "key": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:13:14", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:0:1-1:2:3", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:3:4-1:8:9", + "value": [ + { + "string": "style", + "raw_string": "style" + } + ] + } + }, + { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:9:10-1:13:14", + "value": [ + { + "string": "fill", + "raw_string": "fill" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/patterns/alixander-review/5.d2,1:15:16-1:18:19", + "value": [ + { + "string": "red", + "raw_string": "red" + } + ] + } + } + } + }, + "due_to_glob": true, + "due_to_lazy_glob": true } ] } diff --git a/testdata/d2ir/TestCompile/patterns/double-glob/defaults.exp.json b/testdata/d2ir/TestCompile/patterns/double-glob/defaults.exp.json index 355e0094b..e0c116c32 100644 --- a/testdata/d2ir/TestCompile/patterns/double-glob/defaults.exp.json +++ b/testdata/d2ir/TestCompile/patterns/double-glob/defaults.exp.json @@ -1162,6 +1162,69 @@ } }, "references": [ + { + "string": { + "range": "TestCompile/patterns/double-glob/defaults.d2,1:1:7-1:6:12", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + }, + "key_path": { + "range": "TestCompile/patterns/double-glob/defaults.d2,1:1:7-1:6:12", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/defaults.d2,1:1:7-1:6:12", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "context": { + "edge": null, + "key": { + "range": "TestCompile/patterns/double-glob/defaults.d2,1:1:7-1:12:18", + "key": { + "range": "TestCompile/patterns/double-glob/defaults.d2,1:1:7-1:6:12", + "path": [ + { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/defaults.d2,1:1:7-1:6:12", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "TestCompile/patterns/double-glob/defaults.d2,1:8:14-1:12:18", + "value": [ + { + "string": "page", + "raw_string": "page" + } + ] + } + } + } + }, + "due_to_glob": true, + "due_to_lazy_glob": true + }, { "string": { "range": "TestCompile/patterns/double-glob/defaults.d2,1:1:7-1:6:12",