Skip to content

Commit

Permalink
Do not try to debug module bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukstafi committed Jul 7, 2024
1 parent 0645844 commit 025f960
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 72 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
## [1.5.1] -- 2024-07-04
## [1.5.1] -- 2024-07-07

### Changed

- Outputs entry ids on the stack when reporting static vs. dynamic scope mismatch failure.
- Promotes `val snapshot : unit -> unit` to the generic interface, implemented as no-op in the flushing backend.
- Does not try to debug module bindings.

## [1.5.0] -- 2024-03-20

Expand Down
17 changes: 14 additions & 3 deletions ppx_minidebug.ml
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,16 @@ let rec pick ~typ ?alt_typ () =
| _ -> typ)
| _ -> typ

let rec has_unprintable_type typ =
match typ.ptyp_desc with
| Ptyp_alias (typ, _) | Ptyp_poly (_, typ) -> has_unprintable_type typ
| Ptyp_any | Ptyp_var _ | Ptyp_package _ | Ptyp_extension _ -> true
| Ptyp_arrow (_, arg, ret) ->
(* TODO: maybe add Ptyp_object, Ptyp_class? *)
has_unprintable_type arg || has_unprintable_type ret
| Ptyp_tuple args | Ptyp_constr (_, args) -> List.exists has_unprintable_type args
| _ -> false

let bound_patterns ~alt_typ pat =
let rec loop ?alt_typ pat =
let loc = pat.ppat_loc in
Expand All @@ -422,8 +432,8 @@ let bound_patterns ~alt_typ pat =
| _ -> (alt_typ, pat)
in
match (typ, pat) with
| ( Some { ptyp_desc = Ptyp_any | Ptyp_var _ | Ptyp_package _ | Ptyp_extension _; _ },
{ ppat_desc = Ppat_var _ | Ppat_alias (_, _); _ } ) ->
| Some t, { ppat_desc = Ppat_var _ | Ppat_alias (_, _); _ }
when has_unprintable_type t ->
(* Skip abstract types and types unlikely to have derivable printers. *)
(A.ppat_any ~loc, [])
| Some typ, ({ ppat_desc = Ppat_var descr_loc | Ppat_alias (_, descr_loc); _ } as pat)
Expand Down Expand Up @@ -936,7 +946,8 @@ let extract_type ?default ~alt_typ exp =
[%type: [%t typ] Lazy.t]
with Not_transforming -> (
match typ with Some typ -> typ | None -> raise Not_transforming))
| Some { ptyp_desc = Ptyp_any | Ptyp_var _ | Ptyp_extension _; _ }, _ ->
| Some { ptyp_desc = Ptyp_any | Ptyp_var _ | Ptyp_package _ | Ptyp_extension _; _ }, _
->
raise Not_transforming
| Some typ, _ -> typ
| None, _ when use_default ->
Expand Down
Loading

0 comments on commit 025f960

Please sign in to comment.