Open jiribenes opened 10 months ago
I think there are a few different issues here. The first error message is indeed confusing.
However, the second message is expected: you are passing f1
which has capture m1
to the operation which requires an empty capture set.
On a high level: I deeply understand the motivation of avoiding box in the API but I think it's not possible this way.
Maybe we can make it more lightweight by changing syntax somehow
On a high level: I deeply understand the motivation of avoiding box in the API but I think it's not possible this way.
I thought so, but I still wanted to report the confusing error message — dealing with boxing and captures is difficult already.
Update: the error is slightly different now (unfortunately still unhelpful though...)
Update: Current error on 0.3.0:
This issue popped up again, on 0.9.0, the following code:
record Container(eqz: Int => Bool at {})
def empty { eqz: Int => Bool }: Container =
Container(box { eqz })
reports "Expected identifier" on the very last character (the closing paren) which is extremely unhelpful :(
The motivation is wrapping a block into a box in order to facilitate a nicer API. (using
orElse { ... } { ... }
instead oforElse(box { ... }, box { ... }
). I don't quite know whether this is just a bad error message or if it's an actual bug in Typer:Here's the offending code:
which returns the following unhelpful message:
If I just ANF it, I get the same message. When I remove the braces, I get a different error:
returns: