There's more conditionals in here than we can reasonably pack into a
terse little statement, so break it apart into something more explicit.

(When would a built-in array ever cause a QAPISemError? I don't know,
maybe never - but the type system wasn't happy all the same.)

Signed-off-by: John Snow <js...@redhat.com>
---
 scripts/qapi/schema.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index 462acb2bb61..164d86c4064 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -384,9 +384,16 @@ def need_has_if_optional(self):
 
     def check(self, schema):
         super().check(schema)
+
+        if self.info:
+            assert self.info.defn_meta  # guaranteed to be set by expr.py
+            what = self.info.defn_meta
+        else:
+            what = 'built-in array'
+
         self._element_type = schema.resolve_type(
-            self._element_type_name, self.info,
-            self.info and self.info.defn_meta)
+            self._element_type_name, self.info, what
+        )
         assert not isinstance(self.element_type, QAPISchemaArrayType)
 
     def set_module(self, schema):
-- 
2.41.0


Reply via email to