Module Frontend.SignatureMismatch

type type_mismatch = private
  1. | DataOnlyError
  2. | TypeMismatch of Middle.UnsizedType.t * Middle.UnsizedType.t * details option
and details = private
  1. | SuffixMismatch of unit Middle.Fun_kind.suffix * unit Middle.Fun_kind.suffix
  2. | ReturnTypeMismatch of Middle.UnsizedType.returntype * Middle.UnsizedType.returntype
  3. | InputMismatch of function_mismatch
and function_mismatch = private
  1. | ArgError of int * type_mismatch
  2. | ArgNumMismatch of int * int
type ('unique, 'error) generic_match_result =
  1. | UniqueMatch of 'unique
  2. | AmbiguousMatch of (Middle.UnsizedType.returntype * (Middle.UnsizedType.autodifftype * Middle.UnsizedType.t) list) list
  3. | SignatureErrors of 'error

The match result for general (non-variadic) functions

val check_of_same_type_mod_conv : Middle.UnsizedType.t -> Middle.UnsizedType.t -> (Promotion.t, type_mismatch) Core.result
val check_compatible_arguments_mod_conv : (Middle.UnsizedType.autodifftype * Middle.UnsizedType.t) list -> (Middle.UnsizedType.autodifftype * Middle.UnsizedType.t) list -> (Promotion.t list, function_mismatch) Core.result
val unique_minimum_promotion : ('a * Promotion.t list) list -> ('a * Promotion.t list, 'a list option) Core.result
val matching_function : Environment.t -> string -> (Middle.UnsizedType.autodifftype * Middle.UnsizedType.t) list -> match_result

Searches for a function of the given name which can support the required argument types. Requires a unique minimum option under type promotion

val matching_stanlib_function : string -> (Middle.UnsizedType.autodifftype * Middle.UnsizedType.t) list -> match_result

Same as matching_function but requires specifically that the function be from StanMath (uses Environment.stan_math_environment)

Check variadic function arguments. If a match is found, returns Ok of the function type and a list of promotions (see promote) If none is found, returns Error of the list of args and a function_mismatch.

val pp_signature_mismatch : Stdlib.Format.formatter -> (string * Middle.UnsizedType.t list * (((Middle.UnsizedType.returntype * (Middle.UnsizedType.autodifftype * Middle.UnsizedType.t) list) * function_mismatch) list * bool)) -> unit
val pp_math_lib_assignmentoperator_sigs : Stdlib.Format.formatter -> (Middle.UnsizedType.t * Middle.Operator.t) -> unit
val compare_errors : function_mismatch -> function_mismatch -> int
val compare_match_results : match_result -> match_result -> int