) => unit = "test"
+
+describe(__MODULE__, () => {
+ test("nested make values are read through flat exports", () => {
+ eq(__LOC__, Flat_make_export_use.top, "top")
+ eq(__LOC__, Flat_make_export_use.one, "one")
+ eq(__LOC__, Flat_make_export_use.two, "two")
+ eq(__LOC__, Flat_make_export_use.three, "three")
+ })
+
+ test("other values keep their module path", () => {
+ eq(__LOC__, Flat_make_export_use.oneKeep, "one-keep")
+ eq(__LOC__, Flat_make_export_use.twoKeep, "two-inner-keep")
+ eq(__LOC__, Flat_make_export_use.threeKeep, "three-deep-keep")
+ eq(__LOC__, Flat_make_export_use.exoticValue, "exotic-value")
+ })
+
+ test("flat names follow the signature, not the implementation", () => {
+ eq(__LOC__, Flat_make_export_use.nested, "nested")
+ eq(__LOC__, Flat_make_export_use.recursive, "recursive")
+ eq(__LOC__, Flat_make_export_use.coerced, "coerced")
+ eq(__LOC__, Flat_make_export_use.rebound->Option.map(f => f()), Some("rebound"))
+ eq(__LOC__, Flat_make_export_use.applied, "applied")
+ eq(__LOC__, Flat_make_export_use.included, "one")
+ eq(__LOC__, Flat_make_export_use.aliased, "one")
+ })
+
+ test("re-exported modules read the flat exports", () => {
+ eq(__LOC__, Flat_make_export_use.reexported, "two")
+ eq(__LOC__, Flat_make_export_use.reexportedDeep, "three")
+ })
+
+ testAsync("awaited modules read the flat exports", async () => {
+ eq(__LOC__, await Flat_make_export_use.awaited(), ("two", "three"))
+ })
+
+ test("a binding hidden by the interface does not clash", () => {
+ eq(__LOC__, Flat_make_export_use.hidden, 1)
+ eq(__LOC__, Flat_make_export_use.hiddenBoth, 3)
+ })
+})
diff --git a/tests/tests/src/flat_make_export_use.mjs b/tests/tests/src/flat_make_export_use.mjs
new file mode 100644
index 00000000000..997d19d8bae
--- /dev/null
+++ b/tests/tests/src/flat_make_export_use.mjs
@@ -0,0 +1,75 @@
+// Generated by ReScript, PLEASE EDIT WITH CARE
+
+import * as Flat_make_export from "./flat_make_export.mjs";
+import * as Flat_make_export_hidden from "./flat_make_export_hidden.mjs";
+import * as Flat_make_export_reexport from "./flat_make_export_reexport.mjs";
+
+let top = Flat_make_export.make();
+
+let one = Flat_make_export.One$make();
+
+let oneKeep = Flat_make_export.One.keep();
+
+let two = Flat_make_export.Two$Inner$make();
+
+let twoKeep = Flat_make_export.Two.Inner.keep();
+
+let three = Flat_make_export.Three$Inner$Deep$make();
+
+let threeKeep = Flat_make_export.Three.Inner.Deep.keep();
+
+let nested = Flat_make_export.Ambiguous$B$make();
+
+let exoticValue = Flat_make_export.Ambiguous.B$make();
+
+let recursive = Flat_make_export.RecursiveA$make();
+
+let coerced = Flat_make_export.Coerced$make();
+
+let rebound = Flat_make_export.Rebound$make;
+
+let applied = Flat_make_export.Applied$make();
+
+let included = Flat_make_export.Included$make();
+
+let aliased = Flat_make_export.One$make();
+
+let hidden = Flat_make_export_hidden.A$B$make();
+
+let hiddenBoth = Flat_make_export_hidden.both();
+
+let reexported = Flat_make_export_reexport.Inner$make();
+
+let reexportedDeep = Flat_make_export_reexport.Deep$Deep$make();
+
+async function awaited() {
+ let Lib = await import("./flat_make_export.mjs");
+ return [
+ Lib.Two$Inner$make(),
+ Lib.Three$Inner$Deep$make()
+ ];
+}
+
+export {
+ top,
+ one,
+ oneKeep,
+ two,
+ twoKeep,
+ three,
+ threeKeep,
+ nested,
+ exoticValue,
+ recursive,
+ coerced,
+ rebound,
+ applied,
+ included,
+ aliased,
+ hidden,
+ hiddenBoth,
+ reexported,
+ reexportedDeep,
+ awaited,
+}
+/* top Not a pure module */
diff --git a/tests/tests/src/flat_make_export_use.res b/tests/tests/src/flat_make_export_use.res
new file mode 100644
index 00000000000..0ec7ec2c131
--- /dev/null
+++ b/tests/tests/src/flat_make_export_use.res
@@ -0,0 +1,29 @@
+let top = Flat_make_export.make()
+
+let one = Flat_make_export.One.make()
+let oneKeep = Flat_make_export.One.keep()
+
+let two = Flat_make_export.Two.Inner.make()
+let twoKeep = Flat_make_export.Two.Inner.keep()
+
+let three = Flat_make_export.Three.Inner.Deep.make()
+let threeKeep = Flat_make_export.Three.Inner.Deep.keep()
+
+let nested = Flat_make_export.Ambiguous.B.make()
+let exoticValue = Flat_make_export.Ambiguous.\"B$make"()
+let recursive = Flat_make_export.RecursiveA.make()
+let coerced = Flat_make_export.Coerced.make()
+let rebound = Flat_make_export.Rebound.make
+let applied = Flat_make_export.Applied.make()
+let included = Flat_make_export.Included.make()
+let aliased = Flat_make_export.Aliased.make()
+let hidden = Flat_make_export_hidden.A.B.make()
+let hiddenBoth = Flat_make_export_hidden.both()
+let reexported = Flat_make_export_reexport.Inner.make()
+let reexportedDeep = Flat_make_export_reexport.Deep.Deep.make()
+
+let awaited = async () => {
+ module Lib = await Flat_make_export
+ module Inner = Lib.Three.Inner
+ (Lib.Two.Inner.make(), Inner.Deep.make())
+}
diff --git a/tests/tests/src/gpr_3519_jsx_test.mjs b/tests/tests/src/gpr_3519_jsx_test.mjs
index d6404300952..b8b75e73937 100644
--- a/tests/tests/src/gpr_3519_jsx_test.mjs
+++ b/tests/tests/src/gpr_3519_jsx_test.mjs
@@ -13,8 +13,11 @@ let Foo = {
make: make
};
+let Foo$make = make;
+
export {
React,
Foo,
+ Foo$make,
}
/* No side effect */
diff --git a/tests/tests/src/gpr_5071_test.mjs b/tests/tests/src/gpr_5071_test.mjs
index 5e390c146ca..11ca4970c4e 100644
--- a/tests/tests/src/gpr_5071_test.mjs
+++ b/tests/tests/src/gpr_5071_test.mjs
@@ -13,7 +13,10 @@ let H = {
make: make
};
+let H$make = make;
+
export {
H,
+ H$make,
}
/* No side effect */
diff --git a/tests/tests/src/hoisted_function_attr_test.mjs b/tests/tests/src/hoisted_function_attr_test.mjs
deleted file mode 100644
index 94f44dc7bef..00000000000
--- a/tests/tests/src/hoisted_function_attr_test.mjs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Generated by ReScript, PLEASE EDIT WITH CARE
-
-import * as Mocha from "mocha";
-import * as Test_utils from "./test_utils.mjs";
-import * as Hoisted_function_attr_use from "./hoisted_function_attr_use.mjs";
-
-Mocha.describe("Hoisted_function_attr_test", () => {
- Mocha.test("flat cross-module exports", () => {
- Test_utils.eq("File \"hoisted_function_attr_test.res\", line 6, characters 7-14", Hoisted_function_attr_use.one, "one");
- Test_utils.eq("File \"hoisted_function_attr_test.res\", line 7, characters 7-14", Hoisted_function_attr_use.two, "two");
- Test_utils.eq("File \"hoisted_function_attr_test.res\", line 8, characters 7-14", Hoisted_function_attr_use.three, "three");
- });
- Mocha.test("exotic identifiers", () => {
- Test_utils.eq("File \"hoisted_function_attr_test.res\", line 12, characters 7-14", Hoisted_function_attr_use.keyword, "keyword");
- Test_utils.eq("File \"hoisted_function_attr_test.res\", line 13, characters 7-14", Hoisted_function_attr_use.dollar, "dollar");
- Test_utils.eq("File \"hoisted_function_attr_test.res\", line 14, characters 7-14", Hoisted_function_attr_use.operator, "operator");
- });
- Mocha.test("structurally distinct paths", () => {
- Test_utils.eq("File \"hoisted_function_attr_test.res\", line 18, characters 7-14", Hoisted_function_attr_use.nested, "nested");
- Test_utils.eq("File \"hoisted_function_attr_test.res\", line 19, characters 7-14", Hoisted_function_attr_use.exoticPath, "exotic");
- });
- Mocha.test("recursive modules", () => Test_utils.eq("File \"hoisted_function_attr_test.res\", line 23, characters 7-14", Hoisted_function_attr_use.recursive, "recursive"));
- Mocha.test("explicit function type annotations", () => Test_utils.eq("File \"hoisted_function_attr_test.res\", line 27, characters 7-14", Hoisted_function_attr_use.typed, "typed"));
- Mocha.test("signature coercion preserves hoists", () => Test_utils.eq("File \"hoisted_function_attr_test.res\", line 31, characters 7-14", Hoisted_function_attr_use.coerced, "coerced"));
- Mocha.test("includes and aliases do not create additional hoists", () => {
- Test_utils.eq("File \"hoisted_function_attr_test.res\", line 35, characters 7-14", Hoisted_function_attr_use.included, "one");
- Test_utils.eq("File \"hoisted_function_attr_test.res\", line 36, characters 7-14", Hoisted_function_attr_use.aliased, "one");
- });
-});
-
-/* Not a pure module */
diff --git a/tests/tests/src/hoisted_function_attr_test.res b/tests/tests/src/hoisted_function_attr_test.res
deleted file mode 100644
index e5e3212bfdb..00000000000
--- a/tests/tests/src/hoisted_function_attr_test.res
+++ /dev/null
@@ -1,38 +0,0 @@
-open Mocha
-open Test_utils
-
-describe(__MODULE__, () => {
- test("flat cross-module exports", () => {
- eq(__LOC__, Hoisted_function_attr_use.one, "one")
- eq(__LOC__, Hoisted_function_attr_use.two, "two")
- eq(__LOC__, Hoisted_function_attr_use.three, "three")
- })
-
- test("exotic identifiers", () => {
- eq(__LOC__, Hoisted_function_attr_use.keyword, "keyword")
- eq(__LOC__, Hoisted_function_attr_use.dollar, "dollar")
- eq(__LOC__, Hoisted_function_attr_use.operator, "operator")
- })
-
- test("structurally distinct paths", () => {
- eq(__LOC__, Hoisted_function_attr_use.nested, "nested")
- eq(__LOC__, Hoisted_function_attr_use.exoticPath, "exotic")
- })
-
- test("recursive modules", () => {
- eq(__LOC__, Hoisted_function_attr_use.recursive, "recursive")
- })
-
- test("explicit function type annotations", () => {
- eq(__LOC__, Hoisted_function_attr_use.typed, "typed")
- })
-
- test("signature coercion preserves hoists", () => {
- eq(__LOC__, Hoisted_function_attr_use.coerced, "coerced")
- })
-
- test("includes and aliases do not create additional hoists", () => {
- eq(__LOC__, Hoisted_function_attr_use.included, "one")
- eq(__LOC__, Hoisted_function_attr_use.aliased, "one")
- })
-})
diff --git a/tests/tests/src/hoisted_function_attr_use.mjs b/tests/tests/src/hoisted_function_attr_use.mjs
deleted file mode 100644
index 979b2062421..00000000000
--- a/tests/tests/src/hoisted_function_attr_use.mjs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Generated by ReScript, PLEASE EDIT WITH CARE
-
-import * as Hoisted_function_attr from "./hoisted_function_attr.mjs";
-
-let one = Hoisted_function_attr.One$make();
-
-let oneKeep = Hoisted_function_attr.One.keep();
-
-let two = Hoisted_function_attr.Two$Inner$make();
-
-let twoKeep = Hoisted_function_attr.Two.Inner.keep();
-
-let three = Hoisted_function_attr.Three$Inner$Deep$make();
-
-let threeKeep = Hoisted_function_attr.Three.Inner.Deep.keep();
-
-let keyword = Hoisted_function_attr.Escaped$switch();
-
-let dollar = Hoisted_function_attr.Escaped$$plus();
-
-let operator = Hoisted_function_attr.Operator$$plus();
-
-let nested = Hoisted_function_attr.Ambiguous$B$make();
-
-let exoticPath = Hoisted_function_attr.Ambiguous.B$make();
-
-let recursive = Hoisted_function_attr.RecursiveA$make();
-
-let typed = Hoisted_function_attr.Typed$make();
-
-let coerced = Hoisted_function_attr.Coerced$make();
-
-let included = Hoisted_function_attr.Included.make();
-
-let aliased = Hoisted_function_attr.One$make();
-
-export {
- one,
- oneKeep,
- two,
- twoKeep,
- three,
- threeKeep,
- keyword,
- dollar,
- operator,
- nested,
- exoticPath,
- recursive,
- typed,
- coerced,
- included,
- aliased,
-}
-/* one Not a pure module */
diff --git a/tests/tests/src/hoisted_function_attr_use.res b/tests/tests/src/hoisted_function_attr_use.res
deleted file mode 100644
index 6e2f7643145..00000000000
--- a/tests/tests/src/hoisted_function_attr_use.res
+++ /dev/null
@@ -1,20 +0,0 @@
-let one = Hoisted_function_attr.One.make()
-let oneKeep = Hoisted_function_attr.One.keep()
-
-let two = Hoisted_function_attr.Two.Inner.make()
-let twoKeep = Hoisted_function_attr.Two.Inner.keep()
-
-let three = Hoisted_function_attr.Three.Inner.Deep.make()
-let threeKeep = Hoisted_function_attr.Three.Inner.Deep.keep()
-
-let keyword = Hoisted_function_attr.Escaped.\"switch"()
-let dollar = Hoisted_function_attr.Escaped.$plus()
-let operator = Hoisted_function_attr.Operator.\"+"()
-
-let nested = Hoisted_function_attr.Ambiguous.B.make()
-let exoticPath = Hoisted_function_attr.Ambiguous.\"B$make"()
-let recursive = Hoisted_function_attr.RecursiveA.make()
-let typed = Hoisted_function_attr.Typed.make()
-let coerced = Hoisted_function_attr.Coerced.make()
-let included = Hoisted_function_attr.Included.make()
-let aliased = Hoisted_function_attr.Aliased.make()
diff --git a/tests/tests/src/import2.mjs b/tests/tests/src/import2.mjs
index bc04c95162a..e86c765f8cb 100644
--- a/tests/tests/src/import2.mjs
+++ b/tests/tests/src/import2.mjs
@@ -8,7 +8,7 @@ let b = A;
let c = import("./export_keyword.mjs").then(m => m.$$case);
-let d = import("./hoisted_function_attr.mjs").then(m => m.Operator$$plus);
+let d = import("./flat_make_export.mjs").then(m => m.Two$Inner$make);
export {
a,
diff --git a/tests/tests/src/import2.res b/tests/tests/src/import2.res
index b9684f60960..c465b59b948 100644
--- a/tests/tests/src/import2.res
+++ b/tests/tests/src/import2.res
@@ -5,7 +5,5 @@ let b = Import_external.makeA
the emitted export (`case` is exported as `$$case`) */
let c = import(Export_keyword.case)
-/* hoisted export names also go through JS identifier conversion:
- the cmj stores the raw flattened name (Operator$+), the module exports
- the converted one (Operator$$plus) */
-let d = import(Hoisted_function_attr.Operator.\"+")
+/* a nested make is imported through its flat export */
+let d = import(Flat_make_export.Two.Inner.make)
diff --git a/tests/tests/src/jsx_optional_props_test.mjs b/tests/tests/src/jsx_optional_props_test.mjs
index 8fab49e1737..3329b8baaab 100644
--- a/tests/tests/src/jsx_optional_props_test.mjs
+++ b/tests/tests/src/jsx_optional_props_test.mjs
@@ -31,6 +31,8 @@ let _comment_multiple_children = JsxRuntime.jsxs("div", {
]
});
+let ComponentWithOptionalProps$make = Jsx_optional_props_test$ComponentWithOptionalProps;
+
export {
ComponentWithOptionalProps,
_element,
@@ -38,5 +40,6 @@ export {
_comment_only_fragment,
_comment_single_child,
_comment_multiple_children,
+ ComponentWithOptionalProps$make,
}
/* _element Not a pure module */
diff --git a/tests/tests/src/jsx_preserve_cases.mjs b/tests/tests/src/jsx_preserve_cases.mjs
index 8d413e86aac..1ae13468cc9 100644
--- a/tests/tests/src/jsx_preserve_cases.mjs
+++ b/tests/tests/src/jsx_preserve_cases.mjs
@@ -109,6 +109,10 @@ let undefinedKey = ;
+let AsProp$make = Jsx_preserve_cases$AsProp;
+
+let Req$make = Jsx_preserve_cases$Req;
+
export {
AsProp,
asProp,
@@ -131,5 +135,7 @@ export {
copySpread,
localComp,
undefinedKey,
+ AsProp$make,
+ Req$make,
}
/* Not a pure module */
diff --git a/tests/tests/src/jsx_preserve_custom_runtime.mjs b/tests/tests/src/jsx_preserve_custom_runtime.mjs
index 6fbd7c56768..15924dbc14c 100644
--- a/tests/tests/src/jsx_preserve_custom_runtime.mjs
+++ b/tests/tests/src/jsx_preserve_custom_runtime.mjs
@@ -40,6 +40,10 @@ let keyed =
;
+let Comp$make = Jsx_preserve_custom_runtime$Comp;
+
+let TopMemo$make = memoComp;
+
export {
MyJsx,
Comp,
@@ -48,5 +52,7 @@ export {
topMemo,
fragment,
keyed,
+ Comp$make,
+ TopMemo$make,
}
/* memoComp Not a pure module */
diff --git a/tests/tests/src/jsx_preserve_test.mjs b/tests/tests/src/jsx_preserve_test.mjs
index bc66ee92593..69e84c5206c 100644
--- a/tests/tests/src/jsx_preserve_test.mjs
+++ b/tests/tests/src/jsx_preserve_test.mjs
@@ -308,6 +308,20 @@ let _comment_multiple_children =
let make$2 = Jsx_preserve_test;
+let Icon$make = Jsx_preserve_test$Icon;
+
+let B$make = Jsx_preserve_test$B;
+
+let MyWeirdComponent$make = Jsx_preserve_test$MyWeirdComponent;
+
+let ComponentWithOptionalProps$make = Jsx_preserve_test$ComponentWithOptionalProps;
+
+let X$make = Jsx_preserve_test$X;
+
+let Y$make = make;
+
+let ContextProvider$make = make$1;
+
export {
Icon,
_single_element_child,
@@ -352,5 +366,12 @@ export {
_comment_only_fragment,
_comment_single_child,
_comment_multiple_children,
+ Icon$make,
+ B$make,
+ MyWeirdComponent$make,
+ ComponentWithOptionalProps$make,
+ X$make,
+ Y$make,
+ ContextProvider$make,
}
/* _single_element_child Not a pure module */
diff --git a/tests/tests/src/jsxv4_newtype.mjs b/tests/tests/src/jsxv4_newtype.mjs
index a6e2b5a2dc7..350f091e21c 100644
--- a/tests/tests/src/jsxv4_newtype.mjs
+++ b/tests/tests/src/jsxv4_newtype.mjs
@@ -33,10 +33,22 @@ let V4A3 = {
make: Jsxv4_newtype$V4A3
};
+let V4A$make = Jsxv4_newtype$V4A;
+
+let V4A1$make = Jsxv4_newtype$V4A1;
+
+let V4A2$make = Jsxv4_newtype$V4A2;
+
+let V4A3$make = Jsxv4_newtype$V4A3;
+
export {
V4A,
V4A1,
V4A2,
V4A3,
+ V4A$make,
+ V4A1$make,
+ V4A2$make,
+ V4A3$make,
}
/* No side effect */
diff --git a/tests/tests/src/mario_game.mjs b/tests/tests/src/mario_game.mjs
index 1da97ecb645..eca037f2378 100644
--- a/tests/tests/src/mario_game.mjs
+++ b/tests/tests/src/mario_game.mjs
@@ -3060,6 +3060,12 @@ let Main = {
preload: preload
};
+let Sprite$make = make;
+
+let Particle$make = make$1;
+
+let Viewport$make = make$3;
+
export {
Random,
Actors,
@@ -3072,5 +3078,8 @@ export {
Director,
Procedural_generator,
Main,
+ Sprite$make,
+ Particle$make,
+ Viewport$make,
}
/* Not a pure module */
diff --git a/tests/tests/src/module_missing_conversion.mjs b/tests/tests/src/module_missing_conversion.mjs
index e45e16d66bc..1410309823a 100644
--- a/tests/tests/src/module_missing_conversion.mjs
+++ b/tests/tests/src/module_missing_conversion.mjs
@@ -40,9 +40,12 @@ let u = [Stdlib_String];
let hh = "x".length;
+let XX$make = Stdlib_Array.make;
+
export {
XX,
u,
hh,
+ XX$make,
}
/* hh Not a pure module */
diff --git a/tests/tests/src/recursive_react_component.mjs b/tests/tests/src/recursive_react_component.mjs
index d7c3005004b..d9f5ba54ac0 100644
--- a/tests/tests/src/recursive_react_component.mjs
+++ b/tests/tests/src/recursive_react_component.mjs
@@ -50,11 +50,23 @@ let ShadowedByNestedParameter = {
let make$1 = Recursive_react_component;
+let ShadowedSelfReference$make = Recursive_react_component$ShadowedSelfReference;
+
+let Leaf$make = Recursive_react_component$Leaf;
+
+let ShadowedByLocalLet$make = Recursive_react_component$ShadowedByLocalLet;
+
+let ShadowedByNestedParameter$make = Recursive_react_component$ShadowedByNestedParameter;
+
export {
make$1 as make,
ShadowedSelfReference,
Leaf,
ShadowedByLocalLet,
ShadowedByNestedParameter,
+ ShadowedSelfReference$make,
+ Leaf$make,
+ ShadowedByLocalLet$make,
+ ShadowedByNestedParameter$make,
}
/* react Not a pure module */
diff --git a/tests/tests/src/test_pervasive.mjs b/tests/tests/src/test_pervasive.mjs
index 6ed0caf27c8..7181f30f136 100644
--- a/tests/tests/src/test_pervasive.mjs
+++ b/tests/tests/src/test_pervasive.mjs
@@ -146,6 +146,8 @@ function a18(prim0, prim1) {
let f = Stdlib_List.concat;
+let Pervasives$make = Stdlib_List.make;
+
export {
Pervasives$1 as Pervasives,
f,
@@ -168,5 +170,6 @@ export {
a16,
a17,
a18,
+ Pervasives$make,
}
/* No side effect */
diff --git a/tests/tests/src/test_pervasives3.mjs b/tests/tests/src/test_pervasives3.mjs
index 8eec9e8367b..94b27cd07fa 100644
--- a/tests/tests/src/test_pervasives3.mjs
+++ b/tests/tests/src/test_pervasives3.mjs
@@ -71,8 +71,11 @@ let Pervasives$1 = {
let v = Stdlib_List.concat;
+let Pervasives$make = Stdlib_List.make;
+
export {
Pervasives$1 as Pervasives,
v,
+ Pervasives$make,
}
/* No side effect */