Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Fix name of functions emitted when an inner signature is annotated.
Browse files Browse the repository at this point in the history
Fixes  #474.
  • Loading branch information
cristianoc committed Nov 17, 2020
1 parent 3f07db3 commit 3dfd4b5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# master
- Fix conversion for nested variants from bs-platform 8 onwards.
- Fix name of functions emitted when an inner signature is annotated (see https://github.com/reason-association/genType/issues/474).

# 3.38.0
- Add missing support for annotations in inner module signatures (e.g. `module M : { ... } = { ... }`). See https://github.com/reason-association/genType/issues/469.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ const InnerModuleSignatureBS = require('./InnerModuleSignature.bs');
// tslint:disable-next-line:interface-over-type-literal
export type InnerModule_t = string;

export const InnerModule_make: (_1:InnerModule_t) => string = InnerModuleSignatureBS.InnerModule.InnerModule;
export const InnerModule_make: (_1:InnerModule_t) => string = InnerModuleSignatureBS.InnerModule.make;

export const InnerModule: { make: (_1:InnerModule_t) => string } = InnerModuleSignatureBS.InnerModule
11 changes: 8 additions & 3 deletions src/TranslateSignatureFromTypes.re
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,14 @@ and translateSignatureItemFromTypes =
);

| Types.Sig_value(id, {val_attributes, val_loc, val_type}) =>
let name = id |> Ident.name;
if (Debug.translation^) {
Log_.item("Translate Sig Value %s\n", name);
};
let moduleItem = moduleItemGen |> Runtime.newModuleItem(~name);
typeEnv |> TypeEnv.updateModuleItem(~nameOpt=Some(name), ~moduleItem);
if (val_attributes |> Annotation.fromAttributes(~loc=val_loc) == GenType) {
id
|> Ident.name
name
|> Translation.translateValue(
~attributes=val_attributes,
~config,
Expand All @@ -135,7 +140,7 @@ and translateSignatureItemFromTypes =
);
} else {
Translation.empty;
}
};
| Types.Sig_typext(_) =>
logNotImplemented("Sig_typext " ++ __LOC__);
Translation.empty;
Expand Down

0 comments on commit 3dfd4b5

Please sign in to comment.