diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index ef7c7be4fd..a58e904978 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -877,14 +877,13 @@ def check_union(expr, info): discriminator_value = base_members.get(discriminator) if not discriminator_value: raise QAPISemError(info, - "Discriminator '%s' is not a member of base " - "struct '%s'" - % (discriminator, base)) + "Discriminator '%s' is not a member of 'base'" + % discriminator) if discriminator_value.get('if'): raise QAPISemError( info, - "The discriminator %s.%s for union %s must not be conditional" - % (base, discriminator, name)) + "The discriminator '%s' for union %s must not be conditional" + % (discriminator, name)) enum_define = enum_types.get(discriminator_value['type']) # Do not allow string discriminator if not enum_define: diff --git a/tests/qapi-schema/flat-union-invalid-discriminator.err b/tests/qapi-schema/flat-union-invalid-discriminator.err index 947a6b73aa..495d5a520e 100644 --- a/tests/qapi-schema/flat-union-invalid-discriminator.err +++ b/tests/qapi-schema/flat-union-invalid-discriminator.err @@ -1 +1 @@ -tests/qapi-schema/flat-union-invalid-discriminator.json:11: Discriminator 'enum_wrong' is not a member of base struct 'OrderedDict([('enum1', {'type': 'TestEnum'})])' +tests/qapi-schema/flat-union-invalid-discriminator.json:10: Discriminator 'enum_wrong' is not a member of 'base' diff --git a/tests/qapi-schema/flat-union-invalid-discriminator.json b/tests/qapi-schema/flat-union-invalid-discriminator.json index de86cf0760..c4fce97362 100644 --- a/tests/qapi-schema/flat-union-invalid-discriminator.json +++ b/tests/qapi-schema/flat-union-invalid-discriminator.json @@ -1,4 +1,3 @@ -# FIXME error message shows base as OrderedDict { 'enum': 'TestEnum', 'data': [ 'value1', 'value2' ] } diff --git a/tests/qapi-schema/flat-union-invalid-if-discriminator.err b/tests/qapi-schema/flat-union-invalid-if-discriminator.err index ec04c4840c..cc5c3fb80b 100644 --- a/tests/qapi-schema/flat-union-invalid-if-discriminator.err +++ b/tests/qapi-schema/flat-union-invalid-if-discriminator.err @@ -1 +1 @@ -tests/qapi-schema/flat-union-invalid-if-discriminator.json:11: The discriminator OrderedDict([('enum1', OrderedDict([('type', 'TestEnum'), ('if', 'FOO')]))]).enum1 for union TestUnion must not be conditional +tests/qapi-schema/flat-union-invalid-if-discriminator.json:10: The discriminator 'enum1' for union TestUnion must not be conditional diff --git a/tests/qapi-schema/flat-union-invalid-if-discriminator.json b/tests/qapi-schema/flat-union-invalid-if-discriminator.json index bbaa9a3f82..e49992b798 100644 --- a/tests/qapi-schema/flat-union-invalid-if-discriminator.json +++ b/tests/qapi-schema/flat-union-invalid-if-discriminator.json @@ -1,4 +1,3 @@ -# FIXME error message shows base as OrderedDict { 'enum': 'TestEnum', 'data': [ 'value1', 'value2' ] } diff --git a/tests/qapi-schema/flat-union-optional-discriminator.err b/tests/qapi-schema/flat-union-optional-discriminator.err index 8b4a4ba847..45f5407c34 100644 --- a/tests/qapi-schema/flat-union-optional-discriminator.err +++ b/tests/qapi-schema/flat-union-optional-discriminator.err @@ -1 +1 @@ -tests/qapi-schema/flat-union-optional-discriminator.json:7: Discriminator 'switch' is not a member of base struct 'Base' +tests/qapi-schema/flat-union-optional-discriminator.json:7: Discriminator 'switch' is not a member of 'base' diff --git a/tests/qapi-schema/union-base-empty.err b/tests/qapi-schema/union-base-empty.err index 7695806d81..9453720ede 100644 --- a/tests/qapi-schema/union-base-empty.err +++ b/tests/qapi-schema/union-base-empty.err @@ -1 +1 @@ -tests/qapi-schema/union-base-empty.json:5: Discriminator 'type' is not a member of base struct 'Empty' +tests/qapi-schema/union-base-empty.json:5: Discriminator 'type' is not a member of 'base'