summaryrefslogtreecommitdiff
path: root/typing/types.ml
diff options
context:
space:
mode:
authorLeo White <leo@lpw25.net>2019-03-14 16:45:27 +0000
committerLeo White <leo@lpw25.net>2021-07-13 17:30:53 +0100
commit1aa65fa9679fcc252c2f7646586e263e0809662e (patch)
tree3e6fa9e64ba270069eb040f5cda4c6eb430baa3f /typing/types.ml
parent013717de96f1699dcae882e9dd23c43265072373 (diff)
downloadocaml-1aa65fa9679fcc252c2f7646586e263e0809662e.tar.gz
Give more precise errors for virtual methods
Previously, the check that a non-virtual class did not have virtual methods was delayed until the last stage of type-checking the class. Now we do those checks more eagerly allowing for clearer errors, especially in common cases.
Diffstat (limited to 'typing/types.ml')
-rw-r--r--typing/types.ml9
1 files changed, 7 insertions, 2 deletions
diff --git a/typing/types.ml b/typing/types.ml
index 8443a770dd..1ec8f5d48f 100644
--- a/typing/types.ml
+++ b/typing/types.ml
@@ -153,13 +153,18 @@ and value_kind =
| Val_prim of Primitive.description (* Primitive *)
| Val_ivar of mutable_flag * string (* Instance variable (mutable ?) *)
| Val_self of
- (Ident.t * private_flag * virtual_flag * type_expr) Meths.t ref *
+ self_var_kind *
(Ident.t * mutable_flag * virtual_flag * type_expr) Vars.t *
- string * type_expr
+ string
(* Self *)
| Val_anc of (string * Ident.t) list * string
(* Ancestor *)
+and self_var_kind =
+ | Self_concrete of (Ident.t * private_flag * virtual_flag * type_expr) Meths.t
+ | Self_virtual of
+ (Ident.t * private_flag * virtual_flag * type_expr) Meths.t ref * type_expr
+
(* Variance *)
module Variance = struct