@@ -463,11 +463,6 @@ let inline files =
463463
464464
465465let inline_type_abbrevs files =
466- let gc_map = Helpers. build_map files (fun map -> function
467- | DType (lid , flags , _ , _ ) when List. mem GcType flags -> Hashtbl. add map lid ()
468- | _ -> ()
469- ) in
470-
471466 let map = Helpers. build_map files (fun map -> function
472467 | DType (lid , _ , _ , Abbrev t ) -> Hashtbl. add map lid (White , t)
473468 | _ -> ()
@@ -493,31 +488,21 @@ let inline_type_abbrevs files =
493488 * type pair a b = Tuple (1, 0)
494489 * breaks this invariant. *)
495490 filter_decls (function
496- | DType (lid , flags , n , Abbrev def ) ->
497- begin match def with
498- | TApp (hd, args)
499- when List. assoc_opt (hd, args) ! NamingHints. hints = None &&
500- not (Hashtbl. mem gc_map hd) ->
501- (* Don't use a type abbreviation towards a to-be-GC'd type as a
502- * hint, because there will be a mismatch later on with a * being
503- * added. This is mosly for backwards-compat with miTLS having
504- * hand-written code in mitlsffi.c. *)
505- NamingHints. (hints := ((hd, args), lid) :: ! hints);
506- (* Never leave the abbreviation in the program otherwise there will
507- * be two types with the same name, the abbreviation and the
508- * monomorphized one. *)
509- None
510- | TTuple args when List. assoc_opt (Monomorphization. tuple_lid, args) ! NamingHints. hints = None ->
511- NamingHints. (hints := ((Monomorphization. tuple_lid, args), lid) :: ! hints);
512- None
513- | _ ->
514- if n = 0 then
515- Some (DType (lid, flags, n, Abbrev def))
516- else
517- (* A type definition with parameters is not something we'll be able to
518- * generate code for (at the moment). So, drop it. *)
519- None
520- end
491+ | DType (_ , _ , n , Abbrev def ) as d ->
492+ let in_hints = match def with
493+ | TApp (hd , args ) ->
494+ List. assoc_opt (hd, args) ! NamingHints. hints <> None
495+ | TTuple args ->
496+ List. assoc_opt (tuple_lid, args) ! NamingHints. hints <> None
497+ | _ ->
498+ false
499+ in
500+ if in_hints then
501+ None
502+ else if n > 0 then
503+ None
504+ else
505+ Some d
521506
522507 | d ->
523508 Some d
0 commit comments