This must always be QAPISchemaObjectTypeMember, and we do check and
enforce this -- but because the seen dict is invariant and check methods
need to operate in terms of a more abstract type, we need to tell the
type system to believe us.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qapi/schema.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index 62b1a7e890..57343a1002 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -17,6 +17,7 @@
import os
import re
from collections import OrderedDict
+from typing import cast, List
from .common import c_name, POINTER_SUFFIX
from .error import QAPISourceError, QAPISemError
@@ -391,7 +392,10 @@ def check(self, schema):
for m in self.local_members:
m.check(schema)
m.check_clash(self.info, seen)
- members = seen.values()
+
+ # check_clash is abstract, but local_members is asserted to be
+ # Sequence[QAPISchemaObjectTypeMember]. Cast to the narrower type.
+ members = cast(List[QAPISchemaObjectTypeMember], list(seen.values()))
if self.variants:
self.variants.check(schema, seen)
--
2.26.2