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
roc nightly pre-release, built from commit e5ea6dc4617 on Mon May 13 10:47:45 UTC 2024
In certain circumstances, default value records do not work as expected:
i = Num.toI321# f1 is all finef1 = \{ a, b ? "DEFAULT" } -> (a < i, b)
expect f1 { a: 1 } == (Bool.false, "DEFAULT")
expect f1 { a: 1, b: "foo" } == (Bool.false, "foo")
# for f2, the first expect does not compile if the second expect exists# unless the record parameter is openf2 : { a : I32, b ? Str } -> (Bool, Str)
f2 = \{ a, b ? "DEFAULT" } -> (a < i, b)
expect f2 { a: 1 } == (Bool.false, "DEFAULT")
expect f2 { a: 1, b: "foo" } == (Bool.false, "foo")
results in:
── TYPE MISMATCH in Test.roc ───────────────────────────────────────────────────
This 1st argument to f2 has an unexpected type:
21│ expect f2 { a: 1 } == (Bool.false, "DEFAULT")
^^^^^^^^
The argument is a record of type:
{ … }
But f2 needs its 1st argument to be:
{ b : Str, … }
Tip: Looks like the b field is missing.
────────────────────────────────────────────────────────────────────────────────
If the type annotation is changed to an open record, it compiles:
roc nightly pre-release, built from commit e5ea6dc4617 on Mon May 13 10:47:45 UTC 2024
In certain circumstances, default value records do not work as expected:
results in:
If the type annotation is changed to an open record, it compiles:
Zulip topic.
The text was updated successfully, but these errors were encountered: