diff --git a/policy/compiler.go b/policy/compiler.go index 6a362328..0b7010c1 100644 --- a/policy/compiler.go +++ b/policy/compiler.go @@ -378,7 +378,7 @@ func (c *compiler) checkMatchOutputTypesAgree(rule *CompiledRule, iss *cel.Issue // Handle assignability as the output type is assignable to the match output or vice versa. // During composition, this is roughly how the type-checker will handle the type agreement check. if !(outputType.IsAssignableType(matchOutputType) || matchOutputType.IsAssignableType(outputType)) { - iss.ReportErrorAtID(m.Output().SourceID(), "incompatible output types: %s not assignable to %s", outputType, matchOutputType) + iss.ReportErrorAtID(m.Output().SourceID(), "incompatible output types: match block has output type %s, but previous match blocks have output type %s", matchOutputType, outputType) return } } diff --git a/policy/helper_test.go b/policy/helper_test.go index c621d7a1..a0d2d171 100644 --- a/policy/helper_test.go +++ b/policy/helper_test.go @@ -206,7 +206,7 @@ ERROR: testdata/errors/policy.yaml:38:75: Syntax error: extraneous input ']' exp ERROR: testdata/errors/policy.yaml:41:67: undeclared reference to 'format' (in container '') | "invalid values provided on one or more labels: %s".format([variables.invalid]) | ..................................................................^ -ERROR: testdata/errors/policy.yaml:45:16: incompatible output types: bool not assignable to string +ERROR: testdata/errors/policy.yaml:45:16: incompatible output types: match block has output type string, but previous match blocks have output type bool | output: "'false'" | ...............^`, },