Add test cases for #3668

Previous commits fix the issue.

Closes #3668
This commit is contained in:
Tim Chevalier 2012-10-15 14:33:32 -07:00
parent 4f9e7babeb
commit c5b82a65e9
3 changed files with 6 additions and 8 deletions

View file

@ -0,0 +1,5 @@
fn f(x:int) {
const child: int = x + 1; //~ ERROR attempt to use a non-constant value in a constant
}
fn main() {}

View file

@ -1,4 +1,3 @@
// xfail-test
struct P { child: Option<@mut P> }
trait PTrait {
fn getChildOption() -> Option<@P>;
@ -6,7 +5,7 @@ trait PTrait {
impl P: PTrait {
fn getChildOption() -> Option<@P> {
const childVal: @P = self.child.get();
const childVal: @P = self.child.get(); //~ ERROR attempt to use a non-constant value in a constant
fail;
}
}

View file

@ -1,6 +0,0 @@
// xfail-test
fn f(x:int) {
const child: int = x + 1;
}
fn main() {}