You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Python][Bug]: Matching against multiple union cases in OR pattern returns none #4649
I have the following issue where I have a discriminate union and a function containing a match expression where matching against two of the three union cases should call the same expressionr. I expect the atLeastMid function to return True both for BestCase and MidCase. But for BestCase it returns none in python transpiled code.
The Python match generator was dropping the wildcard case _: when the default branch shared a target with an explicit case, which left the union tag only reachable via the default (BestCase here) unmatched — so it returned None. The PR always emits the wildcard default and instead drops the redundant explicit cases that route to it.
Activity
dbrattli commentedon Jun 12, 2026
Thanks for the clear repro! Fixed in #4653.
The Python match generator was dropping the wildcard
case _:when the default branch shared a target with an explicit case, which left the union tag only reachable via the default (BestCasehere) unmatched — so it returnedNone. The PR always emits the wildcard default and instead drops the redundant explicit cases that route to it.fix(python): emit wildcard default for union or-patterns (#4649) (#4653)