Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Hint when the expected type is wrapped in a ref #2319
This PR add an hint suggesting to use the
let a = ref 0 let b = a + 1
This PR is based on top of #2313
A meta-comment: in your testsuite entries, it would be nice if you could include a comment in each case describing what you are trying and what is the behavior you expect. Otherwise it's hard to understand why, in a certain case, there is no hint (is this a bug? a not-implemented-yet-feature? a known limitation of the approach? a case where it's good to not hint?).
References are entirely defined in the standard library. It feels wrong to special-case them in the typechecker, from an architectural standpoint. The same can be said about #2307 (int and float operators are not "known" to the typechecker) but it was hastily merged before I could make that remark.
I think this approach is misguided. This kind of error explanations should be declared in the standard library, perhaps as annotations, using some generic mechanism for explanations to be implemented in the typechecker. Not unlike the way Menhir handles user-defined error messages for specific parsing errors.
Can we please have a discussion and vote on caml-devel?
Sure, let's have a discussion. Personally I think that, to a common
(For the record, I think that the