Skip to content

Commit 2875e51

Browse files
committed
[ocaml-gen] prevent multiple declaration of same custom type
1 parent aef71a7 commit 2875e51

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

ocaml/ocaml-gen/derive/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ pub fn derive_ocaml_custom(item: TokenStream) -> TokenStream {
674674
if new_type {
675675
let ty_name = rename.unwrap_or(#ocaml_name);
676676
let ty_id = <Self as ::ocaml_gen::OCamlDesc>::unique_id();
677-
env.new_custom_type(ty_id, ty_name);
677+
env.new_type(ty_id, ty_name);
678678
}
679679

680680
let name = <Self as ::ocaml_gen::OCamlDesc>::ocaml_desc(env, &[]);

ocaml/ocaml-gen/src/lib.rs

-6
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ impl Env {
4444
};
4545
}
4646

47-
/// Declares a new custom type. Unlike [new_type] this can be called several times with the same type.
48-
pub fn new_custom_type(&mut self, ty: u128, name: &'static str) {
49-
self.locations
50-
.insert(ty, (self.current_module.clone(), name));
51-
}
52-
5347
/// retrieves a type that was declared previously
5448
pub fn get_type(&self, ty: u128, name: &str) -> String {
5549
let (type_path, type_name) = self.locations.get(&ty).expect(&format!(

0 commit comments

Comments
 (0)