spicy icon indicating copy to clipboard operation
spicy copied to clipboard

Presence of type alias causes ambiguity in generated code

Open bbannier opened this issue 2 years ago • 1 comments

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.

bbannier avatar Aug 07 '23 09:08 bbannier

This error occurs regardless of whether the type A or the alias B are public or not.

bbannier avatar Aug 10 '23 05:08 bbannier