From 764de078e7c4baaf0a1f426e7ac4d834c2ea8797 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 2 May 2011 19:42:00 -0400 Subject: 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. --- src/test/run-pass/export-unexported-dep.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/run-pass/export-unexported-dep.rs (limited to 'src/test') diff --git a/src/test/run-pass/export-unexported-dep.rs b/src/test/run-pass/export-unexported-dep.rs new file mode 100644 index 00000000..94ef5241 --- /dev/null +++ b/src/test/run-pass/export-unexported-dep.rs @@ -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()); +} \ No newline at end of file -- cgit v1.2.3