[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
qapi-schema esotera
From: |
John Snow |
Subject: |
qapi-schema esotera |
Date: |
Mon, 3 Aug 2020 12:49:38 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
UNION is split into two primary forms:
1. Simple (No discriminator nor base)
2. Flat (Discriminator and base)
In expr.py, I notice that we modify the perceived type of the 'type'
expression based on the two union forms.
1a. Simple unions allow Array[T]
1b. Flat unions disallow Array[T]
From the docs:
Syntax:
UNION = { 'union': STRING,
'data': BRANCHES,
'*if': COND,
'*features': FEATURES }
| { 'union': STRING,
'data': BRANCHES,
'base': ( MEMBERS | STRING ),
'discriminator': STRING,
'*if': COND,
'*features': FEATURES }
BRANCHES = { BRANCH, ... }
BRANCH = STRING : TYPE-REF
| STRING : { 'type': TYPE-REF, '*if': COND }
Both arms use the same "BRANCHES" grammar production, which both use
TYPE-REF.
TYPE-REF = STRING | ARRAY-TYPE
ARRAY-TYPE = [ STRING ]
Implying that List[T] should be allowed for both productions.
Can I ask for a ruling from the judges?
--js
- qapi-schema esotera,
John Snow <=