Open lukaszcz opened 4 days ago
I think the problem is that in the assignment element := f element
, the element
on the rhs refers to the element
on the lhs and not to the element
bound in the node@{element; left; right}
pattern.
I remember we agreed to only bind the name of the field as a recursive function if it had at least one argument. But now I can't find the issue for that
Yes, right, I didn't think of that. The issue is here: https://github.com/anoma/juvix/issues/2968. I think we should prioritize it, because it is really confusing. Even though I "know" that this is recursive, I didn't notice and the error message was not very helpful.
Typechecking
gives
One would expect the type of the node being created to be correctly inferred as
Tree B
. It seems that type inference for some reason decides it should beTree A
.Note that the following type-checks:
So the problem is with type inference for the record creation syntax.