From bacb8e6b7995e242145871c8228cae4dbda7b891 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Mon, 19 Jul 2010 11:50:30 -0700 Subject: [PATCH] Missing semicolon in type.ml, plus test to catch regression. Closes #113. --- src/boot/me/type.ml | 2 +- src/test/compile-fail/wrong-ret-type.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/test/compile-fail/wrong-ret-type.rs diff --git a/src/boot/me/type.ml b/src/boot/me/type.ml index 14047f446e3..a631e58dd64 100644 --- a/src/boot/me/type.ml +++ b/src/boot/me/type.ml @@ -771,7 +771,7 @@ let check_stmt (cx:Semant.ctxt) : (fn_ctx -> Ast.stmt -> unit) = | Ast.STMT_ret (Some atom) -> if fn_ctx.fnctx_is_iter then Common.err None - "iterators can't return values; did you mean 'put'?" + "iterators can't return values; did you mean 'put'?"; demand fn_ctx.fnctx_return_type (check_atom atom) | Ast.STMT_ret None -> diff --git a/src/test/compile-fail/wrong-ret-type.rs b/src/test/compile-fail/wrong-ret-type.rs new file mode 100644 index 00000000000..f00a734cdab --- /dev/null +++ b/src/test/compile-fail/wrong-ret-type.rs @@ -0,0 +1,7 @@ +// error-pattern: mismatched types +fn mk_int() -> uint { + let int i = 3; + ret i; +} +fn main() { +}