Add some tests of tag-export interaction
This commit is contained in:
parent
cb53065a21
commit
3014a5887d
17
src/test/compile-fail/export-no-tag-variants.rs
Normal file
17
src/test/compile-fail/export-no-tag-variants.rs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// xfail-boot
|
||||||
|
// error-pattern: unresolved name
|
||||||
|
|
||||||
|
// Tag variants are not exported with their tags. This allows for a
|
||||||
|
// simple sort of ADT.
|
||||||
|
|
||||||
|
mod foo {
|
||||||
|
export t;
|
||||||
|
|
||||||
|
tag t {
|
||||||
|
t1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
auto x = foo.t1;
|
||||||
|
}
|
19
src/test/run-pass/export-abstract-tag.rs
Normal file
19
src/test/run-pass/export-abstract-tag.rs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// We can export tags without exporting the variants to create a simple
|
||||||
|
// sort of ADT.
|
||||||
|
|
||||||
|
mod foo {
|
||||||
|
export t;
|
||||||
|
export f;
|
||||||
|
|
||||||
|
tag t {
|
||||||
|
t1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn f() -> t {
|
||||||
|
ret t1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let foo.t v = foo.f();
|
||||||
|
}
|
12
src/test/run-pass/export-tag-variant.rs
Normal file
12
src/test/run-pass/export-tag-variant.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Export the tag variants, without the tag
|
||||||
|
|
||||||
|
mod foo {
|
||||||
|
export t1;
|
||||||
|
tag t {
|
||||||
|
t1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
auto v = foo.t1;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user