Add xfailed tests that resources can't be copied into various things

This commit is contained in:
Brian Anderson 2011-09-27 15:22:06 -07:00
parent b8bb663df7
commit 8217e4bd38
4 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,16 @@
// xfail-test
// error-pattern:mismatched kinds
resource r(i: @mutable int) {
*i = *i + 1;
}
fn main() {
let i = @mutable 0;
{
let j <- r(i);
// No no no no no
let k = @j;
}
log_err *i;
assert *i == 2;
}

View File

@ -0,0 +1,16 @@
// xfail-test
// error-pattern:mismatched kinds
resource r(i: @mutable int) {
*i = *i + 1;
}
fn main() {
let i = @mutable 0;
{
let j <- r(i);
// No no no no no
let k <- {x: j};
}
log_err *i;
assert *i == 2;
}

View File

@ -0,0 +1,20 @@
// xfail-test
// error-pattern:mismatched kinds
resource r(i: @mutable int) {
*i = *i + 1;
}
tag t {
t0(r);
}
fn main() {
let i = @mutable 0;
{
let j <- r(i);
// No no no no no
let k <- t0(j);
}
log_err *i;
assert *i == 2;
}

View File

@ -0,0 +1,16 @@
// xfail-test
// error-pattern:mismatched kinds
resource r(i: @mutable int) {
*i = *i + 1;
}
fn main() {
let i = @mutable 0;
{
let j <- r(i);
// No no no no no
let k <- (j, 0);
}
log_err *i;
assert *i == 2;
}