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.
This commit is contained in:
parent
9d21cf3b61
commit
764de078e7
|
@ -0,0 +1,24 @@
|
|||
// This tests that exports can have visible dependencies on things
|
||||
// that are not exported, allowing for a sort of poor-man's ADT
|
||||
|
||||
mod foo {
|
||||
export f;
|
||||
export g;
|
||||
|
||||
// not exported
|
||||
tag t {
|
||||
t1;
|
||||
}
|
||||
|
||||
fn f() -> t {
|
||||
ret t1;
|
||||
}
|
||||
|
||||
fn g(t v) {
|
||||
assert v == t1;
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo.g(foo.f());
|
||||
}
|
Loading…
Reference in New Issue