Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing rules on recursive types #6754

Open
ABuffSeagull opened this issue May 16, 2024 · 0 comments
Open

Confusing rules on recursive types #6754

ABuffSeagull opened this issue May 16, 2024 · 0 comments

Comments

@ABuffSeagull
Copy link
Contributor

Not sure if it's a bug or design decision, but I'm confused as to why one of these works, but the other doesn't.

Children : [Empty, Text Str, Elements (List Element)]

# (1) Doesn't work
Element : {
    tag : Str,
    attributes : List Attribute,
    children : Children,
}

# (2) Works
Element : [
    Element
        {
            tag : Str,
            attributes : List Attribute,
            children : Children,
        },
]

With the error being:

Recursion in aliases is only allowed if recursion happens behind a
tagged union, at least one variant of which is not recursive

I would imagine (1) would still work, since the recursion seems to happen behind Children, which is a tagged union.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant