From 65fbe125451da9421070ab03944c9600a264eefc Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 31 Aug 2015 15:37:42 +0200 Subject: [PATCH] qapi: Drop one of two "simple union must not have base" checks The first check ensures the second one can't trigger. Drop the first one, because the second one is in a more logical place, and emits a nicer error message. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- scripts/qapi.py | 8 -------- tests/qapi-schema/union-base-no-discriminator.err | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index 23c32fe3dd..197db77a9f 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -526,14 +526,6 @@ def check_union(expr, expr_info): members = expr['data'] values = { 'MAX': '(automatic)' } - # If the object has a member 'base', its value must name a struct, - # and there must be a discriminator. - if base is not None: - if discriminator is None: - raise QAPIExprError(expr_info, - "Union '%s' requires a discriminator to go " - "along with base" %name) - # Two types of unions, determined by discriminator. # With no discriminator it is a simple union. diff --git a/tests/qapi-schema/union-base-no-discriminator.err b/tests/qapi-schema/union-base-no-discriminator.err index fc8b79c459..8b7a24260f 100644 --- a/tests/qapi-schema/union-base-no-discriminator.err +++ b/tests/qapi-schema/union-base-no-discriminator.err @@ -1 +1 @@ -tests/qapi-schema/union-base-no-discriminator.json:11: Union 'TestUnion' requires a discriminator to go along with base +tests/qapi-schema/union-base-no-discriminator.json:11: Simple union 'TestUnion' must not have a base