Implement the "simple typechecker", which avoids HM inference
This commit is contained in:
parent
91b4cae8da
commit
c96f0bf738
@ -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
|
||||
|
2395
src/boot/me/type.ml
2395
src/boot/me/type.ml
File diff suppressed because it is too large
Load Diff
@ -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.
|
||||
*)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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]();
|
||||
|
@ -1,8 +1,8 @@
|
||||
// error-pattern: Non-iter function
|
||||
// error-pattern: iterator function
|
||||
|
||||
fn f() -> int {
|
||||
put 10;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user