diff --git a/d2compiler/compile_test.go b/d2compiler/compile_test.go index 2cdc05a4e..5135be5a8 100644 --- a/d2compiler/compile_test.go +++ b/d2compiler/compile_test.go @@ -328,7 +328,7 @@ containers: { Steps } `, - expErr: `d2/testdata/d2compiler/TestCompile/image_children_Steps.d2:4:3: steps is only allowed at a board root`, + expErr: `d2/testdata/d2compiler/TestCompile/image_children_Steps.d2:4:3: steps must be declared at a board root scope`, }, { name: "name-with-dot-underscore", @@ -1746,7 +1746,7 @@ c: { } `, }, - expErr: `d2/testdata/d2compiler/TestCompile/import-classes-boards.d2:10:7: layers is only allowed at a board root`, + expErr: `d2/testdata/d2compiler/TestCompile/import-classes-boards.d2:10:7: layers must be declared at a board root scope`, }, { name: "import_url_link", diff --git a/d2ir/compile_test.go b/d2ir/compile_test.go index c0ac8f4c4..da3a74aaa 100644 --- a/d2ir/compile_test.go +++ b/d2ir/compile_test.go @@ -593,7 +593,7 @@ classes: { } } `) - assert.ErrorString(t, err, `TestCompile/classes/nonroot.d2:2:3: classes is only allowed at a board root`) + assert.ErrorString(t, err, `TestCompile/classes/nonroot.d2:2:3: classes must be declared at a board root scope`) }, }, { diff --git a/d2ir/d2ir.go b/d2ir/d2ir.go index e41edbb83..290e679de 100644 --- a/d2ir/d2ir.go +++ b/d2ir/d2ir.go @@ -942,11 +942,11 @@ func (m *Map) ensureField(i int, kp *d2ast.KeyPath, refctx *RefContext, create b } if headString == "classes" && head.IsUnquoted() && NodeBoardKind(m) == "" { - return d2parser.Errorf(kp.Path[i].Unbox(), "%s is only allowed at a board root", headString) + return d2parser.Errorf(kp.Path[i].Unbox(), "%s must be declared at a board root scope", headString) } if findBoardKeyword(head) != -1 && head.IsUnquoted() && NodeBoardKind(m) == "" { - return d2parser.Errorf(kp.Path[i].Unbox(), "%s is only allowed at a board root", headString) + return d2parser.Errorf(kp.Path[i].Unbox(), "%s must be declared at a board root scope", headString) } for _, f := range m.Fields { diff --git a/testdata/d2compiler/TestCompile/image_children_Steps.exp.json b/testdata/d2compiler/TestCompile/image_children_Steps.exp.json index b9b6f483f..647584533 100644 --- a/testdata/d2compiler/TestCompile/image_children_Steps.exp.json +++ b/testdata/d2compiler/TestCompile/image_children_Steps.exp.json @@ -4,7 +4,7 @@ "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/image_children_Steps.d2,3:2:115-3:7:120", - "errmsg": "d2/testdata/d2compiler/TestCompile/image_children_Steps.d2:4:3: steps is only allowed at a board root" + "errmsg": "d2/testdata/d2compiler/TestCompile/image_children_Steps.d2:4:3: steps must be declared at a board root scope" } ] } diff --git a/testdata/d2compiler/TestCompile/import-classes-boards.exp.json b/testdata/d2compiler/TestCompile/import-classes-boards.exp.json index f746a724a..50d98e426 100644 --- a/testdata/d2compiler/TestCompile/import-classes-boards.exp.json +++ b/testdata/d2compiler/TestCompile/import-classes-boards.exp.json @@ -4,7 +4,7 @@ "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/import-classes-boards.d2,9:6:75-9:12:81", - "errmsg": "d2/testdata/d2compiler/TestCompile/import-classes-boards.d2:10:7: layers is only allowed at a board root" + "errmsg": "d2/testdata/d2compiler/TestCompile/import-classes-boards.d2:10:7: layers must be declared at a board root scope" } ] }