Skip to content

Properly error when trying to UnionΒ #240

@saulshanabrook

Description

@saulshanabrook

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions