[m-rev.] diff: remove support for implicit purity scopes
Julien Fischer
juliensf at csse.unimelb.edu.au
Thu Feb 19 00:46:49 AEDT 2009
Implicity purity scopes were never announced as a supported
lanugage feature, so the NEWS file does not need updating.
--------
Estimated hours taken: 1
Branches: main
Remove support for implicit purity scopes from Mercury.
Unrelated change: disable a test case that no longer works
due to the recent change in the behaviour of string.to_int/2
and friends.
compiler/purity.m:
compiler/add_clause.m:
compiler/add_pred.m:
compiler/constraint.m:
compiler/dep_par_conj.m:
compiler/det_analysis.m:
compiler/erl_code_gen.m:
compiler/goal_util.m:
compiler/granularity.m:
compiler/hlds_desc.m:
compiler/hlds_goal.m:
compiler/hlds_out.m:
compiler/interval.m:
compiler/make_hlds_passes.m:
compiler/mercury_to_mercury.m:
compiler/modes.m:
compiler/module_imports.m:
compiler/module_qual.m:
compiler/prog_data.m:
compiler/prog_io_dcg.m:
compiler/prog_io_goal.m:
compiler/prog_item.m:
compiler/prog_util.m:
compiler/quantification.m:
compiler/saved_vasr.m:
compiler/simplify.m:
compiler/ssdebug.m:
compiler/stm_expand.m:
compiler/typecheck.m:
doc/reference_manual.texi:
library/ops.m:
Remove implicit purity scopes from the language and implementation.
tests/hard_coded/Mmakefile:
tests/hard_coded/impure_foreign[23].{m,exp}:
tests/hard_coded/test_promise_impure_implicit.{m,exp}:
Delete tests cases for implicit purity scopes.
tests/hard_coded/minint_bug.m:
Disable this test case. It no longer works after
Ralph's recent change to strint.to_int/2 and friends.
(Furthermore, it never excercised the behaviour it was
meant to be checking for on 64-bit machines.)
Julien.
Index: compiler/add_clause.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_clause.m,v
retrieving revision 1.51
diff -u -r1.51 add_clause.m
--- compiler/add_clause.m 12 Jan 2009 02:01:02 -0000 1.51
+++ compiler/add_clause.m 18 Feb 2009 13:30:54 -0000
@@ -649,9 +649,9 @@
!QualInfo, !SInfo, !Specs),
finish_local_state_vars(StateVars, Vars, BeforeSInfo, !SInfo),
goal_info_init(GoalInfo).
-transform_goal_2(promise_purity_expr(Implicit, Purity, Goal0), _, Renaming,
+transform_goal_2(promise_purity_expr(Purity, Goal0), _, Renaming,
hlds_goal(
- scope(promise_purity(Implicit, Purity), Goal),
+ scope(promise_purity(Purity), Goal),
GoalInfo),
NumAdded, !VarSet, !ModuleInfo, !QualInfo, !SInfo, !Specs) :-
transform_goal(Goal0, Renaming, Goal, NumAdded, !VarSet, !ModuleInfo,
Index: compiler/add_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pred.m,v
retrieving revision 1.35
diff -u -r1.35 add_pred.m
--- compiler/add_pred.m 9 Sep 2008 01:37:29 -0000 1.35
+++ compiler/add_pred.m 18 Feb 2009 13:30:54 -0000
@@ -288,7 +288,7 @@
ConjExpr = conj(plain_conj, [AssignGoal, CastGoal]),
ConjGoal = hlds_goal(ConjExpr, GoalInfoWithZeroHeadVars),
- Reason = promise_purity(dont_make_implicit_promises, purity_semipure),
+ Reason = promise_purity(purity_semipure),
GoalExpr = scope(Reason, ConjGoal),
GoalInfo = GoalInfo1,
Stub = no
@@ -298,7 +298,7 @@
->
ConjExpr = conj(plain_conj, []),
ConjGoal = hlds_goal(ConjExpr, GoalInfo),
- Reason = promise_purity(dont_make_implicit_promises, purity_impure),
+ Reason = promise_purity(purity_impure),
GoalExpr = scope(Reason, ConjGoal),
GoalInfo = GoalInfo1,
ExtraVars = [],
Index: compiler/constraint.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/constraint.m,v
retrieving revision 1.92
diff -u -r1.92 constraint.m
--- compiler/constraint.m 23 Dec 2008 01:37:30 -0000 1.92
+++ compiler/constraint.m 18 Feb 2009 13:30:54 -0000
@@ -171,7 +171,7 @@
FinalGoals = [hlds_goal(scope(Reason, SubGoal), GoalInfo)]
;
( Reason = promise_solutions(_, _)
- ; Reason = promise_purity(_, _)
+ ; Reason = promise_purity(_)
; Reason = commit(_)
; Reason = barrier(_)
; Reason = trace_goal(_, _, _, _, _)
Index: compiler/dep_par_conj.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dep_par_conj.m,v
retrieving revision 1.33
diff -u -r1.33 dep_par_conj.m
--- compiler/dep_par_conj.m 23 Dec 2008 01:37:31 -0000 1.33
+++ compiler/dep_par_conj.m 18 Feb 2009 13:30:54 -0000
@@ -467,7 +467,7 @@
( Purity = purity_pure
; Purity = purity_semipure
),
- Reason = promise_purity(dont_make_implicit_promises, Purity),
+ Reason = promise_purity(Purity),
NewGoal = hlds_goal(scope(Reason, NewGoal0), GoalInfo)
).
Index: compiler/det_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/det_analysis.m,v
retrieving revision 1.216
diff -u -r1.216 det_analysis.m
--- compiler/det_analysis.m 23 Dec 2008 01:37:31 -0000 1.216
+++ compiler/det_analysis.m 18 Feb 2009 13:30:54 -0000
@@ -1666,7 +1666,7 @@
)
;
( Reason = exist_quant(_)
- ; Reason = promise_purity(_, _)
+ ; Reason = promise_purity(_)
; Reason = commit(_)
; Reason = barrier(_)
),
Index: compiler/erl_code_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/erl_code_gen.m,v
retrieving revision 1.32
diff -u -r1.32 erl_code_gen.m
--- compiler/erl_code_gen.m 23 Dec 2008 01:37:32 -0000 1.32
+++ compiler/erl_code_gen.m 18 Feb 2009 13:30:54 -0000
@@ -630,7 +630,7 @@
MaybeSuccessExpr, Statement, !Info)
;
( ScopeReason = exist_quant(_)
- ; ScopeReason = promise_purity(_, _)
+ ; ScopeReason = promise_purity(_)
; ScopeReason = barrier(_)
; ScopeReason = from_ground_term(_, _)
; ScopeReason = trace_goal(_, _, _, _, _)
Index: compiler/goal_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/goal_util.m,v
retrieving revision 1.164
diff -u -r1.164 goal_util.m
--- compiler/goal_util.m 6 Feb 2009 10:11:13 -0000 1.164
+++ compiler/goal_util.m 18 Feb 2009 13:30:55 -0000
@@ -568,7 +568,7 @@
Reason = exist_quant(Vars),
svset.insert_list(Vars, !Set)
;
- Reason = promise_purity(_, _)
+ Reason = promise_purity(_)
;
Reason = promise_solutions(Vars, _),
svset.insert_list(Vars, !Set)
Index: compiler/granularity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/granularity.m,v
retrieving revision 1.11
diff -u -r1.11 granularity.m
--- compiler/granularity.m 23 Dec 2008 01:37:32 -0000 1.11
+++ compiler/granularity.m 18 Feb 2009 13:30:55 -0000
@@ -145,8 +145,7 @@
Else = hlds_goal(conj(plain_conj, Goals), GoalInfo),
IfThenElse = hlds_goal(if_then_else([], Cond, Then, Else),
GoalInfo),
- Reason = promise_purity(dont_make_implicit_promises,
- purity_pure),
+ Reason = promise_purity(purity_pure),
GoalExpr = scope(Reason, IfThenElse),
!:Changed = yes
)
Index: compiler/hlds_desc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_desc.m,v
retrieving revision 1.2
diff -u -r1.2 hlds_desc.m
--- compiler/hlds_desc.m 23 Dec 2008 01:37:33 -0000 1.2
+++ compiler/hlds_desc.m 18 Feb 2009 13:30:55 -0000
@@ -134,7 +134,7 @@
Reason = promise_solutions(_, _),
Desc = "scope promise solutions"
;
- Reason = promise_purity(_, _),
+ Reason = promise_purity(_),
Desc = "scope promise purity"
;
Reason = commit(_),
Index: compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.203
diff -u -r1.203 hlds_goal.m
--- compiler/hlds_goal.m 12 Jan 2009 02:01:03 -0000 1.203
+++ compiler/hlds_goal.m 18 Feb 2009 13:30:55 -0000
@@ -393,16 +393,14 @@
% inside the scope is a subset of the variables listed here.
% If it is not valid, the compiler must emit an error message.
- ; promise_purity(implicit_purity_promise, purity)
+ ; promise_purity(purity)
% The goal inside the scope implements an interface of the
% specified purity, even if its implementation uses less pure
% components.
%
% Works the same way as a promise_pure or promise_semipure
% pragma, except that it applies to arbitrary goals and not
- % just whole procedure bodies. The implicit_purity_promise
- % says whether or not the compiler requires explicit purity
- % annotations on the goals inside the scope.
+ % just whole procedure bodies.
; commit(force_pruning)
% This scope exists to delimit a piece of code
@@ -2343,7 +2341,7 @@
rename_var_list(Must, Subn, Vars0, Vars),
Reason = exist_quant(Vars)
;
- Reason0 = promise_purity(_, _),
+ Reason0 = promise_purity(_),
Reason = Reason0
;
Reason0 = promise_solutions(Vars0, Kind),
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.460
diff -u -r1.460 hlds_out.m
--- compiler/hlds_out.m 23 Dec 2008 01:37:33 -0000 1.460
+++ compiler/hlds_out.m 18 Feb 2009 13:30:55 -0000
@@ -1650,7 +1650,7 @@
mercury_output_vars(VarSet, AppendVarNums, Vars, !IO),
io.write_string("] (\n", !IO)
;
- Reason = promise_purity(Implicit, Purity),
+ Reason = promise_purity(Purity),
(
Purity = purity_pure,
io.write_string("promise_pure (", !IO)
@@ -1661,13 +1661,7 @@
Purity = purity_impure,
io.write_string("promise_impure (", !IO)
),
- (
- Implicit = make_implicit_promises,
- io.write_string("implicit\n", !IO)
- ;
- Implicit = dont_make_implicit_promises,
- io.write_string("\n", !IO)
- )
+ io.write_string("\n", !IO)
;
Reason = promise_solutions(Vars, Kind),
(
Index: compiler/interval.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/interval.m,v
retrieving revision 1.39
diff -u -r1.39 interval.m
--- compiler/interval.m 23 Dec 2008 01:37:35 -0000 1.39
+++ compiler/interval.m 18 Feb 2009 13:30:55 -0000
@@ -958,7 +958,7 @@
rename_var(need_not_rename, !.VarRename, Var0, Var),
Reason = from_ground_term(Var, Kind)
;
- ( Reason0 = promise_purity(_, _)
+ ( Reason0 = promise_purity(_)
; Reason0 = promise_solutions(_, _)
; Reason0 = commit(_)
; Reason0 = barrier(_)
Index: compiler/make_hlds_passes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds_passes.m,v
retrieving revision 1.82
diff -u -r1.82 make_hlds_passes.m
--- compiler/make_hlds_passes.m 23 Dec 2008 01:37:36 -0000 1.82
+++ compiler/make_hlds_passes.m 18 Feb 2009 13:30:55 -0000
@@ -2071,8 +2071,7 @@
GetBody = goal_list_to_conj(Context,
[CallLock, CallUnsafeGet, CallUnlock]),
- StdGetBody = promise_purity_expr(dont_make_implicit_promises,
- purity_semipure, GetBody) - Context,
+ StdGetBody = promise_purity_expr(purity_semipure, GetBody) - Context,
StdGetItemClause = item_clause_info(compiler(mutable_decl), ProgVarSet0,
pf_predicate, GetPredName, [variable(X, context_init)], StdGetBody,
@@ -2104,8 +2103,7 @@
varset.new_named_var(ProgVarSet0, "IO", IO, ProgVarSet),
% Construct the pure get predicate.
- IOGetBody = promise_purity_expr(dont_make_implicit_promises,
- purity_pure, GetBody) - Context,
+ IOGetBody = promise_purity_expr(purity_pure, GetBody) - Context,
Ctxt = context_init,
IOGetItemClause = item_clause_info(compiler(mutable_decl), ProgVarSet,
@@ -2379,8 +2377,8 @@
% around it.
CallSemipureGet = call_expr(GetPredName, [variable(X, Context)],
purity_semipure) - Context,
- IOGetBody = promise_purity_expr(dont_make_implicit_promises,
- purity_pure, CallSemipureGet) - Context,
+ IOGetBody = promise_purity_expr(purity_pure, CallSemipureGet)
+ - Context,
IOGetItemClause = item_clause_info(compiler(mutable_decl), ProgVarSet,
pf_predicate, GetPredName,
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.332
diff -u -r1.332 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m 28 Jul 2008 08:34:17 -0000 1.332
+++ compiler/mercury_to_mercury.m 18 Feb 2009 13:30:55 -0000
@@ -2919,7 +2919,7 @@
mercury_output_promise_eqv_solutions_goal(Vars, DotSVars, ColonSVars,
Goal, VarSet, Indent, "arbitrary", !IO).
-mercury_output_goal_2(promise_purity_expr(_Implicit, Purity, Goal), VarSet,
+mercury_output_goal_2(promise_purity_expr(Purity, Goal), VarSet,
Indent, !IO) :-
(
Purity = purity_pure,
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.373
diff -u -r1.373 modes.m
--- compiler/modes.m 12 Jan 2009 02:01:03 -0000 1.373
+++ compiler/modes.m 18 Feb 2009 13:30:55 -0000
@@ -1671,7 +1671,7 @@
GoalExpr = scope(UpdatedReason, SubGoal)
)
;
- Reason = promise_purity(_Implicit, _Purity),
+ Reason = promise_purity(_Purity),
mode_info_get_in_promise_purity_scope(!.ModeInfo, InPPScope),
mode_info_set_in_promise_purity_scope(in_promise_purity_scope,
!ModeInfo),
@@ -3276,7 +3276,7 @@
; Reason = from_ground_term(_, from_ground_term_other)
; Reason = exist_quant(_)
; Reason = promise_solutions(_, _)
- ; Reason = promise_purity(_, _)
+ ; Reason = promise_purity(_)
; Reason = commit(_)
; Reason = barrier(_)
; Reason = trace_goal(_, _, _, _, _)
@@ -3348,7 +3348,7 @@
; Reason = from_ground_term(_, from_ground_term_other)
; Reason = exist_quant(_)
; Reason = promise_solutions(_, _)
- ; Reason = promise_purity(_, _)
+ ; Reason = promise_purity(_)
; Reason = commit(_)
; Reason = barrier(_)
; Reason = trace_goal(_, _, _, _, _)
Index: compiler/module_imports.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/module_imports.m,v
retrieving revision 1.3
diff -u -r1.3 module_imports.m
--- compiler/module_imports.m 5 Sep 2008 03:57:37 -0000 1.3
+++ compiler/module_imports.m 18 Feb 2009 13:30:55 -0000
@@ -605,7 +605,7 @@
; GoalExpr = all_expr(_, SubGoal)
; GoalExpr = some_state_vars_expr(_, SubGoal)
; GoalExpr = all_state_vars_expr(_, SubGoal)
- ; GoalExpr = promise_purity_expr(_, _, SubGoal)
+ ; GoalExpr = promise_purity_expr(_, SubGoal)
; GoalExpr = promise_equivalent_solutions_expr(_, _, _, SubGoal)
; GoalExpr = promise_equivalent_solution_sets_expr(_, _, _, SubGoal)
; GoalExpr = promise_equivalent_solution_arbitrary_expr(_, _, _,
Index: compiler/module_qual.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/module_qual.m,v
retrieving revision 1.169
diff -u -r1.169 module_qual.m
--- compiler/module_qual.m 2 Dec 2008 04:30:23 -0000 1.169
+++ compiler/module_qual.m 18 Feb 2009 13:30:55 -0000
@@ -526,7 +526,7 @@
process_assert(G, Symbols, Success).
process_assert(all_state_vars_expr(_, G) - _, Symbols, Success) :-
process_assert(G, Symbols, Success).
-process_assert(promise_purity_expr(_I, _P, G) - _, Symbols, Success) :-
+process_assert(promise_purity_expr(_P, G) - _, Symbols, Success) :-
process_assert(G, Symbols, Success).
process_assert(promise_equivalent_solutions_expr(_V, _D, _C, G) - _,
Symbols, Success) :-
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.215
diff -u -r1.215 prog_data.m
--- compiler/prog_data.m 14 Jan 2009 08:38:46 -0000 1.215
+++ compiler/prog_data.m 18 Feb 2009 13:30:55 -0000
@@ -974,10 +974,6 @@
% NOTE: the representation of goals in the parse tree is defined in
% prog_item.m.
-:- type implicit_purity_promise
- ---> make_implicit_promises
- ; dont_make_implicit_promises.
-
:- type trace_expr(Base)
---> trace_base(Base)
; trace_not(trace_expr(Base))
Index: compiler/prog_io_dcg.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io_dcg.m,v
retrieving revision 1.46
diff -u -r1.46 prog_io_dcg.m
--- compiler/prog_io_dcg.m 2 Dec 2008 04:30:24 -0000 1.46
+++ compiler/prog_io_dcg.m 18 Feb 2009 13:30:55 -0000
@@ -195,8 +195,7 @@
parse_dcg_goal(G, ContextPieces, MaybeGoal0, !VarSet, !Counter, !Var),
(
MaybeGoal0 = ok1(Goal0),
- Goal = promise_purity_expr(dont_make_implicit_promises, purity_pure,
- Goal0) - Context,
+ Goal = promise_purity_expr(purity_pure, Goal0) - Context,
MaybeGoal = ok1(Goal)
;
MaybeGoal0 = error1(Specs),
@@ -207,8 +206,7 @@
parse_dcg_goal(G, ContextPieces, MaybeGoal0, !VarSet, !Counter, !Var),
(
MaybeGoal0 = ok1(Goal0),
- Goal = promise_purity_expr(dont_make_implicit_promises, purity_semipure,
- Goal0) - Context,
+ Goal = promise_purity_expr(purity_semipure, Goal0) - Context,
MaybeGoal = ok1(Goal)
;
MaybeGoal0 = error1(Specs),
@@ -219,44 +217,7 @@
parse_dcg_goal(G, ContextPieces, MaybeGoal0, !VarSet, !Counter, !Var),
(
MaybeGoal0 = ok1(Goal0),
- Goal = promise_purity_expr(dont_make_implicit_promises, purity_impure,
- Goal0) - Context,
- MaybeGoal = ok1(Goal)
- ;
- MaybeGoal0 = error1(Specs),
- MaybeGoal = error1(Specs)
- ).
-parse_dcg_goal_2("promise_pure_implicit", [G], Context, ContextPieces, MaybeGoal,
- !VarSet, !Counter, !Var) :-
- parse_dcg_goal(G, ContextPieces, MaybeGoal0, !VarSet, !Counter, !Var),
- (
- MaybeGoal0 = ok1(Goal0),
- Goal = promise_purity_expr(make_implicit_promises, purity_pure, Goal0)
- - Context,
- MaybeGoal = ok1(Goal)
- ;
- MaybeGoal0 = error1(Specs),
- MaybeGoal = error1(Specs)
- ).
-parse_dcg_goal_2("promise_semipure_implicit", [G], Context, ContextPieces,
- MaybeGoal, !VarSet, !Counter, !Var) :-
- parse_dcg_goal(G, ContextPieces, MaybeGoal0, !VarSet, !Counter, !Var),
- (
- MaybeGoal0 = ok1(Goal0),
- Goal = promise_purity_expr(make_implicit_promises, purity_semipure,
- Goal0) - Context,
- MaybeGoal = ok1(Goal)
- ;
- MaybeGoal0 = error1(Specs),
- MaybeGoal = error1(Specs)
- ).
-parse_dcg_goal_2("promise_impure_implicit", [G], Context, ContextPieces,
- MaybeGoal, !VarSet, !Counter, !Var) :-
- parse_dcg_goal(G, ContextPieces, MaybeGoal0, !VarSet, !Counter, !Var),
- (
- MaybeGoal0 = ok1(Goal0),
- Goal = promise_purity_expr(make_implicit_promises, purity_impure,
- Goal0) - Context,
+ Goal = promise_purity_expr(purity_impure, Goal0) - Context,
MaybeGoal = ok1(Goal)
;
MaybeGoal0 = error1(Specs),
Index: compiler/prog_io_goal.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io_goal.m,v
retrieving revision 1.57
diff -u -r1.57 prog_io_goal.m
--- compiler/prog_io_goal.m 2 Dec 2008 04:30:24 -0000 1.57
+++ compiler/prog_io_goal.m 18 Feb 2009 13:30:55 -0000
@@ -498,8 +498,7 @@
parse_goal(SubTerm, ContextPieces, MaybeSubGoal, !VarSet),
(
MaybeSubGoal = ok1(SubGoal),
- Goal = promise_purity_expr(dont_make_implicit_promises,
- purity_pure, SubGoal) - Context,
+ Goal = promise_purity_expr(purity_pure, SubGoal) - Context,
MaybeGoal = ok1(Goal)
;
MaybeSubGoal = error1(Specs),
@@ -510,8 +509,7 @@
parse_goal(SubTerm, ContextPieces, MaybeSubGoal, !VarSet),
(
MaybeSubGoal = ok1(SubGoal),
- Goal = promise_purity_expr(dont_make_implicit_promises,
- purity_semipure, SubGoal) - Context,
+ Goal = promise_purity_expr(purity_semipure, SubGoal) - Context,
MaybeGoal = ok1(Goal)
;
MaybeSubGoal = error1(Specs),
@@ -522,44 +520,7 @@
parse_goal(SubTerm, ContextPieces, MaybeSubGoal, !VarSet),
(
MaybeSubGoal = ok1(SubGoal),
- Goal = promise_purity_expr(dont_make_implicit_promises,
- purity_impure, SubGoal) - Context,
- MaybeGoal = ok1(Goal)
- ;
- MaybeSubGoal = error1(Specs),
- MaybeGoal = error1(Specs)
- ).
-parse_goal_2("promise_pure_implicit", [SubTerm], Context, ContextPieces,
- MaybeGoal, !VarSet) :-
- parse_goal(SubTerm, ContextPieces, MaybeSubGoal, !VarSet),
- (
- MaybeSubGoal = ok1(SubGoal),
- Goal = promise_purity_expr(make_implicit_promises,
- purity_pure, SubGoal) - Context,
- MaybeGoal = ok1(Goal)
- ;
- MaybeSubGoal = error1(Specs),
- MaybeGoal = error1(Specs)
- ).
-parse_goal_2("promise_semipure_implicit", [SubTerm], Context, ContextPieces,
- MaybeGoal, !VarSet) :-
- parse_goal(SubTerm, ContextPieces, MaybeSubGoal, !VarSet),
- (
- MaybeSubGoal = ok1(SubGoal),
- Goal = promise_purity_expr(make_implicit_promises,
- purity_semipure, SubGoal) - Context,
- MaybeGoal = ok1(Goal)
- ;
- MaybeSubGoal = error1(Specs),
- MaybeGoal = error1(Specs)
- ).
-parse_goal_2("promise_impure_implicit", [SubTerm], Context, ContextPieces,
- MaybeGoal, !VarSet) :-
- parse_goal(SubTerm, ContextPieces, MaybeSubGoal, !VarSet),
- (
- MaybeSubGoal = ok1(SubGoal),
- Goal = promise_purity_expr(make_implicit_promises,
- purity_impure, SubGoal) - Context,
+ Goal = promise_purity_expr(purity_impure, SubGoal) - Context,
MaybeGoal = ok1(Goal)
;
MaybeSubGoal = error1(Specs),
Index: compiler/prog_item.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_item.m,v
retrieving revision 1.36
diff -u -r1.36 prog_item.m
--- compiler/prog_item.m 28 Jul 2008 08:34:19 -0000 1.36
+++ compiler/prog_item.m 18 Feb 2009 13:30:55 -0000
@@ -775,7 +775,7 @@
% some/2 and all/2 quantifiers.
% other scopes
- ; promise_purity_expr(implicit_purity_promise, purity, goal)
+ ; promise_purity_expr(purity, goal)
; promise_equivalent_solutions_expr(
prog_vars, % OrdinaryVars
prog_vars, % DotStateVars
Index: compiler/prog_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_util.m,v
retrieving revision 1.106
diff -u -r1.106 prog_util.m
--- compiler/prog_util.m 21 Jul 2008 03:10:13 -0000 1.106
+++ compiler/prog_util.m 18 Feb 2009 13:30:55 -0000
@@ -320,8 +320,8 @@
rename_in_vars(OldVar, NewVar, Vars0, Vars),
rename_in_goal(OldVar, NewVar, Goal0, Goal).
rename_in_goal_expr(OldVar, NewVar,
- promise_purity_expr(Implicit, Purity, Goal0),
- promise_purity_expr(Implicit, Purity, Goal)) :-
+ promise_purity_expr(Purity, Goal0),
+ promise_purity_expr(Purity, Goal)) :-
rename_in_goal(OldVar, NewVar, Goal0, Goal).
rename_in_goal_expr(OldVar, NewVar,
promise_equivalent_solutions_expr(Vars0, DotSVars0, ColonSVars0,
Index: compiler/purity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/purity.m,v
retrieving revision 1.125
diff -u -r1.125 purity.m
--- compiler/purity.m 12 Jan 2009 02:01:04 -0000 1.125
+++ compiler/purity.m 18 Feb 2009 13:30:55 -0000
@@ -313,12 +313,11 @@
clauses_info_get_vartypes(!.ClausesInfo, VarTypes0),
clauses_info_get_varset(!.ClausesInfo, VarSet0),
PurityInfo0 = purity_info(ModuleInfo, run_post_typecheck,
- !.PredInfo, VarTypes0, VarSet0, [], dont_make_implicit_promises,
- do_not_need_to_requantify),
+ !.PredInfo, VarTypes0, VarSet0, [], do_not_need_to_requantify),
compute_purity_for_clauses(Clauses0, Clauses, !.PredInfo,
purity_pure, Purity, PurityInfo0, PurityInfo),
PurityInfo = purity_info(_, _, !:PredInfo,
- VarTypes, VarSet, GoalSpecs, _, _),
+ VarTypes, VarSet, GoalSpecs, _),
clauses_info_set_vartypes(VarTypes, !ClausesInfo),
clauses_info_set_varset(VarSet, !ClausesInfo),
clauses_info_set_clauses(Clauses, !ClausesInfo),
@@ -368,10 +367,9 @@
proc_info_get_vartypes(ProcInfo0, VarTypes0),
proc_info_get_varset(ProcInfo0, VarSet0),
PurityInfo0 = purity_info(ModuleInfo, do_not_run_post_typecheck,
- !.PredInfo, VarTypes0, VarSet0, [], dont_make_implicit_promises,
- do_not_need_to_requantify),
+ !.PredInfo, VarTypes0, VarSet0, [], do_not_need_to_requantify),
compute_goal_purity(Goal0, Goal, Bodypurity, _, PurityInfo0, PurityInfo),
- PurityInfo = purity_info(_, _, !:PredInfo, VarTypes, VarSet, _, _,
+ PurityInfo = purity_info(_, _, !:PredInfo, VarTypes, VarSet, _,
NeedToRequantify),
proc_info_set_goal(Goal, ProcInfo0, ProcInfo1),
proc_info_set_vartypes(VarTypes, ProcInfo1, ProcInfo2),
@@ -680,16 +678,8 @@
Reason = exist_quant(_),
compute_goal_purity(Goal0, Goal, Purity, ContainsTrace, !Info)
;
- Reason = promise_purity(Implicit, PromisedPurity),
- ImplicitPurity0 = !.Info ^ pi_implicit_purity,
- (
- Implicit = make_implicit_promises,
- !:Info = !.Info ^ pi_implicit_purity := Implicit
- ;
- Implicit = dont_make_implicit_promises
- ),
+ Reason = promise_purity(PromisedPurity),
compute_goal_purity(Goal0, Goal, _, ContainsTrace, !Info),
- !:Info = !.Info ^ pi_implicit_purity := ImplicitPurity0,
Purity = PromisedPurity
;
% We haven't yet classified from_ground_term scopes into
@@ -972,13 +962,13 @@
% Check for a bogus purity annotation on the unification.
DeclaredPurity = goal_info_get_purity(GoalInfo),
(
- DeclaredPurity \= purity_pure,
- !.Info ^ pi_implicit_purity = dont_make_implicit_promises
- ->
+ ( DeclaredPurity = purity_semipure
+ ; DeclaredPurity = purity_impure
+ ),
Spec = impure_unification_expr_error(Context, DeclaredPurity),
purity_info_add_message(Spec, !Info)
;
- true
+ DeclaredPurity = purity_pure
).
% The possible results of a purity check.
@@ -1089,51 +1079,43 @@
!Info) :-
ModuleInfo = !.Info ^ pi_module_info,
PredInfo = !.Info ^ pi_pred_info,
- ImplicitPurity = !.Info ^ pi_implicit_purity,
module_info_pred_info(ModuleInfo, PredId, CalleePredInfo),
pred_info_get_purity(CalleePredInfo, ActualPurity),
(
- % If implicit_purity = make_implicit_promises then
- % we don't report purity errors or warnings.
- ImplicitPurity = make_implicit_promises
+ % The purity of the callee should match the
+ % purity declared at the call.
+ ActualPurity = DeclaredPurity
+ ->
+ true
;
- ImplicitPurity = dont_make_implicit_promises,
- (
- % The purity of the callee should match the
- % purity declared at the call.
- ActualPurity = DeclaredPurity
- ->
- true
- ;
- % Don't require purity annotations on calls in
- % compiler-generated code.
- is_unify_or_compare_pred(PredInfo)
- ->
- true
- ;
- less_pure(ActualPurity, DeclaredPurity)
- ->
- Spec = error_missing_body_impurity_decl(ModuleInfo, PredId,
- Context),
- purity_info_add_message(Spec, !Info)
- ;
- % We don't warn about exaggerated impurity decls in class methods
- % or instance methods --- it just means that the predicate provided
- % as an implementation was more pure than necessary.
+ % Don't require purity annotations on calls in
+ % compiler-generated code.
+ is_unify_or_compare_pred(PredInfo)
+ ->
+ true
+ ;
+ less_pure(ActualPurity, DeclaredPurity)
+ ->
+ Spec = error_missing_body_impurity_decl(ModuleInfo, PredId,
+ Context),
+ purity_info_add_message(Spec, !Info)
+ ;
+ % We don't warn about exaggerated impurity decls in class methods
+ % or instance methods --- it just means that the predicate provided
+ % as an implementation was more pure than necessary.
- pred_info_get_markers(PredInfo, Markers),
- (
- check_marker(Markers, marker_class_method)
- ;
- check_marker(Markers, marker_class_instance_method)
- )
- ->
- true
+ pred_info_get_markers(PredInfo, Markers),
+ (
+ check_marker(Markers, marker_class_method)
;
- Spec = warn_unnecessary_body_impurity_decl(ModuleInfo, PredId,
- Context, DeclaredPurity),
- purity_info_add_message(Spec, !Info)
+ check_marker(Markers, marker_class_instance_method)
)
+ ->
+ true
+ ;
+ Spec = warn_unnecessary_body_impurity_decl(ModuleInfo, PredId,
+ Context, DeclaredPurity),
+ purity_info_add_message(Spec, !Info)
).
:- pred compute_goal_purity(hlds_goal::in, hlds_goal::out, purity::out,
@@ -1452,12 +1434,6 @@
pi_vartypes :: vartypes,
pi_varset :: prog_varset,
pi_messages :: list(error_spec),
- pi_implicit_purity :: implicit_purity_promise,
- % If this is make_implicit_promises,
- % then purity annotations are optional
- % in the current scope and purity
- % warnings/errors should not be
- % generated.
pi_requant :: need_to_requantify
).
Index: compiler/quantification.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/quantification.m,v
retrieving revision 1.130
diff -u -r1.130 quantification.m
--- compiler/quantification.m 12 Jan 2009 02:01:04 -0000 1.130
+++ compiler/quantification.m 18 Feb 2009 13:30:55 -0000
@@ -640,7 +640,7 @@
set_nonlocals(NonLocals, !Info),
PossiblyNonLocalGoalVars0 = NonLocals
;
- ( Reason0 = promise_purity(_, _)
+ ( Reason0 = promise_purity(_)
; Reason0 = promise_solutions(_, _)
; Reason0 = commit(_)
; Reason0 = barrier(_)
@@ -707,7 +707,7 @@
rename_var_list(need_not_rename, RenameMap, TraceVars0, TraceVars),
Reason = trace_goal(Comp, Run, IO, Mut, TraceVars)
;
- ( Reason0 = promise_purity(_, _)
+ ( Reason0 = promise_purity(_)
; Reason0 = commit(_)
; Reason0 = barrier(_)
; Reason0 = from_ground_term(_, _)
@@ -1378,7 +1378,7 @@
Set0 = !.Set,
LambdaSet0 = !.LambdaSet,
(
- ( Reason = promise_purity(_, _)
+ ( Reason = promise_purity(_)
; Reason = commit(_)
; Reason = barrier(_)
; Reason = trace_goal(_, _, _, _, _)
Index: compiler/saved_vars.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/saved_vars.m,v
retrieving revision 1.80
diff -u -r1.80 saved_vars.m
--- compiler/saved_vars.m 23 Dec 2008 01:37:40 -0000 1.80
+++ compiler/saved_vars.m 18 Feb 2009 13:30:55 -0000
@@ -300,7 +300,7 @@
;
( Reason = from_ground_term(_, from_ground_term_construct)
; Reason = promise_solutions(_, _)
- ; Reason = promise_purity(_, _)
+ ; Reason = promise_purity(_)
; Reason = commit(_)
; Reason = barrier(_)
; Reason = trace_goal(_, _, _, _, _)
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.235
diff -u -r1.235 simplify.m
--- compiler/simplify.m 23 Dec 2008 01:37:40 -0000 1.235
+++ compiler/simplify.m 18 Feb 2009 13:30:55 -0000
@@ -1842,7 +1842,7 @@
Goal1 = hlds_goal(GoalExpr1, _GoalInfo1),
( GoalExpr1 = scope(FinalReason, FinalSubGoal) ->
(
- ( FinalReason = promise_purity(_, _)
+ ( FinalReason = promise_purity(_)
; FinalReason = from_ground_term(_, _)
; FinalReason = barrier(removable)
),
Index: compiler/ssdebug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ssdebug.m,v
retrieving revision 1.18
diff -u -r1.18 ssdebug.m
--- compiler/ssdebug.m 23 Dec 2008 01:37:40 -0000 1.18
+++ compiler/ssdebug.m 18 Feb 2009 13:30:55 -0000
@@ -819,7 +819,7 @@
wrap_with_purity_scope(Purity, GoalInfo0, GoalWithoutPurity, Goal) :-
goal_info_set_purity(Purity, GoalInfo0, GoalInfo),
- ScopeReason = promise_purity(dont_make_implicit_promises, Purity),
+ ScopeReason = promise_purity(Purity),
Goal = hlds_goal(scope(ScopeReason, GoalWithoutPurity), GoalInfo).
% Update the proc_info and pred_info with the result of the
Index: compiler/stm_expand.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/stm_expand.m,v
retrieving revision 1.2
diff -u -r1.2 stm_expand.m
--- compiler/stm_expand.m 23 Dec 2008 01:37:40 -0000 1.2
+++ compiler/stm_expand.m 18 Feb 2009 13:30:55 -0000
@@ -336,7 +336,7 @@
;
( Reason = exist_quant(_)
; Reason = promise_solutions(_, _)
- ; Reason = promise_purity(_, _)
+ ; Reason = promise_purity(_)
; Reason = commit(_)
; Reason = barrier(_)
; Reason = from_ground_term(_, from_ground_term_deconstruct)
@@ -2302,7 +2302,7 @@
Context = goal_info_get_context(GoalInInfo),
goal_info_init(NonLocals, InstMapDelta, Detism, GoalPurity, Context,
GoalInfo),
- Reason = promise_purity(dont_make_implicit_promises, ScopePurity),
+ Reason = promise_purity(ScopePurity),
HldsGoalOutExpr = scope(Reason, HldsGoalIn),
HldsGoalOut = hlds_goal(HldsGoalOutExpr, GoalInfo).
Index: compiler/typecheck.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.435
diff -u -r1.435 typecheck.m
--- compiler/typecheck.m 14 Jan 2009 08:38:47 -0000 1.435
+++ compiler/typecheck.m 18 Feb 2009 13:30:56 -0000
@@ -1154,7 +1154,7 @@
Reason = exist_quant(Vars),
ensure_vars_have_a_type(Vars, !Info)
;
- Reason = promise_purity(_, _)
+ Reason = promise_purity(_)
;
Reason = promise_solutions(Vars, _),
ensure_vars_have_a_type(Vars, !Info)
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.429
diff -u -r1.429 reference_manual.texi
--- doc/reference_manual.texi 20 Jan 2009 06:35:13 -0000 1.429
+++ doc/reference_manual.texi 18 Feb 2009 13:30:57 -0000
@@ -506,11 +506,8 @@
promise_exclusive_exhaustive fy 950
promise_exhaustive fy 950
promise_impure fx 950
-promise_impure_implicit fx 950
promise_pure fx 950
-promise_pure_implicit fx 950
promise_semipure fx 950
-promise_semipure_implicit fx 950
some fxy 950
, xfy 1000
& xfy 1025
@@ -773,18 +770,6 @@
This goal instructs the compiler to treat @var{Goal} as though it were impure,
regardless of its actual purity.
- at item @code{promise_pure_implicit @var{Goal}}
-Equivalent to @code{promise_pure @var{Goal}}, except that purity annotations on
-semipure and impure subgoals in @var{Goal} are optional.
-
- at item @code{promise_semipure_implicit @var{Goal}}
-Equivalent to @code{promise_semipure @var{Goal}}, except that purity
-annotations on semipure and impure subgoals in @var{Goal} are optional.
-
- at item @code{promise_impure_implicit @var{Goal}}
-Equivalent to @code{promise_impure @var{Goal}}, except that purity annotations
-on semipure and impure subgoals in @var{Goal} are optional.
-
@item @code{promise_equivalent_solutions @var{Vars} @var{Goal}}
A determinism cast.
@var{Vars} must be a list of variables.
Index: library/ops.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/ops.m,v
retrieving revision 1.70
diff -u -r1.70 ops.m
--- library/ops.m 27 Feb 2008 07:23:56 -0000 1.70
+++ library/ops.m 18 Feb 2009 13:30:57 -0000
@@ -447,11 +447,8 @@
OtherInfos = []
;
( Op = "promise_pure"
- ; Op = "promise_pure_implicit"
; Op = "promise_semipure"
- ; Op = "promise_semipure_implicit"
; Op = "promise_impure"
- ; Op = "promise_impure_implicit"
),
Info = op_info(prefix(x), 950),
OtherInfos = []
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.364
diff -u -r1.364 Mmakefile
--- tests/hard_coded/Mmakefile 4 Feb 2009 23:10:50 -0000 1.364
+++ tests/hard_coded/Mmakefile 18 Feb 2009 13:30:57 -0000
@@ -124,8 +124,6 @@
impl_def_literal \
impossible_unify \
impure_foreign \
- impure_foreign2 \
- impure_foreign3 \
impure_init_and_final \
impure_prune \
initialise_decl \
@@ -146,7 +144,6 @@
map_fold \
mapped_module \
merge_and_remove_dups \
- minint_bug \
mode_check_clauses \
mode_choice \
multi_arm_switch \
@@ -234,7 +231,6 @@
test_imported_no_tag \
test_pretty_printer \
test_pretty_printer_defaults \
- test_promise_impure_implicit \
test_semaphore \
test_yield \
tim_qual1 \
@@ -500,6 +496,11 @@
#
# XXX we fail some of the commented-out tests in write_binary
+# XXX minint_bug
+# Since r1.279 of library/string.m we no longer pass this test
+# since the smallest (decimal) integer literal string.int_to_string/2
+# recognises is int.min_int + 1.
+
# The following tests are passed only in some grades.
# The following tests do not work in the the .profdeep grades.
Index: tests/hard_coded/impure_foreign2.exp
===================================================================
RCS file: tests/hard_coded/impure_foreign2.exp
diff -N tests/hard_coded/impure_foreign2.exp
--- tests/hard_coded/impure_foreign2.exp 26 Apr 2005 07:38:03 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,2 +0,0 @@
-1
-4
Index: tests/hard_coded/impure_foreign2.m
===================================================================
RCS file: tests/hard_coded/impure_foreign2.m
diff -N tests/hard_coded/impure_foreign2.m
--- tests/hard_coded/impure_foreign2.m 23 Aug 2007 01:14:19 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,85 +0,0 @@
-% Test promise_impure_implicit with real impure goals.
-
-:- module impure_foreign2.
-
-:- interface.
-
-:- import_module io.
-
-:- impure pred main(io__state::di, io__state::uo) is det.
-
-:- implementation.
-
-:- import_module require.
-
-main(!IO) :-
- promise_impure_implicit (
- % Inlining this call forces recomputation
- % of purity for main/2 (because of the
- % `:- pragma promise_pure').
- % In some versions of this compiler, this
- % recomputation would erroneously infer
- % that the inlined calls to incr/1 below
- % were `pure'. Duplicate call elimination
- % would then remove all but one of them.
- unsafe_get(Val0),
-
- io__write_int(Val0, !IO),
- io__nl(!IO),
-
- incr(_),
- incr(_),
- incr(_),
- get(Val),
- io__write_int(Val, !IO),
- io__nl(!IO)
- ).
-
-:- pragma foreign_decl("C",
-"
- int counter;
-").
-
-:- pragma foreign_code("C",
-"
- int counter = 1;
-").
-
-:- pragma foreign_code("C#", "static int counter = 1;").
-
-:- impure pred incr(int::out) is det.
-
-incr(_::out) :- error("incr/1 called for language other than C").
-
-:- pragma foreign_proc("C", incr(Val::out), [will_not_call_mercury],
- "counter++; Val = counter;").
-:- pragma foreign_proc("C#", incr(Val::out), [will_not_call_mercury],
- "counter++; Val = counter;").
-:- pragma foreign_proc("Erlang", incr(Val::out), [will_not_call_mercury],
- "case get(counter) of
- undefined -> Val = 2;
- C -> Val = C + 1
- end,
- put(counter, Val)").
-
-:- semipure pred get(int::out) is det.
-
-get(_::out) :- error("get/1 called for language other than C").
-
-:- pragma foreign_proc("C", get(Val::out),
- [will_not_call_mercury, promise_semipure],
- "Val = counter").
-:- pragma foreign_proc("C#", get(Val::out),
- [will_not_call_mercury, promise_semipure],
- "Val = counter;").
-:- pragma foreign_proc("Erlang", get(Val::out),
- [will_not_call_mercury, promise_semipure],
- "Val = case get(counter) of
- undefined -> 1;
- C -> C
- end").
-
-:- pred unsafe_get(int::out) is det.
-:- pragma promise_pure(unsafe_get/1).
-
-unsafe_get(X) :- semipure get(X).
Index: tests/hard_coded/impure_foreign3.exp
===================================================================
RCS file: tests/hard_coded/impure_foreign3.exp
diff -N tests/hard_coded/impure_foreign3.exp
--- tests/hard_coded/impure_foreign3.exp 26 Apr 2005 07:38:03 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,2 +0,0 @@
-1
-4
Index: tests/hard_coded/impure_foreign3.m
===================================================================
RCS file: tests/hard_coded/impure_foreign3.m
diff -N tests/hard_coded/impure_foreign3.m
--- tests/hard_coded/impure_foreign3.m 23 Aug 2007 01:14:19 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,85 +0,0 @@
-% Test promise_impure_implicit in DCGs.
-
-:- module impure_foreign3.
-
-:- interface.
-
-:- import_module io.
-
-:- impure pred main(io__state::di, io__state::uo) is det.
-
-:- implementation.
-
-:- import_module require.
-
-main -->
- promise_impure_implicit (
- % Inlining this call forces recomputation
- % of purity for main/2 (because of the
- % `:- pragma promise_pure').
- % In some versions of this compiler, this
- % recomputation would erroneously infer
- % that the inlined calls to incr/1 below
- % were `pure'. Duplicate call elimination
- % would then remove all but one of them.
- { unsafe_get(Val0) },
-
- io__write_int(Val0),
- io__nl,
-
- { impure incr(_) },
- { impure incr(_) },
- { impure incr(_) },
- { semipure get(Val) },
- io__write_int(Val),
- io__nl
- ).
-
-:- pragma foreign_decl("C",
-"
- int counter;
-").
-
-:- pragma foreign_code("C",
-"
- int counter = 1;
-").
-
-:- pragma foreign_code("C#", "static int counter = 1;").
-
-:- impure pred incr(int::out) is det.
-
-incr(_::out) :- error("incr/1 called for language other than C").
-
-:- pragma foreign_proc("C", incr(Val::out), [will_not_call_mercury],
- "counter++; Val = counter;").
-:- pragma foreign_proc("C#", incr(Val::out), [will_not_call_mercury],
- "counter++; Val = counter;").
-:- pragma foreign_proc("Erlang", incr(Val::out), [will_not_call_mercury],
- "case get(counter) of
- undefined -> Val = 2;
- C -> Val = C + 1
- end,
- put(counter, Val)").
-
-:- semipure pred get(int::out) is det.
-
-get(_::out) :- error("get/1 called for language other than C").
-
-:- pragma foreign_proc("C", get(Val::out),
- [will_not_call_mercury, promise_semipure],
- "Val = counter").
-:- pragma foreign_proc("C#", get(Val::out),
- [will_not_call_mercury, promise_semipure],
- "Val = counter;").
-:- pragma foreign_proc("Erlang", get(Val::out),
- [will_not_call_mercury, promise_semipure],
- "Val = case get(counter) of
- undefined -> 1;
- C -> C
- end").
-
-:- pred unsafe_get(int::out) is det.
-:- pragma promise_pure(unsafe_get/1).
-
-unsafe_get(X) :- semipure get(X).
Index: tests/hard_coded/minint_bug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/hard_coded/minint_bug.m,v
retrieving revision 1.1
diff -u -r1.1 minint_bug.m
--- tests/hard_coded/minint_bug.m 18 Mar 1998 14:16:20 -0000 1.1
+++ tests/hard_coded/minint_bug.m 18 Feb 2009 13:30:57 -0000
@@ -1,4 +1,8 @@
% regression test: versions 0.7.3 and earlier failed this test.
+% Since r1.279 of library/string.m we no longer pass this test
+% (on 32-bit machines at least), see the comment in the Makefile
+% for details. (XXX This never worked as intended on 64-bit
+% machines.)
:- module minint_bug.
Index: tests/hard_coded/test_promise_impure_implicit.exp
===================================================================
RCS file: tests/hard_coded/test_promise_impure_implicit.exp
diff -N tests/hard_coded/test_promise_impure_implicit.exp
--- tests/hard_coded/test_promise_impure_implicit.exp 26 Apr 2005 07:38:03 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1 +0,0 @@
-Hello, World!
Index: tests/hard_coded/test_promise_impure_implicit.m
===================================================================
RCS file: tests/hard_coded/test_promise_impure_implicit.m
diff -N tests/hard_coded/test_promise_impure_implicit.m
--- tests/hard_coded/test_promise_impure_implicit.m 26 Apr 2005 07:38:03 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,40 +0,0 @@
-%-----------------------------------------------------------------------------%
-% test_promise_impure_implicit.m
-% Ralph Becket <rafe at cs.mu.oz.au>
-% Tue Apr 26 13:14:12 EST 2005
-% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
-%
-%-----------------------------------------------------------------------------%
-
-:- module test_promise_impure_implicit.
-
-:- interface.
-
-:- import_module io.
-
-
-
-:- pred main(io :: di, io :: uo) is det.
-
-%-----------------------------------------------------------------------------%
-%-----------------------------------------------------------------------------%
-
-:- implementation.
-
-%-----------------------------------------------------------------------------%
-
-main(!IO) :-
- promise_pure_implicit (
- X = some_impure_string,
- io.print(X, !IO)
- ).
-
-:- impure func some_impure_string = string.
-
-some_impure_string = X :-
- promise_impure (
- X = "Hello, World!\n"
- ).
-
-%-----------------------------------------------------------------------------%
-%-----------------------------------------------------------------------------%
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list