]> git.lizzy.rs Git - rust.git/commitdiff
Un-revert "Use different syntax for checks that matter to typestate", fixing the...
authorPatrick Walton <pcwalton@mimiga.net>
Tue, 3 May 2011 00:47:24 +0000 (17:47 -0700)
committerPatrick Walton <pcwalton@mimiga.net>
Tue, 3 May 2011 00:50:46 +0000 (17:50 -0700)
This reverts commit d08b443fffb1181d8d45ae5d061412f202dd4118.

182 files changed:
src/boot/fe/item.ml
src/boot/fe/lexer.mll
src/boot/fe/token.ml
src/comp/front/ast.rs
src/comp/front/creader.rs
src/comp/front/lexer.rs
src/comp/front/parser.rs
src/comp/front/token.rs
src/comp/lib/llvm.rs
src/comp/middle/fold.rs
src/comp/middle/metadata.rs
src/comp/middle/resolve.rs
src/comp/middle/trans.rs
src/comp/middle/ty.rs
src/comp/middle/typeck.rs
src/comp/middle/typestate_check.rs
src/comp/middle/walk.rs
src/comp/pretty/pprust.rs
src/comp/util/typestate_ann.rs
src/lib/Term.rs
src/lib/_int.rs
src/lib/_str.rs
src/lib/_uint.rs
src/lib/_vec.rs
src/lib/bitv.rs
src/lib/deque.rs
src/lib/ebml.rs
src/lib/fs.rs
src/lib/io.rs
src/lib/linux_os.rs
src/lib/macos_os.rs
src/lib/posix_fs.rs
src/lib/sha1.rs
src/lib/win32_os.rs
src/test/run-fail/fail.rs
src/test/run-fail/linked-failure.rs
src/test/run-fail/str-overrun.rs
src/test/run-fail/vec-overrun.rs
src/test/run-fail/vec-underrun.rs
src/test/run-pass/alt-pattern-drop.rs
src/test/run-pass/alt-pattern-lit.rs
src/test/run-pass/alt-tag.rs
src/test/run-pass/arith-0.rs
src/test/run-pass/arith-1.rs
src/test/run-pass/arith-2.rs
src/test/run-pass/arith-unsigned.rs
src/test/run-pass/autoderef-full-lval.rs
src/test/run-pass/bind-exterior.rs
src/test/run-pass/bind-interior.rs
src/test/run-pass/bind-obj-ctor.rs
src/test/run-pass/bind-thunk.rs
src/test/run-pass/bind-trivial.rs
src/test/run-pass/bitwise.rs
src/test/run-pass/bool-not.rs
src/test/run-pass/box-compare.rs
src/test/run-pass/box-unbox.rs
src/test/run-pass/box.rs
src/test/run-pass/break.rs
src/test/run-pass/cast.rs
src/test/run-pass/char.rs
src/test/run-pass/clone-with-exterior.rs
src/test/run-pass/comm.rs
src/test/run-pass/decl-with-recv.rs
src/test/run-pass/deep.rs
src/test/run-pass/div-mod.rs
src/test/run-pass/else-if.rs
src/test/run-pass/expr-alt-box.rs
src/test/run-pass/expr-alt-generic-box1.rs
src/test/run-pass/expr-alt-generic-box2.rs
src/test/run-pass/expr-alt-generic.rs
src/test/run-pass/expr-alt-struct.rs
src/test/run-pass/expr-alt.rs
src/test/run-pass/expr-block-box.rs
src/test/run-pass/expr-block-fn.rs
src/test/run-pass/expr-block-generic-box1.rs
src/test/run-pass/expr-block-generic-box2.rs
src/test/run-pass/expr-block-generic.rs
src/test/run-pass/expr-block.rs
src/test/run-pass/expr-if-box.rs
src/test/run-pass/expr-if-generic-box1.rs
src/test/run-pass/expr-if-generic-box2.rs
src/test/run-pass/expr-if-generic.rs
src/test/run-pass/expr-if-struct.rs
src/test/run-pass/expr-if.rs
src/test/run-pass/exterior.rs
src/test/run-pass/fact.rs
src/test/run-pass/float2.rs
src/test/run-pass/floatlits.rs
src/test/run-pass/foreach-nested-2.rs
src/test/run-pass/foreach-nested.rs
src/test/run-pass/foreach-put-structured.rs
src/test/run-pass/foreach-simple-outer-slot.rs
src/test/run-pass/fun-call-variants.rs
src/test/run-pass/fun-indirect-call.rs
src/test/run-pass/generic-alias-box.rs
src/test/run-pass/generic-bind-2.rs
src/test/run-pass/generic-bind.rs
src/test/run-pass/generic-box.rs
src/test/run-pass/generic-derived-type.rs
src/test/run-pass/generic-exterior-box.rs
src/test/run-pass/generic-fn-infer.rs
src/test/run-pass/generic-fn.rs
src/test/run-pass/generic-obj-with-derived-type.rs
src/test/run-pass/generic-obj.rs
src/test/run-pass/generic-tag-alt.rs
src/test/run-pass/generic-tag-values.rs
src/test/run-pass/generic-temporary.rs
src/test/run-pass/generic-tup.rs
src/test/run-pass/generic-type.rs
src/test/run-pass/i32-sub.rs
src/test/run-pass/i8-incr.rs
src/test/run-pass/integral-indexing.rs
src/test/run-pass/iter-range.rs
src/test/run-pass/lazy-and-or.rs
src/test/run-pass/lazychan.rs
src/test/run-pass/lib-bitv.rs
src/test/run-pass/lib-box.rs
src/test/run-pass/lib-deque.rs
src/test/run-pass/lib-int.rs
src/test/run-pass/lib-io.rs
src/test/run-pass/lib-map.rs
src/test/run-pass/lib-sha1.rs
src/test/run-pass/lib-sort.rs
src/test/run-pass/lib-str-buf.rs
src/test/run-pass/lib-str.rs
src/test/run-pass/lib-uint.rs
src/test/run-pass/lib-vec-str-conversions.rs
src/test/run-pass/lib-vec.rs
src/test/run-pass/linear-for-loop.rs
src/test/run-pass/many.rs
src/test/run-pass/mutable-alias-vec.rs
src/test/run-pass/native-opaque-type.rs
src/test/run-pass/obj-as.rs
src/test/run-pass/obj-dtor-2.rs
src/test/run-pass/obj-dtor.rs
src/test/run-pass/obj-self-3.rs
src/test/run-pass/obj-with-vec.rs
src/test/run-pass/opeq.rs
src/test/run-pass/operator-associativity.rs
src/test/run-pass/readalias.rs
src/test/run-pass/rec-extend.rs
src/test/run-pass/rec-tup.rs
src/test/run-pass/rec.rs
src/test/run-pass/rt-circular-buffer.rs
src/test/run-pass/seq-compare.rs
src/test/run-pass/stateful-obj.rs
src/test/run-pass/str-append.rs
src/test/run-pass/str-concat.rs
src/test/run-pass/str-growth.rs
src/test/run-pass/str-idx.rs
src/test/run-pass/structured-compare-recursive.rs
src/test/run-pass/structured-compare.rs
src/test/run-pass/syntax-extension-fmt.rs
src/test/run-pass/tag.rs
src/test/run-pass/tail-cps.rs
src/test/run-pass/tail-direct.rs
src/test/run-pass/task-comm-0.rs
src/test/run-pass/task-comm-16.rs
src/test/run-pass/task-comm-3.rs
src/test/run-pass/task-comm-4.rs
src/test/run-pass/task-comm-5.rs
src/test/run-pass/task-comm-6.rs
src/test/run-pass/task-comm-7.rs
src/test/run-pass/task-comm-8.rs
src/test/run-pass/task-comm-9.rs
src/test/run-pass/task-comm-chan-nil.rs
src/test/run-pass/task-comm.rs
src/test/run-pass/tup.rs
src/test/run-pass/type-sizes.rs
src/test/run-pass/u32-decr.rs
src/test/run-pass/u8-incr-decr.rs
src/test/run-pass/u8-incr.rs
src/test/run-pass/utf8.rs
src/test/run-pass/utf8_chars.rs
src/test/run-pass/vec-append.rs
src/test/run-pass/vec-concat.rs
src/test/run-pass/vec-growth.rs
src/test/run-pass/vec-ref-count.rs
src/test/run-pass/vec-slice.rs
src/test/run-pass/vec.rs
src/test/run-pass/while-with-break.rs
src/test/run-pass/writealias.rs

index 6b232e7eba7edaa3e5cb2f7a1dfc25becf498a2b..70e59be303912021ae58760a8eb71aee564a9ce1 100644 (file)
@@ -199,6 +199,14 @@ and parse_stmts_including_none (ps:pstate) : Ast.stmt array =
           bump ps;
           expect ps SEMI;
           [| span ps apos (lexpos ps) Ast.STMT_cont |]
+      | ASSERT ->
+          bump ps;
+          let (stmts, expr) =
+             ctxt "stmts: check value" parse_expr ps
+          in
+              expect ps SEMI;
+              spans ps stmts apos (Ast.STMT_check_expr expr)
+(* leaving check as it is; adding assert as a synonym for the "old" check *)
       | CHECK ->
           bump ps;
           begin
index b375b874b89d259d405728ddea71d9bc26c75b7a..a65acba1a6f7668d855e0852e4dd77980261f5cd 100644 (file)
@@ -92,6 +92,7 @@
 
                 ("type", TYPE);
                 ("check", CHECK);
+                ("assert", ASSERT); 
                 ("claim", CLAIM);
                 ("prove", PROVE);
 
index 0b1579839847c00f3f66c0976315e6f55eff91a7..27cb399b5516d72cfebd99931a89c0aeb0e312b5 100644 (file)
@@ -77,6 +77,7 @@ type token =
   (* Type and type-state keywords *)
   | TYPE
   | CHECK
+  | ASSERT
   | CLAIM
   | PROVE
 
@@ -237,6 +238,7 @@ let rec string_of_tok t =
     (* Type and type-state keywords *)
     | TYPE       -> "type"
     | CHECK      -> "check"
+    | ASSERT     -> "assert"
     | CLAIM      -> "claim"
     | PROVE      -> "prove"
 
index 2fd13194e50375fe9093de822711ed5726c91d26..13b5739e8dfec4c372ac961e605c46408544ae56 100644 (file)
@@ -283,7 +283,10 @@ fn unop_to_str(unop op) -> str {
     expr_put(option.t[@expr], ann);
     expr_be(@expr, ann);
     expr_log(int, @expr, ann);
-    expr_check_expr(@expr, ann);
+/* just an assert, no significance to typestate */
+    expr_assert(@expr, ann);
+/* preds that typestate is aware of */
+    expr_check(@expr, ann);
     expr_port(ann);
     expr_chan(@expr, ann);
 }
index f48d47c90be608f93122e422f6ab2e536c043793..c8b31159444f7a1873ab91f317612eb9d225e12e 100644 (file)
@@ -93,7 +93,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty.t {
         case ('c') { ret ty.mk_char(st.tcx); }
         case ('s') { ret ty.mk_str(st.tcx); }
         case ('t') {
-            check(next(st) as char == '[');
+            assert (next(st) as char == '[');
             auto def = parse_def(st, sd);
             let vec[ty.t] params = vec();
             while (peek(st) as char != ']') {
@@ -108,7 +108,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty.t {
         case ('P') { ret ty.mk_port(st.tcx, parse_ty(st, sd)); }
         case ('C') { ret ty.mk_chan(st.tcx, parse_ty(st, sd)); }
         case ('T') {
-            check(next(st) as char == '[');
+            assert (next(st) as char == '[');
             let vec[ty.mt] params = vec();
             while (peek(st) as char != ']') {
                 params += vec(parse_mt(st, sd));
@@ -117,7 +117,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty.t {
             ret ty.mk_tup(st.tcx, params);
         }
         case ('R') {
-            check(next(st) as char == '[');
+            assert (next(st) as char == '[');
             let vec[ty.field] fields = vec();
             while (peek(st) as char != ']') {
                 auto name = "";
@@ -149,7 +149,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty.t {
             ret ty.mk_native_fn(st.tcx,abi,func._0,func._1);
         }
         case ('O') {
-            check(next(st) as char == '[');
+            assert (next(st) as char == '[');
             let vec[ty.method] methods = vec();
             while (peek(st) as char != ']') {
                 auto proto;
@@ -175,9 +175,9 @@ fn parse_ty(@pstate st, str_def sd) -> ty.t {
         case ('Y') { ret ty.mk_type(st.tcx); }
         case ('#') {
             auto pos = parse_hex(st);
-            check (next(st) as char == ':');
+            assert (next(st) as char == ':');
             auto len = parse_hex(st);
-            check (next(st) as char == '#');
+            assert (next(st) as char == '#');
             alt (st.tcx.rcache.find(tup(st.crate,pos,len))) {
                 case (some[ty.t](?tt)) { ret tt; }
                 case (none[ty.t]) {
@@ -245,7 +245,7 @@ fn parse_hex(@pstate st) -> uint {
 }
 
 fn parse_ty_fn(@pstate st, str_def sd) -> tup(vec[ty.arg], ty.t) {
-    check(next(st) as char == '[');
+    assert (next(st) as char == '[');
     let vec[ty.arg] inputs = vec();
     while (peek(st) as char != ']') {
         auto mode = ast.val;
index 3659af1c655e2708a8c9aad56e3fe889b60e6d09..dabdee1c7389ab12a2a2a2ffe87a5538f1e1a745 100644 (file)
@@ -127,6 +127,7 @@ fn keyword_table() -> std.map.hashmap[str, token.token] {
 
     keywords.insert("type", token.TYPE);
     keywords.insert("check", token.CHECK);
+    keywords.insert("assert", token.ASSERT);
     keywords.insert("claim", token.CLAIM);
     keywords.insert("prove", token.PROVE);
 
@@ -528,7 +529,7 @@ fn scan_numeric_escape(reader rdr) -> char {
 
     auto n_hex_digits = 0;
 
-    check (rdr.curr() == '\\');
+    assert (rdr.curr() == '\\');
 
     alt (rdr.next()) {
         case ('x') { n_hex_digits = 2; }
index fdd41cf0ff702784691f925ccbf8b09415cb9816..3e8ca85a830550069ed14a0e3fb2e7b1e7e33ef6 100644 (file)
@@ -621,7 +621,7 @@ fn parse_path(parser p, greed g) -> ast.path {
                 if (p.peek() == token.DOT) {
                     if (g == GREEDY) {
                         p.bump();
-                        check (is_ident(p.peek()));
+                        assert (is_ident(p.peek()));
                     } else {
                         more = false;
                     }
@@ -816,20 +816,23 @@ fn parse_expr_opt(parser p) -> option.t[@ast.expr] {
             ex = ast.expr_log(0, e, ast.ann_none);
         }
 
-        case (token.CHECK) {
+        case (token.ASSERT) {
             p.bump();
-            alt (p.peek()) {
-                case (token.LPAREN) {
-                    auto e = parse_expr(p);
-                    auto hi = e.span.hi;
-                    ex = ast.expr_check_expr(e, ast.ann_none);
-                }
-                case (_) {
-                    p.get_session().unimpl("constraint-check stmt");
-                }
-            }
+            auto e = parse_expr(p);
+            auto hi = e.span.hi;
+            ex = ast.expr_assert(e, ast.ann_none);
         }
 
+        case (token.CHECK) {
+            p.bump();
+            /* Should be a predicate (pure boolean function) applied to 
+             arguments that are all either slot variables or literals.
+            but the typechecker enforces that. */
+            auto e = parse_expr(p);
+            auto hi = e.span.hi;
+            ex = ast.expr_check(e, ast.ann_none);
+        } 
+
         case (token.RET) {
             p.bump();
             alt (p.peek()) {
@@ -937,7 +940,7 @@ fn expand_syntax_ext(parser p, ast.span sp,
                      &ast.path path, vec[@ast.expr] args,
                      option.t[str] body) -> ast.expr_ {
 
-    check (_vec.len[ast.ident](path.node.idents) > 0u);
+    assert (_vec.len[ast.ident](path.node.idents) > 0u);
     auto extname = path.node.idents.(0);
     if (_str.eq(extname, "fmt")) {
         auto expanded = extfmt.expand_syntax_ext(args, body);
@@ -1673,7 +1676,8 @@ fn stmt_ends_with_semi(@ast.stmt stmt) -> bool {
                 case (ast.expr_put(_,_))        { ret true; }
                 case (ast.expr_be(_,_))         { ret true; }
                 case (ast.expr_log(_,_,_))        { ret true; }
-                case (ast.expr_check_expr(_,_)) { ret true; }
+                case (ast.expr_check(_,_)) { ret true; }
+                case (ast.expr_assert(_,_)) { ret true; }
             }
         }
         // We should not be calling this on a cdir.
@@ -2157,24 +2161,24 @@ fn parse_item(parser p) -> @ast.item {
 
     alt (p.peek()) {
         case (token.CONST) {
-            check (lyr == ast.layer_value);
+            assert (lyr == ast.layer_value);
             ret parse_item_const(p);
         }
 
         case (token.FN) {
-            check (lyr == ast.layer_value);
+            assert (lyr == ast.layer_value);
             ret parse_item_fn_or_iter(p);
         }
         case (token.ITER) {
-            check (lyr == ast.layer_value);
+            assert (lyr == ast.layer_value);
             ret parse_item_fn_or_iter(p);
         }
         case (token.MOD) {
-            check (lyr == ast.layer_value);
+            assert (lyr == ast.layer_value);
             ret parse_item_mod(p);
         }
         case (token.NATIVE) {
-            check (lyr == ast.layer_value);
+            assert (lyr == ast.layer_value);
             ret parse_item_native_mod(p);
         }
         case (token.TYPE) {
index f367bcc6835a26b32ea397f6a7f054bfb3b56ae2..594515f22141e7df67ef2df96d46840816be1ccc 100644 (file)
@@ -89,6 +89,7 @@
 
     /* Type and type-state keywords */
     TYPE;
+    ASSERT;
     CHECK;
     CLAIM;
     PROVE;
@@ -258,6 +259,7 @@ fn to_str(token t) -> str {
 
         /* Type and type-state keywords */
         case (TYPE) { ret "type"; }
+        case (ASSERT) { ret "assert"; }
         case (CHECK) { ret "check"; }
         case (CLAIM) { ret "claim"; }
         case (PROVE) { ret "prove"; }
index 41ec1836d18d2bd82df6a709a0365347b89ac732..070174bad3c688364611f1dde4246d059281552f 100644 (file)
@@ -861,19 +861,19 @@ fn LLVMRustWriteOutputFile(PassManagerRef PM, ModuleRef M,
 
     /* Terminators */
     fn RetVoid()  -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         *terminated = true;
         ret llvm.LLVMBuildRetVoid(B);
     }
 
     fn Ret(ValueRef V) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         *terminated = true;
         ret llvm.LLVMBuildRet(B, V);
     }
 
     fn AggregateRet(vec[ValueRef] RetVals) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         *terminated = true;
         ret llvm.LLVMBuildAggregateRet(B,
                                        _vec.buf[ValueRef](RetVals),
@@ -881,26 +881,26 @@ fn AggregateRet(vec[ValueRef] RetVals) -> ValueRef {
     }
 
     fn Br(BasicBlockRef Dest) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         *terminated = true;
         ret llvm.LLVMBuildBr(B, Dest);
     }
 
     fn CondBr(ValueRef If, BasicBlockRef Then,
               BasicBlockRef Else) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         *terminated = true;
         ret llvm.LLVMBuildCondBr(B, If, Then, Else);
     }
 
     fn Switch(ValueRef V, BasicBlockRef Else, uint NumCases) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         *terminated = true;
         ret llvm.LLVMBuildSwitch(B, V, Else, NumCases);
     }
 
     fn IndirectBr(ValueRef Addr, uint NumDests) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         *terminated = true;
         ret llvm.LLVMBuildIndirectBr(B, Addr, NumDests);
     }
@@ -909,7 +909,7 @@ fn Invoke(ValueRef Fn,
               vec[ValueRef] Args,
               BasicBlockRef Then,
               BasicBlockRef Catch) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         *terminated = true;
         ret llvm.LLVMBuildInvoke(B, Fn,
                                  _vec.buf[ValueRef](Args),
@@ -919,209 +919,209 @@ fn Invoke(ValueRef Fn,
     }
 
     fn Unwind() -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         *terminated = true;
         ret llvm.LLVMBuildUnwind(B);
     }
 
     fn Unreachable() -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         *terminated = true;
         ret llvm.LLVMBuildUnreachable(B);
     }
 
     /* Arithmetic */
     fn Add(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildAdd(B, LHS, RHS, _str.buf(""));
     }
 
     fn NSWAdd(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildNSWAdd(B, LHS, RHS, _str.buf(""));
     }
 
     fn NUWAdd(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildNUWAdd(B, LHS, RHS, _str.buf(""));
     }
 
     fn FAdd(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFAdd(B, LHS, RHS, _str.buf(""));
     }
 
     fn Sub(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildSub(B, LHS, RHS, _str.buf(""));
     }
 
     fn NSWSub(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildNSWSub(B, LHS, RHS, _str.buf(""));
     }
 
     fn NUWSub(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildNUWSub(B, LHS, RHS, _str.buf(""));
     }
 
     fn FSub(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFSub(B, LHS, RHS, _str.buf(""));
     }
 
     fn Mul(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildMul(B, LHS, RHS, _str.buf(""));
     }
 
     fn NSWMul(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildNSWMul(B, LHS, RHS, _str.buf(""));
     }
 
     fn NUWMul(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildNUWMul(B, LHS, RHS, _str.buf(""));
     }
 
     fn FMul(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFMul(B, LHS, RHS, _str.buf(""));
     }
 
     fn UDiv(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildUDiv(B, LHS, RHS, _str.buf(""));
     }
 
     fn SDiv(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildSDiv(B, LHS, RHS, _str.buf(""));
     }
 
     fn ExactSDiv(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildExactSDiv(B, LHS, RHS, _str.buf(""));
     }
 
     fn FDiv(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFDiv(B, LHS, RHS, _str.buf(""));
     }
 
     fn URem(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildURem(B, LHS, RHS, _str.buf(""));
     }
 
     fn SRem(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildSRem(B, LHS, RHS, _str.buf(""));
     }
 
     fn FRem(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFRem(B, LHS, RHS, _str.buf(""));
     }
 
     fn Shl(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildShl(B, LHS, RHS, _str.buf(""));
     }
 
     fn LShr(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildLShr(B, LHS, RHS, _str.buf(""));
     }
 
     fn AShr(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildAShr(B, LHS, RHS, _str.buf(""));
     }
 
     fn And(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildAnd(B, LHS, RHS, _str.buf(""));
     }
 
     fn Or(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildOr(B, LHS, RHS, _str.buf(""));
     }
 
     fn Xor(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildXor(B, LHS, RHS, _str.buf(""));
     }
 
     fn BinOp(Opcode Op, ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildBinOp(B, Op, LHS, RHS, _str.buf(""));
     }
 
     fn Neg(ValueRef V) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildNeg(B, V, _str.buf(""));
     }
 
     fn NSWNeg(ValueRef V) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildNSWNeg(B, V, _str.buf(""));
     }
 
     fn NUWNeg(ValueRef V) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildNUWNeg(B, V, _str.buf(""));
     }
     fn FNeg(ValueRef V) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFNeg(B, V, _str.buf(""));
     }
     fn Not(ValueRef V) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildNot(B, V, _str.buf(""));
     }
 
     /* Memory */
     fn Malloc(TypeRef Ty) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildMalloc(B, Ty, _str.buf(""));
     }
 
     fn ArrayMalloc(TypeRef Ty, ValueRef Val) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildArrayMalloc(B, Ty, Val, _str.buf(""));
     }
 
     fn Alloca(TypeRef Ty) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildAlloca(B, Ty, _str.buf(""));
     }
 
     fn ArrayAlloca(TypeRef Ty, ValueRef Val) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildArrayAlloca(B, Ty, Val, _str.buf(""));
     }
 
     fn Free(ValueRef PointerVal) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFree(B, PointerVal);
     }
 
     fn Load(ValueRef PointerVal) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildLoad(B, PointerVal, _str.buf(""));
     }
 
     fn Store(ValueRef Val, ValueRef Ptr) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildStore(B, Val, Ptr);
     }
 
     fn GEP(ValueRef Pointer, vec[ValueRef] Indices) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildGEP(B, Pointer,
                               _vec.buf[ValueRef](Indices),
                               _vec.len[ValueRef](Indices),
@@ -1129,7 +1129,7 @@ fn GEP(ValueRef Pointer, vec[ValueRef] Indices) -> ValueRef {
     }
 
     fn InBoundsGEP(ValueRef Pointer, vec[ValueRef] Indices) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildInBoundsGEP(B, Pointer,
                                       _vec.buf[ValueRef](Indices),
                                       _vec.len[ValueRef](Indices),
@@ -1137,125 +1137,125 @@ fn InBoundsGEP(ValueRef Pointer, vec[ValueRef] Indices) -> ValueRef {
     }
 
     fn StructGEP(ValueRef Pointer, uint Idx) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildStructGEP(B, Pointer, Idx, _str.buf(""));
     }
 
     fn GlobalString(sbuf Str) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildGlobalString(B, Str, _str.buf(""));
     }
 
     fn GlobalStringPtr(sbuf Str) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildGlobalStringPtr(B, Str, _str.buf(""));
     }
 
     /* Casts */
     fn Trunc(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildTrunc(B, Val, DestTy, _str.buf(""));
     }
 
     fn ZExt(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildZExt(B, Val, DestTy, _str.buf(""));
     }
 
     fn SExt(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildSExt(B, Val, DestTy, _str.buf(""));
     }
 
     fn FPToUI(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFPToUI(B, Val, DestTy, _str.buf(""));
     }
 
     fn FPToSI(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFPToSI(B, Val, DestTy, _str.buf(""));
     }
 
     fn UIToFP(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildUIToFP(B, Val, DestTy, _str.buf(""));
     }
 
     fn SIToFP(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildSIToFP(B, Val, DestTy, _str.buf(""));
     }
 
     fn FPTrunc(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFPTrunc(B, Val, DestTy, _str.buf(""));
     }
 
     fn FPExt(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFPExt(B, Val, DestTy, _str.buf(""));
     }
 
     fn PtrToInt(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildPtrToInt(B, Val, DestTy, _str.buf(""));
     }
 
     fn IntToPtr(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildIntToPtr(B, Val, DestTy, _str.buf(""));
     }
 
     fn BitCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildBitCast(B, Val, DestTy, _str.buf(""));
     }
 
     fn ZExtOrBitCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildZExtOrBitCast(B, Val, DestTy, _str.buf(""));
     }
 
     fn SExtOrBitCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildSExtOrBitCast(B, Val, DestTy, _str.buf(""));
     }
 
     fn TruncOrBitCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildTruncOrBitCast(B, Val, DestTy, _str.buf(""));
     }
 
     fn Cast(Opcode Op, ValueRef Val, TypeRef DestTy, sbuf Name) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildCast(B, Op, Val, DestTy, _str.buf(""));
     }
 
     fn PointerCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildPointerCast(B, Val, DestTy, _str.buf(""));
     }
 
     fn IntCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildIntCast(B, Val, DestTy, _str.buf(""));
     }
 
     fn FPCast(ValueRef Val, TypeRef DestTy) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFPCast(B, Val, DestTy, _str.buf(""));
     }
 
 
     /* Comparisons */
     fn ICmp(uint Op, ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildICmp(B, Op, LHS, RHS, _str.buf(""));
     }
 
     fn FCmp(uint Op, ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildFCmp(B, Op, LHS, RHS, _str.buf(""));
     }
 
@@ -1263,9 +1263,9 @@ fn FCmp(uint Op, ValueRef LHS, ValueRef RHS) -> ValueRef {
     /* Miscellaneous instructions */
     fn Phi(TypeRef Ty, vec[ValueRef] vals,
            vec[BasicBlockRef] bbs) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         auto phi = llvm.LLVMBuildPhi(B, Ty, _str.buf(""));
-        check (_vec.len[ValueRef](vals) == _vec.len[BasicBlockRef](bbs));
+        assert (_vec.len[ValueRef](vals) == _vec.len[BasicBlockRef](bbs));
         llvm.LLVMAddIncoming(phi,
                              _vec.buf[ValueRef](vals),
                              _vec.buf[BasicBlockRef](bbs),
@@ -1276,7 +1276,7 @@ fn Phi(TypeRef Ty, vec[ValueRef] vals,
     fn AddIncomingToPhi(ValueRef phi,
                         vec[ValueRef] vals,
                         vec[BasicBlockRef] bbs) {
-        check (_vec.len[ValueRef](vals) == _vec.len[BasicBlockRef](bbs));
+        assert (_vec.len[ValueRef](vals) == _vec.len[BasicBlockRef](bbs));
         llvm.LLVMAddIncoming(phi,
                              _vec.buf[ValueRef](vals),
                              _vec.buf[BasicBlockRef](bbs),
@@ -1284,7 +1284,7 @@ fn AddIncomingToPhi(ValueRef phi,
     }
 
     fn Call(ValueRef Fn, vec[ValueRef] Args) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildCall(B, Fn,
                                _vec.buf[ValueRef](Args),
                                _vec.len[ValueRef](Args),
@@ -1292,7 +1292,7 @@ fn Call(ValueRef Fn, vec[ValueRef] Args) -> ValueRef {
     }
 
     fn FastCall(ValueRef Fn, vec[ValueRef] Args) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         auto v = llvm.LLVMBuildCall(B, Fn,
                                     _vec.buf[ValueRef](Args),
                                     _vec.len[ValueRef](Args),
@@ -1302,65 +1302,65 @@ fn FastCall(ValueRef Fn, vec[ValueRef] Args) -> ValueRef {
     }
 
     fn Select(ValueRef If, ValueRef Then, ValueRef Else) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildSelect(B, If, Then, Else, _str.buf(""));
     }
 
     fn VAArg(ValueRef List, TypeRef Ty) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildVAArg(B, List, Ty, _str.buf(""));
     }
 
     fn ExtractElement(ValueRef VecVal, ValueRef Index) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildExtractElement(B, VecVal, Index, _str.buf(""));
     }
 
     fn InsertElement(ValueRef VecVal, ValueRef EltVal,
                      ValueRef Index) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildInsertElement(B, VecVal, EltVal, Index,
                                         _str.buf(""));
     }
 
     fn ShuffleVector(ValueRef V1, ValueRef V2, ValueRef Mask) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildShuffleVector(B, V1, V2, Mask, _str.buf(""));
     }
 
     fn ExtractValue(ValueRef AggVal, uint Index) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildExtractValue(B, AggVal, Index, _str.buf(""));
     }
 
     fn InsertValue(ValueRef AggVal, ValueRef EltVal,
                    uint Index) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildInsertValue(B, AggVal, EltVal, Index, _str.buf(""));
     }
 
     fn IsNull(ValueRef Val) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildIsNull(B, Val, _str.buf(""));
     }
 
     fn IsNotNull(ValueRef Val) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildIsNotNull(B, Val, _str.buf(""));
     }
 
     fn PtrDiff(ValueRef LHS, ValueRef RHS) -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         ret llvm.LLVMBuildPtrDiff(B, LHS, RHS, _str.buf(""));
     }
 
     fn Trap() -> ValueRef {
-        check (!*terminated);
+        assert (!*terminated);
         let BasicBlockRef BB = llvm.LLVMGetInsertBlock(B);
         let ValueRef FN = llvm.LLVMGetBasicBlockParent(BB);
         let ModuleRef M = llvm.LLVMGetGlobalParent(FN);
         let ValueRef T = llvm.LLVMGetNamedFunction(M, _str.buf("llvm.trap"));
-        check (T as int != 0);
+        assert (T as int != 0);
         let vec[ValueRef] Args = vec();
         ret llvm.LLVMBuildCall(B, T,
                                _vec.buf[ValueRef](Args),
@@ -1391,8 +1391,8 @@ fn mk_type_handle() -> type_handle {
                     std.map.hashmap[str, TypeRef] named_types) {
 
     fn associate(str s, TypeRef t) {
-        check (!named_types.contains_key(s));
-        check (!type_names.contains_key(t));
+        assert (!named_types.contains_key(s));
+        assert (!type_names.contains_key(t));
         type_names.insert(t, s);
         named_types.insert(s, t);
     }
index a0f3bc93f955d846eeb49917b46d4164193624fa..e932fd9af497cc3b30943fbc953973872a2e17f1 100644 (file)
          @expr e, ann a) -> @expr)                fold_expr_log,
 
      (fn(&ENV e, &span sp,
-         @expr e, ann a) -> @expr)                fold_expr_check_expr,
+         @expr e, ann a) -> @expr)                fold_expr_check,
+
+     (fn(&ENV e, &span sp,
+         @expr e, ann a) -> @expr)                fold_expr_assert,
 
      (fn(&ENV e, &span sp,
          ann a) -> @expr)                         fold_expr_port,
