Add compile-fail tests for tail calls

This commit is contained in:
Brian Anderson 2011-01-30 17:38:46 -05:00 committed by Graydon Hoare
parent 378c0087ca
commit 6461cf30de
3 changed files with 26 additions and 0 deletions

View file

@ -434,6 +434,7 @@ TEST_XFAILS_BOOT := $(TASK_XFAILS) \
test/compile-fail/bad-recv.rs \
test/compile-fail/bad-send.rs \
test/compile-fail/infinite-vec-type-recursion.rs \
test/compile-fail/tail-non-call.rs \
test/compile-fail/writing-through-read-alias.rs
# Same strategy here for the time being: just list the ones that
@ -555,6 +556,8 @@ TEST_XFAILS_RUSTC := $(filter-out \
multiline-comment-line-tracking.rs \
output-type-mismatch.rs \
rec-missing-fields.rs \
tail-non-call.rs \
tail-typeck.rs \
type-shadow.rs \
while-type-error.rs \
wrong-ret-type.rs \

View file

@ -0,0 +1,10 @@
// error-pattern: Non-call expression in tail call
fn f() -> int {
auto x = 1;
be x;
}
fn main() {
auto y = f();
}

View file

@ -0,0 +1,13 @@
// error-pattern: mismatched types
fn f() -> int {
be g();
}
fn g() -> uint {
ret 0u;
}
fn main() {
auto y = f();
}