qapi: Move context-sensitive checking to the proper place

When we introduced the QAPISchema intermediate representation (commit
ac88219a6c), 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>
This commit is contained in:
Markus Armbruster
2019-09-28 17:17:19 +02:00
parent 77daece3d9
commit fa110c6a9e
40 changed files with 230 additions and 270 deletions
+193 -231
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/alternate-any.json: In alternate 'Alt':
tests/qapi-schema/alternate-any.json:2: alternate 'Alt' member 'one' cannot use type 'any'
tests/qapi-schema/alternate-any.json:2: branch 'one' cannot use built-in type 'any'
@@ -1,2 +1,2 @@
tests/qapi-schema/alternate-conflict-bool-string.json: In alternate 'Alt':
tests/qapi-schema/alternate-conflict-bool-string.json:2: alternate 'Alt' member 'two' can't be distinguished from member 'one'
tests/qapi-schema/alternate-conflict-bool-string.json:2: branch 'two' can't be distinguished from 'one'
@@ -1,2 +1,2 @@
tests/qapi-schema/alternate-conflict-dict.json: In alternate 'Alt':
tests/qapi-schema/alternate-conflict-dict.json:6: alternate 'Alt' member 'two' can't be distinguished from member 'one'
tests/qapi-schema/alternate-conflict-dict.json:6: branch 'two' can't be distinguished from 'one'
@@ -1,2 +1,2 @@
tests/qapi-schema/alternate-conflict-enum-bool.json: In alternate 'Alt':
tests/qapi-schema/alternate-conflict-enum-bool.json:4: alternate 'Alt' member 'two' can't be distinguished from member 'one'
tests/qapi-schema/alternate-conflict-enum-bool.json:4: branch 'two' can't be distinguished from 'one'
@@ -1,2 +1,2 @@
tests/qapi-schema/alternate-conflict-enum-int.json: In alternate 'Alt':
tests/qapi-schema/alternate-conflict-enum-int.json:4: alternate 'Alt' member 'two' can't be distinguished from member 'one'
tests/qapi-schema/alternate-conflict-enum-int.json:4: branch 'two' can't be distinguished from 'one'
@@ -1,2 +1,2 @@
tests/qapi-schema/alternate-conflict-num-string.json: In alternate 'Alt':
tests/qapi-schema/alternate-conflict-num-string.json:2: alternate 'Alt' member 'two' can't be distinguished from member 'one'
tests/qapi-schema/alternate-conflict-num-string.json:2: branch 'two' can't be distinguished from 'one'
@@ -1,2 +1,2 @@
tests/qapi-schema/alternate-conflict-string.json: In alternate 'Alt':
tests/qapi-schema/alternate-conflict-string.json:2: alternate 'Alt' member 'two' can't be distinguished from member 'one'
tests/qapi-schema/alternate-conflict-string.json:2: branch 'two' can't be distinguished from 'one'
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/alternate-nested.json: In alternate 'Alt2':
tests/qapi-schema/alternate-nested.json:4: member 'nested' of alternate 'Alt2' cannot use alternate type 'Alt1'
tests/qapi-schema/alternate-nested.json:4: branch 'nested' cannot use alternate type 'Alt1'
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/alternate-unknown.json: In alternate 'Alt':
tests/qapi-schema/alternate-unknown.json:2: member 'unknown' of alternate 'Alt' uses unknown type 'MissingType'
tests/qapi-schema/alternate-unknown.json:2: branch 'unknown' uses unknown type 'MissingType'
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/args-alternate.json: In command 'oops':
tests/qapi-schema/args-alternate.json:3: 'data' for command 'oops' cannot use alternate type 'Alt'
tests/qapi-schema/args-alternate.json:3: command's 'data' cannot take alternate type 'Alt'
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/args-any.json: In command 'oops':
tests/qapi-schema/args-any.json:2: 'data' for command 'oops' cannot use built-in type 'any'
tests/qapi-schema/args-any.json:2: command's 'data' cannot take built-in type 'any'
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/args-array-unknown.json: In command 'oops':
tests/qapi-schema/args-array-unknown.json:2: member 'array' of 'data' for command 'oops' uses unknown type 'NoSuchType'
tests/qapi-schema/args-array-unknown.json:2: command uses unknown type 'NoSuchType'
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/args-boxed-string.json: In command 'foo':
tests/qapi-schema/args-boxed-string.json:2: 'data' for command 'foo' cannot use built-in type 'str'
tests/qapi-schema/args-boxed-string.json:2: command's 'data' cannot take built-in type 'str'
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/args-int.json: In command 'oops':
tests/qapi-schema/args-int.json:2: 'data' for command 'oops' cannot use built-in type 'int'
tests/qapi-schema/args-int.json:2: command's 'data' cannot take built-in type 'int'
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/args-member-unknown.json: In command 'oops':
tests/qapi-schema/args-member-unknown.json:2: member 'member' of 'data' for command 'oops' uses unknown type 'NoSuchType'
tests/qapi-schema/args-member-unknown.json:2: parameter 'member' uses unknown type 'NoSuchType'
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/args-union.json: In command 'oops':
tests/qapi-schema/args-union.json:3: 'data' for command 'oops' cannot use union type 'Uni'
tests/qapi-schema/args-union.json:3: command's 'data' can take union type 'Uni' only with 'boxed': true
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/args-unknown.json: In command 'oops':
tests/qapi-schema/args-unknown.json:2: 'data' for command 'oops' uses unknown type 'NoSuchType'
tests/qapi-schema/args-unknown.json:2: command's 'data' uses unknown type 'NoSuchType'
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/bad-base.json: In struct 'MyType':
tests/qapi-schema/bad-base.json:3: 'base' for struct 'MyType' cannot use union type 'Union'
tests/qapi-schema/bad-base.json:3: 'base' requires a struct type, union type 'Union' isn't
+1 -1
View File
@@ -1,2 +1,2 @@
tests/qapi-schema/command-int.json: In command 'int':
tests/qapi-schema/command-int.json:2: built-in 'int' is already defined
tests/qapi-schema/command-int.json:2: built-in type 'int' is already defined

Some files were not shown because too many files have changed in this diff Show More