spicy
spicy copied to clipboard
Presence of type alias causes ambiguity in generated code
The mere presence of a type alias can lead to ambiguities in generated code which cause compilation to fail, e.g.,
module foo;
public type A = unit {
: uint8;
};
public type B = A; # PRESENCE OF THIS LINE TRIGGERS THE ERROR.
$ spicyc -dj foo.spicy
[error] foo.spicy:3:17-5:2: ID 'foo::A::parse1' is ambiguous
[error] foo.spicy:3:17-5:2: ID 'foo::A::parse2' is ambiguous
[error] foo.spicy:3:17-5:2: ID 'foo::A::parse3' is ambiguous
[error] foo.spicy:3:17-5:2: ID 'spicy_rt::waitForInput' is ambiguous
[error] foo.spicy:3:17-5:2: unknown ID 'self'
[error] spicyc: aborting after errors
The only workaround for now seems to be to not use a type alias in case it causes such errors.
This error occurs regardless of whether the type A or the alias B are public or not.