Implement the "simple typechecker", which avoids HM inference

This commit is contained in:
Patrick Walton 2010-07-12 19:39:29 -07:00
parent 91b4cae8da
commit c96f0bf738
7 changed files with 860 additions and 1559 deletions

View File

@ -361,7 +361,8 @@ TEST_XFAILS_X86 := $(MUT_BOX_XFAILS) \
test/compile-fail/bad-send.rs \
test/compile-fail/bad-recv.rs \
test/compile-fail/infinite-tag-type-recursion.rs \
test/compile-fail/infinite-vec-type-recursion.rs
test/compile-fail/infinite-vec-type-recursion.rs \
test/compile-fail/writing-through-read-alias.rs
TEST_XFAILS_LLVM := $(addprefix test/run-pass/, \
acyclic-unwind.rs \
@ -492,6 +493,7 @@ TEST_XFAILS_LLVM := $(addprefix test/run-pass/, \
bad-recv.rs \
infinite-tag-type-recursion.rs \
infinite-vec-type-recursion.rs \
writing-through-read-alias.rs \
)
ifdef MINGW_CROSS

File diff suppressed because it is too large Load Diff

View File

@ -341,6 +341,16 @@ let bool_of_option x =
Some _ -> true
| None -> false
let may f x =
match x with
Some x' -> f x'
| None -> ()
let option_get x =
match x with
Some x -> x
| None -> raise Not_found
(*
* Auxiliary stack functions.
*)

View File

@ -80,7 +80,7 @@ fn map[T,U](&op[T,U] f, &vec[T] v) -> vec[U] {
// but this does not work presently.
let vec[U] u = vec();
for (T ve in v) {
u += vec(f[T,U](ve));
u += vec(f(ve));
}
ret u;
}

View File

@ -5,7 +5,7 @@ type operator[T, U] = fn(&T) -> U;
fn option_map[T, U](&operator[T, U] f, &option[T] opt) -> option[U] {
alt (opt) {
case (some[T](x)) {
ret some[U](f[T, U](x));
ret some[U](f(x));
}
case (none[T]()) {
ret none[U]();

View File

@ -1,8 +1,8 @@
// error-pattern: Non-iter function
// error-pattern: iterator function
fn f() -> int {
put 10;
}
fn main() {
}
}

View File

@ -5,7 +5,7 @@ io fn f(chan[int] c)
type t = tup(int,int,int);
// Allocate a box.
let @t x = tup(1,2,3);
let @t x = @tup(1,2,3);
// Signal parent that we've allocated a box.
c <| 1;