jon.recoil.org

Module Typemode

module Jkind = Btype.Jkind0
type 'a modes = {
  1. mode_modes : 'a;
  2. mode_desc : Mode.Alloc.atom Location.loc list;
}
type modalities = {
  1. moda_modalities : Mode.Modality.Const.t;
  2. moda_desc : Mode.Modality.atom Location.loc list;
}
val transl_mode_annots : Parsetree.modes -> Mode.Alloc.Const.Option.t modes

Interpret mode syntax as mode annotation, where axes can be left unspecified

val untransl_mode : _ modes -> Parsetree.modes
val transl_alloc_mode : Parsetree.modes -> Mode.Alloc.Const.t modes

Interpret mode syntax as alloc mode (on arrow types), where axes are set to legacy if unspecified

Interpret mode syntax as modalities. Modalities occuring at different places requires different levels of maturity. Also takes the mutability and attributes on the field and insert mutable-implied modalities accordingly.

val least_modalities : include_implied:bool -> mut:Types.mutability -> Mode.Modality.Const.t -> Mode.Modality.atom list

Find the minimum modality annots a user must write to express the given modality. If include_implied is false, modalities implied by other written modalities are included, even if not necessary.

val sort_dedup_modalities : Mode.Modality.atom list -> Mode.Modality.atom list
val mutable_modalities : Types.mutability -> Mode.Modality.Const.t

Get the default modalities implied by the mutability of a field.

val transl_modalities_with_default : maturity:Language_extension.maturity -> default:Mode.Modality.Const.t -> Parsetree.modalities -> modalities

Similar to transl_modalities but takes an explicit default modality instead of computing it from mutability. Used when merging explicit modalities with existing signature default modalities.

val let_mutable_modalities : Mode.Modality.Const.t
val atomic_mutable_modalities : Mode.Modality.Const.t

The (default) modalities for an atomic mutable field

val untransl_modalities : modalities -> Parsetree.modalities
val transl_with_bound_modifiers : Parsetree.modalities -> Mode.Modality.Const.t * Jkind_axis.Externality.t option

Interpret modality syntax in with-bound context. Returns the modal modality and the externality modifier (if any).

Interpret a mod-bounds.

val untransl_mod_bounds : ?verbose:bool -> Jkind.Mod_bounds.t -> Parsetree.modes

Translate an algebraic representation of mod bounds into user syntax. If verbose is true, redundant annotations are included.

val idx_expected_modalities : mut:bool -> Mode.Modality.Const.t