Closed ericzhang6222 closed 4 years ago
According to sysl2/sysl/tests/union.sysl
in #170, the right syntax is
Test:
!type A: ...
!type B: ...
!type C: ...
!union U:
A
B
C
@ChloePlanet Is it by design that aliases don't support primitive types or is it a bug? Could aliases support primitive types:
!alias StringInt:
string
int
It's an implementation gap. We should support unions of any type, including aliases and direct primitives:
!union StringInt:
string
int
Avro to Sysl transformation is depending on this issue, change priority to P0 to fix ASAP.
This fix also needs to support sequences and sets:
!union StringSequenceAddressSet:
sequence of string
set of Address
Description
As https://sysl.io/docs/lang-spec/#union
!union string, int32
should work, but it can't actually.Steps to Reproduce
Simple: !type User: id <: string ping <: StringOrInt32
$ sysl datamodel -j Project -d demo.sysl line 20:11 mismatched input 'string' expecting {TEXT_LINE, Name, E_Name} ERRO[0000] demo.sysl has syntax errors
!union StringOrInt32: a b
!alias a: string !alias b: int32