From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ztbf9-000727-VY for qemu-devel@nongnu.org; Tue, 03 Nov 2015 08:30:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ztbf5-00027u-US for qemu-devel@nongnu.org; Tue, 03 Nov 2015 08:30:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52394) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ztbf5-00026r-OE for qemu-devel@nongnu.org; Tue, 03 Nov 2015 08:30:07 -0500 References: <1446052473-19170-1-git-send-email-eblake@redhat.com> <1446052473-19170-8-git-send-email-eblake@redhat.com> <871tc8tnsl.fsf@blackfin.pond.sub.org> <5637D470.5040203@redhat.com> <878u6fldnp.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <5638B6DD.2050600@redhat.com> Date: Tue, 3 Nov 2015 06:30:05 -0700 MIME-Version: 1.0 In-Reply-To: <878u6fldnp.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="I0VlibrXHgdO4NIEV7qQnhaTDkaGbAFQC" Subject: Re: [Qemu-devel] [PATCH v8 07/17] qapi: Rework collision assertions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --I0VlibrXHgdO4NIEV7qQnhaTDkaGbAFQC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/03/2015 12:56 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> On 11/02/2015 08:37 AM, Markus Armbruster wrote: >> >>> >>> Not checked: variant's members don't collide with non-variant members= =2E >>> I think this check got lost when we simplified >>> QAPISchemaObjectTypeVariants to hold a single member. >> >> Yep, I found the culprit: in your v2 proposal for QAPISchema, you had:= >> >> +class QAPISchemaObjectTypeVariant(QAPISchemaObjectTypeMember): >> + def __init__(self, name, typ, flat): >> + QAPISchemaObjectTypeMember.__init__(self, name, typ, False) >> + assert isinstance(flat, bool) >> + self.flat =3D flat >> + def check(self, schema, tag_type, seen): >> + QAPISchemaObjectTypeMember.check(self, schema, [], seen) >> + assert self.name in tag_type.values >> + if self.flat: >> + self.type.check(schema) >> + assert isinstance(self.type, QAPISchemaObjectType) >> >> https://lists.gnu.org/archive/html/qemu-devel/2015-07/msg00394.html >> >> but the 'if self.flat' clause was lost in v3: >> >> https://lists.gnu.org/archive/html/qemu-devel/2015-08/msg00450.html >=20 > Quoting v3's change log: >=20 > - Lower simple variants to flat ones as described on > qapi-code-gen.txt. Replace QAPISchemaObjectType's .flat by > .simple_union_type(), for use by pre-existing code-generation > warts. >=20 >> I am in fact reinstating it here, but for v9, will do it in a separate= >> patch rather than blended in with the rest of the changes. >=20 > Any "is this union flat or simple" check signals a flaw. It's either a= > pointless difference in generated code (these should all be marked TODO= > by now), or something's wrong with the desugaring of simple to flat > unions. Losing 'if self.flat' was correct, but we still need 'if union'; and that's what I add in 2/4. >=20 > Therefore, the if self.flat is superfluous. Good, because otherwise ou= r > desugaring must be flawed. And things correctly work on simple unions due to our wrapper type, so that 'if union' was sufficient. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --I0VlibrXHgdO4NIEV7qQnhaTDkaGbAFQC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWOLbdAAoJEKeha0olJ0Nq3PIIAK2093QnPB/HV736emLz1JQf CWLf+6L/oppeLkkLi+kD8lkUFmN0b1Ui1uHl6UHvpsoBacCvFWmslZAcY9YzP0VE E79o84b6PiITJFOJm9i/+L9qaI5MXKp64pJgZj66MeCNe0c/8XElgWGqsx4topSc g37uXZPhMxxjtMxGBlk8Cu7qniBuMglv1+cuRbwX2/GYu1Uc2pA5Ji9CPbyWHsfY 84x/dZBYsfko5m7xCqbD/YOI98vt0JMUnDvS4r919znPIgtQNcqD6rFEa9Xetmpl jbi+kV8NGkfApcS4YAVYB3Tgm12hqXqEPv18oq/ZSs8oz3B+WqLTmGEYgiCZcOY= =qnFh -----END PGP SIGNATURE----- --I0VlibrXHgdO4NIEV7qQnhaTDkaGbAFQC--