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

Properly error when trying to Union #240

Open
saulshanabrook opened this issue Dec 5, 2024 · 0 comments
Open

Properly error when trying to Union #240

saulshanabrook opened this issue Dec 5, 2024 · 0 comments

Comments

@saulshanabrook
Copy link
Member

Add a helpful error message when trying to use a union of two eqsorts as a type.

This should error:

from typing import TypeAlias, Union
from egglog import *

class A(Expr):
    def __init__(self) -> None: ...

class B(Expr):
    def __init__(self) -> None: ...

CustomLike: TypeAlias = Union[A, B]

class C(Expr):
    def __init__(self, some_input: CustomLike) -> None: ...

a = A()
b = B()

C(a) # ok
C(b) # not ok... :(

https://egraphs.zulipchat.com/#narrow/channel/375765-egg.2Fegglog/topic/multiple.20sort.20inputs.20.28via.20Union.29.3F/near/484334683

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