Skip to content

Commit 764de07

Browse files
committed
Add a regression test that exports can expose unexported items
While those unexported items can't be used by name outside the module in which they are defined, they can be used as a sort of ADT.
1 parent 9d21cf3 commit 764de07

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// This tests that exports can have visible dependencies on things
2+
// that are not exported, allowing for a sort of poor-man's ADT
3+
4+
mod foo {
5+
export f;
6+
export g;
7+
8+
// not exported
9+
tag t {
10+
t1;
11+
}
12+
13+
fn f() -> t {
14+
ret t1;
15+
}
16+
17+
fn g(t v) {
18+
assert v == t1;
19+
}
20+
}
21+
22+
fn main() {
23+
foo.g(foo.f());
24+
}

0 commit comments

Comments
 (0)