1a6d029b07
This code was causing a bounds check failure: fn hd[U](&vec[U] v) -> U { fn hd1(&vec[U] w) -> U { ret w.(0); } ret hd1(v); } because in hd1, U was being treated as if it referred to a type parameter of hd1, rather than referring to the lexically enclosing binding for U that's part of hd. I'm actually not sure whether this is a legit program or not. But I wanted to get rid of the bounds check error, so I assumed that program shouldn't compile and made it a proper error message.
12 lines
316 B
Rust
12 lines
316 B
Rust
// error-pattern:Unbound type parameter in callee
|
|
/* I'm actually not sure whether this should compile.
|
|
But having a nice error message seems better than
|
|
a bounds check failure (which is what was happening
|
|
before.) */
|
|
fn hd[U](&vec[U] v) -> U {
|
|
fn hd1(&vec[U] w) -> U {
|
|
ret w.(0);
|
|
}
|
|
ret hd1(v);
|
|
}
|