From e3a68e235cd077c35654f79013ad54da46d72fee Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Wed, 4 May 2011 11:28:13 -0700 Subject: Bring back "pred" syntax for writing predicates for check This commit reinstates the requirement that the predicate in a "check" must be a manifest call to a special kind of function declared with the new "pred" keyword instead of "fn". Preds must have a boolean return type and can only call other preds; they can't have any effects (as enforced by the typechecker). The arguments to a predicate in a check expression must be slot variables or literals. --- src/comp/pretty/pprust.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/comp/pretty') diff --git a/src/comp/pretty/pprust.rs b/src/comp/pretty/pprust.rs index 62e6594b..c87a8679 100644 --- a/src/comp/pretty/pprust.rs +++ b/src/comp/pretty/pprust.rs @@ -790,7 +790,14 @@ fn print_pat(ps s, &@ast.pat pat) { fn print_fn(ps s, ast.fn_decl decl, str name, vec[ast.ty_param] typarams) { - wrd1(s, "fn"); + alt (decl.purity) { + case (ast.impure_fn) { + wrd1(s, "fn"); + } + case (_) { + wrd1(s, "pred"); + } + } wrd(s.s, name); print_type_params(s, typarams); popen(s); -- cgit v1.2.3