diff --git a/diagnostic_text.go b/diagnostic_text.go index bdfad42b..e53a15f0 100644 --- a/diagnostic_text.go +++ b/diagnostic_text.go @@ -170,6 +170,9 @@ func (w *diagnosticTextWriter) WriteDiagnostic(diag *Diagnostic) error { continue case val.IsNull(): stmts = append(stmts, fmt.Sprintf("%s set to null", traversalStr)) + case val.IsMarked(): + // Skip the marked values as it is not clear here how they should be rendered. + continue default: stmts = append(stmts, fmt.Sprintf("%s as %s", traversalStr, w.valueStr(val))) } diff --git a/diagnostic_text_test.go b/diagnostic_text_test.go index 1057998a..3e18f9b2 100644 --- a/diagnostic_text_test.go +++ b/diagnostic_text_test.go @@ -157,6 +157,21 @@ Did you mean "pizzetta"? Name: "boz", }, }, + { + TraverseRoot{ + Name: "marked", + }, + }, + { + TraverseRoot{ + Name: "null", + }, + }, + { + TraverseRoot{ + Name: "unknown", + }, + }, }, }, EvalContext: &EvalContext{ @@ -169,8 +184,11 @@ Did you mean "pizzetta"? "bar": cty.ObjectVal(map[string]cty.Value{ "baz": cty.ListValEmpty(cty.String), }), - "boz": cty.NumberIntVal(5), - "unused": cty.True, + "boz": cty.NumberIntVal(5), + "marked": cty.StringVal("marked").Mark("x"), + "null": cty.NullVal(cty.String), + "unknown": cty.UnknownVal(cty.String), + "unused": cty.True, }, }, }, @@ -181,7 +199,8 @@ Did you mean "pizzetta"? with bar.baz as empty list of string, boz as 5, - foo as "foo value". + foo as "foo value", + null set to null. This diagnostic includes an expression and an evalcontext.