Skip to content

Commit

Permalink
Merge pull request #1972 from alixander/linked-import
Browse files Browse the repository at this point in the history
compiler: fix board links from spread imports
  • Loading branch information
alixander authored Jun 6, 2024
2 parents 025b015 + d2ec7cd commit 108cf56
Show file tree
Hide file tree
Showing 4 changed files with 539 additions and 0 deletions.
1 change: 1 addition & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
- Using `shape: circle` for arrowheads no longer removes all arrowheads along path in sketch mode [#1942](https://github.com/terrastruct/d2/pull/1942)
- Globs to null connections work [#1965](https://github.com/terrastruct/d2/pull/1965)
- Edge globs setting styles inherit correctly in child boards [#1967](https://github.com/terrastruct/d2/pull/1967)
- Board links imported with spread imports work [#1972](https://github.com/terrastruct/d2/pull/1972)
16 changes: 16 additions & 0 deletions d2compiler/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2902,6 +2902,22 @@ qa: {
tassert.Equal(t, "Qa Environment", g.Objects[2].Label.Value)
},
},
{
name: "spread-import-link",
text: `k
layers: {
x: {...@x}
}`,
files: map[string]string{
"x.d2": `a.link: layers.b
layers: {
b: {
d
}
}`,
},
},
}

for _, tc := range testCases {
Expand Down
1 change: 1 addition & 0 deletions d2ir/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ func (c *compiler) compileMap(dst *Map, ast, scopeAST *d2ast.Map) {
}

OverlayMap(dst, impn.Map())
c.updateLinks(dst)

if impnf, ok := impn.(*Field); ok {
if impnf.Primary_ != nil {
Expand Down
Loading

0 comments on commit 108cf56

Please sign in to comment.