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
moduleM=structtypet = A | Bendclassa=objectmethodf=M.Aendclassb=objectinherit a
method! f =Bend
What happens ?
Class b get translated into:
classb=objectinherit a
method! f =Landmark.enter __generated_landmark;
let r =tryBwithe -> (Landmark.exit __generated_landmark; Landmark.raise e) inLandmark.exit __generated_landmark;
r
end
which triggers "Error: Unbound constructor B" because the typechecker does not know at this point that the B has the same type as the method's returned type.
Proposed Solution
We could add type annotations ("'a") to guide the inference (we have to make sure that 'a is fresh of course).
classb=objectinherit a
method! f : 'a =Landmark.enter __generated_landmark;
let r =try (B : 'a) withe -> (Landmark.exit __generated_landmark; Landmark.raise e) inLandmark.exit __generated_landmark;
r
end
If there's an annotation on the returned type we probably should copy it around the body in a similar fashion.
The text was updated successfully, but these errors were encountered:
How to reproduce:
Run the ppx in automatic mode on :
What happens ?
Class b get translated into:
which triggers "Error: Unbound constructor B" because the typechecker does not know at this point that the B has the same type as the method's returned type.
Proposed Solution
We could add type annotations ("'a") to guide the inference (we have to make sure that 'a is fresh of course).
If there's an annotation on the returned type we probably should copy it around the body in a similar fashion.
The text was updated successfully, but these errors were encountered: