|
@@ -762,14 +762,23 @@ let save_class_state ctx t = match t with
|
|
|
(* PASS 2 begin *)
|
|
|
|
|
|
let is_removable_class c =
|
|
|
- c.cl_kind = KGeneric &&
|
|
|
- (Meta.has Meta.Remove c.cl_meta ||
|
|
|
- List.exists (fun (_,t) -> match follow t with
|
|
|
- | TInst(c,_) ->
|
|
|
- Codegen.has_ctor_constraint c
|
|
|
- | _ ->
|
|
|
- false
|
|
|
- ) c.cl_params)
|
|
|
+ match c.cl_kind with
|
|
|
+ | KGeneric ->
|
|
|
+ (Meta.has Meta.Remove c.cl_meta ||
|
|
|
+ (match c.cl_super with
|
|
|
+ | Some ({cl_kind = KTypeParameter _},_) -> true
|
|
|
+ | _ -> false) ||
|
|
|
+ List.exists (fun (_,t) -> match follow t with
|
|
|
+ | TInst(c,_) ->
|
|
|
+ Codegen.has_ctor_constraint c
|
|
|
+ | _ ->
|
|
|
+ false
|
|
|
+ ) c.cl_params)
|
|
|
+ | KTypeParameter _ ->
|
|
|
+ (* this shouldn't happen, have to investigate (see #4092) *)
|
|
|
+ true
|
|
|
+ | _ ->
|
|
|
+ false
|
|
|
|
|
|
let remove_generic_base ctx t = match t with
|
|
|
| TClassDecl c when is_removable_class c ->
|