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

Inner module signature annotated functions are broken #474

Closed

Description

@chrischen
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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions