validateExamples makes sure that the attribute example values are compatible with the attribute type.
(ctx string, parent eval.Expression)
| 772 | // validateExamples makes sure that the attribute example values are compatible |
| 773 | // with the attribute type. |
| 774 | func (a *AttributeExpr) validateExamples(ctx string, parent eval.Expression) *eval.ValidationErrors { |
| 775 | verr := new(eval.ValidationErrors) |
| 776 | for _, ex := range a.UserExamples { |
| 777 | if !a.Type.IsCompatible(ex.Value) { // DSL ensures ex.Value is not nil |
| 778 | verr.Add(parent, "%sexample value %#v is incompatible with type %s", ctx, ex.Value, a.Type.Name()) |
| 779 | } |
| 780 | } |
| 781 | return verr |
| 782 | } |
| 783 | |
| 784 | func (a *AttributeExpr) inheritRecursive(parent *AttributeExpr, seen map[*AttributeExpr]struct{}) { |
| 785 | if !a.shouldInherit(parent) { |
no test coverage detected