@@ -113,18 +113,12 @@ let verify_identifier id : unit =
113113 " Variable name 'jacobian' will be a reserved word starting in Stan 2.38. \
114114 Please rename it!" ;
115115 if id.name = ! model_name then
116- Semantic_error. ident_is_model_name id.id_loc id.name |> error
117- else if
116+ Semantic_error. ident_is_model_name id.id_loc id.name |> error;
117+ if
118118 String. is_suffix id.name ~suffix: " __"
119119 || List. mem reserved_keywords id.name ~equal: String. equal
120120 then Semantic_error. ident_is_keyword id.id_loc id.name |> error
121121
122- let distribution_name_variants name =
123- match Utils. split_distribution_suffix name with
124- | Some (stem , "lpmf" ) -> [name; stem ^ " _lpdf" ]
125- | Some (stem , "lpdf" ) -> [name; stem ^ " _lpmf" ]
126- | _ -> [name]
127-
128122(* * verify that the variable being declared is previous unused.
129123 allowed to shadow StanLib *)
130124let verify_name_fresh_var loc tenv name =
@@ -160,10 +154,8 @@ let verify_name_fresh_udf loc tenv name =
160154 - is not already in use (for now)
161155*)
162156let verify_name_fresh tenv id ~is_udf =
163- let f =
164- if is_udf then verify_name_fresh_udf id.id_loc tenv
165- else verify_name_fresh_var id.id_loc tenv in
166- List. iter ~f (distribution_name_variants id.name)
157+ if is_udf then verify_name_fresh_udf id.id_loc tenv id.name
158+ else verify_name_fresh_var id.id_loc tenv id.name
167159
168160let is_of_compatible_return_type rt1 srt2 =
169161 UnsizedType. (
@@ -513,10 +505,10 @@ let check_normal_fn ~is_cond_dist loc tenv id es =
513505 let is_known_family s =
514506 List. mem known_families s ~equal: String. equal in
515507 match suffix with
516- | ("lpmf" | "lumpf " ) when Env. mem tenv (prefix ^ " _lpdf" ) ->
508+ | ("lpmf" | "lupmf " ) when Env. mem tenv (prefix ^ " _lpdf" ) ->
517509 Semantic_error. returning_fn_expected_wrong_dist_suffix_found loc
518510 (prefix, suffix)
519- | ("lpdf" | "lumdf " ) when Env. mem tenv (prefix ^ " _lpmf" ) ->
511+ | ("lpdf" | "lupdf " ) when Env. mem tenv (prefix ^ " _lpmf" ) ->
520512 Semantic_error. returning_fn_expected_wrong_dist_suffix_found loc
521513 (prefix, suffix)
522514 | _ ->
@@ -1692,9 +1684,7 @@ and check_var_decl loc cf tenv sized_ty trans
16921684
16931685(* function definitions *)
16941686and exists_matching_fn_declared tenv id arg_tys rt =
1695- let options =
1696- List. concat_map ~f: (Env. find tenv) (distribution_name_variants id.name)
1697- in
1687+ let options = Env. find tenv id.name in
16981688 let f = function
16991689 | Env. {kind= `UserDeclared _; type_= UFun (listedtypes, rt', _, _)}
17001690 when arg_tys = listedtypes && rt = rt' ->
@@ -1703,9 +1693,7 @@ and exists_matching_fn_declared tenv id arg_tys rt =
17031693 List. exists ~f options
17041694
17051695and verify_unique_signature tenv loc id arg_tys rt =
1706- let existing =
1707- List. concat_map ~f: (Env. find tenv) (distribution_name_variants id.name)
1708- in
1696+ let existing = Env. find tenv id.name in
17091697 let same_args = function
17101698 | Env. {type_= UFun (listedtypes, _, _, _); _}
17111699 when List. map ~f: snd arg_tys = List. map ~f: snd listedtypes ->
0 commit comments