@@ -34,6 +34,8 @@ module TypeError = struct
3434 | ReturningFnExpectedNonReturningFound of string
3535 | ReturningFnExpectedNonFnFound of string
3636 | ReturningFnExpectedUndeclaredIdentFound of string
37+ | ReturningFnExpectedUndeclaredDistSuffixFound of string * string
38+ | ReturningFnExpectedWrongDistSuffixFound of string * string
3739 | NonReturningFnExpectedReturningFound of string
3840 | NonReturningFnExpectedNonFnFound of string
3941 | NonReturningFnExpectedUndeclaredIdentFound of string
@@ -163,6 +165,22 @@ module TypeError = struct
163165 " A returning function was expected but an undeclared identifier \
164166 '%s' was supplied."
165167 fn_name
168+ | ReturningFnExpectedUndeclaredDistSuffixFound (prefix , suffix ) ->
169+ Fmt. pf ppf " Function '%s_%s' is not implemented for distribution '%s'."
170+ prefix suffix prefix
171+ | ReturningFnExpectedWrongDistSuffixFound (prefix , suffix ) ->
172+ let newsuffix =
173+ match suffix with
174+ | "lpdf" -> " lpmf"
175+ | "lupdf" -> " lupmf"
176+ | "lpmf" -> " lpdf"
177+ | "lupmf" -> " lupdf"
178+ | _ -> raise_s [% message " This should never happen." ]
179+ in
180+ Fmt. pf ppf
181+ " Function '%s_%s' is not implemented for distribution '%s', use \
182+ '%s_%s' instead."
183+ prefix suffix prefix prefix newsuffix
166184 | NonReturningFnExpectedUndeclaredIdentFound fn_name ->
167185 Fmt. pf ppf
168186 " A non-returning function was expected but an undeclared identifier \
@@ -487,6 +505,16 @@ let returning_fn_expected_nonfn_found loc name =
487505let returning_fn_expected_undeclaredident_found loc name =
488506 TypeError (loc, TypeError. ReturningFnExpectedUndeclaredIdentFound name)
489507
508+ let returning_fn_expected_undeclared_dist_suffix_found loc (prefix , suffix ) =
509+ TypeError
510+ ( loc
511+ , TypeError. ReturningFnExpectedUndeclaredDistSuffixFound (prefix, suffix)
512+ )
513+
514+ let returning_fn_expected_wrong_dist_suffix_found loc (prefix , suffix ) =
515+ TypeError
516+ (loc, TypeError. ReturningFnExpectedWrongDistSuffixFound (prefix, suffix))
517+
490518let nonreturning_fn_expected_returning_found loc name =
491519 TypeError (loc, TypeError. NonReturningFnExpectedReturningFound name)
492520
0 commit comments