qapi: Move context-sensitive checking to the proper place
commitfa110c6a9e6c0ae0ce2d4bcf5771cdb8c3e53a7e
authorMarkus Armbruster <armbru@redhat.com>
Fri, 27 Sep 2019 13:46:29 +0000 (27 15:46 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Sat, 28 Sep 2019 15:17:19 +0000 (28 17:17 +0200)
tree6f9a4338cdd579a82e4144a0b04eabce8b7ae5e3
parent77daece3d95dc7edaa5982fbbfd7afe3bc4121ac
qapi: Move context-sensitive checking to the proper place

When we introduced the QAPISchema intermediate representation (commit
ac88219a6c7), we took a shortcut: we left check_exprs() & friends
alone instead of moving semantic checks into the
QAPISchemaFOO.check().  The .check() assert check_exprs() did its job.

Time to finish the conversion job.  Move exactly the context-sensitive
checks to the .check().  They replace assertions there.  Context-free
checks stay put.

Fixes the misleading optional tag error demonstrated by test
flat-union-optional-discriminator.

A few other error message improve.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-17-armbru@redhat.com>
40 files changed:
scripts/qapi/common.py
tests/qapi-schema/alternate-any.err
tests/qapi-schema/alternate-conflict-bool-string.err
tests/qapi-schema/alternate-conflict-dict.err
tests/qapi-schema/alternate-conflict-enum-bool.err
tests/qapi-schema/alternate-conflict-enum-int.err
tests/qapi-schema/alternate-conflict-num-string.err
tests/qapi-schema/alternate-conflict-string.err
tests/qapi-schema/alternate-nested.err
tests/qapi-schema/alternate-unknown.err
tests/qapi-schema/args-alternate.err
tests/qapi-schema/args-any.err
tests/qapi-schema/args-array-unknown.err
tests/qapi-schema/args-boxed-string.err
tests/qapi-schema/args-int.err
tests/qapi-schema/args-member-unknown.err
tests/qapi-schema/args-union.err
tests/qapi-schema/args-unknown.err
tests/qapi-schema/bad-base.err
tests/qapi-schema/command-int.err
tests/qapi-schema/flat-union-base-any.err
tests/qapi-schema/flat-union-base-union.err
tests/qapi-schema/flat-union-discriminator-bad-name.err
tests/qapi-schema/flat-union-discriminator-bad-name.json
tests/qapi-schema/flat-union-empty.err
tests/qapi-schema/flat-union-int-branch.err
tests/qapi-schema/flat-union-invalid-branch-key.err
tests/qapi-schema/flat-union-invalid-if-discriminator.err
tests/qapi-schema/flat-union-optional-discriminator.err
tests/qapi-schema/flat-union-optional-discriminator.json
tests/qapi-schema/flat-union-string-discriminator.err
tests/qapi-schema/redefined-builtin.err
tests/qapi-schema/redefined-type.err
tests/qapi-schema/returns-alternate.err
tests/qapi-schema/returns-unknown.err
tests/qapi-schema/returns-whitelist.err
tests/qapi-schema/union-empty.err
tests/qapi-schema/union-invalid-base.err
tests/qapi-schema/union-unknown.err
tests/qapi-schema/union-unknown.json