Properly typecheck and compile invocations of generic methods.

Aligning the type parameters of the ifaces, impls, and methods
correctly in typeck is almost brain surgery. Seems to work now for
everything I threw at it, but might still break in other corner cases.

Issue #1227
This commit is contained in:
Marijn Haverbeke
2012-01-04 11:32:26 +01:00
parent d1ffe5034b
commit a7e1a35f88
6 changed files with 235 additions and 166 deletions

View File

@@ -742,6 +742,17 @@ fn iter<T>(v: [const T], f: block(T)) {
iteri(v) { |_i, v| f(v) }
}
/*
Function: iter2
Iterates over two vectors in parallel
*/
fn iter2<U, T>(v: [U], v2: [T], f: block(U, T)) {
let i = 0;
for elt in v { f(elt, v2[i]); i += 1; }
}
/*
Function: iteri