2 // compile-flags:-C overflow-checks=off
5 struct Cons<T> {head:isize, tail:T}
6 trait Dot {fn dot(&self, other:Self) -> isize;}
8 fn dot(&self, _:Nil) -> isize {0}
10 impl<T:Dot> Dot for Cons<T> {
11 fn dot(&self, other:Cons<T>) -> isize {
12 self.head * other.head + self.tail.dot(other.tail)
15 fn test<T:Dot> (n:isize, i:isize, first:T, second:T) ->isize {
16 match n { 0 => {first.dot(second)}
17 _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})}
18 //~^ ERROR recursion limit
22 let n = test(1, 0, Nil::NilValue, Nil::NilValue);