summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--parsing/parsetree.mli4
-rw-r--r--typing/typeclass.ml5
2 files changed, 8 insertions, 1 deletions
diff --git a/parsing/parsetree.mli b/parsing/parsetree.mli
index 8a4841c25..654fadcb8 100644
--- a/parsing/parsetree.mli
+++ b/parsing/parsetree.mli
@@ -297,7 +297,9 @@ and expression_desc =
(* lazy E *)
| Pexp_poly of expression * core_type option
(* Used for method bodies.
- TODO: this must probably be cleaned up. *)
+
+ Can only be used as the expression under Cfk_concrete
+ for methods (not values). *)
| Pexp_object of class_structure
(* object ... end *)
| Pexp_newtype of string * expression
diff --git a/typing/typeclass.ml b/typing/typeclass.ml
index a1d17c280..96fa5c6b1 100644
--- a/typing/typeclass.ml
+++ b/typing/typeclass.ml
@@ -608,6 +608,11 @@ let rec class_field self_loc cl_num self_type meths vars
concr_meths, warn_vals, inher)
| Pcf_method (lab, priv, Cfk_concrete (ovf, expr)) ->
+ let expr =
+ match expr.pexp_desc with
+ | Pexp_poly _ -> expr
+ | _ -> Ast_helper.Exp.poly ~loc:expr.pexp_loc expr None
+ in
if Concr.mem lab.txt concr_meths then begin
if ovf = Fresh then
Location.prerr_warning loc (Warnings.Method_override [lab.txt])