Skip to content

Since 5.2, ocaml rejects some recursive type definitions involving polymorphic variants and object rows. #13501

@garrigue

Description

@garrigue

The following snippet was accepted until 5.1, but is rejected since 5.2.

module type ET = sig type exp end
(* The recursive operations on our our types *)
module type E = sig
  include ET
  val eval : (string * exp) list -> exp -> exp
  val fv : exp -> string list
end
module VarT = struct  type exp = [`Var of string] end
module LamT = struct
  (* Define types using only one parameter for recursion; *)
  (* actual types are then extracted through the constraint *)
  type 'a exp = [VarT.exp | `Abs of string * 'e | `App of 'e * 'e]
  constraint 'a = <exp:'e;..>
end

(* Signature for parameters to the language construction functor *)
module type LamS = sig
  (* Close the recursion creating row-abstract types *)
  type exp0 = private [> a LamT.exp]
  and a = <exp:exp0>
  include E with type exp = exp0
end

This code is part of one of my solutions to the expression problem: https://www.math.nagoya-u.ac.jp/~garrigue/papers/mixmod5.ml.txt.

The culprit is commit a84586d, coming from PR #12180 by myself. Will have to look into it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions