Skip to content

Commit 43d512d

Browse files
authored
fix(compiler): Raise appropriate error on unbound export (#1528)
1 parent 6ad6dc1 commit 43d512d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

compiler/src/typed/typemod.re

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,8 @@ let type_module = (~toplevel=false, funct_body, anchor, env, sstr /*scope*/) =>
601601
| None => Ident.create(name.txt)
602602
};
603603
let name = Identifier.IdentName(name);
604-
let (p, {val_fullpath} as desc) = Env.lookup_value(name, env);
604+
let (p, {val_fullpath} as desc) =
605+
Typetexp.find_value(env, loc, name);
605606
(
606607
TSigValue(id, desc),
607608
{tex_id: id, tex_path: val_fullpath, tex_loc: loc},

compiler/test/suites/exports.re

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ describe("exports", ({test, testSkip}) => {
8787
ExposedType.apply((arg) => print("ok"))
8888
|},
8989
);
90+
assertCompileError(
91+
"regression_issue_1489",
92+
"export foo",
93+
"Unbound value foo",
94+
);
9095

9196
assertSnapshot("let_rec_export", "export let rec foo = () => 5");
9297

0 commit comments

Comments
 (0)