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

Inner module signature annotated functions are broken #474

Closed
chrischen opened this issue Nov 13, 2020 · 0 comments · Fixed by #475
Closed

Inner module signature annotated functions are broken #474

chrischen opened this issue Nov 13, 2020 · 0 comments · Fixed by #475

Comments

@chrischen
Copy link

chrischen commented Nov 13, 2020

module Test: {
  /* include (module type of Test_Types); */

	[@genType]
	let make: string => string; // Broken

	[@genType.as "make3"]
	let make2: string => string; // Broken
} = {
  /* include Test_Types; */

	let make = (_) => "test";
	let make2 = (_) => "test";
};

[@genType]
let makeTest = Test.make; // Works - also a viable workaround for those looking

This is the corresponding generated code:

export const Test_make: (_1:string) => string = MyModuleBS.Test.Test; // Broken - should be MyModuleBS.Test.make

export const Test_make3: (_1:string) => string = MyModuleBS.Test.Test; // Broken - should be MyModuleBS.Test.make2

export const makeTest: (_1:string) => string = MyModuleBS.makeTest; // Works

// I'm not sure why this also gets generated, but this becomes broken if we rename one of the functions to "make3"
export const Test: { make3: (_1:string) => string; make: (_1:string) => string } = MyModuleBS.Test

// probably should be = { make3: MyModuleBS.Test.make2, make: MyModuleBS.Test.make };

If I throw in a module include statement such as in the pattern for de-duplicating repeated types between interfaces and implementation, another weird behavior surfaces.


module Test_Types = {

  module TestSubModule = {
    type t = {
      content: string,
    };
  };
};
module Test: {
        include (module type of Test_Types);

	[@genType]
	let make: string => string; // Broken

	[@genType.as "make3"]
	let make2: string => string; // Broken
} = {
        include Test_Types;

	let make = (_) => "test";
	let make2 = (_) => "test";
};

Somehow "TestSubModule" works its way into the generated output despite never being used.

export const Test_make: (_1:string) => string = MyModuleBS.Test.TestSubModule;
export const Test_make3: (_1:string) => string = MyModuleBS.Test.TestSubModule;
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant