[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/19] qapi/schema: assert QAPISchemaVariants are QAPISchemaObjec
|
From: |
John Snow |
|
Subject: |
[PATCH 14/19] qapi/schema: assert QAPISchemaVariants are QAPISchemaObjectType |
|
Date: |
Wed, 15 Nov 2023 20:43:45 -0500 |
I'm actually not too sure about this one, it seems to hold up at runtime
but instead of lying and coming up with an elaborate ruse as a commit
message I'm just going to admit I just cribbed my own notes from the
last time I typed schema.py and I no longer remember why or if this is
correct.
Cool!
With more seriousness, variants are only guaranteed to house a
QAPISchemaType as per the definition of QAPISchemaObjectTypeMember but
the only classes/types that have a check_clash method are descendents of
QAPISchemaMember and the QAPISchemaVariants class itself.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qapi/schema.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index 476b19aed61..ce5b01b3182 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -717,6 +717,7 @@ def check_clash(self, info, seen):
for v in self.variants:
# Reset seen map for each variant, since qapi names from one
# branch do not affect another branch
+ assert isinstance(v.type, QAPISchemaObjectType) # I think, anyway?
v.type.check_clash(info, dict(seen))
--
2.41.0
- Re: [PATCH 05/19] qapi/schema: make c_type() and json_type() abstract methods, (continued)
[PATCH 09/19] qapi/schema: assert info is present when necessary, John Snow, 2023/11/15
[PATCH 11/19] qapi/schema: fix QAPISchemaArrayType.check's call to resolve_type, John Snow, 2023/11/15
[PATCH 14/19] qapi/schema: assert QAPISchemaVariants are QAPISchemaObjectType,
John Snow <=
[PATCH 13/19] qapi/schema: fix typing for QAPISchemaVariants.tag_member, John Snow, 2023/11/15
[PATCH 17/19] qapi/schema: turn on mypy strictness, John Snow, 2023/11/15
[PATCH 19/19] qapi/schema: refactor entity lookup helpers, John Snow, 2023/11/15
[PATCH 18/19] qapi/schema: remove unnecessary asserts, John Snow, 2023/11/15
[PATCH 15/19] qapi/parser: demote QAPIExpression to Dict[str, Any], John Snow, 2023/11/15