@@ -796,10 +799,16 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
             ret fld.fold_expr_log(env_, e.span, l, ee, t2);
         }
 
-        case (ast.expr_check_expr(?x, ?t)) {
+        case (ast.expr_check(?x, ?t)) {
             auto ee = fold_expr(env_, fld, x);
             auto t2 = fld.fold_ann(env_, t);
-            ret fld.fold_expr_check_expr(env_, e.span, ee, t2);
+            ret fld.fold_expr_check(env_, e.span, ee, t2);
+        }
+
+        case (ast.expr_assert(?x, ?t)) {
+            auto ee = fold_expr(env_, fld, x);
+            auto t2 = fld.fold_ann(env_, t);
+            ret fld.fold_expr_assert(env_, e.span, ee, t2);
         }
 
         case (ast.expr_port(?t)) {
@@ -1380,9 +1389,14 @@ fn identity_fold_expr_log[ENV](&ENV e, &span sp, int lvl, @expr x,
     ret @respan(sp, ast.expr_log(lvl, x, a));
 }
 
-fn identity_fold_expr_check_expr[ENV](&ENV e, &span sp, @expr x, ann a)
+fn identity_fold_expr_check[ENV](&ENV e, &span sp, @expr x, ann a)
+    -> @expr {
+    ret @respan(sp, ast.expr_check(x, a));
+}
+
+fn identity_fold_expr_assert[ENV](&ENV e, &span sp, @expr x, ann a)
     -> @expr {
-    ret @respan(sp, ast.expr_check_expr(x, a));
+    ret @respan(sp, ast.expr_check(x, a));
 }
 
 fn identity_fold_expr_port[ENV](&ENV e, &span sp, ann a) -> @expr {
@@ -1676,8 +1690,11 @@ fn new_identity_fold[ENV]() -> ast_fold[ENV] {
          fold_expr_put    = bind identity_fold_expr_put[ENV](_,_,_,_),
          fold_expr_be     = bind identity_fold_expr_be[ENV](_,_,_,_),
          fold_expr_log    = bind identity_fold_expr_log[ENV](_,_,_,_,_),
-         fold_expr_check_expr
-         = bind identity_fold_expr_check_expr[ENV](_,_,_,_),
+         fold_expr_check
+         = bind identity_fold_expr_check[ENV](_,_,_,_),
+         fold_expr_assert
+         = bind identity_fold_expr_assert[ENV](_,_,_,_),
+              
          fold_expr_port   = bind identity_fold_expr_port[ENV](_,_,_),
          fold_expr_chan   = bind identity_fold_expr_chan[ENV](_,_,_,_),
 
index 806f38b52528126f221f03896834f12cb5f8a1b5..bec6262847e3c1bd23bc10968ba25cfa5ee96f37 100644 (file)
@@ -63,7 +63,7 @@ mod Encode {
     );
 
     fn ty_str(@ctxt cx, ty.t t) -> str {
-        check (! cx.use_abbrevs);
+        assert (! cx.use_abbrevs);
         auto sw = io.string_writer();
         enc_ty(sw.get_writer(), cx, t);
         ret sw.get_str();
index d75a6db09d9ab5c3e8f19e07f758e03900a2262c..c045413c2dba7ba0066e96869fd6c5e8a5d01078 100644 (file)
@@ -662,7 +662,7 @@ fn fold_pat_tag(&env e, &span sp, ast.path p, vec[@ast.pat] args,
 fn fold_expr_path(&env e, &span sp, &ast.path p, &option.t[def] d,
                   ann a) -> @ast.expr {
     auto n_idents = _vec.len[ast.ident](p.node.idents);
-    check (n_idents != 0u);
+    assert (n_idents != 0u);
 
     auto index = new_def_hash[def_wrap]();
     auto d = find_final_def(e, index, sp, p.node.idents, ns_value,
index d4ba3073bbbe8e09dacf090f42e785296c9e1134..2c639c4cd6e12b94672c9330f170f31275ebdcff 100644 (file)
@@ -586,7 +586,7 @@ fn type_of_explicit_args(@crate_ctxt cx, vec[ty.arg] inputs) -> vec[TypeRef] {
     let vec[TypeRef] atys = vec();
     for (ty.arg arg in inputs) {
         if (ty.type_has_dynamic_size(cx.tcx, arg.ty)) {
-            check (arg.mode == ast.alias);
+            assert (arg.mode == ast.alias);
             atys += vec(T_typaram_ptr(cx.tn));
         } else {
             let TypeRef t;
@@ -632,7 +632,7 @@ fn type_of_fn_full(@crate_ctxt cx,
     // Arg 2: Env (closure-bindings / self-obj)
     alt (obj_self) {
         case (some[TypeRef](?t)) {
-            check (t as int != 0);
+            assert (t as int != 0);
             atys += vec(t);
         }
         case (_) {
@@ -800,7 +800,7 @@ fn type_of_inner(@crate_ctxt cx, ty.t t) -> TypeRef {
         case (ty.ty_type) { llty = T_ptr(T_tydesc(cx.tn)); }
     }
 
-    check (llty as int != 0);
+    assert (llty as int != 0);
     llvm.LLVMAddTypeName(cx.llmod,
                          _str.buf(ty.ty_to_short_str(cx.tcx,
                                                      cx.type_abbrevs, t)),
@@ -1355,7 +1355,7 @@ fn dynamic_align_of(@block_ctxt cx, ty.t t) -> result {
 fn GEP_tup_like(@block_ctxt cx, ty.t t,
                 ValueRef base, vec[int] ixs) -> result {
 
-    check (ty.type_is_tup_like(cx.fcx.lcx.ccx.tcx, t));
+    assert (ty.type_is_tup_like(cx.fcx.lcx.ccx.tcx, t));
 
     // It might be a static-known type. Handle this.
 
@@ -1393,17 +1393,17 @@ fn split_type(@crate_ctxt ccx, ty.t t, vec[int] ixs, uint n)
         // and the latter would only be meaningful if we supported non-0
         // values for the 0th index (we don't).
 
-        check (len > 1u);
+        assert (len > 1u);
 
         if (n == 0u) {
             // Since we're starting from a value that's a pointer to a
             // *single* structure, the first index (in GEP-ese) should just be
             // 0, to yield the pointee.
-            check (ixs.(n) == 0);
+            assert (ixs.(n) == 0);
             ret split_type(ccx, t, ixs, n+1u);
         }
 
-        check (n < len);
+        assert (n < len);
 
         let int ix = ixs.(n);
         let vec[ty.t] prefix = vec();
@@ -1618,8 +1618,8 @@ fn get_tydesc(&@block_ctxt cx, ty.t t, bool escapes) -> result {
         let uint n_params = ty.count_ty_params(cx.fcx.lcx.ccx.tcx, t);
         auto tys = linearize_ty_params(cx, t);
 
-        check (n_params == _vec.len[uint](tys._0));
-        check (n_params == _vec.len[ValueRef](tys._1));
+        assert (n_params == _vec.len[uint](tys._0));
+        assert (n_params == _vec.len[ValueRef](tys._1));
 
         auto root = get_static_tydesc(cx, t, tys._0).tydesc;
 
@@ -2348,7 +2348,7 @@ fn tag_variants(@crate_ctxt cx, ast.def_id id) -> vec[variant_info] {
         ret creader.get_tag_variants(cx.sess, cx.tcx, id);
     }
 
-    check (cx.items.contains_key(id));
+    assert (cx.items.contains_key(id));
     alt (cx.items.get(id).node) {
         case (ast.item_tag(_, ?variants, _, _, _)) {
             let vec[variant_info] result = vec();
@@ -3367,7 +3367,7 @@ fn join_results(@block_ctxt parent_cx,
             // No incoming edges are live, so we're in dead-code-land.
             // Arbitrarily pick the first dead edge, since the caller
             // is just going to propagate it outward.
-            check (_vec.len[result](ins) >= 1u);
+            assert (_vec.len[result](ins) >= 1u);
             ret ins.(0);
         }
 
@@ -3995,7 +3995,7 @@ fn lval_generic_fn(@block_ctxt cx,
     auto lv;
     if (cx.fcx.lcx.ccx.sess.get_targ_crate_num() == fn_id._0) {
         // Internal reference.
-        check (cx.fcx.lcx.ccx.fn_pairs.contains_key(fn_id));
+        assert (cx.fcx.lcx.ccx.fn_pairs.contains_key(fn_id));
         lv = lval_val(cx, cx.fcx.lcx.ccx.fn_pairs.get(fn_id));
     } else {
         // External reference.
@@ -4038,7 +4038,7 @@ fn lookup_discriminant(@local_ctxt lcx, ast.def_id tid, ast.def_id vid)
     alt (lcx.ccx.discrims.find(vid)) {
         case (none[ValueRef]) {
             // It's an external discriminant that we haven't seen yet.
-            check (lcx.ccx.sess.get_targ_crate_num() != vid._0);
+            assert (lcx.ccx.sess.get_targ_crate_num() != vid._0);
             auto sym = creader.get_symbol(lcx.ccx.sess, vid);
             auto gvar = llvm.LLVMAddGlobal(lcx.ccx.llmod, T_int(),
                                            _str.buf(sym));
@@ -4060,7 +4060,7 @@ fn trans_path(@block_ctxt cx, &ast.path p, &option.t[ast.def] dopt,
                 case (ast.def_arg(?did)) {
                     alt (cx.fcx.llargs.find(did)) {
                         case (none[ValueRef]) {
-                            check (cx.fcx.llupvars.contains_key(did));
+                            assert (cx.fcx.llupvars.contains_key(did));
                             ret lval_mem(cx, cx.fcx.llupvars.get(did));
                         }
                         case (some[ValueRef](?llval)) {
@@ -4071,7 +4071,7 @@ fn trans_path(@block_ctxt cx, &ast.path p, &option.t[ast.def] dopt,
                 case (ast.def_local(?did)) {
                     alt (cx.fcx.lllocals.find(did)) {
                         case (none[ValueRef]) {
-                            check (cx.fcx.llupvars.contains_key(did));
+                            assert (cx.fcx.llupvars.contains_key(did));
                             ret lval_mem(cx, cx.fcx.llupvars.get(did));
                         }
                         case (some[ValueRef](?llval)) {
@@ -4080,11 +4080,11 @@ fn trans_path(@block_ctxt cx, &ast.path p, &option.t[ast.def] dopt,
                     }
                 }
                 case (ast.def_binding(?did)) {
-                    check (cx.fcx.lllocals.contains_key(did));
+                    assert (cx.fcx.lllocals.contains_key(did));
                     ret lval_mem(cx, cx.fcx.lllocals.get(did));
                 }
                 case (ast.def_obj_field(?did)) {
-                    check (cx.fcx.llobjfields.contains_key(did));
+                    assert (cx.fcx.llobjfields.contains_key(did));
                     ret lval_mem(cx, cx.fcx.llobjfields.get(did));
                 }
                 case (ast.def_fn(?did)) {
@@ -4136,7 +4136,7 @@ fn trans_path(@block_ctxt cx, &ast.path p, &option.t[ast.def] dopt,
                 }
                 case (ast.def_const(?did)) {
                     // TODO: externals
-                    check (cx.fcx.lcx.ccx.consts.contains_key(did));
+                    assert (cx.fcx.lcx.ccx.consts.contains_key(did));
                     ret lval_mem(cx, cx.fcx.lcx.ccx.consts.get(did));
                 }
                 case (ast.def_native_fn(?did)) {
@@ -4275,7 +4275,7 @@ fn trans_lval(@block_ctxt cx, @ast.expr e) -> lval_result {
             ret trans_index(cx, e.span, base, idx, ann);
         }
         case (ast.expr_unary(?unop, ?base, ?ann)) {
-            check (unop == ast.deref);
+            assert (unop == ast.deref);
 
             auto sub = trans_expr(cx, base);
             auto val = sub.bcx.build.GEP(sub.val,
@@ -4439,7 +4439,7 @@ fn trans_bind_thunk(@local_ctxt cx,
                     }
                 } else if (ty.type_contains_params(cx.ccx.tcx,
                                                    out_arg.ty)) {
-                    check (out_arg.mode == ast.alias);
+                    assert (out_arg.mode == ast.alias);
                     val = bcx.build.PointerCast(val, llout_arg_ty);
                 }
 
@@ -4452,7 +4452,7 @@ fn trans_bind_thunk(@local_ctxt cx,
                 let ValueRef passed_arg = llvm.LLVMGetParam(llthunk, a);
 
                 if (ty.type_contains_params(cx.ccx.tcx, out_arg.ty)) {
-                    check (out_arg.mode == ast.alias);
+                    assert (out_arg.mode == ast.alias);
                     passed_arg = bcx.build.PointerCast(passed_arg,
                                                        llout_arg_ty);
                 }
@@ -5142,7 +5142,7 @@ fn trans_expr(@block_ctxt cx, @ast.expr e) -> result {
 
         case (ast.expr_assign(?dst, ?src, ?ann)) {
             auto lhs_res = trans_lval(cx, dst);
-            check (lhs_res.is_mem);
+            assert (lhs_res.is_mem);
             auto rhs_res = trans_expr(lhs_res.res.bcx, src);
             auto t = node_ann_type(cx.fcx.lcx.ccx, ann);
             // FIXME: calculate copy init-ness in typestate.
@@ -5153,7 +5153,7 @@ fn trans_expr(@block_ctxt cx, @ast.expr e) -> result {
         case (ast.expr_assign_op(?op, ?dst, ?src, ?ann)) {
             auto t = node_ann_type(cx.fcx.lcx.ccx, ann);
             auto lhs_res = trans_lval(cx, dst);
-            check (lhs_res.is_mem);
+            assert (lhs_res.is_mem);
             auto rhs_res = trans_expr(lhs_res.res.bcx, src);
             if (ty.type_is_sequence(cx.fcx.lcx.ccx.tcx, t)) {
                 alt (op) {
@@ -5210,7 +5210,11 @@ fn trans_expr(@block_ctxt cx, @ast.expr e) -> result {
             ret trans_log(lvl, cx, a);
         }
 
-        case (ast.expr_check_expr(?a, _)) {
+        case (ast.expr_assert(?a, _)) {
+            ret trans_check_expr(cx, a);
+        }
+
+        case (ast.expr_check(?a, _)) {
             ret trans_check_expr(cx, a);
         }
 
@@ -5531,7 +5535,7 @@ fn trans_ret(@block_ctxt cx, &option.t[@ast.expr] e) -> result {
 
 fn trans_be(@block_ctxt cx, @ast.expr e) -> result {
     // FIXME: This should be a typestate precondition
-    check (ast.is_call_expr(e));
+    assert (ast.is_call_expr(e));
     // FIXME: Turn this into a real tail call once
     // calling convention issues are settled
     ret trans_ret(cx, some(e));
@@ -5627,7 +5631,7 @@ fn trans_recv(@block_ctxt cx, @ast.expr lhs, @ast.expr rhs,
 
     auto bcx = cx;
     auto data = trans_lval(bcx, lhs);
-    check (data.is_mem);
+    assert (data.is_mem);
     bcx = data.res.bcx;
     auto unit_ty = node_ann_type(bcx.fcx.lcx.ccx, ann);
 
@@ -5659,7 +5663,7 @@ fn recv_val(@block_ctxt cx, ValueRef lhs, @ast.expr rhs,
 fn init_local(@block_ctxt cx, @ast.local local) -> result {
 
     // Make a note to drop this slot on the way out.
-    check (cx.fcx.lllocals.contains_key(local.id));
+    assert (cx.fcx.lllocals.contains_key(local.id));
     auto llptr = cx.fcx.lllocals.get(local.id);
     auto ty = node_ann_type(cx.fcx.lcx.ccx, local.ann);
     auto bcx = cx;
@@ -5775,7 +5779,7 @@ fn trans_block_cleanups(@block_ctxt cx,
     auto bcx = cx;
 
     if (cleanup_cx.kind == NON_SCOPE_BLOCK) {
-        check (_vec.len[cleanup](cleanup_cx.cleanups) == 0u);
+        assert (_vec.len[cleanup](cleanup_cx.cleanups) == 0u);
     }
 
     auto i = _vec.len[cleanup](cleanup_cx.cleanups);
@@ -5996,7 +6000,7 @@ fn create_llargs_for_fn_args(&@fn_ctxt cx,
             auto i = 0u;
             for (ast.ty_param tp in ty_params) {
                 auto llarg = llvm.LLVMGetParam(cx.llfn, arg_n);
-                check (llarg as int != 0);
+                assert (llarg as int != 0);
                 cx.lltydescs += vec(llarg);
                 arg_n += 1u;
                 i += 1u;
@@ -6006,14 +6010,14 @@ fn create_llargs_for_fn_args(&@fn_ctxt cx,
 
     if (proto == ast.proto_iter) {
         auto llarg = llvm.LLVMGetParam(cx.llfn, arg_n);
-        check (llarg as int != 0);
+        assert (llarg as int != 0);
         cx.lliterbody = some[ValueRef](llarg);
         arg_n += 1u;
     }
 
     for (ast.arg arg in args) {
         auto llarg = llvm.LLVMGetParam(cx.llfn, arg_n);
-        check (llarg as int != 0);
+        assert (llarg as int != 0);
         cx.llargs.insert(arg.id, llarg);
         arg_n += 1u;
     }
@@ -6451,7 +6455,7 @@ fn trans_tag_variant(@local_ctxt cx, ast.def_id tag_id,
                            id=varg.id));
     }
 
-    check (cx.ccx.item_ids.contains_key(variant.node.id));
+    assert (cx.ccx.item_ids.contains_key(variant.node.id));
     let ValueRef llfndecl = cx.ccx.item_ids.get(variant.node.id);
 
     auto fcx = new_fn_ctxt(cx, llfndecl);
@@ -6718,7 +6722,7 @@ fn decl_native_fn_and_pair(@crate_ctxt ccx,
             for each (uint i in _uint.range(0u, num_ty_param)) {
                 auto llarg = llvm.LLVMGetParam(fcx.llfn, arg_n);
                 fcx.lltydescs += vec(llarg);
-                check (llarg as int != 0);
+                assert (llarg as int != 0);
                 call_args += vec(vp2i(bcx, llarg));
                 arg_n += 1u;
             }
@@ -6784,7 +6788,7 @@ fn push_arg(@block_ctxt cx,
 
         for (ty.arg arg in args) {
             auto llarg = llvm.LLVMGetParam(fcx.llfn, arg_n);
-            check (llarg as int != 0);
+            assert (llarg as int != 0);
             push_arg(bcx, call_args, llarg, arg.ty, arg.mode);
             if (arg.mode == ast.val) {
                 drop_args += vec(tup(llarg, arg.ty));
index 83befefc701227145c761afd283235c7adf19e88..220adcb1a23aa25f87dc9b47ec4e02eaaa140690 100644 (file)
@@ -895,7 +895,7 @@ fn type_is_tup_like(ctxt cx, t ty) -> bool {
 }
 
 fn get_element_type(ctxt cx, t ty, uint i) -> t {
-    check (type_is_tup_like(cx, ty));
+    assert (type_is_tup_like(cx, ty));
     alt (struct(cx, ty)) {
         case (ty_tup(?mts)) {
             ret mts.(i).ty;
@@ -1785,50 +1785,117 @@ fn pat_ty(ctxt cx, @ast.pat pat) -> t {
     fail;   // not reached
 }
 
-fn expr_ann(@ast.expr expr) -> option.t[ast.ann] {
-    alt (expr.node) {
-        case (ast.expr_vec(_, _, ?ann))       { ret some[ast.ann](ann); }
-        case (ast.expr_tup(_, ?ann))          { ret some[ast.ann](ann); }
-        case (ast.expr_rec(_, _, ?ann))       { ret some[ast.ann](ann); }
-        case (ast.expr_bind(_, _, ?ann))      { ret some[ast.ann](ann); }
-        case (ast.expr_call(_, _, ?ann))      { ret some[ast.ann](ann); }
-        case (ast.expr_self_method(_, ?ann))  { ret some[ast.ann](ann); }
-        case (ast.expr_spawn(_, _, _, _, ?ann))
-                                              { ret some[ast.ann](ann); }
-        case (ast.expr_binary(_, _, _, ?ann)) { ret some[ast.ann](ann); }
-        case (ast.expr_unary(_, _, ?ann))     { ret some[ast.ann](ann); }
-        case (ast.expr_lit(_, ?ann))          { ret some[ast.ann](ann); }
-        case (ast.expr_cast(_, _, ?ann))      { ret some[ast.ann](ann); }
-        case (ast.expr_if(_, _, _, ?ann))     { ret some[ast.ann](ann); }
-        case (ast.expr_for(_, _, _, ?ann))    { ret some[ast.ann](ann); }
-        case (ast.expr_for_each(_, _, _, ?ann))
-                                              { ret some[ast.ann](ann); }
-        case (ast.expr_while(_, _, ?ann))     { ret some[ast.ann](ann); }
-        case (ast.expr_do_while(_, _, ?ann))  { ret some[ast.ann](ann); }
-        case (ast.expr_alt(_, _, ?ann))       { ret some[ast.ann](ann); }
-        case (ast.expr_block(_, ?ann))        { ret some[ast.ann](ann); }
-        case (ast.expr_assign(_, _, ?ann))    { ret some[ast.ann](ann); }
-        case (ast.expr_assign_op(_, _, _, ?ann))
-                                              { ret some[ast.ann](ann); }
-        case (ast.expr_field(_, _, ?ann))     { ret some[ast.ann](ann); }
-        case (ast.expr_index(_, _, ?ann))     { ret some[ast.ann](ann); }
-        case (ast.expr_path(_, _, ?ann))      { ret some[ast.ann](ann); }
-        case (ast.expr_ext(_, _, _, _, ?ann)) { ret some[ast.ann](ann); }
-        case (ast.expr_port(?ann))            { ret some[ast.ann](ann); }
-        case (ast.expr_chan(_, ?ann))         { ret some[ast.ann](ann); }
-        case (ast.expr_send(_, _, ?ann))      { ret some[ast.ann](ann); }
-        case (ast.expr_recv(_, _, ?ann))      { ret some[ast.ann](ann); }
-
-        case (ast.expr_fail(_))               { ret none[ast.ann]; }
-        case (ast.expr_break(_))              { ret none[ast.ann]; }
-        case (ast.expr_cont(_))               { ret none[ast.ann]; }
-        case (ast.expr_log(_,_,_))            { ret none[ast.ann]; }
-        case (ast.expr_check_expr(_,_))       { ret none[ast.ann]; }
-        case (ast.expr_ret(_,_))              { ret none[ast.ann]; }
-        case (ast.expr_put(_,_))              { ret none[ast.ann]; }
-        case (ast.expr_be(_,_))               { ret none[ast.ann]; }
+fn expr_ann(&@ast.expr e) -> ast.ann {
+    alt(e.node) {
+        case (ast.expr_vec(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_tup(_,?a)) {
+            ret a;
+        }
+        case (ast.expr_rec(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_call(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_bind(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_binary(_,_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_unary(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_lit(_,?a)) {
+            ret a;
+        }
+        case (ast.expr_cast(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_if(_,_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_while(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_for(_,_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_for_each(_,_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_do_while(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_alt(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_block(_,?a)) {
+            ret a;
+        }
+        case (ast.expr_assign(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_assign_op(_,_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_send(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_recv(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_field(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_index(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_path(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_ext(_,_,_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_fail(?a)) {
+            ret a;
+        }
+        case (ast.expr_ret(_,?a)) {
+            ret a; 
+        }
+        case (ast.expr_put(_,?a)) {
+            ret a;
+        }
+        case (ast.expr_be(_,?a)) {
+            ret a;
+        }
+        case (ast.expr_log(_,_,?a)) {
+            ret a;
+        }
+        case (ast.expr_assert(_,?a)) {
+            ret a;
+        }
+        case (ast.expr_check(_,?a)) {
+            ret a;
+        }
+        case (ast.expr_port(?a)) {
+            ret a;
+        }
+        case (ast.expr_chan(_,?a)) {
+            ret a;
+        }
+        case (ast.expr_break(?a)) {
+            ret a;
+        }
+        case (ast.expr_cont(?a)) {
+            ret a;
+        }
+        case (ast.expr_self_method(_, ?a)) {
+            ret a;
+        }
     }
-    fail;
 }
 
 // Returns the type of an expression as a monotype.
@@ -1838,35 +1905,21 @@ fn expr_ann(@ast.expr expr) -> option.t[ast.ann] {
 // instead of "fn(&T) -> T with T = int". If this isn't what you want, see
 // expr_ty_params_and_ty() below.
 fn expr_ty(ctxt cx, @ast.expr expr) -> t {
-    alt (expr_ann(expr)) {
-        case (none[ast.ann])     { ret mk_nil(cx); }
-        case (some[ast.ann](?a)) { ret ann_to_monotype(cx, a); }
-    }
+    { ret ann_to_monotype(cx, expr_ann(expr)); }
 }
 
 fn expr_ty_params_and_ty(ctxt cx, @ast.expr expr) -> tup(vec[t], t) {
-    alt (expr_ann(expr)) {
-        case (none[ast.ann]) {
-            let vec[t] tps = vec();
-            ret tup(tps, mk_nil(cx));
-        }
-        case (some[ast.ann](?a)) {
-            ret tup(ann_to_type_params(a), ann_to_type(a));
-        }
-    }
+    auto a = expr_ann(expr);
+
+    ret tup(ann_to_type_params(a), ann_to_type(a));
 }
 
 fn expr_has_ty_params(@ast.expr expr) -> bool {
     // FIXME: Rewrite using complex patterns when they're trustworthy.
     alt (expr_ann(expr)) {
-        case (none[ast.ann]) { fail; }
-        case (some[ast.ann](?a)) {
-            alt (a) {
-                case (ast.ann_none) { fail; }
-                case (ast.ann_type(_, ?tps_opt, _)) {
-                    ret !option.is_none[vec[t]](tps_opt);
-                }
-            }
+        case (ast.ann_none) { fail; }
+        case (ast.ann_type(_, ?tps_opt, _)) {
+            ret !option.is_none[vec[t]](tps_opt);
         }
     }
 }
@@ -2233,7 +2286,7 @@ fn unify_step(@ctxt cx, t expected, t actual) -> result {
                         if (actual_n < vlen) {
                             cx.types.(actual_n) += vec(expected);
                         } else {
-                            check (actual_n == vlen);
+                            assert (actual_n == vlen);
                             cx.types += vec(mutable vec(expected));
                         }
                     }
@@ -2601,7 +2654,7 @@ fn unify_step(@ctxt cx, t expected, t actual) -> result {
                 if (expected_n < vlen) {
                     cx.types.(expected_n) += vec(actual);
                 } else {
-                    check (expected_n == vlen);
+                    assert (expected_n == vlen);
                     cx.types += vec(mutable vec(actual));
                 }
                 ret ures_ok(expected);
index 3354fe46ad96390445045a3c2f04b7d7103546fd..094b7e1f0ee99cd72b8b1440a9d94e43bc730e5d 100644 (file)
@@ -110,7 +110,7 @@ fn ty_param_count_and_ty_for_def(@fn_ctxt fcx, &ast.span sp, &ast.def defn)
         -> ty_param_count_and_ty {
     alt (defn) {
         case (ast.def_arg(?id)) {
-            // check (fcx.locals.contains_key(id));
+            // assert (fcx.locals.contains_key(id));
             ret tup(0u, fcx.locals.get(id));
         }
         case (ast.def_local(?id)) {
@@ -122,7 +122,7 @@ fn ty_param_count_and_ty_for_def(@fn_ctxt fcx, &ast.span sp, &ast.def defn)
             ret tup(0u, t);
         }
         case (ast.def_obj_field(?id)) {
-            // check (fcx.locals.contains_key(id));
+            // assert (fcx.locals.contains_key(id));
             ret tup(0u, fcx.locals.get(id));
         }
         case (ast.def_fn(?id)) {
@@ -142,7 +142,7 @@ fn ty_param_count_and_ty_for_def(@fn_ctxt fcx, &ast.span sp, &ast.def defn)
                                     fcx.ccx.type_cache, vid);
         }
         case (ast.def_binding(?id)) {
-            // check (fcx.locals.contains_key(id));
+            // assert (fcx.locals.contains_key(id));
             ret tup(0u, fcx.locals.get(id));
         }
         case (ast.def_obj(?id)) {
@@ -298,7 +298,7 @@ fn instantiate(ty.ctxt tcx,
         }
 
         case (ast.ty_path(?path, ?def)) {
-            check (def != none[ast.def]);
+            assert (def != none[ast.def]);
             alt (option.get[ast.def](def)) {
                 case (ast.def_ty(?id)) {
                     typ = instantiate(tcx, getter, id, path.node.types);
@@ -411,7 +411,7 @@ fn getter(@ctxt cx, ast.def_id id) -> ty.ty_param_count_and_ty {
             ret creader.get_type(cx.sess, cx.tcx, id);
         }
 
-        // check (cx.id_to_ty_item.contains_key(id));
+        // assert (cx.id_to_ty_item.contains_key(id));
 
         auto it = cx.id_to_ty_item.get(id);
         auto tpt;
@@ -672,7 +672,7 @@ fn convert_native(&@env e, @ast.native_item i) -> @env {
     fn fold_item_const(&@env e, &span sp, ast.ident i,
                        @ast.ty t, @ast.expr ex,
                        ast.def_id id, ast.ann a) -> @ast.item {
-        // check (e.cx.type_cache.contains_key(id));
+        // assert (e.cx.type_cache.contains_key(id));
         auto typ = e.cx.type_cache.get(id)._1;
         auto item = ast.item_const(i, t, ex, id, triv_ann(typ));
         ret @fold.respan[ast.item_](sp, item);
@@ -681,7 +681,7 @@ fn fold_item_const(&@env e, &span sp, ast.ident i,
     fn fold_item_fn(&@env e, &span sp, ast.ident i,
                     &ast._fn f, vec[ast.ty_param] ty_params,
                     ast.def_id id, ast.ann a) -> @ast.item {
-        // check (e.cx.type_cache.contains_key(id));
+        // assert (e.cx.type_cache.contains_key(id));
         auto typ = e.cx.type_cache.get(id)._1;
         auto item = ast.item_fn(i, f, ty_params, id, triv_ann(typ));
         ret @fold.respan[ast.item_](sp, item);
@@ -690,7 +690,7 @@ fn fold_item_fn(&@env e, &span sp, ast.ident i,
     fn fold_native_item_fn(&@env e, &span sp, ast.ident i, option.t[str] ln,
                            &ast.fn_decl d, vec[ast.ty_param] ty_params,
                            ast.def_id id, ast.ann a) -> @ast.native_item {
-        // check (e.cx.type_cache.contains_key(id));
+        // assert (e.cx.type_cache.contains_key(id));
         auto typ = e.cx.type_cache.get(id)._1;
         auto item = ast.native_item_fn(i, ln, d, ty_params, id,
                                        triv_ann(typ));
@@ -721,7 +721,7 @@ fn get_ctor_obj_methods(&@env e, ty.t t) -> vec[method] {
     fn fold_item_obj(&@env e, &span sp, ast.ident i,
                     &ast._obj ob, vec[ast.ty_param] ty_params,
                     ast.obj_def_ids odid, ast.ann a) -> @ast.item {
-        // check (e.cx.type_cache.contains_key(odid.ctor));
+        // assert (e.cx.type_cache.contains_key(odid.ctor));
         auto t = e.cx.type_cache.get(odid.ctor)._1;
         let vec[method] meth_tys = get_ctor_obj_methods(e, t);
         let vec[@ast.method] methods = vec();
@@ -777,7 +777,7 @@ fn fold_item_obj(&@env e, &span sp, ast.ident i,
     fn fold_item_ty(&@env e, &span sp, ast.ident i,
                     @ast.ty t, vec[ast.ty_param] ty_params,
                     ast.def_id id, ast.ann a) -> @ast.item {
-        // check (e.cx.type_cache.contains_key(id));
+        // assert (e.cx.type_cache.contains_key(id));
         auto typ = e.cx.type_cache.get(id)._1;
         auto item = ast.item_ty(i, t, ty_params, id, triv_ann(typ));
         ret @fold.respan[ast.item_](sp, item);
@@ -1214,7 +1214,7 @@ fn pushdown_expr_full(&@fn_ctxt fcx, ty.t expected, @ast.expr e,
                             case (none[@ast.expr]) {
                                 auto i = 0u;
                                 for (ast.field field_0 in fields_0) {
-                                    check (_str.eq(field_0.ident,
+                                    assert (_str.eq(field_0.ident,
                                                    field_mts.(i).ident));
                                     auto e_1 =
                                         pushdown_expr(fcx,
@@ -1409,7 +1409,8 @@ fn pushdown_expr_full(&@fn_ctxt fcx, ty.t expected, @ast.expr e,
             case (ast.expr_ret(_,_)) { e_1 = e.node; }
             case (ast.expr_put(_,_)) { e_1 = e.node; }
             case (ast.expr_be(_,_))  { e_1 = e.node; }
-            case (ast.expr_check_expr(_,_)) { e_1 = e.node; }
+            case (ast.expr_check(_,_)) { e_1 = e.node; }
+            case (ast.expr_assert(_,_)) { e_1 = e.node; }
 
             case (ast.expr_port(?ann)) {
                 auto t = Demand.simple(fcx, e.span, expected,
@@ -1839,7 +1840,7 @@ fn check_call(&@fn_ctxt fcx, @ast.expr f, vec[@ast.expr] args)
 
         case (ast.expr_path(?pth, ?defopt, _)) {
             auto t = ty.mk_nil(fcx.ccx.tcx);
-            check (defopt != none[ast.def]);
+            assert (defopt != none[ast.def]);
             auto defn = option.get[ast.def](defopt);
 
             auto tpt = ty_param_count_and_ty_for_def(fcx, expr.span, defn);
@@ -1939,7 +1940,7 @@ fn check_call(&@fn_ctxt fcx, @ast.expr f, vec[@ast.expr] args)
 
         case (ast.expr_be(?e, _)) {
             /* FIXME: prove instead of check */
-            check (ast.is_call_expr(e));
+            assert (ast.is_call_expr(e));
             auto expr_0 = check_expr(fcx, e);
             auto expr_1 = Pushdown.pushdown_expr(fcx, fcx.ret_ty, expr_0);
             ret @fold.respan[ast.expr_](expr.span,
@@ -1953,12 +1954,25 @@ fn check_call(&@fn_ctxt fcx, @ast.expr f, vec[@ast.expr] args)
                                          plain_ann(fcx.ccx.tcx)));
         }
 
-        case (ast.expr_check_expr(?e, _)) {
+        case (ast.expr_check(?e, _)) {
+            /* FIXME */
+        /* presumably, here is where we should check that e is
+         actually a call to a predicate, where all the arguments
+        are literals or slot variables? */
             auto expr_t = check_expr(fcx, e);
             Demand.simple(fcx, expr.span, ty.mk_bool(fcx.ccx.tcx),
                           expr_ty(fcx.ccx.tcx, expr_t));
             ret @fold.respan[ast.expr_]
-                (expr.span, ast.expr_check_expr(expr_t,
+                (expr.span, ast.expr_check(expr_t,
+                                                plain_ann(fcx.ccx.tcx)));
+        }
+
+        case (ast.expr_assert(?e, _)) {
+            auto expr_t = check_expr(fcx, e);
+            Demand.simple(fcx, expr.span, ty.mk_bool(fcx.ccx.tcx),
+                          expr_ty(fcx.ccx.tcx, expr_t));
+            ret @fold.respan[ast.expr_]
+                (expr.span, ast.expr_assert(expr_t,
                                                 plain_ann(fcx.ccx.tcx)));
         }
 
index d08ae82d603d71e1ff8883e4524669fe04989af9..e15c720a3d957e0a64d6e72d538fce35789ac203 100644 (file)
@@ -55,7 +55,8 @@
 import front.ast.expr_port;
 import front.ast.expr_chan;
 import front.ast.expr_be;
-import front.ast.expr_check_expr;
+import front.ast.expr_check;
+import front.ast.expr_assert;
 import front.ast.expr_cast;
 import front.ast.expr_for;
 import front.ast.expr_for_each;
 import middle.ty;
 import middle.ty.ann_to_type;
 import middle.ty.arg;
-import middle.ty.block_ty;
-import middle.ty.expr_ty;
+import middle.ty.expr_ann;
 import middle.ty.ty_to_str;
 
 import pretty.pprust.print_block;
@@ -293,11 +293,11 @@ fn print_idents(vec[ident] idents) -> () {
 type fn_info_map = std.map.hashmap[def_id, fn_info];
  
 fn bit_num(def_id v, fn_info m) -> uint {
-  check (m.contains_key(v));
+  assert (m.contains_key(v));
   ret m.get(v)._0;
 }
 fn get_fn_info(fn_info_map fm, def_id did) -> fn_info {
-    check (fm.contains_key(did));
+    assert (fm.contains_key(did));
     ret fm.get(did);
 }
 
@@ -389,116 +389,6 @@ fn mk_f_to_fn_info(@ast.crate c) -> fn_info_map {
   ret res;
 }
 /**** Helpers ****/
-fn expr_ann(&expr e) -> ann {
-  alt(e.node) {
-    case (ast.expr_vec(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_tup(_,?a)) {
-      ret a;
-    }
-    case (ast.expr_rec(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_call(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_bind(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_binary(_,_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_unary(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_lit(_,?a)) {
-      ret a;
-    }
-    case (ast.expr_cast(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_if(_,_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_while(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_for(_,_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_for_each(_,_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_do_while(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_alt(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_block(_,?a)) {
-      ret a;
-    }
-    case (ast.expr_assign(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_assign_op(_,_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_send(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_recv(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_field(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_index(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_path(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_ext(_,_,_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_fail(?a)) {
-      ret a;
-    }
-    case (ast.expr_ret(_,?a)) {
-      ret a; 
-    }
-    case (ast.expr_put(_,?a)) {
-      ret a;
-    }
-    case (ast.expr_be(_,?a)) {
-      ret a;
-    }
-    case (ast.expr_log(_,_,?a)) {
-      ret a;
-    }
-    case (ast.expr_check_expr(_,?a)) {
-      ret a;
-    }
-    case (ast.expr_port(?a)) {
-      ret a;
-    }
-    case (ast.expr_chan(_,?a)) {
-      ret a;
-    }
-    case (expr_break(?a)) {
-        ret a;
-    }
-    case (expr_cont(?a)) {
-        ret a;
-    }
-    case (expr_self_method(_, ?a)) {
-        ret a;
-    }
-  }
-}
-
 fn ann_to_ts_ann(ann a, uint nv) -> ts_ann {
   alt (a) {
     case (ann_none)         { ret empty_ann(nv); }
@@ -532,7 +422,7 @@ fn ann_to_ts_ann_fail_more(ann a) -> @ts_ann {
           fail;
       }
       case (ann_type(_,_,?t)) {
-          check (! is_none[@ts_ann](t));
+          assert (! is_none[@ts_ann](t));
           ret get[@ts_ann](t);
       }
   }
@@ -557,7 +447,7 @@ fn stmt_to_ann(&stmt s) -> option.t[@ts_ann] {
 }
 
 /* fails if e has no annotation */
-fn expr_states(&expr e) -> pre_and_post_state {
+fn expr_states(@expr e) -> pre_and_post_state {
   alt (expr_ann(e)) {
     case (ann_none) {
       log_err "expr_pp: the impossible happened (no annotation)";
@@ -578,7 +468,7 @@ fn expr_states(&expr e) -> pre_and_post_state {
 }
 
 /* fails if e has no annotation */
-fn expr_pp(&expr e) -> pre_and_post {
+fn expr_pp(@expr e) -> pre_and_post {
   alt (expr_ann(e)) {
     case (ann_none) {
       log_err "expr_pp: the impossible happened (no annotation)";
@@ -664,19 +554,19 @@ fn stmt_states(&stmt s, uint nv) -> pre_and_post_state {
 }
 
 
-fn expr_precond(&expr e) -> precond {
+fn expr_precond(@expr e) -> precond {
   ret (expr_pp(e)).precondition;
 }
 
-fn expr_postcond(&expr e) -> postcond {
+fn expr_postcond(@expr e) -> postcond {
   ret (expr_pp(e)).postcondition;
 }
 
-fn expr_prestate(&expr e) -> prestate {
+fn expr_prestate(@expr e) -> prestate {
   ret (expr_states(e)).prestate;
 }
 
-fn expr_poststate(&expr e) -> poststate {
+fn expr_poststate(@expr e) -> poststate {
   ret (expr_states(e)).poststate;
 }
 
@@ -737,7 +627,7 @@ fn seq_preconds(fn_info enclosing, vec[pre_and_post] pps) -> precond {
 
   if (sz >= 1u) {
     auto first   = pps.(0);
-    check (pps_len(first) == num_vars);
+    assert (pps_len(first) == num_vars);
     let precond rest = seq_preconds(enclosing,
                          slice[pre_and_post](pps, 1u, sz));
     difference(rest, first.postcondition);
@@ -797,7 +687,7 @@ fn intersect_postconds_go(&postcond first, &vec[postcond] rest) -> postcond {
 }
 
 fn intersect_postconds(&vec[postcond] pcs) -> postcond {
-  check (len[postcond](pcs) > 0u);
+  assert (len[postcond](pcs) > 0u);
 
   ret intersect_postconds_go(bitv.clone(pcs.(0)), pcs);
 }
@@ -826,7 +716,7 @@ fn find_pre_post_state_native_mod(&native_mod m) -> bool {
  
 fn find_pre_post_obj(&fn_info_map fm, _obj o) -> () {
     fn do_a_method(fn_info_map fm, &@method m) -> () {
-        check(fm.contains_key(m.node.id));
+        assert (fm.contains_key(m.node.id));
         find_pre_post_fn(fm, fm.get(m.node.id), m.node.meth);
     }
     auto f = bind do_a_method(fm,_);
@@ -836,7 +726,7 @@ fn do_a_method(fn_info_map fm, &@method m) -> () {
 
 fn find_pre_post_state_obj(fn_info_map fm, _obj o) -> bool {
     fn do_a_method(fn_info_map fm, &@method m) -> bool {
-        check(fm.contains_key(m.node.id));
+        assert (fm.contains_key(m.node.id));
         ret find_pre_post_state_fn(fm, fm.get(m.node.id), m.node.meth);
     }
     auto f = bind do_a_method(fm,_);
@@ -849,10 +739,10 @@ fn do_a_method(fn_info_map fm, &@method m) -> bool {
 fn find_pre_post_item(fn_info_map fm, fn_info enclosing, &item i) -> () {
   alt (i.node) {
     case (ast.item_const(?id, ?t, ?e, ?di, ?a)) {
-        find_pre_post_expr(fm, enclosing, *e);
+        find_pre_post_expr(fm, enclosing, e);
     }
     case (ast.item_fn(?id, ?f, ?ps, ?di, ?a)) {
-      check (fm.contains_key(di));
+      assert (fm.contains_key(di));
       find_pre_post_fn(fm, fm.get(di), f);
     }
     case (ast.item_mod(?id, ?m, ?di)) {
@@ -883,14 +773,14 @@ fn find_pre_post_exprs(&fn_info_map fm, &fn_info enclosing,
 
     fn do_one(fn_info_map fm, fn_info enclosing,
               &@expr e) -> () {
-        find_pre_post_expr(fm, enclosing, *e);
+        find_pre_post_expr(fm, enclosing, e);
     }
     auto f = bind do_one(fm, enclosing, _);
 
     _vec.map[@expr, ()](f, args);
 
     fn get_pp(&@expr e) -> pre_and_post {
-        ret expr_pp(*e);
+        ret expr_pp(e);
     }
     auto g = get_pp;
     auto pps = _vec.map[@expr, pre_and_post](g, args);
@@ -904,31 +794,31 @@ fn get_pp(&@expr e) -> pre_and_post {
 
 fn find_pre_post_loop(&fn_info_map fm, &fn_info enclosing, &@decl d,
      &@expr index, &block body, &ann a) -> () {
-    find_pre_post_expr(fm, enclosing, *index);
+    find_pre_post_expr(fm, enclosing, index);
     find_pre_post_block(fm, enclosing, body);
     auto loop_precond = declare_var(enclosing, decl_lhs(d),
-           seq_preconds(enclosing, vec(expr_pp(*index),
-                                                   block_pp(body))));
+           seq_preconds(enclosing, vec(expr_pp(index),
+                                       block_pp(body))));
     auto loop_postcond = intersect_postconds
-        (vec(expr_postcond(*index), block_postcond(body)));
+        (vec(expr_postcond(index), block_postcond(body)));
     set_pre_and_post(a, rec(precondition=loop_precond,
                             postcondition=loop_postcond));
 }
 
 /* Fills in annotations as a side effect. Does not rebuild the expr */
-fn find_pre_post_expr(&fn_info_map fm, &fn_info enclosing, &expr e) -> () {
+fn find_pre_post_expr(&fn_info_map fm, &fn_info enclosing, @expr e) -> () {
     auto num_local_vars = num_locals(enclosing);
 
     fn do_rand_(fn_info_map fm, fn_info enclosing, &@expr e) -> () {
-        find_pre_post_expr(fm, enclosing, *e);
+        find_pre_post_expr(fm, enclosing, e);
     }
     fn pp_one(&@expr e) -> pre_and_post {
-        ret expr_pp(*e);
+        ret expr_pp(e);
     }
     
         log("find_pre_post_expr (num_locals =" +
              uistr(num_local_vars) + "):");
-        log_expr(e);
+        log_expr(*e);
     
     alt (e.node) {
         case (expr_call(?operator, ?operands, ?a)) {
@@ -974,18 +864,18 @@ fn pp_one(&@expr e) -> pre_and_post {
             set_pre_and_post(a, empty_pre_post(num_local_vars));
         }
         case(expr_log(_, ?arg, ?a)) {
-            find_pre_post_expr(fm, enclosing, *arg);
-            set_pre_and_post(a, expr_pp(*arg));
+            find_pre_post_expr(fm, enclosing, arg);
+            set_pre_and_post(a, expr_pp(arg));
         }
         case (expr_chan(?arg, ?a)) {
-            find_pre_post_expr(fm, enclosing, *arg);
-            set_pre_and_post(a, expr_pp(*arg));
+            find_pre_post_expr(fm, enclosing, arg);
+            set_pre_and_post(a, expr_pp(arg));
         }
         case(expr_put(?opt, ?a)) {
             alt (opt) {
                 case (some[@expr](?arg)) {
-                    find_pre_post_expr(fm, enclosing, *arg);
-                    set_pre_and_post(a, expr_pp(*arg));
+                    find_pre_post_expr(fm, enclosing, arg);
+                    set_pre_and_post(a, expr_pp(arg));
                 }
                 case (none[@expr]) {
                     set_pre_and_post(a, empty_pre_post(num_local_vars));
@@ -1004,10 +894,10 @@ fn pp_one(&@expr e) -> pre_and_post {
         case (expr_assign(?lhs, ?rhs, ?a)) {
             alt (lhs.node) {
                 case (expr_path(?p, some[def](def_local(?d_id)), ?a_lhs)) {
-                    find_pre_post_expr(fm, enclosing, *rhs);
-                    set_pre_and_post(a, expr_pp(*rhs));
+                    find_pre_post_expr(fm, enclosing, rhs);
+                    set_pre_and_post(a, expr_pp(rhs));
                     log("gen:");
-                    log_expr(e);
+                    log_expr(*e);
                     gen(enclosing, a, d_id);
                 }
                 case (_) {
@@ -1020,10 +910,10 @@ fn pp_one(&@expr e) -> pre_and_post {
         case (expr_recv(?lhs, ?rhs, ?a)) {
             alt (lhs.node) {
                 case (expr_path(?p, some[def](def_local(?d_id)), ?a_lhs)) {
-                    find_pre_post_expr(fm, enclosing, *rhs);
-                    set_pre_and_post(a, expr_pp(*rhs));
+                    find_pre_post_expr(fm, enclosing, rhs);
+                    set_pre_and_post(a, expr_pp(rhs));
                     log("gen:");
-                    log_expr(e);
+                    log_expr(*e);
                     gen(enclosing, a, d_id);
                 }
                 case (_) {
@@ -1049,45 +939,45 @@ fn pp_one(&@expr e) -> pre_and_post {
                           postcondition=false_postcond(num_local_vars)));
                 }
                 case (some[@expr](?ret_val)) {
-                    find_pre_post_expr(fm, enclosing, *ret_val);
+                    find_pre_post_expr(fm, enclosing, ret_val);
                     let pre_and_post pp =
-                        rec(precondition=expr_precond(*ret_val),
+                        rec(precondition=expr_precond(ret_val),
                             postcondition=false_postcond(num_local_vars));
                     set_pre_and_post(a, pp);
                 }
             }
         }
         case (expr_be(?e, ?a)) {
-            find_pre_post_expr(fm, enclosing, *e);
-            set_pre_and_post(a, rec(precondition=expr_prestate(*e),
+            find_pre_post_expr(fm, enclosing, e);
+            set_pre_and_post(a, rec(precondition=expr_prestate(e),
                           postcondition=false_postcond(num_local_vars)));
         }
         case (expr_if(?antec, ?conseq, ?maybe_alt, ?a)) {
-            find_pre_post_expr(fm, enclosing, *antec);
+            find_pre_post_expr(fm, enclosing, antec);
             find_pre_post_block(fm, enclosing, conseq);
             alt (maybe_alt) {
                 case (none[@expr]) {
                     auto precond_res = seq_preconds(enclosing,
-                                                    vec(expr_pp(*antec),
+                                                    vec(expr_pp(antec),
                                                         block_pp(conseq)));
                     set_pre_and_post(a, rec(precondition=precond_res,
                                             postcondition=
-                                            expr_poststate(*antec)));
+                                            expr_poststate(antec)));
                 }
                 case (some[@expr](?altern)) {
-                    find_pre_post_expr(fm, enclosing, *altern);
+                    find_pre_post_expr(fm, enclosing, altern);
                     auto precond_true_case =
                         seq_preconds(enclosing,
-                                     vec(expr_pp(*antec), block_pp(conseq)));
+                                     vec(expr_pp(antec), block_pp(conseq)));
                     auto postcond_true_case = union_postconds
                         (num_local_vars,
-                         vec(expr_postcond(*antec), block_postcond(conseq)));
+                         vec(expr_postcond(antec), block_postcond(conseq)));
                     auto precond_false_case = seq_preconds
                         (enclosing,
-                         vec(expr_pp(*antec), expr_pp(*altern)));
+                         vec(expr_pp(antec), expr_pp(altern)));
                     auto postcond_false_case = union_postconds
                         (num_local_vars,
-                         vec(expr_postcond(*antec), expr_postcond(*altern)));
+                         vec(expr_postcond(antec), expr_postcond(altern)));
                     auto precond_res = union_postconds
                         (num_local_vars,
                          vec(precond_true_case, precond_false_case));
@@ -1107,31 +997,31 @@ fn pp_one(&@expr e) -> pre_and_post {
             find_pre_post_exprs(fm, enclosing, vec(l, r), a);
         }
         case (expr_unary(_,?operand,?a)) {
-            find_pre_post_expr(fm, enclosing, *operand);
-            set_pre_and_post(a, expr_pp(*operand));
+            find_pre_post_expr(fm, enclosing, operand);
+            set_pre_and_post(a, expr_pp(operand));
         }
         case (expr_cast(?operand, _, ?a)) {
-            find_pre_post_expr(fm, enclosing, *operand);
-            set_pre_and_post(a, expr_pp(*operand));
+            find_pre_post_expr(fm, enclosing, operand);
+            set_pre_and_post(a, expr_pp(operand));
         }
         case (expr_while(?test, ?body, ?a)) {
-            find_pre_post_expr(fm, enclosing, *test);
+            find_pre_post_expr(fm, enclosing, test);
             find_pre_post_block(fm, enclosing, body);
             set_pre_and_post(a,
               rec(precondition=
                   seq_preconds(enclosing,
-                                 vec(expr_pp(*test), 
+                                 vec(expr_pp(test), 
                                      block_pp(body))),
                   postcondition=
-                  intersect_postconds(vec(expr_postcond(*test),
+                  intersect_postconds(vec(expr_postcond(test),
                                           block_postcond(body)))));
         }
         case (expr_do_while(?body, ?test, ?a)) {
             find_pre_post_block(fm, enclosing, body);
-            find_pre_post_expr(fm, enclosing, *test);
+            find_pre_post_expr(fm, enclosing, test);
    
             auto loop_postcond = union_postconds(num_local_vars,
-                            vec(block_postcond(body), expr_postcond(*test)));
+                            vec(block_postcond(body), expr_postcond(test)));
             /* conservative approximination: if the body
                could break or cont, the test may never be executed */
             if (has_nonlocal_exits(body)) {
@@ -1141,7 +1031,7 @@ fn pp_one(&@expr e) -> pre_and_post {
             set_pre_and_post(a, 
                              rec(precondition=seq_preconds(enclosing,
                                              vec(block_pp(body),
-                                                 expr_pp(*test))),
+                                                 expr_pp(test))),
                    postcondition=loop_postcond));
         }
         case (expr_for(?d, ?index, ?body, ?a)) {
@@ -1154,7 +1044,7 @@ fn pp_one(&@expr e) -> pre_and_post {
             find_pre_post_exprs(fm, enclosing, vec(e, sub), a);
         }
         case (expr_alt(?e, ?alts, ?a)) {
-            find_pre_post_expr(fm, enclosing, *e);
+            find_pre_post_expr(fm, enclosing, e);
             fn do_an_alt(fn_info_map fm, fn_info enc, &arm an_alt)
                 -> pre_and_post {
                 find_pre_post_block(fm, enc, an_alt.block);
@@ -1170,7 +1060,7 @@ fn combine_pp(pre_and_post antec,
                 intersect(pp.postcondition, next.postcondition);
                 ret pp;
             }
-            auto antec_pp = pp_clone(expr_pp(*e)); 
+            auto antec_pp = pp_clone(expr_pp(e)); 
             auto e_pp  = rec(precondition=empty_prestate(num_local_vars),
                              postcondition=false_postcond(num_local_vars));
             auto g = bind combine_pp(antec_pp, enclosing, _, _);
@@ -1181,8 +1071,8 @@ fn combine_pp(pre_and_post antec,
             set_pre_and_post(a, alts_overall_pp);
         }
         case (expr_field(?operator, _, ?a)) {
-            find_pre_post_expr(fm, enclosing, *operator);
-            set_pre_and_post(a, expr_pp(*operator));
+            find_pre_post_expr(fm, enclosing, operator);
+            set_pre_and_post(a, expr_pp(operator));
         }
         case (expr_fail(?a)) {
             set_pre_and_post(a,
@@ -1191,10 +1081,14 @@ fn combine_pp(pre_and_post antec,
                rec(precondition=empty_prestate(num_local_vars),
                    postcondition=false_postcond(num_local_vars)));
         }
-        case (expr_check_expr(?p, ?a)) {
+        case (expr_assert(?p, ?a)) {
+            find_pre_post_expr(fm, enclosing, p);
+            set_pre_and_post(a, expr_pp(p));
+        }
+        case (expr_check(?p, ?a)) {
             /* will need to change when we support arbitrary predicates... */
-            find_pre_post_expr(fm, enclosing, *p);
-            set_pre_and_post(a, expr_pp(*p));
+            find_pre_post_expr(fm, enclosing, p);
+            set_pre_and_post(a, expr_pp(p));
         }
         case(expr_bind(?operator, ?maybe_args, ?a)) {
             auto args = _vec.cat_options[@expr](maybe_args);
@@ -1211,21 +1105,21 @@ fn combine_pp(pre_and_post antec,
             set_pre_and_post(a, empty_pre_post(num_local_vars));
         }
         case (expr_ext(_, _, _, ?expanded, ?a)) {
-            find_pre_post_expr(fm, enclosing, *expanded);
-            set_pre_and_post(a, expr_pp(*expanded));
+            find_pre_post_expr(fm, enclosing, expanded);
+            set_pre_and_post(a, expr_pp(expanded));
         }
     }
 }
 
 fn gen(&fn_info enclosing, &ann a, def_id id) -> bool {
-  check(enclosing.contains_key(id));
+  assert (enclosing.contains_key(id));
   let uint i = (enclosing.get(id))._0;
   ret set_in_postcond(i, (ann_to_ts_ann_fail_more(a)).conditions);
 }
 
 fn declare_var(&fn_info enclosing, def_id id, prestate pre)
    -> prestate {
-    check(enclosing.contains_key(id));
+    assert (enclosing.contains_key(id));
     let uint i = (enclosing.get(id))._0;
     auto res = clone(pre);
     relax_prestate(i, res);
@@ -1233,7 +1127,7 @@ fn declare_var(&fn_info enclosing, def_id id, prestate pre)
 }
 
 fn gen_poststate(&fn_info enclosing, &ann a, def_id id) -> bool {
-  check(enclosing.contains_key(id));
+  assert (enclosing.contains_key(id));
   let uint i = (enclosing.get(id))._0;
 
   ret set_in_poststate(i, (ann_to_ts_ann_fail_more(a)).states);
@@ -1251,8 +1145,8 @@ fn find_pre_post_stmt(fn_info_map fm, &fn_info enclosing, &ast.stmt s)
             case(ast.decl_local(?alocal)) {
                 alt(alocal.init) {
                     case(some[ast.initializer](?an_init)) {
-                        find_pre_post_expr(fm, enclosing, *an_init.expr);
-                        auto rhs_pp = expr_pp(*an_init.expr);
+                        find_pre_post_expr(fm, enclosing, an_init.expr);
+                        auto rhs_pp = expr_pp(an_init.expr);
                         set_pre_and_post(alocal.ann, rhs_pp);
 
                         /* Inherit ann from initializer, and add var being
@@ -1281,8 +1175,8 @@ fn find_pre_post_stmt(fn_info_map fm, &fn_info enclosing, &ast.stmt s)
         }
     }
     case(stmt_expr(?e,?a)) {
-        find_pre_post_expr(fm, enclosing, *e);
-        set_pre_and_post(a, expr_pp(*e));
+        find_pre_post_expr(fm, enclosing, e);
+        set_pre_and_post(a, expr_pp(e));
     }    
   }
 }
@@ -1318,7 +1212,7 @@ fn do_one_(fn_info_map fm, fn_info i, &@stmt s) -> () {
     
     _vec.map[@stmt, ()](do_one, b.node.stmts);
     fn do_inner_(fn_info_map fm, fn_info i, &@expr e) -> () {
-        find_pre_post_expr(fm, i, *e);
+        find_pre_post_expr(fm, i, e);
     }
     auto do_inner = bind do_inner_(fm, enclosing, _);
     option.map[@expr, ()](do_inner, b.node.expr);
@@ -1331,7 +1225,7 @@ fn get_pp_stmt(&@stmt s) -> pre_and_post {
     auto f = get_pp_stmt;
     pps += _vec.map[@stmt, pre_and_post](f, b.node.stmts);
     fn get_pp_expr(&@expr e) -> pre_and_post {
-        ret expr_pp(*e);
+        ret expr_pp(e);
     }
     auto g = get_pp_expr;
     plus_option[pre_and_post](pps,
@@ -1363,7 +1257,7 @@ fn check_item_fn(&fn_info_map fm, &span sp, ident i, &ast._fn f,
     log("check_item_fn:");
     log_fn(f, i, ty_params);
 
-  check (fm.contains_key(id));
+  assert (fm.contains_key(id));
   find_pre_post_fn(fm, fm.get(id), f);  
 
   ret @respan(sp, ast.item_fn(i, f, ty_params, id, a));
@@ -1377,7 +1271,7 @@ fn find_pre_post_state_item(fn_info_map fm, fn_info enclosing, @item i)
               empty_prestate(num_locals(enclosing)), e);
     }
     case (ast.item_fn(?id, ?f, ?ps, ?di, ?a)) {
-      check (fm.contains_key(di));
+      assert (fm.contains_key(di));
       ret find_pre_post_state_fn(fm, fm.get(di), f);
     }
     case (ast.item_mod(?id, ?m, ?di)) {
@@ -1401,7 +1295,7 @@ fn find_pre_post_state_item(fn_info_map fm, fn_info enclosing, @item i)
 fn set_prestate_ann(@ann a, prestate pre) -> bool {
   alt (*a) {
     case (ann_type(_,_,?ts_a)) {
-      check (! is_none[@ts_ann](ts_a));
+      assert (! is_none[@ts_ann](ts_a));
       ret set_prestate(get[@ts_ann](ts_a), pre);
     }
     case (ann_none) {
@@ -1415,8 +1309,8 @@ fn set_prestate_ann(@ann a, prestate pre) -> bool {
 fn extend_prestate_ann(ann a, prestate pre) -> bool {
   alt (a) {
     case (ann_type(_,_,?ts_a)) {
-      check (! is_none[@ts_ann](ts_a));
-      ret extend_prestate((*get[@ts_ann](ts_a)).states.prestate, pre);
+      assert (! is_none[@ts_ann](ts_a));
+      ret extend_prestate((get[@ts_ann](ts_a)).states.prestate, pre);
     }
     case (ann_none) {
       log("set_prestate_ann: expected an ann_type here");
@@ -1428,8 +1322,8 @@ fn extend_prestate_ann(ann a, prestate pre) -> bool {
 fn set_poststate_ann(ann a, poststate post) -> bool {
   alt (a) {
     case (ann_type(_,_,?ts_a)) {
-      check (! is_none[@ts_ann](ts_a));
-      ret set_poststate(*get[@ts_ann](ts_a), post);
+      assert (! is_none[@ts_ann](ts_a));
+      ret set_poststate(get[@ts_ann](ts_a), post);
     }
     case (ann_none) {
       log("set_poststate_ann: expected an ann_type here");
@@ -1441,7 +1335,7 @@ fn set_poststate_ann(ann a, poststate post) -> bool {
 fn extend_poststate_ann(ann a, poststate post) -> bool {
   alt (a) {
     case (ann_type(_,_,?ts_a)) {
-      check (! is_none[@ts_ann](ts_a));
+      assert (! is_none[@ts_ann](ts_a));
       ret extend_poststate((*get[@ts_ann](ts_a)).states.poststate, post);
     }
     case (ann_none) {
@@ -1454,7 +1348,7 @@ fn extend_poststate_ann(ann a, poststate post) -> bool {
 fn set_pre_and_post(&ann a, pre_and_post pp) -> () {
     alt (a) {
         case (ann_type(_,_,?ts_a)) {
-            check (! is_none[@ts_ann](ts_a));
+            assert (! is_none[@ts_ann](ts_a));
             auto t = *get[@ts_ann](ts_a);
             /*  log("set_pre_and_post, old =");
             log_pp(t.conditions);
@@ -1478,7 +1372,7 @@ fn seq_states(&fn_info_map fm, &fn_info enclosing,
 
   for (@expr e in exprs) {
     changed = find_pre_post_state_expr(fm, enclosing, post, e) || changed;
-    post = expr_poststate(*e);
+    post = expr_poststate(e);
   }
 
   ret tup(changed, post);
@@ -1513,8 +1407,8 @@ fn find_pre_post_state_loop(fn_info_map fm, fn_info enclosing,
     /* in general, would need the intersection of
        (poststate of index, poststate of body) */
     changed = find_pre_post_state_block(fm, enclosing,
-                expr_poststate(*index), body) || changed;
-    auto res_p = intersect_postconds(vec(expr_poststate(*index),
+                expr_poststate(index), body) || changed;
+    auto res_p = intersect_postconds(vec(expr_poststate(index),
                                          block_poststate(body)));
   
     changed = extend_poststate_ann(a, res_p) || changed;
@@ -1522,7 +1416,7 @@ fn find_pre_post_state_loop(fn_info_map fm, fn_info enclosing,
 }
 
 fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
-                            &prestate pres, &@expr e) -> bool {
+                            &prestate pres, @expr e) -> bool {
   auto changed = false;
   auto num_local_vars = num_locals(enclosing);
 
@@ -1540,20 +1434,20 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
         || changed;
       /* rands go left-to-right */
       ret(find_pre_post_state_exprs(fm, enclosing,
-                                    expr_poststate(*operator), a, operands)
+                                    expr_poststate(operator), a, operands)
           || changed);
     }
     case (expr_spawn(_, _, ?operator, ?operands, ?a)) {
         changed = find_pre_post_state_expr(fm, enclosing, pres, operator);
         ret(find_pre_post_state_exprs(fm, enclosing,
-                 expr_poststate(*operator), a, operands)
+                 expr_poststate(operator), a, operands)
           || changed);
     }
     case (expr_bind(?operator, ?maybe_args, ?a)) {
         changed = find_pre_post_state_expr(fm, enclosing, pres, operator)
             || changed;
         ret (find_pre_post_state_exprs(fm, enclosing,
-          expr_poststate(*operator), a, cat_options[@expr](maybe_args))
+          expr_poststate(operator), a, cat_options[@expr](maybe_args))
             || changed);
     }
     case (expr_path(_,_,?a)) {
@@ -1563,19 +1457,19 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
         /* factor out the "one exp" pattern */
         changed = find_pre_post_state_expr(fm, enclosing, pres, e);
         changed = extend_prestate_ann(a, pres) || changed;
-        changed = extend_poststate_ann(a, expr_poststate(*e)) || changed;
+        changed = extend_poststate_ann(a, expr_poststate(e)) || changed;
         ret changed;
     }
     case (expr_chan(?e, ?a)) {
         changed = find_pre_post_state_expr(fm, enclosing, pres, e);
         changed = extend_prestate_ann(a, pres) || changed;
-        changed = extend_poststate_ann(a, expr_poststate(*e)) || changed;
+        changed = extend_poststate_ann(a, expr_poststate(e)) || changed;
         ret changed;
     }
     case (expr_ext(_, _, _, ?expanded, ?a)) {
         changed = find_pre_post_state_expr(fm, enclosing, pres, expanded);
         changed = extend_prestate_ann(a, pres) || changed;
-        changed = extend_poststate_ann(a, expr_poststate(*expanded))
+        changed = extend_poststate_ann(a, expr_poststate(expanded))
            || changed;
         ret changed;
     }
@@ -1584,7 +1478,7 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
             case (some[@expr](?arg)) {
                 changed = find_pre_post_state_expr(fm, enclosing, pres, arg);
                 changed = extend_prestate_ann(a, pres) || changed;
-                changed = extend_poststate_ann(a, expr_poststate(*arg))
+                changed = extend_poststate_ann(a, expr_poststate(arg))
                     || changed;
                 ret changed;
             }
@@ -1611,7 +1505,7 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
             case (some[@expr](?base)) {
                 changed = find_pre_post_state_expr(fm, enclosing, pres, base)
                     || changed;
-                changed = extend_poststate_ann(a, expr_poststate(*base))
+                changed = extend_poststate_ann(a, expr_poststate(base))
                     || changed;
             }
         }
@@ -1626,7 +1520,7 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
                 changed = pure_exp(a_lhs, pres) || changed;
                 changed = find_pre_post_state_expr(fm, enclosing, pres, rhs)
                     || changed;
-                changed = extend_poststate_ann(a, expr_poststate(*rhs))
+                changed = extend_poststate_ann(a, expr_poststate(rhs))
                     || changed;
                 changed = gen_poststate(enclosing, a, d_id) || changed;
             }
@@ -1635,8 +1529,8 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
                 changed = find_pre_post_state_expr(fm, enclosing, pres, lhs)
                     || changed;
                 changed = find_pre_post_state_expr(fm, enclosing,
-                     expr_poststate(*lhs), rhs) || changed;
-                changed = extend_poststate_ann(a, expr_poststate(*rhs))
+                     expr_poststate(lhs), rhs) || changed;
+                changed = extend_poststate_ann(a, expr_poststate(rhs))
                     || changed;
             }
         }
@@ -1651,7 +1545,7 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
                 changed = pure_exp(a_lhs, pres) || changed;
                 changed = find_pre_post_state_expr(fm, enclosing, pres, rhs)
                     || changed;
-                changed = extend_poststate_ann(a, expr_poststate(*rhs))
+                changed = extend_poststate_ann(a, expr_poststate(rhs))
                     || changed;
                 changed = gen_poststate(enclosing, a, d_id) || changed;
             }
@@ -1660,8 +1554,8 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
                 changed = find_pre_post_state_expr(fm, enclosing, pres, lhs)
                     || changed;
                 changed = find_pre_post_state_expr(fm, enclosing,
-                     expr_poststate(*lhs), rhs) || changed;
-                changed = extend_poststate_ann(a, expr_poststate(*rhs))
+                     expr_poststate(lhs), rhs) || changed;
+                changed = extend_poststate_ann(a, expr_poststate(rhs))
                     || changed;
             }
         }
@@ -1691,17 +1585,17 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
         changed = find_pre_post_state_expr(fm, enclosing, pres, antec)
             || changed;
         changed = find_pre_post_state_block(fm, enclosing,
-          expr_poststate(*antec), conseq) || changed;
+          expr_poststate(antec), conseq) || changed;
         alt (maybe_alt) {
             case (none[@expr]) {
-                changed = extend_poststate_ann(a, expr_poststate(*antec))
+                changed = extend_poststate_ann(a, expr_poststate(antec))
                     || changed;
             }
             case (some[@expr](?altern)) {
                 changed = find_pre_post_state_expr(fm, enclosing,
-                   expr_poststate(*antec), altern) || changed;
+                   expr_poststate(antec), altern) || changed;
                 auto poststate_res = intersect_postconds
-                    (vec(block_poststate(conseq), expr_poststate(*altern)));
+                    (vec(block_poststate(conseq), expr_poststate(altern)));
                 changed = extend_poststate_ann(a, poststate_res) || changed;
             }
         }
@@ -1710,7 +1604,7 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
         log("new prestate:");
         log_bitv(enclosing, pres);
         log("new poststate:");
-        log_bitv(enclosing, expr_poststate(*e));
+        log_bitv(enclosing, expr_poststate(e));
 
         ret changed;
     }
@@ -1720,8 +1614,8 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
         changed = find_pre_post_state_expr(fm, enclosing, pres, l)
                     || changed;
         changed = find_pre_post_state_expr(fm,
-                    enclosing, expr_poststate(*l), r) || changed;
-        changed = extend_poststate_ann(a, expr_poststate(*r)) || changed;
+                    enclosing, expr_poststate(l), r) || changed;
+        changed = extend_poststate_ann(a, expr_poststate(r)) || changed;
         ret changed;
     }
     case (expr_send(?l, ?r, ?a)) {
@@ -1729,8 +1623,8 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
         changed = find_pre_post_state_expr(fm, enclosing, pres, l)
                     || changed;
         changed = find_pre_post_state_expr(fm,
-                    enclosing, expr_poststate(*l), r) || changed;
-        changed = extend_poststate_ann(a, expr_poststate(*r)) || changed;
+                    enclosing, expr_poststate(l), r) || changed;
+        changed = extend_poststate_ann(a, expr_poststate(r)) || changed;
         ret changed;
     }
     case (expr_assign_op(?op, ?lhs, ?rhs, ?a)) {
@@ -1739,8 +1633,8 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
         changed = find_pre_post_state_expr(fm, enclosing, pres, lhs)
                     || changed;
         changed = find_pre_post_state_expr(fm,
-                    enclosing, expr_poststate(*lhs), rhs) || changed;
-        changed = extend_poststate_ann(a, expr_poststate(*rhs)) || changed;
+                    enclosing, expr_poststate(lhs), rhs) || changed;
+        changed = extend_poststate_ann(a, expr_poststate(rhs)) || changed;
         ret changed;
     }
     case (expr_while(?test, ?body, ?a)) {
@@ -1756,9 +1650,9 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
         changed = find_pre_post_state_expr(fm, enclosing, pres, test)
             || changed;
         changed = find_pre_post_state_block(fm, 
-                   enclosing, expr_poststate(*test), body) || changed; 
+                   enclosing, expr_poststate(test), body) || changed; 
         changed = extend_poststate_ann(a,
-                    intersect_postconds(vec(expr_poststate(*test),
+                    intersect_postconds(vec(expr_poststate(test),
                                         block_poststate(body)))) || changed;
         ret changed;
     }
@@ -1777,7 +1671,7 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
             changed = set_poststate_ann(a, pres) || changed;
         }
         else {
-            changed = extend_poststate_ann(a, expr_poststate(*test))
+            changed = extend_poststate_ann(a, expr_poststate(test))
               || changed;
         }
 
@@ -1793,14 +1687,14 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
         changed = extend_prestate_ann(a, pres) || changed; 
         changed = find_pre_post_state_expr(fm, enclosing, pres, e) || changed;
         changed = find_pre_post_state_expr(fm, enclosing,
-                     expr_poststate(*e), sub) || changed;
-        changed = extend_poststate_ann(a, expr_poststate(*sub));
+                     expr_poststate(e), sub) || changed;
+        changed = extend_poststate_ann(a, expr_poststate(sub));
         ret changed;
     }
     case (expr_alt(?e, ?alts, ?a)) {
         changed = extend_prestate_ann(a, pres) || changed; 
         changed = find_pre_post_state_expr(fm, enclosing, pres, e) || changed;
-        auto e_post = expr_poststate(*e);
+        auto e_post = expr_poststate(e);
         auto a_post;
         if (_vec.len[arm](alts) > 0u) {
             a_post = false_postcond(num_local_vars);
@@ -1821,14 +1715,14 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
     case (expr_field(?e,_,?a)) {
         changed = find_pre_post_state_expr(fm, enclosing, pres, e);
         changed = extend_prestate_ann(a, pres) || changed;
-        changed = extend_poststate_ann(a, expr_poststate(*e)) || changed;
+        changed = extend_poststate_ann(a, expr_poststate(e)) || changed;
         ret changed;
     }
     case (expr_unary(_,?operand,?a)) {
         changed = find_pre_post_state_expr(fm, enclosing, pres, operand)
           || changed;
         changed = extend_prestate_ann(a, pres) || changed;
-        changed = extend_poststate_ann(a, expr_poststate(*operand))
+        changed = extend_poststate_ann(a, expr_poststate(operand))
           || changed;
         ret changed;
     }
@@ -1836,7 +1730,7 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
            changed = find_pre_post_state_expr(fm, enclosing, pres, operand)
           || changed;
         changed = extend_prestate_ann(a, pres) || changed;
-        changed = extend_poststate_ann(a, expr_poststate(*operand))
+        changed = extend_poststate_ann(a, expr_poststate(operand))
           || changed;
         ret changed;
     }
@@ -1845,14 +1739,15 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
         /* if execution continues after fail, then everything is true! woo! */
         changed = set_poststate_ann(a, false_postcond(num_local_vars))
           || changed;
-        /*        log_err("fail: poststate = ");
-                  log_bitv(enclosing, expr_poststate(*e)); */
         ret changed;
     }
-    case (expr_check_expr(?p, ?a)) {
+    case (expr_assert(?p, ?a)) {
+        ret pure_exp(a, pres);
+    }
+    case (expr_check(?p, ?a)) {
         changed = extend_prestate_ann(a, pres) || changed;
         changed = find_pre_post_state_expr(fm, enclosing, pres, p) || changed;
-        /* p is pure, so the poststate must be the same as the prestate */
+        /* FIXME: update the postcondition to reflect that p holds */
         changed = extend_poststate_ann(a, pres) || changed;
         ret changed;
     }
@@ -1875,7 +1770,7 @@ fn find_pre_post_state_stmt(&fn_info_map fm, &fn_info enclosing,
                             &prestate pres, @stmt s) -> bool {
   auto changed = false;
   auto stmt_ann_ = stmt_to_ann(*s);
-  check (!is_none[@ts_ann](stmt_ann_));
+  assert (!is_none[@ts_ann](stmt_ann_));
   auto stmt_ann = *(get[@ts_ann](stmt_ann_));
               log("*At beginning: stmt = ");
               log_stmt(*s);
@@ -1897,7 +1792,7 @@ fn find_pre_post_state_stmt(&fn_info_map fm, &fn_info enclosing,
                 changed = find_pre_post_state_expr
                     (fm, enclosing, pres, an_init.expr) || changed;
                 changed = extend_poststate(stmt_ann.states.poststate,
-                                           expr_poststate(*an_init.expr))
+                                           expr_poststate(an_init.expr))
                     || changed;
                 changed = gen_poststate(enclosing, a, alocal.id) || changed;
               log("Summary: stmt = ");
@@ -1932,10 +1827,10 @@ fn find_pre_post_state_stmt(&fn_info_map fm, &fn_info enclosing,
     }
     case (stmt_expr(?e, _)) {
       changed = find_pre_post_state_expr(fm, enclosing, pres, e) || changed;
-      changed = extend_prestate(stmt_ann.states.prestate, expr_prestate(*e))
+      changed = extend_prestate(stmt_ann.states.prestate, expr_prestate(e))
           || changed;
       changed = extend_poststate(stmt_ann.states.poststate,
-                                 expr_poststate(*e)) || changed;
+                                 expr_poststate(e)) || changed;
       /*
                     log("Summary: stmt = ");
               log_stmt(*s);
@@ -1980,7 +1875,7 @@ fn find_pre_post_state_block(&fn_info_map fm, &fn_info enclosing,
     case (none[@expr]) {}
     case (some[@expr](?e)) {
       changed = find_pre_post_state_expr(fm, enclosing, pres, e) || changed;
-      post = expr_poststate(*e);
+      post = expr_poststate(e);
     }
   }
 
@@ -2038,13 +1933,13 @@ fn (&fn_info_map, &fn_info, &ast._fn) -> bool f,
   }
 }
 
-fn check_states_expr(fn_info enclosing, &expr e) -> () {
+fn check_states_expr(fn_info enclosing, @expr e) -> () {
   let precond prec    = expr_precond(e);
   let prestate pres   = expr_prestate(e);
 
   if (!implies(pres, prec)) {
       log_err("check_states_expr: Unsatisfied precondition constraint for ");
-      log_expr_err(e);
+      log_expr_err(*e);
       log_err("Precondition: ");
       log_bitv_err(enclosing, prec);
       log_err("Prestate: ");
@@ -2093,7 +1988,7 @@ fn do_one_(fn_info i, &@stmt s) -> () {
  
   _vec.map[@stmt, ()](do_one, f.body.node.stmts);
   fn do_inner_(fn_info i, &@expr e) -> () {
-    check_states_expr(i, *e);
+    check_states_expr(i, e);
   }
   auto do_inner = bind do_inner_(enclosing, _);
   option.map[@expr, ()](do_inner, f.body.node.expr);
@@ -2116,7 +2011,7 @@ fn check_item_fn_state(&fn_info_map f_info_map, &span sp, ident i,
                        ann a) -> @item {
 
   /* Look up the var-to-bit-num map for this function */
-  check(f_info_map.contains_key(id));
+  assert (f_info_map.contains_key(id));
   auto f_info = f_info_map.get(id);
 
   check_fn_states(f_info_map, f_info, f);
@@ -2126,7 +2021,7 @@ fn check_item_fn_state(&fn_info_map f_info_map, &span sp, ident i,
 }
 
 fn check_method_states(&fn_info_map f_info_map, @method m) -> () {
-    check (f_info_map.contains_key(m.node.id));
+    assert (f_info_map.contains_key(m.node.id));
     auto f_info = f_info_map.get(m.node.id);
     check_fn_states(f_info_map, f_info, m.node.meth);
 }
@@ -2193,7 +2088,7 @@ fn init_block(&fn_info fi, &span sp, &block_ b) -> block {
 fn item_fn_anns(&fn_info_map fm, &span sp, ident i, &ast._fn f,
                 vec[ast.ty_param] ty_params, def_id id, ann a) -> @item {
 
-    check(fm.contains_key(id));
+    assert (fm.contains_key(id));
     auto f_info = fm.get(id);
 
     log(i + " has " + uistr(num_locals(f_info)) + " local vars");
@@ -2413,8 +2308,11 @@ fn annotate_expr(&fn_info_map fm, &@expr e) -> @expr {
         case (expr_log(?n, ?e, ?a)) {
             e1 = expr_log(n, annotate_expr(fm, e), a);
         }
-        case (expr_check_expr(?e, ?a)) {
-            e1 = expr_check_expr(annotate_expr(fm, e), a);
+        case (expr_assert(?e, ?a)) {
+            e1 = expr_assert(annotate_expr(fm, e), a);
+        }
+        case (expr_check(?e, ?a)) {
+            e1 = expr_check(annotate_expr(fm, e), a);
         }
         case (expr_port(_)) { /* no change */ }
         case (expr_chan(?e, ?a)) {
index dbc188b1d40661dfa8b3cabd57f5f91ffbaae781..8a5d40dc563c40e537e9bbc3d781ae90cff5c41b 100644 (file)
@@ -392,7 +392,10 @@ fn walk_expr(&ast_visitor v, @ast.expr e) {
         case (ast.expr_log(_,?x, _)) {
             walk_expr(v, x);
         }
-        case (ast.expr_check_expr(?x, _)) {
+        case (ast.expr_check(?x, _)) {
+            walk_expr(v, x);
+        }
+        case (ast.expr_assert(?x, _)) {
             walk_expr(v, x);
         }
         case (ast.expr_port(_)) { }
index e49ed34e948b1e9daf059139b4ff734596274105..7ef91ce89e4f92afe7f1646b12f516b37c8e0fd7 100644 (file)
@@ -661,12 +661,18 @@ fn print_opt(ps s, &option.t[@ast.expr] expr) {
             }
             print_expr(s, expr);
         }
-        case (ast.expr_check_expr(?expr,_)) {
+        case (ast.expr_check(?expr,_)) {
             wrd1(s, "check");
             popen_h(s);
             print_expr(s, expr);
             pclose(s);
         }
+        case (ast.expr_assert(?expr,_)) {
+            wrd1(s, "assert");
+            popen_h(s);
+            print_expr(s, expr);
+            pclose(s);
+        }
         case (ast.expr_ext(?path, ?args, ?body, _, _)) {
             wrd(s.s, "#");
             print_path(s, path);
index b7fbc3cc25d5858c2d00723756614c43f4b182b3..9e815b464849717ad7d41e0d6ae720e48b5680b3 100644 (file)
@@ -85,7 +85,7 @@ fn intersect(&precond p1, &precond p2) -> bool {
 
 fn pps_len(&pre_and_post p) -> uint {
   // gratuitous check
-  check (p.precondition.nbits == p.postcondition.nbits);
+  assert (p.precondition.nbits == p.postcondition.nbits);
   ret p.precondition.nbits;
 }
 
@@ -129,7 +129,7 @@ fn set_prestate(@ts_ann a, &prestate p) -> bool {
 
 // Sets all the bits in a's postcondition to equal the
 // corresponding bit in p's postcondition.
-fn set_poststate(&ts_ann a, &poststate p) -> bool {
+fn set_poststate(@ts_ann a, &poststate p) -> bool {
   ret bitv.copy(a.states.poststate, p);
 }
 
index 0d925d7d0249c20ac57c0834dff94bd185c05c97..368fe21710ed7e84c0fb523185c32cda7ae480ef 100644 (file)
@@ -35,7 +35,7 @@ fn color_supported() -> bool {
 }
 
 fn set_color(io.buf_writer writer, u8 first_char, u8 color) {
-    check (color < 16u8);
+    assert (color < 16u8);
 
     esc(writer);
     if (color >= 8u8) {
index dfd2204d007a99e8adb95d4edee4d50e072d14b3..1824d142dab793d437e92a7b95fcfea1930f94ca 100644 (file)
@@ -27,7 +27,7 @@
 
 fn to_str(int n, uint radix) -> str
 {
-    check (0u < radix && radix <= 16u);
+    assert (0u < radix && radix <= 16u);
     if (n < 0) {
         ret "-" + _uint.to_str((-n) as uint, radix);
     } else {
index 44f14fb6e1cc34c7beb69ca115fe7d007d08597c..ed2027e1da29a4fc97be54037aa9d9edf1592203 100644 (file)
@@ -218,14 +218,14 @@ fn utf8_char_width(u8 b) -> uint {
 fn char_range_at(str s, uint i) -> tup(char, uint) {
     auto b0 = s.(i);
     auto w = utf8_char_width(b0);
-    check(w != 0u);
+    assert (w != 0u);
     if (w == 1u) {ret tup(b0 as char, i + 1u);}
     auto val = 0u;
     auto end = i + w;
     i += 1u;
     while (i < end) {
         auto byte = s.(i);
-        check(byte & 0xc0_u8 == tag_cont_u8);
+        assert (byte & 0xc0_u8 == tag_cont_u8);
         val <<= 6u;
         val += (byte & 0x3f_u8) as uint;
         i += 1u;
@@ -247,11 +247,11 @@ fn char_len(str s) -> uint {
     auto total = byte_len(s);
     while (i < total) {
         auto chsize = utf8_char_width(s.(i));
-        check(chsize > 0u);
+        assert (chsize > 0u);
         len += 1u;
         i += chsize;
     }
-    check(i == total);
+    assert (i == total);
     ret len;
 }
 
@@ -274,7 +274,7 @@ fn push_char(&mutable str s, char ch) {
 fn pop_char(&mutable str s) -> char {
     auto end = byte_len(s);
     while (end > 0u && s.(end - 1u) & 0xc0_u8 == tag_cont_u8) {end -= 1u;}
-    check(end > 0u);
+    assert (end > 0u);
     auto ch = char_at(s, end - 1u);
     s = substr(s, 0u, end - 1u);
     ret ch;
@@ -404,7 +404,7 @@ fn slice(str s, uint begin, uint end) -> str {
 
 fn shift_byte(&mutable str s) -> u8 {
     auto len = byte_len(s);
-    check(len > 0u);
+    assert (len > 0u);
     auto b = s.(0);
     s = substr(s, 1u, len - 1u);
     ret b;
@@ -412,7 +412,7 @@ fn shift_byte(&mutable str s) -> u8 {
 
 fn pop_byte(&mutable str s) -> u8 {
     auto len = byte_len(s);
-    check(len > 0u);
+    assert (len > 0u);
     auto b = s.(len - 1u);
     s = substr(s, 0u, len - 1u);
     ret b;
index 97108c9082b64882d219288266f8ac202fe655e1..2d373cdd2babc778c886a6e9975d770c3b42beff 100644 (file)
@@ -56,7 +56,7 @@ fn to_str(uint num, uint radix) -> str
 {
     auto n = num;
 
-    check (0u < radix && radix <= 16u);
+    assert (0u < radix && radix <= 16u);
     fn digit(uint n) -> char {
         alt (n) {
             case (0u) { ret '0'; }
index 126bf363052c00e4a89466a0cecbe6b020f22905..4761a867494df125c366f42589c05e6218cc71ea 100644 (file)
@@ -131,7 +131,7 @@ fn len_set[T](array[T] v, uint n) {
 }
 
 fn buf_off[T](array[T] v, uint offset) -> vbuf {
-    check (offset < len[T](v));
+     assert (offset < len[T](v));
     ret rustrt.vec_buf[T](v, offset);
 }
 
@@ -149,9 +149,10 @@ fn last[T](array[T] v) -> option.t[T] {
 }
 
 // Returns elements from [start..end) from v.
+
 fn slice[T](array[T] v, uint start, uint end) -> vec[T] {
-    check (start <= end);
-    check (end <= len[T](v));
+    assert (start <= end);
+    assert (end <= len[T](v));
     auto result = alloc[T](end - start);
     let uint i = start;
     while (i < end) {
@@ -163,7 +164,7 @@ fn slice[T](array[T] v, uint start, uint end) -> vec[T] {
 
 fn shift[T](&mutable array[T] v) -> T {
     auto ln = len[T](v);
-    check(ln > 0u);
+    assert (ln > 0u);
     auto e = v.(0);
     v = slice[T](v, 1u, ln);
     ret e;
@@ -171,7 +172,7 @@ fn shift[T](&mutable array[T] v) -> T {
 
 fn pop[T](&mutable array[T] v) -> T {
     auto ln = len[T](v);
-    check(ln > 0u);
+    assert (ln > 0u);
     ln -= 1u;
     auto e = v.(ln);
     v = slice[T](v, 0u, ln);
index feb4296aa6efd09dfec0096af4eb309f28c21284..f52b016b7688339a7804bd42e70630a372031084 100644 (file)
@@ -28,8 +28,8 @@ fn create(uint nbits, bool init) -> t {
 fn process(&fn(uint, uint) -> uint op, &t v0, &t v1) -> bool {
     auto len = _vec.len[mutable uint](v1.storage);
 
-    check (_vec.len[mutable uint](v0.storage) == len);
-    check (v0.nbits == v1.nbits);
+    assert (_vec.len[mutable uint](v0.storage) == len);
+    assert (v0.nbits == v1.nbits);
 
     auto changed = false;
 
@@ -84,7 +84,7 @@ fn clone(t v) -> t {
 }
 
 fn get(&t v, uint i) -> bool {
-    check (i < v.nbits);
+    assert (i < v.nbits);
 
     auto bits = uint_bits();
 
@@ -129,7 +129,7 @@ fn difference(&t v0, &t v1) -> bool {
 }
 
 fn set(&t v, uint i, bool x) {
-    check (i < v.nbits);
+    assert (i < v.nbits);
 
     auto bits = uint_bits();
 
@@ -196,7 +196,7 @@ fn to_str(&t v) -> str {
 
 // FIXME: can we just use structural equality on to_vec?
 fn eq_vec(&t v0, &vec[uint] v1) -> bool {
-    check (v0.nbits == _vec.len[uint](v1));
+    assert (v0.nbits == _vec.len[uint](v1));
     auto len = v0.nbits;
     auto i = 0u;
     while (i < len) {
index 776f82e99fe8fe9e4a303cedfc32d592224c65a4..ee706ae7e7d1b427e5b03c99b4f5d77e7e3e10bd 100644 (file)
@@ -28,7 +28,7 @@ fn create[T]() -> t[T] {
      * elsewhere.
      */
     fn grow[T](uint nelts, uint lo, vec[cell[T]] elts) -> vec[cell[T]] {
-        check (nelts == _vec.len[cell[T]](elts));
+        assert (nelts == _vec.len[cell[T]](elts));
 
         fn fill[T](uint i, uint nelts, uint lo,
                    vec[cell[T]] old) -> cell[T] {
index f73ad4fc6474362c35e2ec07b04de756fb22ad24..9bad0f3311d8c59c0e39b18dbf4860b34d3d310f 100644 (file)
@@ -99,7 +99,7 @@ fn doc_data(doc d) -> vec[u8] {
 
 fn be_uint_from_bytes(vec[u8] data, uint start, uint size) -> uint {
     auto sz = size;
-    check (sz <= 4u);
+    assert (sz <= 4u);
     auto val = 0u;
     auto pos = start;
     while (sz > 0u) {
index 774ce11324cbc8c963e593ef7f0f3ec8e01cddec..e185ca3e8c25c3fcdd04db8068fa61fef1850f75 100644 (file)
@@ -10,7 +10,7 @@ fn path_sep() -> str {
 
 fn dirname(path p) -> path {
     auto sep = path_sep();
-    check (_str.byte_len(sep) == 1u);
+    assert (_str.byte_len(sep) == 1u);
     let int i = _str.rindex(p, sep.(0));
     if (i == -1) {
         ret p;
index 4c1bf2dfb2b120e15009398b2cd34220e198fc8c..7d59da30400860601d37308607a251d97450bfc5 100644 (file)
@@ -72,7 +72,7 @@ fn eof() -> bool {
         ret os.libc.feof(f) != 0;
     }
     fn seek(int offset, seek_style whence) {
-        check (os.libc.fseek(f, offset, convert_whence(whence)) == 0);
+        assert (os.libc.fseek(f, offset, convert_whence(whence)) == 0);
     }
     fn tell() -> uint {
         ret os.libc.ftell(f) as uint;
@@ -101,14 +101,14 @@ fn read_char() -> char {
         if (c0 == -1) {ret -1 as char;} // FIXME will this stay valid?
         auto b0 = c0 as u8;
         auto w = _str.utf8_char_width(b0);
-        check(w > 0u);
+        assert (w > 0u);
         if (w == 1u) {ret b0 as char;}
         auto val = 0u;
         while (w > 1u) {
             w -= 1u;
             auto next = rdr.read_byte();
-            check(next > -1);
-            check(next & 0xc0 == 0x80);
+            assert (next > -1);
+            assert (next & 0xc0 == 0x80);
             val <<= 6u;
             val += (next & 0x3f) as uint;
         }
@@ -279,7 +279,7 @@ fn write(vec[u8] v) {
     }
 
     fn seek(int offset, seek_style whence) {
-        check(os.libc.fseek(f, offset, convert_whence(whence)) == 0);
+        assert (os.libc.fseek(f, offset, convert_whence(whence)) == 0);
     }
 
     fn tell() -> uint {
index d5230e9ae09c4290979f4a404b460d8d59370b77..d2a8ff97aafade29315959fd52bef4cb11eca001 100644 (file)
@@ -66,7 +66,7 @@ fn dylib_filename(str base) -> str {
 
 fn pipe() -> tup(int, int) {
     let vec[mutable int] fds = vec(mutable 0, 0);
-    check(os.libc.pipe(_vec.buf[mutable int](fds)) == 0);
+    assert (os.libc.pipe(_vec.buf[mutable int](fds)) == 0);
     ret tup(fds.(0), fds.(1));
 }
 
@@ -76,7 +76,7 @@ fn fd_FILE(int fd) -> libc.FILE {
 
 fn waitpid(int pid) -> int {
     let vec[mutable int] status = vec(mutable 0);
-    check(os.libc.waitpid(pid, _vec.buf[mutable int](status), 0) != -1);
+    assert (os.libc.waitpid(pid, _vec.buf[mutable int](status), 0) != -1);
     ret status.(0);
 }
 
index b0980bc5225810a0cb0a34a4fd4cdc448439c280..a52b02c5658e507d9995f0695aabf9ba5fa2a882 100644 (file)
@@ -63,7 +63,7 @@ fn dylib_filename(str base) -> str {
 
 fn pipe() -> tup(int, int) {
     let vec[mutable int] fds = vec(mutable 0, 0);
-    check(os.libc.pipe(_vec.buf[mutable int](fds)) == 0);
+    assert (os.libc.pipe(_vec.buf[mutable int](fds)) == 0);
     ret tup(fds.(0), fds.(1));
 }
 
@@ -73,7 +73,7 @@ fn fd_FILE(int fd) -> libc.FILE {
 
 fn waitpid(int pid) -> int {
     let vec[mutable int] status = vec(mutable 0);
-    check(os.libc.waitpid(pid, _vec.buf[mutable int](status), 0) != -1);
+    assert (os.libc.waitpid(pid, _vec.buf[mutable int](status), 0) != -1);
     ret status.(0);
 }
 
index 03115fc7d331b67b94e2eb3e8c47aaae9156c0c3..f4cf12d35f2990d139e23a6e801be43f70c33779 100644 (file)
@@ -5,7 +5,7 @@
 fn list_dir(str path) -> vec[str] {
   // TODO ensure this is always closed
   auto dir = os.libc.opendir(_str.buf(path));
-  check (dir as uint != 0u);
+  assert (dir as uint != 0u);
   let vec[str] result = vec();
   while (true) {
     auto ent = os.libc.readdir(dir);
index 3866be1e04cfeb7d52b0b61fa25f650c7bb00af1..690489db345faf08f2b5cb7d9e0ffbb0edbad681 100644 (file)
@@ -43,7 +43,7 @@ fn mk_sha1() -> sha1 {
 
     fn add_input(&sha1state st, &vec[u8] msg) {
         // FIXME: Should be typestate precondition
-        check (!st.computed);
+        assert (!st.computed);
 
         for (u8 element in msg) {
             st.msg_block.(st.msg_block_idx) = element;
@@ -67,7 +67,7 @@ fn add_input(&sha1state st, &vec[u8] msg) {
     fn process_msg_block(&sha1state st) {
 
         // FIXME: Make precondition
-        check (_vec.len[mutable u32](st.h) == digest_buf_len);
+        assert (_vec.len[mutable u32](st.h) == digest_buf_len);
 
         // Constants
         auto k = vec(0x5A827999u32,
@@ -192,7 +192,7 @@ fn mk_result(&sha1state st) -> vec[u8] {
      */
     fn pad_msg(&sha1state st) {
         // FIXME: Should be a precondition
-        check (_vec.len[mutable u8](st.msg_block) == msg_block_len);
+        assert (_vec.len[mutable u8](st.msg_block) == msg_block_len);
 
         /*
          * Check to see if the current message block is too small to hold
@@ -236,7 +236,7 @@ fn pad_msg(&sha1state st) {
 
         fn reset() {
             // FIXME: Should be typestate precondition
-            check (_vec.len[mutable u32](st.h) == digest_buf_len);
+            assert (_vec.len[mutable u32](st.h) == digest_buf_len);
 
             st.len_low = 0u32;
             st.len_high = 0u32;
index a2940d8de55ea507f252067afcf8015f44332863..1c6521e31f699a4d358770a57afe9843d5e508d3 100644 (file)
@@ -53,7 +53,7 @@ fn dylib_filename(str base) -> str {
 
 fn pipe() -> tup(int, int) {
     let vec[mutable int] fds = vec(mutable 0, 0);
-    check(os.libc._pipe(_vec.buf[mutable int](fds), 1024u,
+    assert (os.libc._pipe(_vec.buf[mutable int](fds), 1024u,
                         libc_constants.O_BINARY()) == 0);
     ret tup(fds.(0), fds.(1));
 }
index e8c9cf71bcbee00274442a9439263761ffa801ff..c688a40426d563b0da60e5f223f2737bd9038b56 100644 (file)
@@ -2,5 +2,5 @@
 // error-pattern:1 == 2
 
 fn main() {
-   check (1 == 2);
+   assert (1 == 2);
 }
index 7def7c11d0a221d2f7618170518d9d63189bdac5..60e82200848a0c1f6bb2fb0c02b2929eba5e38eb 100644 (file)
@@ -4,7 +4,7 @@
 // error-pattern:1 == 2
 
 fn child() {
-  check (1 == 2);
+  assert (1 == 2);
 }
 
 fn main() {
index 4388cb3ac802e5d7bc101fdce9e540d09d9f8b2a..68b1e263d27fa279633ab04ca1edb250f6427a02 100644 (file)
@@ -6,12 +6,12 @@
 fn main() {
   let str s = "hello";
   let int x = 0;
-  check (s.(x) == (0x68 as u8));
+  assert (s.(x) == (0x68 as u8));
 
   // NB: at the moment a string always has a trailing NULL,
   // so the largest index value on the string above is 5, not
   // 4. Possibly change this.
 
   // Bounds-check failure.
-  check (s.(x + 6) == (0x0 as u8));
+  assert (s.(x + 6) == (0x0 as u8));
 }
index 961da730e3bdaa0a22df41317880e3abe9eb0096..810feb39bcd9e502ed614514d86102303e5b6e3d 100644 (file)
@@ -6,7 +6,7 @@
 fn main() {
   let vec[int] v = vec(10);
   let int x = 0;
-  check (v.(x) == 10);
+  assert (v.(x) == 10);
   // Bounds-check failure.
-  check (v.(x + 2) == 20);
+  assert (v.(x + 2) == 20);
 }
index a230d1be7ff7613f7065341883cc7e33b8f08874..f1998da52932116df5fdf49480b5f01a432dc8aa 100644 (file)
@@ -6,7 +6,7 @@
 fn main() {
   let vec[int] v = vec(10, 20);
   let int x = 0;
-  check (v.(x) == 10);
+  assert (v.(x) == 10);
   // Bounds-check failure.
-  check (v.(x-1) == 20);
+  assert (v.(x-1) == 20);
 }
index 4ee2c12bec25d957f95fcc92e3576df03310ec72..b92ffd7481bda28a65a5b176e1ff0e0f50dcda52 100644 (file)
@@ -21,12 +21,12 @@ fn foo(str s) {
   }
 
   log _str.refcount(s);
-  check (_str.refcount(s) == const_refcount);
+  assert (_str.refcount(s) == const_refcount);
 }
 
 fn main() {
   let str s = "hi";     // ref up
   foo(s);               // ref up then down
   log _str.refcount(s);
-  check (_str.refcount(s) == const_refcount);
+  assert (_str.refcount(s) == const_refcount);
 }
index 91190260bb10f53bd54bd62a194250ded909879d..bad74a2a3cefd13c7aeabf575de259bf4a2905c0 100644 (file)
@@ -12,6 +12,6 @@ fn altlit(int f) -> int {
 }
 
 fn main() {
-  check (altlit(10) == 20);
-  check (altlit(11) == 22);
+  assert (altlit(10) == 20);
+  assert (altlit(11) == 22);
 }
index 68013dfe303a772823b5822630b1bdb9405c6b93..bc0afcb5fec4873fc541f6c8c98878e305da5ba4 100644 (file)
@@ -32,8 +32,8 @@ fn main() {
   let color gray = rgb(127, 127, 127);
   let color clear = rgba(50, 150, 250, 0);
   let color red = hsl(0, 255, 255);
-  check (process(gray) == 127);
-  check (process(clear) == 0);
-  check (process(red) == 255);
+  assert (process(gray) == 127);
+  assert (process(clear) == 0);
+  assert (process(red) == 255);
 }
 
index 7587b0050ad379203f69be645f6e5fd4963cedac..857eaa8e42a7dbbf6467fdc547cd518a77567a44 100644 (file)
@@ -1,5 +1,5 @@
 fn main() -> () {
     let int a = 10;
     log a;
-    check (a * (a - 1) == 90);
+    assert (a * (a - 1) == 90);
 }
\ No newline at end of file
index bac6a055e80e1905d1a40f9469fbb2c8e796cf1c..55230e9e5dac58df2a560781f9fcb525da226c3c 100644 (file)
@@ -1,22 +1,22 @@
 fn main() -> () {
     let int i32_a = 10;
-    check(i32_a == 10);
-    check(i32_a - 10 == 0);
-    check(i32_a / 10 == 1);
-    check(i32_a - 20 == -10);
-    check(i32_a << 10 == 10240);
-    check(i32_a << 16 == 655360);
-    check(i32_a * 16 == 160);
-    check(i32_a * i32_a * i32_a == 1000);
-    check(i32_a * i32_a * i32_a * i32_a == 10000);
-    check(((i32_a * i32_a) / i32_a) * i32_a == 100);
-    check(i32_a * (i32_a - 1) << 2 + i32_a == 368640);
+    assert (i32_a == 10);
+    assert (i32_a - 10 == 0);
+    assert (i32_a / 10 == 1);
+    assert (i32_a - 20 == -10);
+    assert (i32_a << 10 == 10240);
+    assert (i32_a << 16 == 655360);
+    assert (i32_a * 16 == 160);
+    assert (i32_a * i32_a * i32_a == 1000);
+    assert (i32_a * i32_a * i32_a * i32_a == 10000);
+    assert (((i32_a * i32_a) / i32_a) * i32_a == 100);
+    assert (i32_a * (i32_a - 1) << 2 + i32_a == 368640);
 
     let int i32_b = 0x10101010;
-    check(i32_b + 1 - 1 == i32_b);
-    check(i32_b << 1 == i32_b << 1);
-    check(i32_b >> 1 == i32_b >> 1);
-    check((i32_b & (i32_b << 1)) == 0);
+    assert (i32_b + 1 - 1 == i32_b);
+    assert (i32_b << 1 == i32_b << 1);
+    assert (i32_b >> 1 == i32_b >> 1);
+    assert ((i32_b & (i32_b << 1)) == 0);
     log ((i32_b | (i32_b << 1)));
-    check((i32_b | (i32_b << 1)) == 0x30303030);
+    assert ((i32_b | (i32_b << 1)) == 0x30303030);
 }
\ No newline at end of file
index 33a740c84fce6ffd6df35c09eeaef486fdca5725..70892682b777db558eaded687d937a3fd4ce6f9f 100644 (file)
@@ -1,5 +1,5 @@
 fn main() -> () {
     let int i32_c = 0x10101010;
-    check (i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3) == 
+    assert (i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3) == 
            i32_c + (((i32_c * 2) / 3) * 2) + (i32_c - (7 % 3)));
 }
\ No newline at end of file
index 748ff6b7da32bb724b4f9a72a2a17c0c98ab6f88..0e2818a3a45da0ffd2b85cf9043644ac3cdb7929 100644 (file)
@@ -2,24 +2,24 @@
 // Unsigned integer operations
 
 fn main() {
-  check (0u8 < 255u8);
-  check (0u8 <= 255u8);
-  check (255u8 > 0u8);
-  check (255u8 >= 0u8);
-  check (250u8 / 10u8 == 25u8);
-  check (255u8 % 10u8 == 5u8);
-  check (0u16 < 60000u16);
-  check (0u16 <= 60000u16);
-  check (60000u16 > 0u16);
-  check (60000u16 >= 0u16);
-  check (60000u16 / 10u16 == 6000u16);
-  check (60005u16 % 10u16 == 5u16);
-  check (0u32 < 4000000000u32);
-  check (0u32 <= 4000000000u32);
-  check (4000000000u32 > 0u32);
-  check (4000000000u32 >= 0u32);
-  check (4000000000u32 / 10u32 == 400000000u32);
-  check (4000000005u32 % 10u32 == 5u32);
+  assert (0u8 < 255u8);
+  assert (0u8 <= 255u8);
+  assert (255u8 > 0u8);
+  assert (255u8 >= 0u8);
+  assert (250u8 / 10u8 == 25u8);
+  assert (255u8 % 10u8 == 5u8);
+  assert (0u16 < 60000u16);
+  assert (0u16 <= 60000u16);
+  assert (60000u16 > 0u16);
+  assert (60000u16 >= 0u16);
+  assert (60000u16 / 10u16 == 6000u16);
+  assert (60005u16 % 10u16 == 5u16);
+  assert (0u32 < 4000000000u32);
+  assert (0u32 <= 4000000000u32);
+  assert (4000000000u32 > 0u32);
+  assert (4000000000u32 >= 0u32);
+  assert (4000000000u32 / 10u32 == 400000000u32);
+  assert (4000000005u32 % 10u32 == 5u32);
 
   // 64-bit numbers have some flakiness yet. Not tested
 }
index 956a7eb440b55cb07fb1025795691cf400f660b7..5df5456b773eed9454d8a78c79e419102898aa81 100644 (file)
@@ -8,11 +8,11 @@ fn main() {
   let clam b = rec(x=@10, y=@20);
   let int z = a.x + b.y;
   log z;
-  check (z == 21);
+  assert (z == 21);
 
   let fish forty = tup(@40);
   let fish two = tup(@2);
   let int answer = forty._0 + two._0;
   log answer;
-  check (answer == 42);
+  assert (answer == 42);
 }
index c3fc2e7c3613744d3e10ac66bc6aed016b482bad..f6f369185fc7a07ef289d58cb992138ccbea46c9 100644 (file)
@@ -4,5 +4,5 @@ fn foo(@int a, @int b) -> int {
 
 fn main() {
   auto f1 = bind foo(@10, @12);
-  check(f1() == 22);
+  assert (f1() == 22);
 }
index 2d164e07e058c51fc9c83745bfcff2cca28482b2..ae994d1c7ab8115259dd0af8e07e90b93aac7986 100644 (file)
@@ -7,5 +7,5 @@ fn f(int n) -> int {
 fn main() {
   let fn() -> int g = bind f(10);
   let int i = g();
-  check(i == 10);
+  assert (i == 10);
 }
index 8780b22a002d891b38f591cd86bb2264d24e71e4..b5215f9ad68870488b3952934fb5faaf6ef4345e 100644 (file)
@@ -11,7 +11,7 @@ fn sum() -> int {
   auto ctor1 = bind simple(_, 2);
   auto obj1 = ctor0(2);
   auto obj2 = ctor1(1);
-  check (obj0.sum() == 3);
-  check (obj1.sum() == 3);
-  check (obj2.sum() == 3);
+  assert (obj0.sum() == 3);
+  assert (obj1.sum() == 3);
+  assert (obj2.sum() == 3);
 }
index be6e1b24e133e70402749234a0a473082f40b1f5..7cafc50108d652c65d39b863950398bc081e0715 100644 (file)
@@ -7,5 +7,5 @@ fn f() -> int {
 fn main() {
   let fn() -> int g = bind f();
   let int i = g();
-  check(i == 42);
+  assert (i == 42);
 }
index fbd6e78d797bd7ecb6bfc664b4e2bf2f071f1519..e73f2b7ca3c8f95fcfa8c88fbe02c289575ef01d 100644 (file)
@@ -7,5 +7,5 @@ fn f(int n) -> int {
 fn main() {
   let fn(int) -> int g = bind f(_);
   let int i = g(42);
-  check(i == 42);
+  assert (i == 42);
 }
index 36b58a9172632a71d05f61c89b4c2b508bb7690c..99324489186567b8618c6ec00cebd5a0f79fd85b 100644 (file)
@@ -8,14 +8,14 @@ fn main() {
   a = a ^ b;
   log a;
   log b;
-  check (b == 1);
-  check (a == 2);
+  assert (b == 1);
+  assert (a == 2);
 
-  check (~(0xf0) & 0xff == 0xf);
-  check (0xf0 | 0xf == 0xff);
-  check (0xf << 4 == 0xf0);
-  check (0xf0 >> 4 == 0xf);
-  check (-16 >>> 2 == -4);
-  check (0b1010_1010 | 0b0101_0101 == 0xff);
+  assert (~(0xf0) & 0xff == 0xf);
+  assert (0xf0 | 0xf == 0xff);
+  assert (0xf << 4 == 0xf0);
+  assert (0xf0 >> 4 == 0xf);
+  assert (-16 >>> 2 == -4);
+  assert (0b1010_1010 | 0b0101_0101 == 0xff);
 }
 
index ba70bdb1318dc27e84e641d346c80de2d4bedcae..337efc6f85f9703695db1afb7e0899d8551c5b9a 100644 (file)
@@ -2,14 +2,14 @@
 
 fn main() {
   if (!false) {
-    check (true);
+    assert (true);
   } else {
-    check (false);
+    assert (false);
   }
 
   if (!true) {
-    check (false);
+    assert (false);
   } else {
-    check (true);
+    assert (true);
   }
 }
index 619790d796512d3ff381c92136d5c53a7e0eac61..8f23035dbd863fe54d367fe823639a71e0e7c59c 100644 (file)
@@ -1,6 +1,6 @@
 // xfail-boot
 fn main() {
-  check (@1 < @3);
-  check (@@"hello " > @@"hello");
-  check (@@@"hello" != @@@"there");
+  assert (@1 < @3);
+  assert (@@"hello " > @@"hello");
+  assert (@@@"hello" != @@@"there");
 }
\ No newline at end of file
index d0ad615b2e61cffa31e9a89d005a5c66bb8d373d..b1d5053360785532e913807e796dcc72778a11d7 100644 (file)
@@ -6,5 +6,5 @@ fn main() {
   let int foo = 17;
   let box[int] bfoo = tup(@foo);
   log "see what's in our box";
-  check (unbox[int](bfoo) == foo);
+  assert (unbox[int](bfoo) == foo);
 }
index ffcd9ec5946281d3d081524fc6d8dd8bf12a9288..c105e80146cc96c5c1979a901f70351ba29f840c 100644 (file)
@@ -1,4 +1,4 @@
 fn main() {
   let @int x = @10;
-  check ((*x) == 10);
+  assert ((*x) == 10);
 }
index 48c3b091f08b0233ce7570d3440a6b234bacd6c8..5a63d9acb48c24acfe6633e38746fc3b097549f5 100644 (file)
@@ -6,35 +6,35 @@ fn main() {
     i += 1;
     if (i == 10) { break; }
   }
-  check(i == 10);
+  assert (i == 10);
 
   do {
     i += 1;
     if (i == 20) { break; }
   } while (i < 30);
-  check(i == 20);
+  assert (i == 20);
 
   for (int x in vec(1, 2, 3, 4, 5, 6)) {
     if (x == 3) { break; }
-    check(x <= 3);
+    assert (x <= 3);
   }
 
   i = 0;
   while (i < 10) {
     i += 1;
     if (i % 2 == 0) { cont; }
-    check(i % 2 != 0);
+    assert (i % 2 != 0);
   }
 
   i = 0;
   do {
     i += 1;
     if (i % 2 == 0) { cont; }
-    check(i % 2 != 0);
+    assert (i % 2 != 0);
   } while (i < 10);
 
   for (int x in vec(1, 2, 3, 4, 5, 6)) {
     if (x % 2 == 0) { cont; }
-    check(x % 2 != 0);
+    assert (x % 2 != 0);
   }
 }
index e04ad62939d213da5d6bd988b7034bdad50ed939..ecc7ac12db1fcec752d4ce8a2494b0e0f6604481 100644 (file)
@@ -3,14 +3,14 @@
 
 fn main() {
   let int i = 'Q' as int;
-  check (i == 0x51);
+  assert (i == 0x51);
   let u32 u = i as u32;
-  check (u == (0x51 as u32));
-  check (u == ('Q' as u32));
-  check ((i as u8) == ('Q' as u8));
-  check (((i as u8) as i8) == (('Q' as u8) as i8));
-  check ((0x51 as char) == 'Q');
+  assert (u == (0x51 as u32));
+  assert (u == ('Q' as u32));
+  assert ((i as u8) == ('Q' as u8));
+  assert (((i as u8) as i8) == (('Q' as u8) as i8));
+  assert ((0x51 as char) == 'Q');
 
-  check (true == (1 as bool));
-  check ((0 as u32) == (false as u32));
+  assert (true == (1 as bool));
+  assert ((0 as u32) == (false as u32));
 }
index 123f2eb26c42ea017a405d1ed2627a5be7c3fabc..a3ddae6c7cb90a019b6a5a2c23997a8273ccd14f 100644 (file)
@@ -1,12 +1,12 @@
 fn main() {
     let char c = 'x';
     let char d = 'x';
-    check(c == 'x');
-    check('x' == c);
-    check(c == c);
-    check(c == d);
-    check(d == c);
-    check (d == 'x');
-    check('x' == d);
+    assert (c == 'x');
+    assert ('x' == c);
+    assert (c == c);
+    assert (c == d);
+    assert (d == c);
+    assert (d == 'x');
+    assert ('x' == d);
 }
 
index e97c409d50f3b9d653dd42bab0a639a46c657667..99c319c26d0f3ac40a0f4095a0a477e8646bcd8c 100644 (file)
@@ -1,8 +1,8 @@
 // xfail-boot
 // xfail-stage0
 fn f(@rec(int a, int b) x) {
-  check (x.a == 10);
-  check (x.b == 12);
+  assert (x.a == 10);
+  assert (x.b == 12);
 }
 
 fn main() {
index 2bca62488dc933a5b2e4a7df1a14b40f7368d8a8..ef93eee634964048f8270119e5884796d0a1625d 100644 (file)
@@ -8,7 +8,7 @@ fn main() {
   y <- p;
   log "received";
   log y;
-  check (y == 10);
+  assert (y == 10);
 }
 
 fn child(chan[int] c) {
index 5630d2e278dd91c07988f879ea959e0d5c68ddb2..36487aa83b53f72119c56e9dbe0ccdf58a2d849a 100644 (file)
@@ -6,9 +6,9 @@ fn main() {
 
   ch <| 10;
   let int i <- po;
-  check (i == 10);
+  assert (i == 10);
 
   ch <| 11;
   auto j <- po;
-  check (j == 11);
+  assert (j == 11);
 }
index 5131c42b0fe001b5dc8a62f125251076066fdcf8..32d4dae1fece8c1d3490a8848806275ada95dee6 100644 (file)
@@ -10,5 +10,5 @@ fn f(int x) -> int {
 }
 
 fn main() {
-  check (f(5000) == 5000);
+  assert (f(5000) == 5000);
 }
index cfa0fbe9c1776ed1fc81e87cf4a13ff0409b106c..00835d41c721073c043cceb8ac30ef1ceed8c460 100644 (file)
@@ -3,15 +3,15 @@
 fn main() {
   let int x = 15;
   let int y = 5;
-  check(x / 5 == 3);
-  check(x / 4 == 3);
-  check(x / 3 == 5);
-  check(x / y == 3);
-  check(15 / y == 3);
+  assert (x / 5 == 3);
+  assert (x / 4 == 3);
+  assert (x / 3 == 5);
+  assert (x / y == 3);
+  assert (15 / y == 3);
 
-  check(x % 5 == 0);
-  check(x % 4 == 3);
-  check(x % 3 == 0);
-  check(x % y == 0);
-  check(15 % y == 0);
+  assert (x % 5 == 0);
+  assert (x % 4 == 3);
+  assert (x % 3 == 0);
+  assert (x % y == 0);
+  assert (15 % y == 0);
 }
index d9e5b8690250f452f1c7b398831dbeddd9fee70d..edb25e16f73c402be39ba2901e9ce9a0cf2cae9d 100644 (file)
@@ -1,42 +1,42 @@
 fn main() {
   if (1 == 2) {
-    check(false);
+    assert (false);
   } else if (2 == 3) {
-    check(false);
+    assert (false);
   } else if (3 == 4) {
-    check(false);
+    assert (false);
   } else {
-    check(true);
+    assert (true);
   }
 
 
   if (1 == 2) {
-    check(false);
+    assert (false);
   } else if (2 == 2) {
-    check(true);
+    assert (true);
   }
 
   if (1 == 2) {
-    check(false);
+    assert (false);
   } else if (2 == 2) {
     if (1 == 1) {
-      check(true);
+      assert (true);
     } else {
       if (2 == 1) {
-        check(false);
+        assert (false);
       } else {
-        check(false);
+        assert (false);
       }
     }
   }
 
   if (1 == 2) {
-    check(false);
+    assert (false);
   } else {
     if (1 == 2) {
-      check(false);
+      assert (false);
     } else {
-      check(true);
+      assert (true);
     }
   }
 }
index 2e7846f36c337ffa1bd2aa72a419d165a5135229..e18611fa96ff7f706d8bc6f754c65593974db4c5 100644 (file)
@@ -9,7 +9,7 @@ fn test_box() {
       @100
     }
   };
-  check (*res == 100);
+  assert (*res == 100);
 }
 
 fn test_str() {
@@ -18,7 +18,7 @@ fn test_str() {
       "happy"
     }
   };
-  check (res == "happy");
+  assert (res == "happy");
 }
 
 fn main() {
index 8ff67f0ff3b704066968262541e18f6524e242b8..a1367e81b8cf7b0084b6e12cd092ba1bd5cd2b40 100644 (file)
@@ -9,7 +9,7 @@ fn test_generic[T](@T expected, &compare[T] eq) {
       expected
     }
   };
-  check (eq(expected, actual));
+  assert (eq(expected, actual));
 }
 
 fn test_box() {
index 7928ffede554514a02e324c184de26f45061cbe9..469b8e7c6d9f3b86a895c18583924abef074c90c 100644 (file)
@@ -9,7 +9,7 @@ fn test_generic[T](&T expected, &compare[T] eq) {
       expected
     }
   };
-  check (eq(expected, actual));
+  assert (eq(expected, actual));
 }
 
 fn test_vec() {
index 6668105955d9d8330d720bae66cb5b8acc43c35c..0cd0177a2151354f1145aca2d6dc04ceba33eff3 100644 (file)
@@ -9,7 +9,7 @@ fn test_generic[T](&T expected, &compare[T] eq) {
       expected
     }
   };
-  check (eq(expected, actual));
+  assert (eq(expected, actual));
 }
 
 fn test_bool() {
index 31406969d87c40fd5a92def4223b7ef525f8e3cf..762303d53c17eac3ce7a9af8159dd0c79f71c254 100644 (file)
@@ -9,7 +9,7 @@ fn test_rec() {
       rec(i = 100)
     }
   };
-  check (res == rec(i = 100));
+  assert (res == rec(i = 100));
 }
 
 fn test_tag() {
@@ -26,7 +26,7 @@ fn test_tag() {
       sad
     }
   };
-  check (res == happy);
+  assert (res == happy);
 }
 
 fn main() {
index 4c10a7d9e292697dc007ec40146180fe3c2f6479..52a01078762b1f0cc5dfcff9246ebd2e16ac441a 100644 (file)
@@ -12,7 +12,7 @@ fn test_basic() {
       false
     }
   };
-  check (res);
+  assert (res);
 
   res = alt(false) {
     case (true) {
@@ -22,7 +22,7 @@ fn test_basic() {
       true
     }
   };
-  check (res);
+  assert (res);
 }
 
 fn test_inferrence() {
@@ -34,7 +34,7 @@ fn test_inferrence() {
       false
     }
   };
-  check (res);
+  assert (res);
 }
 
 fn test_alt_as_alt_head() {
@@ -47,7 +47,7 @@ fn test_alt_as_alt_head() {
       true
     }
   };
-  check (res);
+  assert (res);
 }
 
 fn test_alt_as_block_result() {
@@ -66,7 +66,7 @@ fn test_alt_as_block_result() {
       }
     }
   };
-  check (res);
+  assert (res);
 }
 
 fn main() {
index e8ab62091a59da412ab813010a22862ffa0297dd..206c44afd3ae375420e5a988e55061a8f23862cb 100644 (file)
@@ -6,5 +6,5 @@ fn main() {
     @100
   };
 
-  check (*x == 100);
+  assert (*x == 100);
 }
index eb0357d9e89bab5901fabfb74b6b0adf6dee5732..a37d1cb0f8d6d308d5fdc3bd7f0df1a011e78c19 100644 (file)
@@ -6,7 +6,7 @@ fn ten() -> int {
     ret 10;
   }
   let t res = { ten };
-  check (res() == 10);
+  assert (res() == 10);
 }
 
 fn main() {
index 57487fd617d06dddbba092b6ac76937bb0bbf280..82d54c175d0558fa8259eac2dd3aae8af0f2d419 100644 (file)
@@ -5,7 +5,7 @@
 
 fn test_generic[T](@T expected, &compare[T] eq) {
   let @T actual = { expected };
-  check (eq(expected, actual));
+  assert (eq(expected, actual));
 }
 
 fn test_box() {
index 3b1e44791a074c4a3cc8c686338cafb64b6b2c25..c1c8260c6815186c7ab9ce732bcebd49125bf3d1 100644 (file)
@@ -5,7 +5,7 @@
 
 fn test_generic[T](&T expected, &compare[T] eq) {
   let T actual = { expected };
-  check (eq(expected, actual));
+  assert (eq(expected, actual));
 }
 
 fn test_vec() {
index ded3b6207045b7b3a1530df3f755129ba021fbd9..d6061a6c84c80edb10fcd74a974afb9be789a982 100644 (file)
@@ -7,7 +7,7 @@
 
 fn test_generic[T](&T expected, &compare[T] eq) {
   let T actual = { expected };
-  check (eq(expected, actual));
+  assert (eq(expected, actual));
 }
 
 fn test_bool() {
index ecc6f04a3402970b33c39f27aafa3316c27f0db0..1c03a6b0694af4e27c8fd62416541982c8954a98 100644 (file)
@@ -5,12 +5,12 @@
 
 fn test_basic() {
   let bool res = { true };
-  check (res);
+  assert (res);
 }
 
 fn test_rec() {
   auto res = { rec(v1 = 10, v2 = 20) };
-  check (res.v2 == 20);
+  assert (res.v2 == 20);
 }
 
 fn test_filled_with_stuff() {
@@ -21,7 +21,7 @@ fn test_filled_with_stuff() {
     }
     a
   };
-  check (res == 10);
+  assert (res == 10);
 }
 
 fn main() {
index a629c9c9bc4644f03b25ce9a507f4701c600e57c..d242d7448b7771c49668dd2f5980ca6ca8769819 100644 (file)
@@ -5,12 +5,12 @@
 
 fn test_box() {
   auto res = if (true) { @100 } else { @101 };
-  check (*res == 100);
+  assert (*res == 100);
 }
 
 fn test_str() {
   auto res = if (true) { "happy" } else { "sad" };
-  check (res == "happy");
+  assert (res == "happy");
 }
 
 fn main() {
index 32aea8bb72f159ad0de33bbc92e48a139ff8d23a..d1d4c05dee93c70796137305f6bbf833311f3afe 100644 (file)
@@ -5,7 +5,7 @@
 
 fn test_generic[T](@T expected, @T not_expected, &compare[T] eq) {
   let @T actual = if (true) { expected } else { not_expected };
-  check (eq(expected, actual));
+  assert (eq(expected, actual));
 }
 
 fn test_box() {
index d414d6d104de7109c97d9ce55ecbcb5b15b97824..a126b1c45a9c09228812ddcfda79094105ea6fc8 100644 (file)
@@ -5,7 +5,7 @@
 
 fn test_generic[T](&T expected, &T not_expected, &compare[T] eq) {
   let T actual = if (true) { expected } else { not_expected };
-  check (eq(expected, actual));
+  assert (eq(expected, actual));
 }
 
 fn test_vec() {
index 0a0db2ddfde31fe8866c5405f9fa4c4d8335b7b1..b86a7553d98939b2663e1778b18d3eeb93fcbf40 100644 (file)
@@ -7,7 +7,7 @@
 
 fn test_generic[T](&T expected, &T not_expected, &compare[T] eq) {
   let T actual = if (true) { expected } else { not_expected };
-  check (eq(expected, actual));
+  assert (eq(expected, actual));
 }
 
 fn test_bool() {
index df20a3bae603079835b3e05a4836d1674e613512..6d42c2241d57d53d7dd389f45762b4ba5a8c2c6e 100644 (file)
@@ -5,7 +5,7 @@
 
 fn test_rec() {
   auto res = if (true) { rec(i = 100) } else { rec(i = 101) };
-  check (res == rec(i = 100));
+  assert (res == rec(i = 100));
 }
 
 fn test_tag() {
@@ -15,7 +15,7 @@ fn test_tag() {
   }
 
   auto res = if (true) { happy } else { sad };
-  check (res == happy);
+  assert (res == happy);
 }
 
 fn main() {
index 7c99f2ea82e1c284ddf3c9ea58e9be54ee09dd76..67f56746de6bd0e991278f65673f076ac9896f42 100644 (file)
@@ -5,12 +5,12 @@
 
 fn test_if() {
   let bool res = if (true) { true } else { false };
-  check (res);
+  assert (res);
 }
 
 fn test_else() {
   let bool res = if (false) { false } else { true };
-  check (res);
+  assert (res);
 }
 
 fn test_elseif1() {
@@ -21,7 +21,7 @@ fn test_elseif1() {
   } else {
     false
   };
-  check (res);
+  assert (res);
 }
 
 fn test_elseif2() {
@@ -32,7 +32,7 @@ fn test_elseif2() {
   } else {
     false
   };
-  check (res);
+  assert (res);
 }
 
 fn test_elseif3() {
@@ -43,12 +43,12 @@ fn test_elseif3() {
   } else {
     true
   };
-  check (res);
+  assert (res);
 }
 
 fn test_inferrence() {
   auto res = if (true) { true } else { false };
-  check (res);
+  assert (res);
 }
 
 fn test_if_as_if_condition() {
@@ -57,14 +57,14 @@ fn test_if_as_if_condition() {
   } else {
     false
   };
-  check (res1);
+  assert (res1);
 
   auto res2 = if (if (true) { false } else { true }) {
     false
   } else {
     true
   };
-  check (res2);
+  assert (res2);
 }
 
 fn test_if_as_block_result() {
@@ -77,7 +77,7 @@ fn test_if_as_block_result() {
   } else {
     false
   };
-  check (res);
+  assert (res);
 }
 
 fn main() {
index f09ee8234e35dc235453871881756758ba7a243d..661effda38ac1fcac86e91ba4ea5fc0750eabb2c 100644 (file)
@@ -3,16 +3,16 @@
 type point = rec(int x, int y, mutable int z);
 
 fn f(@point p) {
-  check (p.z == 12);
+  assert (p.z == 12);
   p.z = 13;
-  check (p.z == 13);
+  assert (p.z == 13);
 }
 
 fn main() {
   let point a = rec(x=10, y=11, mutable z=12);
   let @point b = @a;
-  check (b.z == 12);
+  assert (b.z == 12);
   f(b);
-  check (a.z == 12);
-  check (b.z == 13);
+  assert (a.z == 12);
+  assert (b.z == 13);
 }
index 91cf099c3acb09e51cdf79c6a3a486bfe2d96002..577ee6a226eb75a58ebf1158a70de25fe932b763 100644 (file)
@@ -15,7 +15,7 @@ fn f(int x) -> int {
   }
 }
 fn main () {
-  check (f(5) == 120);
+  assert (f(5) == 120);
   // log "all done";
 }
 
index 9cc3a8ca9cd31a5bab77ac3cc88a43398af0da0b..e6136d2cf442120fb0812c3497f0d84378abf0c6 100644 (file)
@@ -12,13 +12,13 @@ fn main() {
   auto j = 3.1e+9;
   auto k = 3.2e-10;
  
-  check(a == b);
-  check(c < b);
-  check(c == d);
-  check(e < g);
-  check(f < h);
-  check(g == 1000000.0f32);
-  check(h == i);
-  check(j > k);
-  check(k < a);
+  assert (a == b);
+  assert (c < b);
+  assert (c == d);
+  assert (e < g);
+  assert (f < h);
+  assert (g == 1000000.0f32);
+  assert (h == i);
+  assert (j > k);
+  assert (k < a);
 }
\ No newline at end of file
index 10b0fb7766a60aa063eabd5cad05ef433fa127de..37f21c8f43a4ff25acbad1cf4d9bb825de7cf90c 100644 (file)
@@ -1,9 +1,9 @@
 // xfail-boot
 fn main() {
   auto f = 4.999999999999;
-  check (f > 4.90);
-  check (f < 5.0);
+  assert (f > 4.90);
+  assert (f < 5.0);
   auto g = 4.90000000001e-10;
-  check(g > 5e-11);
-  check(g < 5e-9);
+  assert (g > 5e-11);
+  assert (g < 5e-9);
 }
\ No newline at end of file
index d25405d8c6e57090832600402cb9f61e462b8034..33a376d529e6157ccf3eda5a77c43cf834a494f1 100644 (file)
@@ -28,12 +28,12 @@ fn main() {
         }
     }
 
-    check (a.(0) == 0);
-    check (a.(1) == 1);
-    check (a.(2) == 10);
-    check (a.(3) == 11);
-    check (a.(4) == 100);
-    check (a.(5) == 101);
-    check (a.(6) == 110);
-    check (a.(7) == 111);
+    assert (a.(0) == 0);
+    assert (a.(1) == 1);
+    assert (a.(2) == 10);
+    assert (a.(3) == 11);
+    assert (a.(4) == 100);
+    assert (a.(5) == 101);
+    assert (a.(6) == 110);
+    assert (a.(7) == 111);
 }
index a655f59101988944da2bcd039a9546410859f730..9ba304c1463a47bf2b02003aeac893af888d6c37 100644 (file)
@@ -16,8 +16,8 @@ fn main() {
         }
     }
 
-    check (a.(0) == 0);
-    check (a.(1) == 1);
-    check (a.(2) == 10);
-    check (a.(3) == 11);
+    assert (a.(0) == 0);
+    assert (a.(1) == 1);
+    assert (a.(2) == 10);
+    assert (a.(3) == 11);
 }
index 43d8b5c33a897c81de8127973792d464600e32ad..02dbef5d514b8e4585313fce5b23f23a13e47c95 100644 (file)
@@ -14,9 +14,9 @@ fn main() {
   for each (tup(int,int) p in pairs()) {
       log p._0;
       log p._1;
-      check (p._0 + 10 == i);
+      assert (p._0 + 10 == i);
       i += 1;
       j = p._1;
     }
-  check(j == 45);
+  assert (j == 45);
 }
\ No newline at end of file
index efc6e8ca7025c8c933002888648e67b168bf77a2..8f23d61d03dcae63ddc4dcb9f304ac38b85e8d94 100644 (file)
@@ -9,7 +9,7 @@ fn main() {
   }
   log "sum";
   log sum;
-  check (sum == 45);
+  assert (sum == 45);
 }
 
 iter first_ten() -> int {
index 59446b4a771eb8edaa268b7967b9c23b88c7b2c6..5fa3837e6b3cbc700c820e153bc855047da1a0c7 100644 (file)
@@ -13,7 +13,7 @@ fn main() {
   let int a = direct(3); // direct
   //let int b = ho(direct); // indirect unbound
   let int c = ho(bind direct(_)); // indirect bound
-  //check(a == b);
-  //check(b == c);
+  //assert (a == b);
+  //assert (b == c);
 }
 
index 10c2cf40505504b43815d84c4e4a176ed2917d0d..1d506dca26e8095292ccb54175bfde8f067fa505 100644 (file)
@@ -7,5 +7,5 @@ fn f() -> int {
 fn main() {
   let fn() -> int g = f;
   let int i = g();
-  check(i == 42);
+  assert (i == 42);
 }
index 377e0fb2b8d143a757689b0a42fd31d49e842d78..ce3889fbb4c7620668a457b9372f585b832d0676 100644 (file)
@@ -8,5 +8,5 @@ fn main() {
   auto expected = @100;
   auto actual = id[@int](expected);
   log *actual;
-  check (*expected == *actual);
+  assert (*expected == *actual);
 }
\ No newline at end of file
index 3975867ac29a32f13781f9bbeab80695c162d8e3..f3a65edd549ce00951b69b09774557febe75fc0a 100644 (file)
@@ -5,7 +5,7 @@ fn id[T](&T t) -> T {
 
 fn main() {
   auto t = tup(1,2,3,4,5,6,7);
-  check (t._5 == 6);
+  assert (t._5 == 6);
   auto f0 = bind id[tup(int,int,int,int,int,int,int)](t);
-  check (f0()._5 == 6);
+  assert (f0()._5 == 6);
 }
index ef1275e3cecd6ebae893c7201dcfe5ccbe078f50..c65e061ad214ef0c668b2489f17e7fb0b3322eb7 100644 (file)
@@ -4,7 +4,7 @@ fn id[T](&T t) -> T {
 
 fn main() {
   auto t = tup(1,2,3,4,5,6,7);
-  check (t._5 == 6);
+  assert (t._5 == 6);
   auto f1 = bind id[tup(int,int,int,int,int,int,int)](_);
-  check (f1(t)._5 == 6);
+  assert (f1(t)._5 == 6);
 }
index 856f3aff8e6e069ed4bc4e37d89ef307042fceb3..76d5e3ab01b3bc68547bd0551c792771e1afc259 100644 (file)
@@ -4,5 +4,5 @@ fn box[T](&tup(T,T,T) x) -> @tup(T,T,T) {
 
 fn main() {
   let @tup(int,int,int) x = box[int](tup(1,2,3));
-  check (x._1 == 2);
+  assert (x._1 == 2);
 }
\ No newline at end of file
index 54c3f9564ecf006d825ba146effa08ae108b7a65..507d1c5fd8799bcf38f637fb1d8b134bd48a3d22 100644 (file)
@@ -12,6 +12,6 @@ fn main() {
   auto b = f[int](10);
   log b._0;
   log b._1;
-  check (b._0 == 10);
-  check (b._1 == 10);
+  assert (b._0 == 10);
+  assert (b._1 == 10);
 }
index 0ec7020cdaddaf75f62da5108fc6be393c77b31d..07eae9c1a4268f9f1ae7939140b7c1be09093151 100644 (file)
@@ -8,6 +8,6 @@ fn main() {
   let int foo = 17;
   let tupbox[int] tbfoo = tuplift[int](foo);
   let recbox[int] rbfoo = reclift[int](foo);
-  check (tbfoo._0 == foo);
-  check (rbfoo.x == foo);
+  assert (tbfoo._0 == foo);
+  assert (rbfoo.x == foo);
 }
index 4398670f15e9a9256f932fc8d061616daf346f94..9c795ec250c39776e189c9d989b5f55216736201 100644 (file)
@@ -9,5 +9,5 @@ fn id[T](&T x) -> T {
 fn main() {
   let int x = 42;
   let int y = id(x);
-  check (x == y);
+  assert (x == y);
 }
index 238ef2d1aea2a663f9432a79e0a5fec9a9ef5831..4f93fef52c9cb169567678163c79950eeac5df05 100644 (file)
@@ -17,16 +17,16 @@ fn main() {
 
    y = id[int](x);
    log y;
-   check (x == y);
+   assert (x == y);
 
    b = id[char](a);
    log b;
-   check (a == b);
+   assert (a == b);
 
    q = id[triple](p);
    x = p._2;
    y = q._2;
    log y;
-   check (x == y);
+   assert (x == y);
 
 }
index 2a50ccd2bb175cd9dad662f4985af9f47445c492..cc549f6bd6efa348f7ef59a319e959017a544edc 100644 (file)
@@ -11,7 +11,7 @@ fn main() {
   log h.get()._0;
   log h.get()._1;
   log h.get()._2;
-  check (h.get()._0 == (1 as u8));
-  check (h.get()._1 == (2 as u8));
-  check (h.get()._2 == (3 as u8));
+  assert (h.get()._0 == (1 as u8));
+  assert (h.get()._1 == (2 as u8));
+  assert (h.get()._2 == (3 as u8));
 }
index ced9140fc60bb777839b6edc4183639ef62b925c..9879fa790b5571e57e162147ed2537247b8a8d7d 100644 (file)
@@ -21,8 +21,8 @@ fn main() {
   log b.get(0);
   log b.get(1);
   log b.get(2);
-  check (b.get(0) == 1);
-  check (b.get(1) == 2);
-  check (b.get(2) == 3);
+  assert (b.get(0) == 1);
+  assert (b.get(1) == 2);
+  assert (b.get(2) == 3);
   b.take2(0);
 }
index 9b19eec7388e3d5f9a8699e5746abc0a225b0105..f29cfa00036fab7406797d25dced238d671a9b0f 100644 (file)
@@ -10,7 +10,7 @@ fn altfoo[T](&foo[T] f) {
       hit = true;
     }
   }
-  check (hit);
+  assert (hit);
 }
 
 fn main() {
index 090a050404a92849670cf3c0d47ece2ae97e83f8..46421e0a28c6be5be8e4fae52014ea5dee40b120 100644 (file)
@@ -9,7 +9,7 @@ fn main() {
   alt (nop) {
     case (some[int](?n)) {
       log n;
-      check (n == 5);
+      assert (n == 5);
     }
   }
 
@@ -18,8 +18,8 @@ fn main() {
     case (some[tup(int, int)](?t)) {
       log t._0;
       log t._1;
-      check (t._0 == 17);
-      check (t._1 == 42);
+      assert (t._0 == 17);
+      assert (t._1 == 42);
     }
   }
 }
index 98401ecc1c5ee8d9da18bd05c56cf554988b66bd..2f697124625140ffaf0c6277e3d495fb5b97c363 100644 (file)
@@ -5,7 +5,7 @@ fn mk() -> int {
 
 fn chk(&int a) {
   log a;
-  check (a == 1);
+  assert (a == 1);
 }
 
 fn apply[T](fn() -> T produce, fn(&T) consume) {
index c387ef1928dc119d80799bbd4ed8cf8bdc41f19c..d2edfd2e379b181a9e6f6c3fc12c0993537fcec3 100644 (file)
@@ -6,6 +6,6 @@ fn get_third[T](&tup(T,T,T) t) -> T {
 
 fn main() {
   log get_third(tup(1,2,3));
-  check (get_third(tup(1,2,3)) == 3);
-  check (get_third(tup(5u8,6u8,7u8)) == 7u8);
+  assert (get_third(tup(1,2,3)) == 3);
+  assert (get_third(tup(5u8,6u8,7u8)) == 7u8);
 }
\ No newline at end of file
index 6638cebfeeaf76497c20a6f1714da18af3d8cd82..9b5b5297f15cd68914453fc76c99e2739bcd0f26 100644 (file)
@@ -1,6 +1,6 @@
 type pair[T] = tup(T,T);
 fn main() {
   let pair[int] x = tup(10,12);
-  check (x._0 == 10);
-  check (x._1 == 12);
+  assert (x._0 == 10);
+  assert (x._1 == 12);
 }
index 3f00acb1ff86b42874eb08a7ab12fc931c64e9aa..eb5e76fb292a6bc8d7b7f629cfd2423a0f9ca738 100644 (file)
@@ -3,6 +3,6 @@
 fn main() {
     let i32 x = -400_i32;
     x = 0_i32 - x;
-    check(x == 400_i32);
+    assert (x == 400_i32);
 }
 
index fb387d316c52f026291422204622f883fae2750a..92ff04ea28453fe306cfcad98c8dd6b060d96be1 100644 (file)
@@ -5,5 +5,5 @@ fn main() {
   let i8 y = -12i8;
   x = x + 1i8;
   x = x - 1i8;
-  check(x == y);
+  assert (x == y);
 }
index fe7d147c30c1d87030db86a5b919247e13b19a5d..ee80786c18a41b7d9d912d33b8e38cc4886d68ce 100644 (file)
@@ -4,19 +4,19 @@ fn main() {
 
   let vec[int] v = vec(0, 1, 2, 3, 4, 5);
   let str s = "abcdef";
-  check (v.(3u) == 3);
-  check (v.(3u8) == 3);
-  check (v.(3i8) == 3);
-  check (v.(3u32) == 3);
-  check (v.(3i32) == 3);
+  assert (v.(3u) == 3);
+  assert (v.(3u8) == 3);
+  assert (v.(3i8) == 3);
+  assert (v.(3u32) == 3);
+  assert (v.(3i32) == 3);
 
   log v.(3u8);
 
-  check (s.(3u) == 'd' as u8);
-  check (s.(3u8) == 'd' as u8);
-  check (s.(3i8) == 'd' as u8);
-  check (s.(3u32) == 'd' as u8);
-  check (s.(3i32) == 'd' as u8);
+  assert (s.(3u) == 'd' as u8);
+  assert (s.(3u8) == 'd' as u8);
+  assert (s.(3i8) == 'd' as u8);
+  assert (s.(3u32) == 'd' as u8);
+  assert (s.(3i32) == 'd' as u8);
 
   log s.(3u8);
 }
\ No newline at end of file
index ade7c51c6ab02b510147ad8ff0b2cf070940a09b..78bf94c33ab4775d70b7576c4502e99f494b089f 100644 (file)
@@ -1,5 +1,5 @@
 iter range(int a, int b) -> int {
-  check (a < b);
+  assert (a < b);
 
   let int i = a;
   while (i < b) {
index fe0ffe6b21b991964411b906f2d97018e35c49f9..7034efba2b6556f804fc900b9792759f03ffed23 100644 (file)
@@ -1,22 +1,22 @@
 fn incr(& mutable int x) -> bool {
   x += 1;
-  check (false);
+  assert (false);
   ret false;
 }
 
 fn main() {
 
   auto x = (1 == 2) || (3 == 3);
-  check (x);
+  assert (x);
 
   let int y = 10;
   log x || incr(y);
-  check (y == 10);
+  assert (y == 10);
 
   if (true && x) {
-    check (true);
+    assert (true);
   } else {
-    check (false);
+    assert (false);
   }
 
 }
\ No newline at end of file
index 6face271eed222ed11d8d71fa6275974dfb00fd0..a91adaa15653a5db5f4499ab377d672846a72df2 100644 (file)
@@ -10,13 +10,13 @@ fn main() {
   y <- p;
   log "received 1";
   log y;
-  check (y == 10);
+  assert (y == 10);
 
   spawn child(c);
   y <- p;
   log "received 2";
   log y;
-  check (y == 10);
+  assert (y == 10);
 }
 
 fn child(chan[int] c) {
index 162e8b13293f34a24ae5d86051c9246215cc9310..8f2d939005c78e6cd497ff0d145917ef349c478e 100644 (file)
@@ -9,17 +9,17 @@ fn test_0_elements() {
   act = bitv.create(0u, false);
   exp = _vec.init_elt[uint](0u, 0u);
   // FIXME: why can't I write vec[uint]()?
-  check (bitv.eq_vec(act, exp));
+  assert (bitv.eq_vec(act, exp));
 }
 
 fn test_1_element() {
   auto act;
 
   act = bitv.create(1u, false);
-  check (bitv.eq_vec(act, vec(0u)));
+  assert (bitv.eq_vec(act, vec(0u)));
 
   act = bitv.create(1u, true);
-  check (bitv.eq_vec(act, vec(1u)));
+  assert (bitv.eq_vec(act, vec(1u)));
 }
 
 fn test_10_elements() {
@@ -27,11 +27,11 @@ fn test_10_elements() {
 
   // all 0
   act = bitv.create(10u, false);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u)));
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u)));
 
   // all 1
   act = bitv.create(10u, true);
-  check (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u)));
+  assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u)));
 
   // mixed
   act = bitv.create(10u, false);
@@ -40,7 +40,7 @@ fn test_10_elements() {
   bitv.set(act, 2u, true);
   bitv.set(act, 3u, true);
   bitv.set(act, 4u, true);
-  check (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u)));
+  assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u)));
 
   // mixed
   act = bitv.create(10u, false);
@@ -49,7 +49,7 @@ fn test_10_elements() {
   bitv.set(act, 7u, true);
   bitv.set(act, 8u, true);
   bitv.set(act, 9u, true);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u)));
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u)));
 
   // mixed
   act = bitv.create(10u, false);
@@ -57,7 +57,7 @@ fn test_10_elements() {
   bitv.set(act, 3u, true);
   bitv.set(act, 6u, true);
   bitv.set(act, 9u, true);
-  check (bitv.eq_vec(act, vec(1u, 0u, 0u, 1u, 0u, 0u, 1u, 0u, 0u, 1u)));
+  assert (bitv.eq_vec(act, vec(1u, 0u, 0u, 1u, 0u, 0u, 1u, 0u, 0u, 1u)));
 }
 
 fn test_31_elements() {
@@ -65,14 +65,14 @@ fn test_31_elements() {
 
   // all 0
   act = bitv.create(31u, false);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u)));
 
   // all 1
   act = bitv.create(31u, true);
-  check (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
+  assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u)));
@@ -87,7 +87,7 @@ fn test_31_elements() {
   bitv.set(act, 5u, true);
   bitv.set(act, 6u, true);
   bitv.set(act, 7u, true);
-  check (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
+  assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u)));
@@ -102,7 +102,7 @@ fn test_31_elements() {
   bitv.set(act, 21u, true);
   bitv.set(act, 22u, true);
   bitv.set(act, 23u, true);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u)));
@@ -116,7 +116,7 @@ fn test_31_elements() {
   bitv.set(act, 28u, true);
   bitv.set(act, 29u, true);
   bitv.set(act, 30u, true);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u)));
@@ -126,7 +126,7 @@ fn test_31_elements() {
   bitv.set(act, 3u, true);
   bitv.set(act, 17u, true);
   bitv.set(act, 30u, true);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u,
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 1u)));
@@ -137,14 +137,14 @@ fn test_32_elements() {
 
   // all 0
   act = bitv.create(32u, false);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u)));
 
   // all 1
   act = bitv.create(32u, true);
-  check (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
+  assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u)));
@@ -159,7 +159,7 @@ fn test_32_elements() {
   bitv.set(act, 5u, true);
   bitv.set(act, 6u, true);
   bitv.set(act, 7u, true);
-  check (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
+  assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u)));
@@ -174,7 +174,7 @@ fn test_32_elements() {
   bitv.set(act, 21u, true);
   bitv.set(act, 22u, true);
   bitv.set(act, 23u, true);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u)));
@@ -189,7 +189,7 @@ fn test_32_elements() {
   bitv.set(act, 29u, true);
   bitv.set(act, 30u, true);
   bitv.set(act, 31u, true);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u)));
@@ -200,7 +200,7 @@ fn test_32_elements() {
   bitv.set(act, 17u, true);
   bitv.set(act, 30u, true);
   bitv.set(act, 31u, true);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u,
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u)));
@@ -211,7 +211,7 @@ fn test_33_elements() {
 
   // all 0
   act = bitv.create(33u, false);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
@@ -219,7 +219,7 @@ fn test_33_elements() {
 
   // all 1
   act = bitv.create(33u, true);
-  check (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
+  assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
@@ -235,7 +235,7 @@ fn test_33_elements() {
   bitv.set(act, 5u, true);
   bitv.set(act, 6u, true);
   bitv.set(act, 7u, true);
-  check (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
+  assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
@@ -251,7 +251,7 @@ fn test_33_elements() {
   bitv.set(act, 21u, true);
   bitv.set(act, 22u, true);
   bitv.set(act, 23u, true);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
@@ -267,7 +267,7 @@ fn test_33_elements() {
   bitv.set(act, 29u, true);
   bitv.set(act, 30u, true);
   bitv.set(act, 31u, true);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
@@ -280,7 +280,7 @@ fn test_33_elements() {
   bitv.set(act, 30u, true);
   bitv.set(act, 31u, true);
   bitv.set(act, 32u, true);
-  check (bitv.eq_vec(act, vec(0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u,
+  assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u,
                               0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u,
index 10f5e727110cff7ed67073dca5f3cde53a571065..62807251bd16044762029d1d03b7482fe4afd66d 100644 (file)
@@ -4,9 +4,9 @@
 fn main() {
     auto x = @3;
     auto y = @3;
-    check (Box.ptr_eq[int](x, x));
-    check (Box.ptr_eq[int](y, y));
-    check (!Box.ptr_eq[int](x, y));
-    check (!Box.ptr_eq[int](y, x));
+    assert (Box.ptr_eq[int](x, x));
+    assert (Box.ptr_eq[int](y, y));
+    assert (!Box.ptr_eq[int](x, y));
+    assert (!Box.ptr_eq[int](y, x));
 }
 
index 9fd177eaf9601f11236b032c919837ef55133e69..405ab72be2037d3df16716e4b55d1ddf94d32d95 100644 (file)
 
 fn test_simple() {
   let deque.t[int] d = deque.create[int]();
-  check (d.size() == 0u);
+  assert (d.size() == 0u);
   d.add_front(17);
   d.add_front(42);
   d.add_back(137);
-  check (d.size() == 3u);
+  assert (d.size() == 3u);
   d.add_back(137);
-  check (d.size() == 4u);
+  assert (d.size() == 4u);
 
   log d.peek_front();
-  check (d.peek_front() == 42);
+  assert (d.peek_front() == 42);
 
   log d.peek_back();
-  check (d.peek_back() == 137);
+  assert (d.peek_back() == 137);
 
   let int i = d.pop_front();
   log i;
-  check (i == 42);
+  assert (i == 42);
 
   i = d.pop_back();
   log i;
-  check (i == 137);
+  assert (i == 137);
 
   i = d.pop_back();
   log i;
-  check (i == 137);
+  assert (i == 137);
 
   i = d.pop_back();
   log i;
-  check (i == 17);
+  assert (i == 17);
 
-  check (d.size() == 0u);
+  assert (d.size() == 0u);
   d.add_back(3);
-  check (d.size() == 1u);
+  assert (d.size() == 1u);
   d.add_front(2);
-  check (d.size() == 2u);
+  assert (d.size() == 2u);
   d.add_back(4);
-  check (d.size() == 3u);
+  assert (d.size() == 3u);
   d.add_front(1);
-  check (d.size() == 4u);
+  assert (d.size() == 4u);
 
   log d.get(0);
   log d.get(1);
   log d.get(2);
   log d.get(3);
 
-  check (d.get(0) == 1);
-  check (d.get(1) == 2);
-  check (d.get(2) == 3);
-  check (d.get(3) == 4);
+  assert (d.get(0) == 1);
+  assert (d.get(1) == 2);
+  assert (d.get(2) == 3);
+  assert (d.get(3) == 4);
 }
 
 fn test_boxes(@int a, @int b, @int c, @int d) {
   let deque.t[@int] deq = deque.create[@int]();
-  check (deq.size() == 0u);
+  assert (deq.size() == 0u);
   deq.add_front(a);
   deq.add_front(b);
   deq.add_back(c);
-  check (deq.size() == 3u);
+  assert (deq.size() == 3u);
   deq.add_back(d);
-  check (deq.size() == 4u);
+  assert (deq.size() == 4u);
 
-  check (deq.peek_front() == b);
-  check (deq.peek_back() == d);
+  assert (deq.peek_front() == b);
+  assert (deq.peek_back() == d);
 
-  check (deq.pop_front() == b);
-  check (deq.pop_back() == d);
-  check (deq.pop_back() == c);
-  check (deq.pop_back() == a);
+  assert (deq.pop_front() == b);
+  assert (deq.pop_back() == d);
+  assert (deq.pop_back() == c);
+  assert (deq.pop_back() == a);
 
-  check (deq.size() == 0u);
+  assert (deq.size() == 0u);
   deq.add_back(c);
-  check (deq.size() == 1u);
+  assert (deq.size() == 1u);
   deq.add_front(b);
-  check (deq.size() == 2u);
+  assert (deq.size() == 2u);
   deq.add_back(d);
-  check (deq.size() == 3u);
+  assert (deq.size() == 3u);
   deq.add_front(a);
-  check (deq.size() == 4u);
+  assert (deq.size() == 4u);
 
-  check (deq.get(0) == a);
-  check (deq.get(1) == b);
-  check (deq.get(2) == c);
-  check (deq.get(3) == d);
+  assert (deq.get(0) == a);
+  assert (deq.get(1) == b);
+  assert (deq.get(2) == c);
+  assert (deq.get(3) == d);
 }
 
 type eqfn[T] = fn(&T a, &T b) -> bool;
 
 fn test_parameterized[T](eqfn[T] e, &T a, &T b, &T c, &T d) {
   let deque.t[T] deq = deque.create[T]();
-  check (deq.size() == 0u);
+  assert (deq.size() == 0u);
   deq.add_front(a);
   deq.add_front(b);
   deq.add_back(c);
-  check (deq.size() == 3u);
+  assert (deq.size() == 3u);
   deq.add_back(d);
-  check (deq.size() == 4u);
+  assert (deq.size() == 4u);
 
-  check (e(deq.peek_front(), b));
-  check (e(deq.peek_back(), d));
+  assert (e(deq.peek_front(), b));
+  assert (e(deq.peek_back(), d));
 
-  check (e(deq.pop_front(), b));
-  check (e(deq.pop_back(), d));
-  check (e(deq.pop_back(), c));
-  check (e(deq.pop_back(), a));
+  assert (e(deq.pop_front(), b));
+  assert (e(deq.pop_back(), d));
+  assert (e(deq.pop_back(), c));
+  assert (e(deq.pop_back(), a));
 
-  check (deq.size() == 0u);
+  assert (deq.size() == 0u);
   deq.add_back(c);
-  check (deq.size() == 1u);
+  assert (deq.size() == 1u);
   deq.add_front(b);
-  check (deq.size() == 2u);
+  assert (deq.size() == 2u);
   deq.add_back(d);
-  check (deq.size() == 3u);
+  assert (deq.size() == 3u);
   deq.add_front(a);
-  check (deq.size() == 4u);
+  assert (deq.size() == 4u);
 
-  check (e(deq.get(0), a));
-  check (e(deq.get(1), b));
-  check (e(deq.get(2), c));
-  check (e(deq.get(3), d));
+  assert (e(deq.get(0), a));
+  assert (e(deq.get(1), b));
+  assert (e(deq.get(2), c));
+  assert (e(deq.get(3), d));
 }
 
 tag taggy {
index 2e85abf6509f23ac9589c25fe55989a0c6f2e312..e4e68351aabfc25a891e22e61fd3b287a6b50358 100644 (file)
@@ -4,22 +4,22 @@
 import std._str.eq;
 
 fn test_to_str() {
-  check (eq(_int.to_str(0, 10u), "0"));
-  check (eq(_int.to_str(1, 10u), "1"));
-  check (eq(_int.to_str(-1, 10u), "-1"));
-  check (eq(_int.to_str(255, 16u), "ff"));
-  check (eq(_int.to_str(100, 10u), "100"));
+  assert (eq(_int.to_str(0, 10u), "0"));
+  assert (eq(_int.to_str(1, 10u), "1"));
+  assert (eq(_int.to_str(-1, 10u), "-1"));
+  assert (eq(_int.to_str(255, 16u), "ff"));
+  assert (eq(_int.to_str(100, 10u), "100"));
 }
 
 fn test_pow() {
-  check (_int.pow(0, 0u) == 1);
-  check (_int.pow(0, 1u) == 0);
-  check (_int.pow(0, 2u) == 0);
-  check (_int.pow(-1, 0u) == -1);
-  check (_int.pow(1, 0u) == 1);
-  check (_int.pow(-3, 2u) == 9);
-  check (_int.pow(-3, 3u) == -27);
-  check (_int.pow(4, 9u) == 262144);
+  assert (_int.pow(0, 0u) == 1);
+  assert (_int.pow(0, 1u) == 0);
+  assert (_int.pow(0, 2u) == 0);
+  assert (_int.pow(-1, 0u) == -1);
+  assert (_int.pow(1, 0u) == 1);
+  assert (_int.pow(-3, 2u) == 9);
+  assert (_int.pow(-3, 3u) == -27);
+  assert (_int.pow(4, 9u) == 262144);
 }
 
 fn main() {
index 7102c91e36e32cdac1e7ed967295d3991c7ec9f0..bcc2163cfd3fa314b70dfab40007a487d61e2dd6 100644 (file)
@@ -20,7 +20,7 @@ fn test_simple(str tmpfilebase) {
   let io.reader inp = io.file_reader(tmpfile);
   let str frood2 = inp.read_c_str();
   log frood2;
-  check (_str.eq(frood, frood2));
+  assert (_str.eq(frood, frood2));
 }
 
 fn main(vec[str] argv) {
index 4c8afa7d547a3dd570c29e7fcd1c5fe5abc50f85..abd2041e151318a37340bfcf7ddb2c3a243a8e69 100644 (file)
@@ -28,19 +28,19 @@ fn hash_uint(&uint u) -> uint {
   let map.hashmap[uint, uint] hm_uu = map.mk_hashmap[uint, uint](hasher_uint,
                                                                  eqer_uint);
 
-  check (hm_uu.insert(10u, 12u));
-  check (hm_uu.insert(11u, 13u));
-  check (hm_uu.insert(12u, 14u));
+  assert (hm_uu.insert(10u, 12u));
+  assert (hm_uu.insert(11u, 13u));
+  assert (hm_uu.insert(12u, 14u));
 
-  check (hm_uu.get(11u) == 13u);
-  check (hm_uu.get(12u) == 14u);
-  check (hm_uu.get(10u) == 12u);
+  assert (hm_uu.get(11u) == 13u);
+  assert (hm_uu.get(12u) == 14u);
+  assert (hm_uu.get(10u) == 12u);
 
-  check (!hm_uu.insert(12u, 14u));
-  check (hm_uu.get(12u) == 14u);
+  assert (!hm_uu.insert(12u, 14u));
+  assert (hm_uu.get(12u) == 14u);
 
-  check (!hm_uu.insert(12u, 12u));
-  check (hm_uu.get(12u) == 12u);
+  assert (!hm_uu.insert(12u, 12u));
+  assert (hm_uu.get(12u) == 12u);
 
 
   let str ten = "ten";
@@ -51,21 +51,21 @@ fn hash_uint(&uint u) -> uint {
 
   let map.hashmap[str, uint] hm_su = map.mk_hashmap[str, uint](hasher_str,
                                                                eqer_str);
-  check (hm_su.insert("ten", 12u));
-  check (hm_su.insert(eleven, 13u));
-  check (hm_su.insert("twelve", 14u));
+  assert (hm_su.insert("ten", 12u));
+  assert (hm_su.insert(eleven, 13u));
+  assert (hm_su.insert("twelve", 14u));
 
-  check (hm_su.get(eleven) == 13u);
+  assert (hm_su.get(eleven) == 13u);
 
-  check (hm_su.get("eleven") == 13u);
-  check (hm_su.get("twelve") == 14u);
-  check (hm_su.get("ten") == 12u);
+  assert (hm_su.get("eleven") == 13u);
+  assert (hm_su.get("twelve") == 14u);
+  assert (hm_su.get("ten") == 12u);
 
-  check (!hm_su.insert("twelve", 14u));
-  check (hm_su.get("twelve") == 14u);
+  assert (!hm_su.insert("twelve", 14u));
+  assert (hm_su.get("twelve") == 14u);
 
-  check (!hm_su.insert("twelve", 12u));
-  check (hm_su.get("twelve") == 12u);
+  assert (!hm_su.insert("twelve", 12u));
+  assert (hm_su.get("twelve") == 12u);
 
 
   log "uint -> str";
@@ -73,19 +73,19 @@ fn hash_uint(&uint u) -> uint {
   let map.hashmap[uint, str] hm_us = map.mk_hashmap[uint, str](hasher_uint,
                                                                eqer_uint);
 
-  check (hm_us.insert(10u, "twelve"));
-  check (hm_us.insert(11u, "thirteen"));
-  check (hm_us.insert(12u, "fourteen"));
+  assert (hm_us.insert(10u, "twelve"));
+  assert (hm_us.insert(11u, "thirteen"));
+  assert (hm_us.insert(12u, "fourteen"));
 
-  check (_str.eq(hm_us.get(11u), "thirteen"));
-  check (_str.eq(hm_us.get(12u), "fourteen"));
-  check (_str.eq(hm_us.get(10u), "twelve"));
+  assert (_str.eq(hm_us.get(11u), "thirteen"));
+  assert (_str.eq(hm_us.get(12u), "fourteen"));
+  assert (_str.eq(hm_us.get(10u), "twelve"));
 
-  check (!hm_us.insert(12u, "fourteen"));
-  check (_str.eq(hm_us.get(12u), "fourteen"));
+  assert (!hm_us.insert(12u, "fourteen"));
+  assert (_str.eq(hm_us.get(12u), "fourteen"));
 
-  check (!hm_us.insert(12u, "twelve"));
-  check (_str.eq(hm_us.get(12u), "twelve"));
+  assert (!hm_us.insert(12u, "twelve"));
+  assert (_str.eq(hm_us.get(12u), "twelve"));
 
 
   log "str -> str";
@@ -93,19 +93,19 @@ fn hash_uint(&uint u) -> uint {
   let map.hashmap[str, str] hm_ss = map.mk_hashmap[str, str](hasher_str,
                                                              eqer_str);
 
-  check (hm_ss.insert(ten, "twelve"));
-  check (hm_ss.insert(eleven, "thirteen"));
-  check (hm_ss.insert(twelve, "fourteen"));
+  assert (hm_ss.insert(ten, "twelve"));
+  assert (hm_ss.insert(eleven, "thirteen"));
+  assert (hm_ss.insert(twelve, "fourteen"));
 
-  check (_str.eq(hm_ss.get("eleven"), "thirteen"));
-  check (_str.eq(hm_ss.get("twelve"), "fourteen"));
-  check (_str.eq(hm_ss.get("ten"), "twelve"));
+  assert (_str.eq(hm_ss.get("eleven"), "thirteen"));
+  assert (_str.eq(hm_ss.get("twelve"), "fourteen"));
+  assert (_str.eq(hm_ss.get("ten"), "twelve"));
 
-  check (!hm_ss.insert("twelve", "fourteen"));
-  check (_str.eq(hm_ss.get("twelve"), "fourteen"));
+  assert (!hm_ss.insert("twelve", "fourteen"));
+  assert (_str.eq(hm_ss.get("twelve"), "fourteen"));
 
-  check (!hm_ss.insert("twelve", "twelve"));
-  check (_str.eq(hm_ss.get("twelve"), "twelve"));
+  assert (!hm_ss.insert("twelve", "twelve"));
+  assert (_str.eq(hm_ss.get("twelve"), "twelve"));
 
   log "*** finished test_simple";
 }
@@ -135,7 +135,7 @@ fn hash_uint(&uint u) -> uint {
 
   let uint i = 0u;
   while (i < num_to_insert) {
-    check (hm_uu.insert(i, i * i));
+    assert (hm_uu.insert(i, i * i));
     log "inserting " + _uint.to_str(i, 10u)
       + " -> " + _uint.to_str(i * i, 10u);
     i += 1u;
@@ -147,12 +147,12 @@ fn hash_uint(&uint u) -> uint {
   while (i < num_to_insert) {
     log "get(" + _uint.to_str(i, 10u) + ") = "
       + _uint.to_str(hm_uu.get(i), 10u);
-    check (hm_uu.get(i) == i * i);
+    assert (hm_uu.get(i) == i * i);
     i += 1u;
   }
 
-  check (hm_uu.insert(num_to_insert, 17u));
-  check (hm_uu.get(num_to_insert) == 17u);
+  assert (hm_uu.insert(num_to_insert, 17u));
+  assert (hm_uu.get(num_to_insert) == 17u);
 
   log "-----";
 
@@ -162,7 +162,7 @@ fn hash_uint(&uint u) -> uint {
   while (i < num_to_insert) {
     log "get(" + _uint.to_str(i, 10u) + ") = "
       + _uint.to_str(hm_uu.get(i), 10u);
-    check (hm_uu.get(i) == i * i);
+    assert (hm_uu.get(i) == i * i);
     i += 1u;
   }
 
@@ -176,7 +176,7 @@ fn hash_uint(&uint u) -> uint {
 
   i = 0u;
   while (i < num_to_insert) {
-    check (hm_ss.insert(_uint.to_str(i, 2u), _uint.to_str(i * i, 2u)));
+    assert (hm_ss.insert(_uint.to_str(i, 2u), _uint.to_str(i * i, 2u)));
     log "inserting \"" + _uint.to_str(i, 2u)
       + "\" -> \"" + _uint.to_str(i * i, 2u) + "\"";
     i += 1u;
@@ -191,15 +191,15 @@ fn hash_uint(&uint u) -> uint {
       + "\") = \""
       + hm_ss.get(_uint.to_str(i, 2u)) + "\"";
 
-    check (_str.eq(hm_ss.get(_uint.to_str(i, 2u)),
+    assert (_str.eq(hm_ss.get(_uint.to_str(i, 2u)),
                    _uint.to_str(i * i, 2u)));
     i += 1u;
   }
 
-  check (hm_ss.insert(_uint.to_str(num_to_insert, 2u),
+  assert (hm_ss.insert(_uint.to_str(num_to_insert, 2u),
                       _uint.to_str(17u, 2u)));
 
-  check (_str.eq(hm_ss.get(_uint.to_str(num_to_insert, 2u)),
+  assert (_str.eq(hm_ss.get(_uint.to_str(num_to_insert, 2u)),
                  _uint.to_str(17u, 2u)));
 
   log "-----";
@@ -210,7 +210,7 @@ fn hash_uint(&uint u) -> uint {
   while (i < num_to_insert) {
     log "get(\"" + _uint.to_str(i, 2u) + "\") = \""
       + hm_ss.get(_uint.to_str(i, 2u)) + "\"";
-    check (_str.eq(hm_ss.get(_uint.to_str(i, 2u)),
+    assert (_str.eq(hm_ss.get(_uint.to_str(i, 2u)),
                    _uint.to_str(i * i, 2u)));
     i += 1u;
   }
@@ -230,9 +230,9 @@ fn hash(&uint u) -> uint {
     ret (u / 2u) * 2u;
   }
 
-  check (hash(0u) == hash(1u));
-  check (hash(2u) == hash(3u));
-  check (hash(0u) != hash(2u));
+  assert (hash(0u) == hash(1u));
+  assert (hash(2u) == hash(3u));
+  assert (hash(0u) != hash(2u));
 
   let map.hashfn[uint] hasher = hash;
   let map.eqfn[uint] eqer = eq;
@@ -240,13 +240,13 @@ fn hash(&uint u) -> uint {
 
   let uint i = 0u;
   while (i < num_to_insert) {
-    check (hm.insert(i, i * i));
+    assert (hm.insert(i, i * i));
     log "inserting " + _uint.to_str(i, 10u)
       + " -> " + _uint.to_str(i * i, 10u);
     i += 1u;
   }
 
-  check (hm.size() == num_to_insert);
+  assert (hm.size() == num_to_insert);
 
   log "-----";
   log "removing evens";
@@ -260,7 +260,7 @@ fn hash(&uint u) -> uint {
     let util.option[uint] v = hm.remove(i);
     alt (v) {
       case (util.some[uint](u)) {
-        check (u == (i * i));
+        assert (u == (i * i));
       }
       case (util.none[uint]()) { fail; }
     }
@@ -273,7 +273,7 @@ fn hash(&uint u) -> uint {
     i += 2u;
   }
 
-  check (hm.size() == (num_to_insert / 2u));
+  assert (hm.size() == (num_to_insert / 2u));
 
   log "-----";
 
@@ -281,7 +281,7 @@ fn hash(&uint u) -> uint {
   while (i < num_to_insert) {
     log "get(" + _uint.to_str(i, 10u) + ") = "
       + _uint.to_str(hm.get(i), 10u);
-    check (hm.get(i) == i * i);
+    assert (hm.get(i) == i * i);
     i += 2u;
   }
 
@@ -296,7 +296,7 @@ fn hash(&uint u) -> uint {
   while (i < num_to_insert) {
     log "get(" + _uint.to_str(i, 10u) + ") = "
       + _uint.to_str(hm.get(i), 10u);
-    check (hm.get(i) == i * i);
+    assert (hm.get(i) == i * i);
     i += 2u;
   }
 
@@ -304,13 +304,13 @@ fn hash(&uint u) -> uint {
 
   i = 0u;
   while (i < num_to_insert) {
-    check (hm.insert(i, i * i));
+    assert (hm.insert(i, i * i));
     log "inserting " + _uint.to_str(i, 10u)
       + " -> " + _uint.to_str(i * i, 10u);
     i += 2u;
   }
 
-  check (hm.size() == num_to_insert);
+  assert (hm.size() == num_to_insert);
 
   log "-----";
 
@@ -318,7 +318,7 @@ fn hash(&uint u) -> uint {
   while (i < num_to_insert) {
     log "get(" + _uint.to_str(i, 10u) + ") = "
       + _uint.to_str(hm.get(i), 10u);
-    check (hm.get(i) == i * i);
+    assert (hm.get(i) == i * i);
     i += 1u;
   }
 
@@ -329,13 +329,13 @@ fn hash(&uint u) -> uint {
 
   log "-----";
 
-  check (hm.size() == num_to_insert);
+  assert (hm.size() == num_to_insert);
 
   i = 0u;
   while (i < num_to_insert) {
     log "get(" + _uint.to_str(i, 10u) + ") = "
       + _uint.to_str(hm.get(i), 10u);
-    check (hm.get(i) == i * i);
+    assert (hm.get(i) == i * i);
     i += 1u;
   }
 
index 57e3cdc856b6d95b9e1d80d0522495044c7af5e4..7e8efb5eba745a6291d8b1f1bbd32e1425b731d5 100644 (file)
@@ -69,13 +69,13 @@ fn a_million_letter_a() -> str {
     auto tests = fips_180_1_tests + wikipedia_tests;
 
     fn check_vec_eq(vec[u8] v0, vec[u8] v1) {
-        check (_vec.len[u8](v0) == _vec.len[u8](v1));
+        assert (_vec.len[u8](v0) == _vec.len[u8](v1));
         auto len = _vec.len[u8](v0);
         auto i = 0u;
         while (i < len) {
             auto a = v0.(i);
             auto b = v1.(i);
-            check (a == b);
+            assert (a == b);
             i += 1u;
         }
     }
index e2c3465cdfd47f23a4036f6ce7e2b2a9ac9ff903..a342b24eb5662f87bcfe3a7049a2f35353a129cd 100644 (file)
@@ -10,7 +10,7 @@ fn lteq(&int a, &int b) -> bool {
   auto i = 0u;
   while (i < len) {
     log v3.(i);
-    check (v3.(i) == v2.(i));
+    assert (v3.(i) == v2.(i));
     i += 1u;
   }
 }
index bd5cb036a699fb4fd1a74f442321cbc5c205efe3..9b8c56bb75121bdd52e5f668970293b46202bc0d 100644 (file)
@@ -8,8 +8,8 @@ fn main() {
     auto s = "hello";
     auto sb = _str.rustrt.str_buf(s);
     auto s_cstr = _str.rustrt.str_from_cstr(sb);
-    check (_str.eq(s_cstr, s));
+    assert (_str.eq(s_cstr, s));
     auto s_buf = _str.rustrt.str_from_buf(sb, 5u);
-    check (_str.eq(s_buf, s));
+    assert (_str.eq(s_buf, s));
 }
 
index 835c08a20f68e5d07f4b3a5dba63098644c98461..767177111b2b8a64b5c2caa4f263ea1db178c4df 100644 (file)
@@ -2,22 +2,22 @@
 import std._str;
 
 fn test_bytes_len() {
-  check (_str.byte_len("") == 0u);
-  check (_str.byte_len("hello world") == 11u);
-  check (_str.byte_len("\x63") == 1u);
-  check (_str.byte_len("\xa2") == 2u);
-  check (_str.byte_len("\u03c0") == 2u);
-  check (_str.byte_len("\u2620") == 3u);
-  check (_str.byte_len("\U0001d11e") == 4u);
+  assert (_str.byte_len("") == 0u);
+  assert (_str.byte_len("hello world") == 11u);
+  assert (_str.byte_len("\x63") == 1u);
+  assert (_str.byte_len("\xa2") == 2u);
+  assert (_str.byte_len("\u03c0") == 2u);
+  assert (_str.byte_len("\u2620") == 3u);
+  assert (_str.byte_len("\U0001d11e") == 4u);
 }
 
 fn test_index_and_rindex() {
-  check(_str.index("hello", 'e' as u8) == 1);
-  check(_str.index("hello", 'o' as u8) == 4);
-  check(_str.index("hello", 'z' as u8) == -1);
-  check(_str.rindex("hello", 'l' as u8) == 3);
-  check(_str.rindex("hello", 'h' as u8) == 0);
-  check(_str.rindex("hello", 'z' as u8) == -1);
+  assert (_str.index("hello", 'e' as u8) == 1);
+  assert (_str.index("hello", 'o' as u8) == 4);
+  assert (_str.index("hello", 'z' as u8) == -1);
+  assert (_str.rindex("hello", 'l' as u8) == 3);
+  assert (_str.rindex("hello", 'h' as u8) == 0);
+  assert (_str.rindex("hello", 'z' as u8) == -1);
 }
 
 fn test_split() {
@@ -30,7 +30,7 @@ fn t(&str s, char c, int i, &str k) {
       log z;
     }
     log "comparing: " + v.(i) + " vs. " + k;
-    check(_str.eq(v.(i), k));
+    assert (_str.eq(v.(i), k));
   }
   t("abc.hello.there", '.', 0, "abc");
   t("abc.hello.there", '.', 1, "hello");
@@ -46,7 +46,7 @@ fn t(&str haystack, &str needle, int i) {
     let int j = _str.find(haystack,needle);
     log "searched for " + needle;
     log j;
-    check (i == j);
+    assert (i == j);
   }
   t("this is a simple", "is a", 5);
   t("this is a simple", "is z", -1);
@@ -57,7 +57,7 @@ fn t(&str haystack, &str needle, int i) {
 
 fn test_substr() {
   fn t(&str a, &str b, int start) {
-    check(_str.eq(_str.substr(a, start as uint,
+    assert (_str.eq(_str.substr(a, start as uint,
                               _str.byte_len(b)), b));
   }
 
@@ -68,7 +68,7 @@ fn t(&str a, &str b, int start) {
 
 fn test_concat() {
   fn t(&vec[str] v, &str s) {
-    check(_str.eq(_str.concat(v), s));
+    assert (_str.eq(_str.concat(v), s));
   }
 
   t(vec("you", "know", "I'm", "no", "good"), "youknowI'mnogood");
@@ -79,7 +79,7 @@ fn t(&vec[str] v, &str s) {
 
 fn test_connect() {
   fn t(&vec[str] v, &str sep, &str s) {
-    check(_str.eq(_str.connect(v, sep), s));
+    assert (_str.eq(_str.connect(v, sep), s));
   }
 
   t(vec("you", "know", "I'm", "no", "good"), " ", "you know I'm no good");
@@ -95,7 +95,7 @@ fn test_to_upper() {
   auto input = "abcDEF" + unicode + "xyz:.;";
   auto expected = "ABCDEF" + unicode + "XYZ:.;";
   auto actual = _str.to_upper(input);
-  check (_str.eq(expected, actual));
+  assert (_str.eq(expected, actual));
 }
 
 
index 356ca374092c2be02202933a1b2307c5cec4d3d6..64d39619f0b775500c13cb84c0cf289568bccc91 100644 (file)
@@ -4,44 +4,44 @@
 import std._uint;
 
 fn main() {
-  check (_uint.next_power_of_two(0u) == 0u);
-  check (_uint.next_power_of_two(1u) == 1u);
-  check (_uint.next_power_of_two(2u) == 2u);
-  check (_uint.next_power_of_two(3u) == 4u);
-  check (_uint.next_power_of_two(4u) == 4u);
-  check (_uint.next_power_of_two(5u) == 8u);
-  check (_uint.next_power_of_two(6u) == 8u);
-  check (_uint.next_power_of_two(7u) == 8u);
-  check (_uint.next_power_of_two(8u) == 8u);
-  check (_uint.next_power_of_two(9u) == 16u);
-  check (_uint.next_power_of_two(10u) == 16u);
-  check (_uint.next_power_of_two(11u) == 16u);
-  check (_uint.next_power_of_two(12u) == 16u);
-  check (_uint.next_power_of_two(13u) == 16u);
-  check (_uint.next_power_of_two(14u) == 16u);
-  check (_uint.next_power_of_two(15u) == 16u);
-  check (_uint.next_power_of_two(16u) == 16u);
-  check (_uint.next_power_of_two(17u) == 32u);
-  check (_uint.next_power_of_two(18u) == 32u);
-  check (_uint.next_power_of_two(19u) == 32u);
-  check (_uint.next_power_of_two(20u) == 32u);
-  check (_uint.next_power_of_two(21u) == 32u);
-  check (_uint.next_power_of_two(22u) == 32u);
-  check (_uint.next_power_of_two(23u) == 32u);
-  check (_uint.next_power_of_two(24u) == 32u);
-  check (_uint.next_power_of_two(25u) == 32u);
-  check (_uint.next_power_of_two(26u) == 32u);
-  check (_uint.next_power_of_two(27u) == 32u);
-  check (_uint.next_power_of_two(28u) == 32u);
-  check (_uint.next_power_of_two(29u) == 32u);
-  check (_uint.next_power_of_two(30u) == 32u);
-  check (_uint.next_power_of_two(31u) == 32u);
-  check (_uint.next_power_of_two(32u) == 32u);
-  check (_uint.next_power_of_two(33u) == 64u);
-  check (_uint.next_power_of_two(34u) == 64u);
-  check (_uint.next_power_of_two(35u) == 64u);
-  check (_uint.next_power_of_two(36u) == 64u);
-  check (_uint.next_power_of_two(37u) == 64u);
-  check (_uint.next_power_of_two(38u) == 64u);
-  check (_uint.next_power_of_two(39u) == 64u);
+  assert (_uint.next_power_of_two(0u) == 0u);
+  assert (_uint.next_power_of_two(1u) == 1u);
+  assert (_uint.next_power_of_two(2u) == 2u);
+  assert (_uint.next_power_of_two(3u) == 4u);
+  assert (_uint.next_power_of_two(4u) == 4u);
+  assert (_uint.next_power_of_two(5u) == 8u);
+  assert (_uint.next_power_of_two(6u) == 8u);
+  assert (_uint.next_power_of_two(7u) == 8u);
+  assert (_uint.next_power_of_two(8u) == 8u);
+  assert (_uint.next_power_of_two(9u) == 16u);
+  assert (_uint.next_power_of_two(10u) == 16u);
+  assert (_uint.next_power_of_two(11u) == 16u);
+  assert (_uint.next_power_of_two(12u) == 16u);
+  assert (_uint.next_power_of_two(13u) == 16u);
+  assert (_uint.next_power_of_two(14u) == 16u);
+  assert (_uint.next_power_of_two(15u) == 16u);
+  assert (_uint.next_power_of_two(16u) == 16u);
+  assert (_uint.next_power_of_two(17u) == 32u);
+  assert (_uint.next_power_of_two(18u) == 32u);
+  assert (_uint.next_power_of_two(19u) == 32u);
+  assert (_uint.next_power_of_two(20u) == 32u);
+  assert (_uint.next_power_of_two(21u) == 32u);
+  assert (_uint.next_power_of_two(22u) == 32u);
+  assert (_uint.next_power_of_two(23u) == 32u);
+  assert (_uint.next_power_of_two(24u) == 32u);
+  assert (_uint.next_power_of_two(25u) == 32u);
+  assert (_uint.next_power_of_two(26u) == 32u);
+  assert (_uint.next_power_of_two(27u) == 32u);
+  assert (_uint.next_power_of_two(28u) == 32u);
+  assert (_uint.next_power_of_two(29u) == 32u);
+  assert (_uint.next_power_of_two(30u) == 32u);
+  assert (_uint.next_power_of_two(31u) == 32u);
+  assert (_uint.next_power_of_two(32u) == 32u);
+  assert (_uint.next_power_of_two(33u) == 64u);
+  assert (_uint.next_power_of_two(34u) == 64u);
+  assert (_uint.next_power_of_two(35u) == 64u);
+  assert (_uint.next_power_of_two(36u) == 64u);
+  assert (_uint.next_power_of_two(37u) == 64u);
+  assert (_uint.next_power_of_two(38u) == 64u);
+  assert (_uint.next_power_of_two(39u) == 64u);
 }
index 1d6b61a1900e3d630a56771fadc4cb36327db0e4..3724d627b498441da73c78bfedd6e451b9d847d2 100644 (file)
@@ -21,14 +21,14 @@ fn test_simple() {
   let uint n1 = _str.byte_len(s1);
   let uint n2 = _vec.len[u8](v);
 
-  check (n1 == n2);
+  assert (n1 == n2);
 
   while (i < n1) {
     let u8 a = s1.(i);
     let u8 b = s2.(i);
     log a;
     log b;
-    check (a == b);
+    assert (a == b);
     i += 1u;
   }
 
index 4d6166483bcf2cbec936c67b9a014ad832db1535..51341039c691c6cb9cd8b244a640d25acee5551c 100644 (file)
@@ -2,10 +2,10 @@
 
 fn test_init_elt() {
   let vec[uint] v = std._vec.init_elt[uint](5u, 3u);
-  check (std._vec.len[uint](v) == 3u);
-  check (v.(0) == 5u);
-  check (v.(1) == 5u);
-  check (v.(2) == 5u);
+  assert (std._vec.len[uint](v) == 3u);
+  assert (v.(0) == 5u);
+  assert (v.(1) == 5u);
+  assert (v.(2) == 5u);
 }
 
 fn id(uint x) -> uint {
@@ -14,20 +14,20 @@ fn id(uint x) -> uint {
 fn test_init_fn() {
   let fn(uint)->uint op = id;
   let vec[uint] v = std._vec.init_fn[uint](op, 5u);
-  check (std._vec.len[uint](v) == 5u);
-  check (v.(0) == 0u);
-  check (v.(1) == 1u);
-  check (v.(2) == 2u);
-  check (v.(3) == 3u);
-  check (v.(4) == 4u);
+  assert (std._vec.len[uint](v) == 5u);
+  assert (v.(0) == 0u);
+  assert (v.(1) == 1u);
+  assert (v.(2) == 2u);
+  assert (v.(3) == 3u);
+  assert (v.(4) == 4u);
 }
 
 fn test_slice() {
   let vec[int] v = vec(1,2,3,4,5);
   auto v2 = std._vec.slice[int](v, 2u, 4u);
-  check (std._vec.len[int](v2) == 2u);
-  check (v2.(0) == 3);
-  check (v2.(1) == 4);
+  assert (std._vec.len[int](v2) == 2u);
+  assert (v2.(0) == 3);
+  assert (v2.(1) == 4);
 }
 
 fn test_map() {
@@ -37,7 +37,7 @@ fn test_map() {
   let vec[int] s = std._vec.map[int, int](op, v);
   let int i = 0;
   while (i < 5) {
-    check (v.(i) * v.(i) == s.(i));
+    assert (v.(i) * v.(i) == s.(i));
     i += 1;
   }
 }
@@ -51,7 +51,7 @@ fn test_map2() {
 
   auto i = 0;
   while (i < 5) {
-    check (v0.(i) * v1.(i) == u.(i));
+    assert (v0.(i) * v1.(i) == u.(i));
     i += 1;
   }
 }
index 2b517f78fe3de79a16ab62875ef29fbdc7e26a6a..c816f817225dd11fc0fcb9a2e75c0a3848dbd8cf 100644 (file)
@@ -6,30 +6,30 @@ fn main() {
     y += i;
   }
   log y;
-  check (y == 6);
+  assert (y == 6);
 
   auto s = "hello there";
   let int i = 0;
   for (u8 c in s) {
     if (i == 0) {
-      check (c == ('h' as u8));
+      assert (c == ('h' as u8));
     }
     if (i == 1) {
-      check (c == ('e' as u8));
+      assert (c == ('e' as u8));
     }
     if (i == 2) {
-      check (c == ('l' as u8));
+      assert (c == ('l' as u8));
     }
     if (i == 3) {
-      check (c == ('l' as u8));
+      assert (c == ('l' as u8));
     }
     if (i == 4) {
-      check (c == ('o' as u8));
+      assert (c == ('o' as u8));
     }
     // ...
     i += 1;
     log i;
     log c;
   }
-  check(i == 11);
+  assert (i == 11);
 }
index f83ab4fb6a328f1037a7a067e9b198d06103fa73..5b67fdc64e07207c7c0b73a1be7cf3bcf0754228 100644 (file)
@@ -19,5 +19,5 @@ fn main() {
   let int y <- p;
   log "transmission complete";
   log y;
-  check (y == 500);
+  assert (y == 500);
 }
index 887fb39125eef28d8b5ca28f70d544008f87bf78..71d4dfe927d0fcb89a7eb579f44ab6ebc7cfa8ea 100644 (file)
@@ -13,5 +13,5 @@ fn main() {
   grow(v);
   auto len = std._vec.len[int](v);
   log len;
-  check (len == (3 as uint));
+  assert (len == (3 as uint));
 }
index 19c2c074f9d7cb5fc0b5749430606c03b267e653..e9b7a972dfe264c210475e1c528293d9e8d43ac0 100644 (file)
@@ -3,5 +3,5 @@
 }
 
 fn main() {
-  check (true);
+  assert (true);
 }
index 6e0dac37b8fe62f3708323192c7430a6a5dae552..28868548bbc272ca8342445bece8a924d8602d5d 100644 (file)
 fn main() {
 
   let big b = big();
-  check (b.one() == 1);
-  check (b.two() == 2);
-  check (b.three() == 3);
+  assert (b.one() == 1);
+  assert (b.two() == 2);
+  assert (b.three() == 3);
 
   let small s = b as small;
-  check (s.one() == 1);
+  assert (s.one() == 1);
 }
\ No newline at end of file
index 167b15fbaeec403c65107c87219d6668e4504e22..f512e6ee86837fecf5e4a79aefefaf4bf8ba57f0 100644 (file)
@@ -14,5 +14,5 @@ fn main() {
   {
     auto x = foo(mbox);
   }
-  check ((*mbox) == 11);
+  assert ((*mbox) == 11);
 }
\ No newline at end of file
index 3d633e725eb92b4bab6dccc3e4b9279433af5ebf..62e0de87ef42ea4b2636853606f181a1edf329e3 100644 (file)
@@ -29,6 +29,6 @@ fn main() {
   log "parent waiting for shutdown";
   i <- p;
   log "received int";
-  check (i == 10);
+  assert (i == 10);
   log "int is OK, child-dtor ran as expected";
 }
\ No newline at end of file
index f777b56c15a1551eda841711cbc98394d1fe6685..208d0ded41ac054b29759022b8a45b0ecf4c3351 100644 (file)
@@ -19,11 +19,11 @@ fn m3(mutable int i) -> int {
   let int i = 0;
 
   i = a.m1(i);
-  check (i == 1);
+  assert (i == 1);
   i = a.m2(i);
-  check (i == 2);
+  assert (i == 2);
   i = a.m3(i);
-  check (i == 4);
+  assert (i == 4);
 }
 
 
index 85143c7924dd60077e123dc9c72f3a29361f6f2f..b298f75f969f215a08bce398d014e70548c35325 100644 (file)
@@ -7,5 +7,5 @@ fn get(int i) -> u8 {
   }
   auto b = buf(vec(1 as u8, 2 as u8, 3 as u8));
   log b.get(1);
-  check (b.get(1) == (2 as u8));
+  assert (b.get(1) == (2 as u8));
 }
index d99ebb0449a3187c2e81594df52b1e77f0810a00..0c905ab95e0aa5337709532dfc719cf5c5102b5a 100644 (file)
@@ -5,18 +5,18 @@ fn main() {
 
   x *= 2;
   log x;
-  check (x == 2);
+  assert (x == 2);
 
   x += 3;
   log x;
-  check (x == 5);
+  assert (x == 5);
 
   x *= x;
   log x;
-  check (x == 25);
+  assert (x == 25);
 
   x /= 5;
   log x;
-  check (x == 5);
+  assert (x == 5);
 }
 
index 2c028eba627c6ea93ee731fd4b874e041bf8e764..403d7c2ed2caf0185aae921a8bbc63f03d05c16f 100644 (file)
@@ -1,4 +1,4 @@
 // Testcase for issue #130, operator associativity.
 fn main() -> () {
-  check ((3 * 5 / 2) == 7);
+  assert ((3 * 5 / 2) == 7);
 }
index 15fa142a77a5a76acc3331965dd42b15a5c17cf3..57dcb3b2d077e93c57a0535279dd8a497b79f63f 100644 (file)
@@ -3,7 +3,7 @@
 type point = rec(int x, int y, int z);
 
 fn f(&point p) {
-  check (p.z == 12);
+  assert (p.z == 12);
 }
 
 fn main() {
index db81278b35c7b63c7a47d7d3ab6ad2ed3209404b..ada02597572ec909de3ff24834f931cefd564db1 100644 (file)
@@ -8,12 +8,12 @@ fn main() {
   let point right = rec(x=origin.x + 10 with origin);
   let point up = rec(y=origin.y + 10 with origin);
 
-  check(origin.x == 0);
-  check(origin.y == 0);
+  assert (origin.x == 0);
+  assert (origin.y == 0);
 
-  check(right.x == 10);
-  check(right.y == 0);
+  assert (right.x == 10);
+  assert (right.y == 0);
 
-  check(up.x == 0);
-  check(up.y == 10);
+  assert (up.x == 0);
+  assert (up.y == 10);
 }
index e25439a974daa1aa5e6da4b1b75fb49d33f38c89..30db041706281ebe4e7268e8c4dc21197926479a 100644 (file)
@@ -4,22 +4,22 @@
 type rect = tup(point, point);
 
 fn f(rect r, int x1, int y1, int x2, int y2) {
-  check (r._0.x == x1);
-  check (r._0.y == y1);
-  check (r._1.x == x2);
-  check (r._1.y == y2);
+  assert (r._0.x == x1);
+  assert (r._0.y == y1);
+  assert (r._1.x == x2);
+  assert (r._1.y == y2);
 }
 
 fn main() {
   let rect r = tup( rec(x=10, y=20),
                     rec(x=11, y=22) );
-  check (r._0.x == 10);
-  check (r._0.y == 20);
-  check (r._1.x == 11);
-  check (r._1.y == 22);
+  assert (r._0.x == 10);
+  assert (r._0.y == 20);
+  assert (r._1.x == 11);
+  assert (r._1.y == 22);
   let rect r2 = r;
   let int x = r2._0.x;
-  check (x == 10);
+  assert (x == 10);
   f(r, 10, 20, 11, 22);
   f(r2, 10, 20, 11, 22);
 }
index 0f6b7d79196ab3641a468dc6f73709a71a588910..7d295f6fb610c1e53fa6e35b51be139832272778 100644 (file)
@@ -3,21 +3,21 @@
 type rect = rec(int x, int y, int w, int h);
 
 fn f(rect r, int x, int y, int w, int h) {
-  check (r.x == x);
-  check (r.y == y);
-  check (r.w == w);
-  check (r.h == h);
+  assert (r.x == x);
+  assert (r.y == y);
+  assert (r.w == w);
+  assert (r.h == h);
 }
 
 fn main() {
   let rect r = rec(x=10, y=20, w=100, h=200);
-  check (r.x == 10);
-  check (r.y == 20);
-  check (r.w == 100);
-  check (r.h == 200);
+  assert (r.x == 10);
+  assert (r.y == 20);
+  assert (r.w == 100);
+  assert (r.h == 200);
   let rect r2 = r;
   let int x = r2.x;
-  check (x == 10);
+  assert (x == 10);
   f(r, 10, 20, 100, 200);
   f(r2, 10, 20, 100, 200);
 }
index e5c3da1b88f21972df30ca96893c4389ba71bba7..cd808ad733deb46908752ef22cea0d5b4cfe1994 100644 (file)
@@ -74,9 +74,9 @@ fn test_rotate() {
         mychan <| val;
 
         auto x <- myport;
-        check (x.val1 == i as u32);
-        check (x.val2 == i as u32);
-        check (x.val3 == i as u32);
+        assert (x.val1 == i as u32);
+        assert (x.val2 == i as u32);
+        assert (x.val3 == i as u32);
     }
 }
 
@@ -96,9 +96,9 @@ fn test_rotate_grow() {
 
         for each (uint i in _uint.range(0u, 10u)) {
             auto x <- myport;
-            check (x.val1 == i as u32);
-            check (x.val2 == i as u32);
-            check (x.val3 == i as u32);
+            assert (x.val1 == i as u32);
+            assert (x.val2 == i as u32);
+            assert (x.val3 == i as u32);
         }
     }
 }
index e8bc4788c9a59e64a9f77fc95fb877043cb005fe..942e9e90d94dd37bad4d856a506c9ca991fdc854 100644 (file)
@@ -1,16 +1,16 @@
 // xfail-boot
 fn main() {
-  check ("hello" < "hellr");
-  check ("hello " > "hello");
-  check ("hello" != "there");
+  assert ("hello" < "hellr");
+  assert ("hello " > "hello");
+  assert ("hello" != "there");
 
-  check (vec(1,2,3,4) > vec(1,2,3));
-  check (vec(1,2,3) < vec(1,2,3,4));
-  check (vec(1,2,4,4) > vec(1,2,3,4));
-  check (vec(1,2,3,4) < vec(1,2,4,4));
-  check (vec(1,2,3) <= vec(1,2,3));
-  check (vec(1,2,3) <= vec(1,2,3,3));
-  check (vec(1,2,3,4) > vec(1,2,3));
-  check (vec(1,2,3) == vec(1,2,3));
-  check (vec(1,2,3) != vec(1,1,3));
+  assert (vec(1,2,3,4) > vec(1,2,3));
+  assert (vec(1,2,3) < vec(1,2,3,4));
+  assert (vec(1,2,4,4) > vec(1,2,3,4));
+  assert (vec(1,2,3,4) < vec(1,2,4,4));
+  assert (vec(1,2,3) <= vec(1,2,3));
+  assert (vec(1,2,3) <= vec(1,2,3,3));
+  assert (vec(1,2,3,4) > vec(1,2,3));
+  assert (vec(1,2,3) == vec(1,2,3));
+  assert (vec(1,2,3) != vec(1,1,3));
 }
index c1d96cc3debee5e453521dee215d62da88e6f02b..b0f0cf3b9693c70cdf71e02a0276a968c699ae51 100644 (file)
@@ -14,10 +14,10 @@ fn get() -> int {
 
 fn main() {
   auto y = counter(0);
-  check (y.hello() == 12345);
+  assert (y.hello() == 12345);
   log y.get();
   y.incr();
   y.incr();
   log y.get();
-  check (y.get() == 2);
+  assert (y.get() == 2);
 }
index da4ca07fc26a28c02d3936d0ea1143a6e6e9dd83..abfbe938e223f0dd6b97c9efbcf650c6f8714480 100644 (file)
@@ -7,7 +7,7 @@ fn test1() {
   let str s = "hello";
   s += "world";
   log s;
-  check(s.(9) == ('d' as u8));
+  assert (s.(9) == ('d' as u8));
 }
 
 fn test2() {
@@ -20,8 +20,8 @@ fn test2() {
   log a;
   log b;
 
-  check (_str.eq(a, "abcABCabc"));
-  check (_str.eq(b, "ABCabcABC"));
+  assert (_str.eq(a, "abcABCabc"));
+  assert (_str.eq(b, "ABCabcABC"));
 }
 
 fn main() {
index c906a23ef6b008b03b0a47bcef045e1d8790301c..a21fefbe23fd9dd0e16c3a4ff3dd29bc41f074c0 100644 (file)
@@ -5,5 +5,5 @@ fn main() {
   let str b = "world";
   let str s = a + b;
   log s;
-  check(s.(9) == ('d' as u8));
+  assert (s.(9) == ('d' as u8));
 }
index 06bc8b74621c56305b8e9b8410e706981ec34fc2..55548da519c9f883c8fee4dd35ebc07529edaa4d 100644 (file)
@@ -1,14 +1,14 @@
 fn main() {
     auto s = "a";
     s += "b";
-    check (s.(0) == ('a' as u8));
-    check (s.(1) == ('b' as u8));
+    assert (s.(0) == ('a' as u8));
+    assert (s.(1) == ('b' as u8));
 
     s += "c";
     s += "d";
-    check (s.(0) == ('a' as u8));
-    check (s.(1) == ('b' as u8));
-    check (s.(2) == ('c' as u8));
-    check (s.(3) == ('d' as u8));
+    assert (s.(0) == ('a' as u8));
+    assert (s.(1) == ('b' as u8));
+    assert (s.(2) == ('c' as u8));
+    assert (s.(3) == ('d' as u8));
 }
 
index 9793799a97c7a8477f5a1413acdc14846ff2254f..e2f5abb292754ccade08447a4cb508e50f081828 100644 (file)
@@ -3,5 +3,5 @@ fn main() {
   auto s = "hello";
   let u8 c = s.(4);
   log c;
-  check (c == (0x6f as u8));
+  assert (c == (0x6f as u8));
 }
index 3049faec6b6b817c151db132f8259a83bdbdb3e9..15ddba8465f1bd16c491b868f89a2028370028ec 100644 (file)
@@ -4,6 +4,6 @@
 }
 
 fn main() {
-    check (bar <= bar);
+    assert (bar <= bar);
 }
 
index fed4b1837303a8345898820847cfa0d833d5248f..e677c3cb0bf878ece83f12773e1e2b66c7875411 100644 (file)
@@ -6,15 +6,15 @@
 fn main() {
   auto a = tup(1,2,3);
   auto b = tup(1,2,3);
-  check (a == b);
-  check (a != tup(1,2,4));
-  check (a < tup(1,2,4));
-  check (a <= tup(1,2,4));
-  check (tup(1,2,4) > a);
-  check (tup(1,2,4) >= a);
+  assert (a == b);
+  assert (a != tup(1,2,4));
+  assert (a < tup(1,2,4));
+  assert (a <= tup(1,2,4));
+  assert (tup(1,2,4) > a);
+  assert (tup(1,2,4) >= a);
   auto x = large;
   auto y = small;
-  check (x != y);
-  check (x == large);
-  check (x != small);
+  assert (x != y);
+  assert (x == large);
+  assert (x != small);
 }
\ No newline at end of file
index 82b3e658a63786f997a3d2e9aebd17ac257159d4..5248e782bec5b1c47528af8bbf402197ea27c085 100644 (file)
@@ -6,7 +6,7 @@
 fn test(str actual, str expected) {
   log actual;
   log expected;
-  check (_str.eq(actual, expected));
+  assert (_str.eq(actual, expected));
 }
 
 fn main() {
index e3f89a7f262f47076b86646d66f5cbfe35ef260f..695832b129dad9b9be838dba36943e7ff08f1014 100644 (file)
@@ -9,7 +9,7 @@ fn f() {
   auto x = red(1,2);
   auto y = green;
   // FIXME: needs structural equality test working.
-  // check (x != y);
+  // assert (x != y);
 }
 
 fn main() {
index 795a105ad92721b449fc6ba1f41d3c4c33f3fd41..fec48a748c6fd39352a1f5723547eb03f1225f03 100644 (file)
@@ -1,7 +1,7 @@
 // -*- rust -*-
 
 fn checktrue(bool res) -> bool {
-  check(res);
+  assert (res);
   ret true;
 }
 
index 345a322eb171a8ed11ef7115394b3f4d78d42646..ac29bcad167929d4f0d69e44b191713ea7abff25 100644 (file)
@@ -1,8 +1,8 @@
 // -*- rust -*-
 
 fn main() {
-  check(even(42));
-  check(odd(45));
+  assert (even(42));
+  assert (odd(45));
 }
 
 fn even(int n) -> bool {
index e1473548122c9132e800823afbdb9609dc627bb3..54e37a34441071879053a8370a1b80424ab1496e 100644 (file)
@@ -16,5 +16,5 @@ fn test05() {
     let int value <- po;
     value <- po;
     value <- po;
-    check(value == 30);
+    assert (value == 30);
 }
index 16c4b93b8db58790cff85b419f8f2e0633f88efd..9438f50ef4d44167a26e961c337f3fcb5f362d3b 100644 (file)
@@ -14,9 +14,9 @@ fn test_rec() {
   let r r1;
   r1 <- po;
 
-  check (r1.val0 == 0);
-  check (r1.val1 == 1u8);
-  check (r1.val2 == '2');
+  assert (r1.val0 == 0);
+  assert (r1.val1 == 1u8);
+  assert (r1.val2 == '2');
 }
 
 fn test_vec() {
@@ -29,9 +29,9 @@ fn test_vec() {
   let vec[int] v1;
   v1 <- po;
 
-  check (v1.(0) == 0);
-  check (v1.(1) == 1);
-  check (v1.(2) == 2);
+  assert (v1.(0) == 0);
+  assert (v1.(1) == 1);
+  assert (v1.(2) == 2);
 }
 
 fn test_str() {
@@ -44,10 +44,10 @@ fn test_str() {
   let str s1;
   s1 <- po;
 
-  check (s1.(0) as u8 == 't' as u8);
-  check (s1.(1) as u8 == 'e' as u8);
-  check (s1.(2) as u8 == 's' as u8);
-  check (s1.(3) as u8 == 't' as u8);
+  assert (s1.(0) as u8 == 't' as u8);
+  assert (s1.(1) as u8 == 'e' as u8);
+  assert (s1.(2) as u8 == 's' as u8);
+  assert (s1.(3) as u8 == 't' as u8);
 }
 
 fn test_tup() {
@@ -62,9 +62,9 @@ fn test_tup() {
   let t t1;
   t1 <- po;
 
-  check (t0._0 == 0);
-  check (t0._1 == 1u8);
-  check (t0._2 == '2');
+  assert (t0._0 == 0);
+  assert (t0._1 == 1u8);
+  assert (t0._2 == '2');
 }
 
 fn test_tag() {
@@ -84,11 +84,11 @@ fn test_tag() {
   let t t1;
 
   t1 <- po;
-  check (t1 == tag1);
+  assert (t1 == tag1);
   t1 <- po;
-  check (t1 == tag2(10));
+  assert (t1 == tag2(10));
   t1 <- po;
-  check (t1 == tag3(10, 11u8, 'A'));
+  assert (t1 == tag3(10, 11u8, 'A'));
 }
 
 fn test_chan() {
@@ -109,7 +109,7 @@ fn test_chan() {
   let int i;
   i <- po0;
 
-  check (i == 10);
+  assert (i == 10);
 }
 
 fn main() {
index 712557212c1ff0d64dd05aee64c7bfc1ab011fd2..59c46c4c9dbbb170116748c6b933152c596ab623 100644 (file)
@@ -58,7 +58,7 @@ fn test00(bool is_multithreaded) {
     }
     
     log "Completed: Final number is: ";
-    // check (sum == (((number_of_tasks * (number_of_tasks - 1)) / 2) * 
+    // assert (sum == (((number_of_tasks * (number_of_tasks - 1)) / 2) * 
     //       number_of_messages));
-    check (sum == 480);
+    assert (sum == 480);
 }
index 121a9e6e1345cf2c7591feef9f597c3527d72ca7..3c4f3ab6ae04196ef4833c2733df443a694642fa 100644 (file)
@@ -28,5 +28,5 @@ fn test00() {
     r <- p; sum += r; log (r);
     r <- p; sum += r; log (r);
     
-    check (sum == 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8);
+    assert (sum == 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8);
 }
\ No newline at end of file
index d0f3994effb2db3ecd5db2fa72b43e07a913a994..324ce0eddc73d2efef3df2495e1c0f42ad37ba67 100644 (file)
@@ -21,5 +21,5 @@ fn test00() {
         i += 1;
     }
     
-    check (sum == ((number_of_messages * (number_of_messages - 1)) / 2));
+    assert (sum == ((number_of_messages * (number_of_messages - 1)) / 2));
 }
\ No newline at end of file
index 74b40a9098af86df6b28b6da5a9412fe4a4df6f5..0f98ba5b00c783ee0292bf585be16a4c89b3450a 100644 (file)
@@ -32,7 +32,7 @@ fn test00() {
         i += 1;
     }
 
-    check (sum == 1998000);
-    // check (sum == 4 * ((number_of_messages * 
+    assert (sum == 1998000);
+    // assert (sum == 4 * ((number_of_messages * 
     //                   (number_of_messages - 1)) / 2));
 }
\ No newline at end of file
index b5b95db9605f2b2f380b93411bdbd9be5075c88c..f9fbab88be30f7bdb905b16b1cbdfc03c6bb87c6 100644 (file)
@@ -40,6 +40,6 @@ fn test00() {
     join t2;
     join t3;
     
-    check (sum == (((number_of_messages * 4) * 
+    assert (sum == (((number_of_messages * 4) * 
                    ((number_of_messages * 4) - 1)) / 2));
 }
\ No newline at end of file
index a3876bdae5ab52781d84851120b0ed7bee548386..d115ac4004f59c832e9a141bfd152e56796aa939 100644 (file)
@@ -41,6 +41,6 @@ fn test00() {
     join t2;
     join t3;
     
-    check (sum == (((number_of_messages * 4) * 
+    assert (sum == (((number_of_messages * 4) * 
                    ((number_of_messages * 4) - 1)) / 2));
 }
\ No newline at end of file
index a9ac1688cd25b4a6b15c43181d7850e1524150bb..c1c8a3bd6f97852022a42440761fe7a5b1e7c291 100644 (file)
@@ -29,5 +29,5 @@ fn test00() {
             
     join t0;
     
-    check (sum == (number_of_messages * (number_of_messages - 1)) / 2);
+    assert (sum == (number_of_messages * (number_of_messages - 1)) / 2);
 }
\ No newline at end of file
index aae788a5128c49450db5518162f9b746d7a56558..de7de81af47ba46f2ceee488080efa05248dfddf 100644 (file)
@@ -14,5 +14,5 @@ fn main() {
   let () n;
   n <- po;
 
-  check (n == ());
+  assert (n == ());
 }
index 0a91b98abdf8ed1a4230cfb3f86b6ae2ea79426c..d256ced90b180a0e9da3a28751f0b7288285f8ce 100644 (file)
@@ -58,7 +58,7 @@ fn test00(bool is_multithreaded) {
     }
     
     log "Completed: Final number is: ";
-    check (sum == number_of_messages * 
+    assert (sum == number_of_messages * 
            (number_of_tasks * number_of_tasks + number_of_tasks) / 2);
 }
 
index 234066460eff3366cdf54bc7edd6a4c700435b54..b7670776bd1621772cf36195c4b65bf7341a4302 100644 (file)
@@ -3,17 +3,17 @@
 type point = tup(int, int);
 
 fn f(point p, int x, int y) {
-  check (p._0 == x);
-  check (p._1 == y);
+  assert (p._0 == x);
+  assert (p._1 == y);
 }
 
 fn main() {
   let point p = tup(10, 20);
-  check (p._0 == 10);
-  check (p._1 == 20);
+  assert (p._0 == 10);
+  assert (p._1 == 20);
   let point p2 = p;
   let int x = p2._0;
-  check (x == 10);
+  assert (x == 10);
   f(p, 10, 20);
   f(p2, 10, 20);
 }
index 67b8b57871ff69d64e61b4215ebbc3a8f0823d5d..1903cb76049b80e1bc4968db7b64e35eadc5116b 100644 (file)
@@ -5,17 +5,17 @@
 use std;
 
 fn main() {
-  check (size_of[u8]() == (1 as uint));
-  check (size_of[u32]() == (4 as uint));
-  check (size_of[char]() == (4 as uint));
-  check (size_of[i8]() == (1 as uint));
-  check (size_of[i32]() == (4 as uint));
-  check (size_of[tup(u8,i8)]() == (2 as uint));
-  check (size_of[tup(u8,i8,u8)]() == (3 as uint));
+  assert (size_of[u8]() == (1 as uint));
+  assert (size_of[u32]() == (4 as uint));
+  assert (size_of[char]() == (4 as uint));
+  assert (size_of[i8]() == (1 as uint));
+  assert (size_of[i32]() == (4 as uint));
+  assert (size_of[tup(u8,i8)]() == (2 as uint));
+  assert (size_of[tup(u8,i8,u8)]() == (3 as uint));
   // Alignment causes padding before the char and the u32.
-  check (size_of[tup(u8,i8,tup(char,u8),u32)]() == (16 as uint));
-  check (size_of[int]() == size_of[uint]());
-  check (size_of[tup(int,())]() == size_of[int]());
-  check (size_of[tup(int,(),())]() == size_of[int]());
-  check (size_of[int]() == size_of[rec(int x)]());
+  assert (size_of[tup(u8,i8,tup(char,u8),u32)]() == (16 as uint));
+  assert (size_of[int]() == size_of[uint]());
+  assert (size_of[tup(int,())]() == size_of[int]());
+  assert (size_of[tup(int,(),())]() == size_of[int]());
+  assert (size_of[int]() == size_of[rec(int x)]());
 }
index 1ff511aa6bb0c191350eba9b095bb8bd90d8897c..7e7b5026f27a8f7ee739b0e311517bcc9f2fca96 100644 (file)
@@ -3,6 +3,6 @@
 fn main() {
     let u32 word = (200000u32);
     word = word - (1u32);
-    check(word == (199999u32));
+    assert (word == (199999u32));
 }
 
index f89325fc45f3a3f16fd841b162bff09fc90a9065..992c61d5865b514c950636b008dbbd4d09a56bcd 100644 (file)
@@ -8,5 +8,5 @@ fn main() {
   let u8 y = 35u8;  // 0x23
   x = x + (7u8);    // 0x7
   y = y - (9u8);    // 0x9
-  check(x == y);
+  assert (x == y);
 }
index 602d83c66c5c83aca16b6daa90bd54eb3d61a335..7cc9488948e44b731b485a855a09780a0be745a7 100644 (file)
@@ -5,7 +5,7 @@ fn main() {
   let u8 y = 12u8;
   x = x + (1u8);
   x = x - (1u8);
-  check(x == y);
+  assert (x == y);
   // x = 14u8;
   // x = x + 1u8;
 }
index 68f5fa9f680032ad367f2f696add750c9df21fd2..bf758a4931594babe3b81ac69ee27d765f65383b 100644 (file)
@@ -6,14 +6,14 @@ fn main() {
   let char y_diaeresis = 'ÿ'; // 0xff
   let char pi = 'Π';          // 0x3a0
 
-  check ((yen as int) == 0xa5);
-  check ((c_cedilla as int) == 0xe7);
-  check ((thorn as int) == 0xfe);
-  check ((y_diaeresis as int) == 0xff);
-  check ((pi as int) == 0x3a0);
+  assert ((yen as int) == 0xa5);
+  assert ((c_cedilla as int) == 0xe7);
+  assert ((thorn as int) == 0xfe);
+  assert ((y_diaeresis as int) == 0xff);
+  assert ((pi as int) == 0x3a0);
 
-  check ((pi as int) == ('\u03a0' as int));
-  check (('\x0a' as int) == ('\n' as int));
+  assert ((pi as int) == ('\u03a0' as int));
+  assert (('\x0a' as int) == ('\n' as int));
 
   let str bhutan = "འབྲུག་ཡུལ།";
   let str japan = "日本";
@@ -28,7 +28,7 @@ fn main() {
   let str austria_e = "\u00d6sterreich";
 
   let char oo = 'Ö';
-  check ((oo as int) == 0xd6);
+  assert ((oo as int) == 0xd6);
 
   fn check_str_eq(str a, str b) {
     let int i = 0;
@@ -37,7 +37,7 @@ fn check_str_eq(str a, str b) {
       log ab;
       let u8 bb = b.(i);
       log bb;
-      check(ab == bb);
+      assert (ab == bb);
       i += 1;
     }
   }
index 08671093edfb75b1b905b37d40915e76c8d16b26..07eaca1927a69bde0613286d0d02d436f4e3ad4b 100644 (file)
@@ -9,25 +9,25 @@ fn main() {
   let vec[char] chs = vec('e', 'é', '€', 0x10000 as char);
   let str s = _str.from_chars(chs);
 
-  check(_str.byte_len(s) == 10u);
-  check(_str.char_len(s) == 4u);
-  check(_vec.len[char](_str.to_chars(s)) == 4u);
-  check(_str.eq(_str.from_chars(_str.to_chars(s)), s));
-  check(_str.char_at(s, 0u) == 'e');
-  check(_str.char_at(s, 1u) == 'é');
+  assert (_str.byte_len(s) == 10u);
+  assert (_str.char_len(s) == 4u);
+  assert (_vec.len[char](_str.to_chars(s)) == 4u);
+  assert (_str.eq(_str.from_chars(_str.to_chars(s)), s));
+  assert (_str.char_at(s, 0u) == 'e');
+  assert (_str.char_at(s, 1u) == 'é');
 
-  check(_str.is_utf8(_str.bytes(s)));
-  check(!_str.is_utf8(vec(0x80_u8)));
-  check(!_str.is_utf8(vec(0xc0_u8)));
-  check(!_str.is_utf8(vec(0xc0_u8, 0x10_u8)));
+  assert (_str.is_utf8(_str.bytes(s)));
+  assert (!_str.is_utf8(vec(0x80_u8)));
+  assert (!_str.is_utf8(vec(0xc0_u8)));
+  assert (!_str.is_utf8(vec(0xc0_u8, 0x10_u8)));
 
   auto stack = "a×c€";
-  check(_str.pop_char(stack) == '€');
-  check(_str.pop_char(stack) == 'c');
+  assert (_str.pop_char(stack) == '€');
+  assert (_str.pop_char(stack) == 'c');
   _str.push_char(stack, 'u');
-  check(_str.eq(stack, "a×u"));
-  check(_str.shift_char(stack) == 'a');
-  check(_str.shift_char(stack) == '×');
+  assert (_str.eq(stack, "a×u"));
+  assert (_str.shift_char(stack) == 'a');
+  assert (_str.shift_char(stack) == '×');
   _str.unshift_char(stack, 'ß');
-  check(_str.eq(stack, "ßu"));
+  assert (_str.eq(stack, "ßu"));
 }
index 0f9f56dd9541b834793b699628ed110147c4cd2f..69db478841d41eb6720a9a2b40bf1b04bfef0c3c 100644 (file)
@@ -15,9 +15,9 @@ fn fast_growth() {
   v += vec(6,7,8,9,0);
 
   log v.(9);
-  check(v.(0) == 1);
-  check(v.(7) == 8);
-  check(v.(9) == 0);
+  assert (v.(0) == 1);
+  assert (v.(7) == 8);
+  assert (v.(9) == 0);
 }
 
 fn slow_growth() {
@@ -26,7 +26,7 @@ fn slow_growth() {
   v += vec(17);
 
   log v.(0);
-  check (v.(0) == 17);
+  assert (v.(0) == 17);
 }
 
 fn slow_growth2_helper(str s) {   // ref up: s
@@ -52,7 +52,7 @@ fn slow_growth2_helper(str s) {   // ref up: s
     let acc a = acc(v);           // ref up: a, v
 
     log _vec.refcount[str](v);
-    check (_vec.refcount[str](v) == 2u);
+    assert (_vec.refcount[str](v) == 2u);
 
     a.add(s);                     // ref up: mumble, s.  ref down: v
 
@@ -60,21 +60,21 @@ fn slow_growth2_helper(str s) {   // ref up: s
     log _str.refcount(s);
     log _str.refcount(mumble);
 
-    check (_vec.refcount[str](v) == 1u);
-    check (_str.refcount(s) == const_refcount);
-    check (_str.refcount(mumble) == const_refcount);
+    assert (_vec.refcount[str](v) == 1u);
+    assert (_str.refcount(s) == const_refcount);
+    assert (_str.refcount(mumble) == const_refcount);
 
     log v.(0);
     log _vec.len[str](v);
-    check (_str.eq(v.(0), mumble));
-    check (_vec.len[str](v) == 1u);
+    assert (_str.eq(v.(0), mumble));
+    assert (_vec.len[str](v) == 1u);
   }                               // ref down: a, mumble, s, v
 
   log _str.refcount(s);
   log _str.refcount(mumble);
 
-  check (_str.refcount(s) == const_refcount);
-  check (_str.refcount(mumble) == const_refcount);
+  assert (_str.refcount(s) == const_refcount);
+  assert (_str.refcount(mumble) == const_refcount);
 
   log mumble;
   log ss;
@@ -84,7 +84,7 @@ fn slow_growth2() {
   let str s = "hi";               // ref up: s
   slow_growth2_helper(s);
   log _str.refcount(s);
-  check (_str.refcount(s) == const_refcount);
+  assert (_str.refcount(s) == const_refcount);
 }
 
 fn main() {
index b6c52c3e08d7404656bd4ded8042eb8af0009040..09a95402e65f4d35101f21aaf81b34c3d0a7c2ec 100644 (file)
@@ -5,7 +5,7 @@ fn main() {
   let vec[int] b = vec(6,7,8,9,0);
   let vec[int] v = a + b;
   log v.(9);
-  check(v.(0) == 1);
-  check(v.(7) == 8);
-  check(v.(9) == 0);
+  assert (v.(0) == 1);
+  assert (v.(7) == 8);
+  assert (v.(9) == 0);
 }
index fe2070306d5205efb80f2c035090108988ec3967..b6976abd3a92e2178f0491f245a74ca0ad79fb11 100644 (file)
@@ -4,10 +4,10 @@ fn main() {
     v += vec(3);
     v += vec(4);
     v += vec(5);
-    check (v.(0) == 1);
-    check (v.(1) == 2);
-    check (v.(2) == 3);
-    check (v.(3) == 4);
-    check (v.(4) == 5);
+    assert (v.(0) == 1);
+    assert (v.(1) == 2);
+    assert (v.(2) == 3);
+    assert (v.(3) == 4);
+    assert (v.(4) == 5);
 }
 
index 788489362fdc7e8d9fea93c5d89856009960edd8..45f28f9bff29e3bc687ae6727aae285b39e497ba 100644 (file)
@@ -6,7 +6,7 @@ fn main() {
     log_err _vec.refcount[int](v);
     log_err _vec.refcount[int](v);
     log_err _vec.refcount[int](v);
-    check (_vec.refcount[int](v) == 1u || _vec.refcount[int](v) == 2u);
-    check (_vec.refcount[int](v) == 1u || _vec.refcount[int](v) == 2u);
+    assert (_vec.refcount[int](v) == 1u || _vec.refcount[int](v) == 2u);
+    assert (_vec.refcount[int](v) == 1u || _vec.refcount[int](v) == 2u);
 }
 
index 5517414230899055bab3cbc6accc81013175854a..c3042d0c03f843141b9e82900b2f397822848e0f 100644 (file)
@@ -4,6 +4,6 @@
 fn main() {
   let vec[int] v = vec(1,2,3,4,5);
   auto v2 = v.(1,2);
-  check (v2.(0) == 2);
-  check (v2.(1) == 3);
+  assert (v2.(0) == 2);
+  assert (v2.(1) == 3);
 }
\ No newline at end of file
index 67a41eabcf6e29a288726234f7d3961afd00fa04..138d0ff2880a0b2bd659748430155333fa1deba1 100644 (file)
@@ -2,12 +2,12 @@
 
 fn main() {
   let vec[int] v = vec(10, 20);
-  check (v.(0) == 10);
-  check (v.(1) == 20);
+  assert (v.(0) == 10);
+  assert (v.(1) == 20);
   let int x = 0;
-  check (v.(x) == 10);
-  check (v.(x + 1) == 20);
+  assert (v.(x) == 10);
+  assert (v.(x + 1) == 20);
   x = x + 1;
-  check (v.(x) == 20);
-  check (v.(x-1) == 10);
+  assert (v.(x) == 20);
+  assert (v.(x-1) == 10);
 }
index 0e27f252ebb310e69e4cf3a7834d44fccef790f7..2adaf24bbc389bbb7f0312d874c79da8e4a758f1 100644 (file)
@@ -11,5 +11,5 @@ fn main() {
       break; 
     }
   }
-  check(i == 95);
+  assert (i == 95);
 }
index 8bf8140f315805566e42599cbe3c3a4f3960d9df..c0ac1803ac73ff3761a45f904e0e7e3979ba41e1 100644 (file)
@@ -9,5 +9,5 @@ fn f(& mutable point p) {
 fn main() {
   let point x = rec(x=10, y=11, mutable z=12);
   f(x);
-  check (x.z == 13);
+  assert (x.z == 13);
 }