Skip to content

[%import] extension not recognized with OCaml 5.4.0 (master pinned) #105

@a2line

Description

@a2line

Hi,

I'm testing OCaml 5.4.0 compatibility for the Geneweb project and encountering an issue after pinning ppx_import to master (commit e7ff301 with PR #100).

Environment:

  • OCaml version: 5.4.0
  • ppx_import: git+https://github.com/ocaml-ppx/ppx_import.git#master
  • Works fine on OCaml 4.08 through 5.3.0

Error:

File "lib/show/def_show.ml", line 1, characters 14-20:
1 | type date = [%import: Def.date] [@@deriving show { with_path = false }]
                  ^^^^^^
Error: Uninterpreted extension 'import'.

Code that fails (lib/show/def_show.ml):

type date = [%import: Def.date] [@@deriving show { with_path = false }]
and calendar = [%import: Def.calendar] [@@deriving show { with_path = false }]
and dmy = [%import: Def.dmy] [@@deriving show { with_path = false }]
and dmy2 = [%import: Def.dmy2] [@@deriving show { with_path = false }]
and precision = [%import: Def.precision] [@@deriving show { with_path = false }]

type cdate = Adef.cdate

let pp_cdate fmt x =
  match Date.od_of_cdate x with
  | Some d -> pp_date fmt d
  | None -> Format.fprintf fmt "None"

type relation_kind = [%import: Def.relation_kind]
[@@deriving show { with_path = false }]

(* ... more similar patterns *)

Dune file:

(library
 (name geneweb_def_show)
 (preprocess (staged_pps ppx_import ppx_deriving.show))
 (public_name geneweb.def_show)
 (libraries geneweb_def geneweb_db)
 (modules def_show)
 (wrapped false))

The pattern is: use [%import] to copy type definitions from other modules, then derive show for them. This works perfectly on OCaml ≤ 5.3.0.

Is there something I should adjust for 5.4.0 compatibility, or is this a known issue? Happy to provide more context if needed!

Thanks for your work on OCaml 5.4.0 support!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions