[m-rev.] diff: module_error function symbol names
Zoltan Somogyi
zs at cs.mu.OZ.AU
Mon Jul 16 18:15:35 AEST 2001
The idea of this change has already been reviewed by Fergus.
Zoltab.
Change the function symbols in type module_errors to avoid clashes with
the function symbols of type bool.
compiler/prog_io.m:
Change the function symbols in type module_errors to avoid clashes with
the function symbols of type bool. The new function symbols are more
meaningful.
compiler/intermod.m:
compiler/mercury_compile.m:
compiler/modules.m:
compiler/recompilation_check.m:
Conform to the change to module_errors.
compiler/typecheck.m:
Delete a now unnecessary type disambiguation.
cvs diff: Diffing .
Index: intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.101
diff -u -b -r1.101 intermod.m
--- intermod.m 2001/07/10 10:45:25 1.101
+++ intermod.m 2001/07/14 07:46:01
@@ -2071,7 +2071,12 @@
% Figure out whether anything went wrong
%
{ module_imports_get_error(Module, FoundError0) },
- { ( FoundError0 \= no ; OptError = yes ; UAError = yes) ->
+ {
+ ( FoundError0 \= no_module_errors
+ ; OptError = yes
+ ; UAError = yes
+ )
+ ->
FoundError = yes
;
FoundError = no
@@ -2116,14 +2121,14 @@
update_error_status(FileType, FileName, ModuleError, Messages,
Error0, Error1) -->
(
- { ModuleError = no },
+ { ModuleError = no_module_errors },
{ Error1 = Error0 }
;
- { ModuleError = yes },
+ { ModuleError = some_module_errors },
prog_out__write_messages(Messages),
{ Error1 = yes }
;
- { ModuleError = fatal },
+ { ModuleError = fatal_module_errors },
{
FileType = opt,
WarningOption = warn_missing_opt_files
Index: mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.210
diff -u -b -r1.210 mercury_compile.m
--- mercury_compile.m 2001/07/13 17:34:55 1.210
+++ mercury_compile.m 2001/07/16 07:30:21
@@ -771,8 +771,8 @@
:- pred halt_at_module_error(bool, module_error).
:- mode halt_at_module_error(in, in) is semidet.
-halt_at_module_error(_, fatal).
-halt_at_module_error(HaltSyntax, yes) :- HaltSyntax = yes.
+halt_at_module_error(_, fatal_module_errors).
+halt_at_module_error(HaltSyntax, some_module_errors) :- HaltSyntax = yes.
:- pred module_to_link(pair(module_name, item_list), string,
io__state, io__state).
@@ -895,7 +895,7 @@
check_for_no_exports(Items, ModuleName),
grab_imported_modules(SourceFileName, ModuleName, ReadModules,
MaybeTimestamp, Items, Module, Error2),
- ( { Error2 \= fatal } ->
+ ( { Error2 \= fatal_module_errors } ->
{ ModuleName = RootModuleName ->
NestedSubModules = NestedSubModules0
;
Index: modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.170
diff -u -b -r1.170 modules.m
--- modules.m 2001/07/12 22:19:59 1.170
+++ modules.m 2001/07/14 07:50:08
@@ -912,7 +912,8 @@
%
% Check whether we succeeded
%
- ( { Error = yes } ->
+ % XXX zs: why does this code not check for fatal_module_errors?
+ ( { Error = some_module_errors } ->
module_name_to_file_name(ModuleName, ".int0", no, FileName),
io__write_strings(["Error reading interface files.\n",
"`", FileName, "' not written.\n"])
@@ -965,7 +966,8 @@
% Check whether we succeeded
%
{ module_imports_get_items(Module0, InterfaceItems1) },
- ( { Error = yes } ->
+ % XXX zs: why does this code not check for fatal_module_errors?
+ ( { Error = some_module_errors } ->
module_name_to_file_name(ModuleName, ".int", no, IntFileName),
module_name_to_file_name(ModuleName, ".int2", no, Int2FileName),
io__write_strings(["Error reading short interface files.\n",
@@ -1256,7 +1258,7 @@
"Reading old interface for module", yes, no,
OldItems0, OldError, _OldIntFileName,
_OldTimestamp),
- ( { OldError = no } ->
+ ( { OldError = no_module_errors } ->
{ strip_off_interface_decl(OldItems0,
OldItems) },
{ MaybeOldItems = yes(OldItems) }
@@ -1544,7 +1546,8 @@
init_module_imports(SourceFileName, ModuleName, Items, PublicChildren,
FactDeps, MaybeTimestamps, Module) :-
Module = module_imports(SourceFileName, ModuleName, [], [], [], [],
- PublicChildren, FactDeps, unknown, Items, no, MaybeTimestamps).
+ PublicChildren, FactDeps, unknown, Items, no_module_errors,
+ MaybeTimestamps).
module_imports_get_source_file_name(Module, Module ^ source_file_name).
module_imports_get_module_name(Module, Module ^ module_name).
@@ -2403,7 +2406,7 @@
%
{ map__lookup(DepsMap, ModuleName, deps(_, ModuleImports)) },
{ module_imports_get_error(ModuleImports, Error) },
- ( { Error = fatal } ->
+ ( { Error = fatal_module_errors } ->
{ prog_out__sym_name_to_string(ModuleName, ModuleString) },
{ string__append_list(["can't read source file for module `",
ModuleString, "'."], Message) },
@@ -2570,7 +2573,7 @@
% the current Module depends on, a .d file is still produced, even
% though it probably contains incorrect information.
{ module_imports_get_error(Module, Error) },
- ( { Error \= fatal } ->
+ ( { Error \= fatal_module_errors } ->
write_dependency_file(Module,
set__list_to_set(IndirectOptDeps), yes(TransOptDeps))
;
@@ -2647,7 +2650,7 @@
IntRel0, IntRel, ImplRel0, ImplRel) :-
Deps = deps(_, ModuleImports),
ModuleError = ModuleImports ^ error,
- ( ModuleError \= fatal ->
+ ( ModuleError \= fatal_module_errors ->
%
% Add interface dependencies to the interface deps relation.
%
@@ -3671,7 +3674,7 @@
select_ok_modules([Module | Modules0], DepsMap, Modules) :-
map__lookup(DepsMap, Module, deps(_, ModuleImports)),
module_imports_get_error(ModuleImports, Error),
- ( Error = fatal ->
+ ( Error = fatal_module_errors ->
Modules = Modules1
;
Modules = [Module | Modules1]
@@ -3842,7 +3845,7 @@
read_mod_ignore_errors(ModuleName, ".m",
"Getting dependencies for module", Search, no, Items0, Error,
FileName0, _),
- ( { Items0 = [], Error = fatal } ->
+ ( { Items0 = [], Error = fatal_module_errors } ->
read_mod_ignore_errors(ModuleName, ".int",
"Getting dependencies for module interface", Search, no,
Items, _Error, FileName, _),
@@ -3977,7 +3980,7 @@
% level of module qualifiers.
%
(
- { Error0 = fatal },
+ { Error0 = fatal_module_errors },
{ Items0 = [] },
{ Extension = ".m" },
{ PartialModuleName = qualified(Parent, Child) }
@@ -3992,7 +3995,7 @@
check_timestamp(FileName0, MaybeTimestamp0, MaybeTimestamp),
( { IgnoreErrors = yes } ->
(
- { Error0 = fatal },
+ { Error0 = fatal_module_errors },
{ Items0 = [] }
->
maybe_write_string(VeryVerbose, "not found.\n")
@@ -4000,15 +4003,18 @@
maybe_write_string(VeryVerbose, "done.\n")
)
;
- ( { Error0 = fatal } ->
+ (
+ { Error0 = fatal_module_errors },
maybe_write_string(VeryVerbose,
"fatal error(s).\n"),
io__set_exit_status(1)
- ; { Error0 = yes } ->
+ ;
+ { Error0 = some_module_errors },
maybe_write_string(VeryVerbose,
"parse error(s).\n"),
io__set_exit_status(1)
;
+ { Error0 = no_module_errors },
maybe_write_string(VeryVerbose,
"successful parse.\n")
),
@@ -4035,13 +4041,16 @@
ReturnTimestamp, Error, ModuleName, Messages, Items,
MaybeTimestamp0),
check_timestamp(FullFileName, MaybeTimestamp0, MaybeTimestamp),
- ( { Error = fatal } ->
+ (
+ { Error = fatal_module_errors },
maybe_write_string(VeryVerbose, "fatal error(s).\n"),
io__set_exit_status(1)
- ; { Error = yes } ->
+ ;
+ { Error = some_module_errors },
maybe_write_string(VeryVerbose, "parse error(s).\n"),
io__set_exit_status(1)
;
+ { Error = no_module_errors },
maybe_write_string(VeryVerbose, "successful parse.\n")
),
prog_out__write_messages(Messages).
@@ -4132,7 +4141,7 @@
globals__io_lookup_bool_option(statistics, Statistics),
maybe_report_stats(Statistics),
- ( { PrivateIntError = fatal } ->
+ ( { PrivateIntError = fatal_module_errors } ->
{ ModAncestors = ModAncestors0 }
;
{ ModAncestors = [Ancestor | ModAncestors0] }
@@ -4188,7 +4197,7 @@
globals__io_lookup_bool_option(statistics, Statistics),
maybe_report_stats(Statistics),
- ( { LongIntError = fatal } ->
+ ( { LongIntError = fatal_module_errors } ->
{ ModImplementationImports =
ModImplementationImports0 },
{ Module1 = Module0 }
@@ -4408,8 +4417,8 @@
:- mode maybe_add_int_error(in, in, out) is det.
maybe_add_int_error(InterfaceError, ModError0, ModError) :-
- ( InterfaceError \= no ->
- ModError = yes
+ ( InterfaceError \= no_module_errors ->
+ ModError = some_module_errors
;
ModError = ModError0
).
Index: prog_io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io.m,v
retrieving revision 1.196
diff -u -b -r1.196 prog_io.m
--- prog_io.m 2001/06/27 05:04:21 1.196
+++ prog_io.m 2001/07/14 07:51:54
@@ -80,9 +80,9 @@
% Program is the parse tree.
:- type module_error
- ---> no % no errors
- ; yes % some syntax errors
- ; fatal. % couldn't open the file
+ ---> no_module_errors % no errors
+ ; some_module_errors % some syntax errors
+ ; fatal_module_errors. % couldn't open the file
:- type file_name == string.
:- type dir_name == string.
@@ -298,7 +298,7 @@
%
{ ModuleName = DefaultModuleName },
{ Items = [] },
- { Error = no },
+ { Error = no_module_errors },
{ Messages = [] }
;
read_all_items(DefaultModuleName, ModuleName,
@@ -314,7 +314,7 @@
string__append(Message2, "'", Message),
dummy_term(Term),
Messages = [Message - Term],
- Error = fatal,
+ Error = fatal_module_errors,
Items = [],
ModuleName = DefaultModuleName,
MaybeModuleTimestamp = no
@@ -399,7 +399,7 @@
add_error(
"`:- end_module' declaration doesn't match `:- module' declaration",
Term, Messages0, Messages),
- Error = yes
+ Error = some_module_errors
;
Messages = Messages0,
Error = Error0
@@ -555,7 +555,7 @@
},
{ make_module_decl(ModuleName, FirstContext, FixedFirstItem) },
{ Items0 = [FixedFirstItem] },
- { Error0 = no },
+ { Error0 = no_module_errors },
read_items_loop(ModuleName, SourceFileName,
Messages0, Items0, Error0,
Messages, Items, Error)
@@ -591,7 +591,7 @@
MaybeSecondItem) },
{ Items0 = [FixedFirstItem] },
- { Error0 = no },
+ { Error0 = no_module_errors },
read_items_loop_2(MaybeSecondItem, ModuleName, SourceFileName,
Messages0, Items0, Error0,
Messages, Items, Error)
@@ -665,7 +665,7 @@
ThisError = ErrorMsg - Term,
Msgs1 = [ThisError | Msgs0],
Items1 = Items0,
- Error1 = yes
+ Error1 = some_module_errors
},
read_items_loop(ModuleName, SourceFileName, Msgs1, Items1, Error1,
Msgs, Items, Error).
@@ -677,7 +677,7 @@
{
add_error(M, T, Msgs0, Msgs1),
Items1 = Items0,
- Error1 = yes
+ Error1 = some_module_errors
},
read_items_loop(ModuleName, SourceFileName, Msgs1, Items1, Error1,
Msgs, Items, Error).
@@ -697,7 +697,7 @@
globals__io_lookup_bool_option(halt_at_warn, Halt),
{ Halt = yes ->
- Error1 = yes
+ Error1 = some_module_errors
;
Error1 = Error0
}
Index: recompilation_check.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_check.m,v
retrieving revision 1.3
diff -u -b -r1.3 recompilation_check.m
--- recompilation_check.m 2001/07/11 15:44:21 1.3
+++ recompilation_check.m 2001/07/14 07:52:08
@@ -217,7 +217,7 @@
throw(recompile_exception(module_changed(FileName),
ErrorInfo))
;
- ( Error \= no
+ ( Error \= no_module_errors
; MaybeNewTimestamp = no
)
->
@@ -685,7 +685,7 @@
module_changed(FileName), Info1))
)
;
- Error \= no
+ Error \= no_module_errors
->
throw(recompile_exception(
file_error(FileName,
Index: trans_opt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trans_opt.m,v
retrieving revision 1.15
diff -u -b -r1.15 trans_opt.m
--- trans_opt.m 2000/02/07 00:12:41 1.15
+++ trans_opt.m 2001/07/14 07:52:15
@@ -138,7 +138,7 @@
{ module_imports_get_items(Module1, Items0) },
{ list__append(Items0, OptItems, Items) },
{ module_imports_set_items(Module1, Items, Module2) },
- { module_imports_set_error(Module2, no, Module) },
+ { module_imports_set_error(Module2, no_module_errors, Module) },
maybe_write_string(Verbose, "% Done.\n").
Index: typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.304
diff -u -b -r1.304 typecheck.m
--- typecheck.m 2001/07/13 17:34:57 1.304
+++ typecheck.m 2001/07/16 08:13:05
@@ -483,7 +483,6 @@
pred_info_set_unproven_body_constraints(PredInfo4,
UnprovenBodyConstraints, PredInfo5),
- is_bool(Inferring),
( Inferring = yes ->
%
% We need to infer which of the head variable
@@ -586,10 +585,6 @@
typecheck_info_get_io_state(TypeCheckInfo4, IOState)
)
).
-
-% is_bool/1 is used to avoid a type ambiguity
-:- pred is_bool(bool::in) is det.
-is_bool(_).
:- pred rename_instance_method_constraints(map(tvar, tvar),
maybe(instance_method_constraints),
cvs diff: Diffing notes
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list