b86b05ed60
Since line info is remembered as QAPISchema.line now, this patch uses it as additional info for every expr in QAPISchema inside qapi.py, then improves error message with it in checking of exprs. For common union the patch will check whether base is a valid complex type if specified. For flat union it will check whether base presents, whether discriminator is found in base, whether the key of every branch is correct when discriminator is an enum type. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
18 lines
382 B
JSON
18 lines
382 B
JSON
{ 'enum': 'TestEnum',
|
|
'data': [ 'value1', 'value2' ] }
|
|
|
|
{ 'type': 'TestBase',
|
|
'data': { 'enum1': 'TestEnum' } }
|
|
|
|
{ 'type': 'TestTypeA',
|
|
'data': { 'string': 'str' } }
|
|
|
|
{ 'type': 'TestTypeB',
|
|
'data': { 'integer': 'int' } }
|
|
|
|
{ 'union': 'TestUnion',
|
|
'base': 'TestBase',
|
|
'discriminator': 'enum1',
|
|
'data': { 'value_wrong': 'TestTypeA',
|
|
'value2': 'TestTypeB' } }
|