Re: [PATCH v3 07/16] qapi/expr.py: Add casts in a few select cases

2021-02-25 Thread John Snow
On 2/25/21 7:07 AM, Markus Armbruster wrote: Unfortunately, the "check" in check_exprs falls off almost immediately. What do you mean by "falls off"? mypy loses the constraint in its static analysis. i.e. all of the work we do in expr.py is almost entirely opaque to mypy.

Re: [PATCH v3 07/16] qapi/expr.py: Add casts in a few select cases

2021-02-25 Thread Markus Armbruster
John Snow writes: > On 2/24/21 7:32 AM, Markus Armbruster wrote: >> John Snow writes: >> >>> Casts are instructions to the type checker only, they aren't "safe" and >>> should probably be avoided in general. In this case, when we perform >>> type checking on a nested structure, the type of each

Re: [PATCH v3 07/16] qapi/expr.py: Add casts in a few select cases

2021-02-24 Thread John Snow
On 2/24/21 7:32 AM, Markus Armbruster wrote: John Snow writes: Casts are instructions to the type checker only, they aren't "safe" and should probably be avoided in general. In this case, when we perform type checking on a nested structure, the type of each field does not "stick". We don't ne

Re: [PATCH v3 07/16] qapi/expr.py: Add casts in a few select cases

2021-02-24 Thread Markus Armbruster
John Snow writes: > Casts are instructions to the type checker only, they aren't "safe" and > should probably be avoided in general. In this case, when we perform > type checking on a nested structure, the type of each field does not > "stick". > > We don't need to assert that something is a str

[PATCH v3 07/16] qapi/expr.py: Add casts in a few select cases

2021-02-22 Thread John Snow
Casts are instructions to the type checker only, they aren't "safe" and should probably be avoided in general. In this case, when we perform type checking on a nested structure, the type of each field does not "stick". We don't need to assert that something is a str if we've already checked that i