-
-
Notifications
You must be signed in to change notification settings - Fork 130
Closed
Labels
Milestone
Description
For a data type defined as
data Name(x="x default", y="y default")
we should compile
Name(got_x) = Name(1)
Name(y=got_y) = Name(y=10)
Name() = Name()
to the equivalent of
Name(got_x, y="y default") = Name(1)
Name(y=got_y, x="x default") = Name(y=10)
Name(x="x default", y="y default") = Name()
probably by looking up the defaults on a __match_defaults__, though note that we'll only be able to do this for data patterns, not class patterns, so as to keep consistency with Python.
Additionally, this will let us pattern-match Expected in the expected way:
Expected(x) = Expected(10)
assert x == 10
Expected(error=err) = Expected(error=some_err)
assert err is some_err