Browse Source
It often happens that just a few discriminator values imply extra data in a flat union. Existing checks did not make possible to leave other values uncovered. Such cases had to be worked around by either stating a dummy (empty) type or introducing another (subset) discriminator enumeration. Both options create redundant entities in qapi files for little profit. With this patch it is not necessary anymore to add designated union fields for every possible value of a discriminator enumeration. Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Message-Id: <1529311206-76847-2-git-send-email-anton.nefedov@virtuozzo.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>pull/73/head
committed by
Markus Armbruster
11 changed files with 35 additions and 30 deletions
@ -1 +0,0 @@ |
|||
tests/qapi-schema/flat-union-incomplete-branch.json:6: Union 'TestUnion' data missing 'value2' branch |
|||
@ -1 +0,0 @@ |
|||
1 |
|||
@ -1,9 +0,0 @@ |
|||
# we require all branches of the union to be covered |
|||
{ 'enum': 'TestEnum', |
|||
'data': [ 'value1', 'value2' ] } |
|||
{ 'struct': 'TestTypeA', |
|||
'data': { 'string': 'str' } } |
|||
{ 'union': 'TestUnion', |
|||
'base': { 'type': 'TestEnum' }, |
|||
'discriminator': 'type', |
|||
'data': { 'value1': 'TestTypeA' } } |
|||
Loading…
Reference in new issue