diff --git a/compiler/accumulator.m b/compiler/accumulator.m index 8be05d545..1c157ec9d 100644 --- a/compiler/accumulator.m +++ b/compiler/accumulator.m @@ -329,7 +329,7 @@ accu_transform_proc(ProgressStream, proc(PredId, ProcId), PredInfo, %---------------------------------------------------------------------------% :- pred generate_accu_warnings(module_info::in, var_table::in, - list(accu_warning)::in, list(error_msg)::out) is det. + list(accu_warning)::in, list(diag_msg)::out) is det. generate_accu_warnings(_, _, [], []). generate_accu_warnings(ModuleInfo, VarTable, @@ -338,7 +338,7 @@ generate_accu_warnings(ModuleInfo, VarTable, generate_accu_warnings(ModuleInfo, VarTable, Warnings, Msgs). :- pred generate_accu_warning(module_info::in, var_table::in, accu_warning::in, - error_msg::out) is det. + diag_msg::out) is det. generate_accu_warning(ModuleInfo, VarTable, Warning, Msg) :- Warning = accu_warn(Context, PredId, VarA, VarB), diff --git a/compiler/add_mode.m b/compiler/add_mode.m index 0ab1af953..c9cfb843d 100644 --- a/compiler/add_mode.m +++ b/compiler/add_mode.m @@ -492,7 +492,7 @@ sna_context_is_for_module(ModuleName, SNA - _Context) :- :- pred local_sna_and_context_to_piece_and_msg(module_info::in, inst_or_mode::in, pair(sym_name_arity, prog_context)::in, - format_piece::out, error_msg::out) is det. + format_piece::out, diag_msg::out) is det. local_sna_and_context_to_piece_and_msg(ModuleInfo, InstOrMode, SNA - Context, SNAPiece, Msg) :- diff --git a/compiler/check_typeclass.m b/compiler/check_typeclass.m index 120a35ece..d1825b214 100644 --- a/compiler/check_typeclass.m +++ b/compiler/check_typeclass.m @@ -2812,7 +2812,7 @@ report_consistency_error(ClassId, ClassDefn, InstanceA, InstanceB, FunDep, PiecesB = [words("Here is the conflicting instance."), nl], MsgA = msg(ContextA, PiecesA), - MsgB = error_msg(yes(ContextB), always_treat_as_first, 0u, + MsgB = gen_msg(yes(ContextB), always_treat_as_first, 0u, [always(PiecesB)]), Spec = error_spec($pred, severity_error, phase_type_check, [MsgA, MsgB]), !:Specs = [Spec | !.Specs]. diff --git a/compiler/common.m b/compiler/common.m index 273f0d675..4d258e789 100644 --- a/compiler/common.m +++ b/compiler/common.m @@ -1196,7 +1196,7 @@ common_do_optimise_call(SeenCall, InputArgs, OutputArgs, Modes, GoalInfo, PrevPieces = [words("Here is the previous") | CallPieces] ++ [suffix(".")], Msg = msg(Context, CurPieces), - PrevMsg = error_msg(yes(PrevContext), always_treat_as_first, + PrevMsg = gen_msg(yes(PrevContext), always_treat_as_first, 0u, [always(PrevPieces)]), Severity = severity_warning(warn_duplicate_calls), Spec = error_spec($pred, Severity, diff --git a/compiler/det_check_goal.m b/compiler/det_check_goal.m index 63d26ae8b..1797d58f3 100644 --- a/compiler/det_check_goal.m +++ b/compiler/det_check_goal.m @@ -37,7 +37,7 @@ % Find out what is wrong, and return a list of messages giving the causes. % :- pred det_diagnose_goal_get_msgs(instmap::in, determinism::in, hlds_goal::in, - list(error_msg)::out, det_info::in, det_info::out) is det. + list(diag_msg)::out, det_info::in, det_info::out) is det. % det_diagnose_conj(InstMap0, FailingContexts, Desired, Goals, % Msgs, !DetInfo): @@ -54,7 +54,7 @@ % model_det. % :- pred det_diagnose_conj(instmap::in, list(switch_context)::in, - determinism::in, list(hlds_goal)::in, list(error_msg_group)::out, + determinism::in, list(hlds_goal)::in, list(diag_msg_group)::out, det_info::in, det_info::out) is det. %---------------------------------------------------------------------------% @@ -95,14 +95,14 @@ det_diagnose_goal_get_msgs(InstMap0, Desired, Goal, Msgs, !DetInfo) :- SwitchContexts = [], det_diagnose_goal(InstMap0, SwitchContexts, Desired, Goal, MsgGroups, !DetInfo), - sort_error_msg_groups(MsgGroups, SortedMsgGroups), - Msgs = flatten_error_msg_groups(SortedMsgGroups). + sort_diag_msg_groups(MsgGroups, SortedMsgGroups), + Msgs = flatten_diag_msg_groups(SortedMsgGroups). % The given goal should have determinism Desired, but doesn't. % Find out what is wrong, and return a list of messages giving the causes. % :- pred det_diagnose_goal(instmap::in, list(switch_context)::in, - determinism::in, hlds_goal::in, list(error_msg_group)::out, + determinism::in, hlds_goal::in, list(diag_msg_group)::out, det_info::in, det_info::out) is det. det_diagnose_goal(InstMap0, SwitchContexts, Desired, Goal, MsgGroups, @@ -127,7 +127,7 @@ det_diagnose_goal(InstMap0, SwitchContexts, Desired, Goal, MsgGroups, :- pred det_diagnose_goal_expr(hlds_goal_expr::in, hlds_goal_info::in, instmap::in, determinism::in, determinism::in, list(switch_context)::in, - det_info::in, det_info::out, list(error_msg_group)::out) is det. + det_info::in, det_info::out, list(diag_msg_group)::out) is det. det_diagnose_goal_expr(GoalExpr, GoalInfo, InstMap0, Desired, Actual, SwitchContexts, !DetInfo, MsgGroups) :- @@ -139,7 +139,7 @@ det_diagnose_goal_expr(GoalExpr, GoalInfo, InstMap0, Desired, Actual, det_diagnose_primitive_goal(Desired, Actual, ProblemPieces), Pieces = SurroundingContextPieces ++ [lower_case_next_if_not_first] ++ GoalPieces ++ ProblemPieces, - MsgGroups = [error_msg_group(msg(Context, Pieces), [])] + MsgGroups = [diag_msg_group(msg(Context, Pieces), [])] ; GoalExpr = plain_call(PredId, ProcId, _, _, CallContext, _), Context = goal_info_get_context(GoalInfo), @@ -148,7 +148,7 @@ det_diagnose_goal_expr(GoalExpr, GoalInfo, InstMap0, Desired, Actual, det_diagnose_primitive_goal(Desired, Actual, ProblemPieces), Pieces = AnyUnifyPieces ++ SurroundingContextPieces ++ [lower_case_next_if_not_first] ++ GoalPieces ++ ProblemPieces, - MsgGroups = [error_msg_group(msg(Context, Pieces), [])] + MsgGroups = [diag_msg_group(msg(Context, Pieces), [])] ; GoalExpr = generic_call(GenericCall, _, _, _, _), Context = goal_info_get_context(GoalInfo), @@ -159,7 +159,7 @@ det_diagnose_goal_expr(GoalExpr, GoalInfo, InstMap0, Desired, Actual, GoalPieces = color_as_subject(GenericCallPieces), det_diagnose_primitive_goal(Desired, Actual, ProblemPieces), Pieces = GoalPieces ++ ProblemPieces, - MsgGroups = [error_msg_group(msg(Context, Pieces), [])] + MsgGroups = [diag_msg_group(msg(Context, Pieces), [])] ; GoalExpr = call_foreign_proc(_, _, _, _, _, _, _), Context = goal_info_get_context(GoalInfo), @@ -167,7 +167,7 @@ det_diagnose_goal_expr(GoalExpr, GoalInfo, InstMap0, Desired, Actual, Pieces = [words("Determinism declaration not satisfied."), words("Desired determinism is"), words(DesiredStr), suffix("."), nl], - MsgGroups = [error_msg_group(msg(Context, Pieces), [])] + MsgGroups = [diag_msg_group(msg(Context, Pieces), [])] ; GoalExpr = conj(_, Goals), det_diagnose_conj(InstMap0, SwitchContexts, Desired, @@ -225,7 +225,7 @@ det_diagnose_goal_expr(GoalExpr, GoalInfo, InstMap0, Desired, Actual, ), list.sort(LaterSolnDisjuncts, SortedLaterSolnDisjuncts), LaterMsgs = list.map(MakeLaterMsgs, SortedLaterSolnDisjuncts), - DisjMsgGroup = error_msg_group(FirstMsg, LaterMsgs), + DisjMsgGroup = diag_msg_group(FirstMsg, LaterMsgs), MsgGroups = [DisjMsgGroup | SubMsgGroups] else MsgGroups = SubMsgGroups @@ -262,7 +262,7 @@ det_diagnose_goal_expr(GoalExpr, GoalInfo, InstMap0, Desired, Actual, Component = always(NestingPieces ++ NoCoverPieces) ), SwitchMsg = simple_msg(Context, [Component]), - SwitchMsgGroups = [error_msg_group(SwitchMsg, [])] + SwitchMsgGroups = [diag_msg_group(SwitchMsg, [])] else SwitchMsgGroups = [] ), @@ -303,14 +303,14 @@ det_diagnose_goal_expr(GoalExpr, GoalInfo, InstMap0, Desired, Actual, then Context = goal_info_get_context(GoalInfo), Pieces = [words("Negated goal can succeed."), nl], - MsgGroups = [error_msg_group(msg(Context, Pieces), [])] + MsgGroups = [diag_msg_group(msg(Context, Pieces), [])] else if DesiredSolns = at_most_zero, ActualSolns \= at_most_zero then Context = goal_info_get_context(GoalInfo), Pieces = [words("Negated goal can fail."), nl], - MsgGroups = [error_msg_group(msg(Context, Pieces), [])] + MsgGroups = [diag_msg_group(msg(Context, Pieces), [])] else MsgGroups = [] ) @@ -438,7 +438,7 @@ det_diagnose_conj(InstMap0, SwitchContexts, Desired, :- pred det_diagnose_disj(instmap::in, list(switch_context)::in, determinism::in, determinism::in, - list(hlds_goal)::in, list(error_msg_group)::out, + list(hlds_goal)::in, list(diag_msg_group)::out, bag(soln_disjunct)::in, bag(soln_disjunct)::out, det_info::in, det_info::out) is det. @@ -487,7 +487,7 @@ det_diagnose_disj(InstMap0, SwitchContexts, Desired, Actual, :- pred det_diagnose_switch_arms(instmap::in, list(switch_context)::in, determinism::in, prog_var::in, mer_type::in, - list(case)::in, list(error_msg_group)::out, + list(case)::in, list(diag_msg_group)::out, det_info::in, det_info::out) is det. det_diagnose_switch_arms(_InstMap0, _Desired, _SwitchContexts, _Var, _VarType, @@ -511,7 +511,7 @@ det_diagnose_switch_arms(InstMap0, SwitchContexts0, Desired, Var, VarType, MsgGroups = HeadMsgGroups ++ TailMsgGroups. :- pred det_diagnose_orelse_goals(instmap::in, list(switch_context)::in, - determinism::in, list(hlds_goal)::in, list(error_msg_group)::out, + determinism::in, list(hlds_goal)::in, list(diag_msg_group)::out, det_info::in, det_info::out) is det. det_diagnose_orelse_goals(_InstMap, _SwitchContexts, _Desired, diff --git a/compiler/det_check_proc.m b/compiler/det_check_proc.m index bea4a70d8..0ebe57231 100644 --- a/compiler/det_check_proc.m +++ b/compiler/det_check_proc.m @@ -293,7 +293,7 @@ check_for_too_tight_or_loose_declared_determinism(PredProcId, ) ). -:- pred cse_nopull_msgs(proc_info::in, list(error_msg)::out) is det. +:- pred cse_nopull_msgs(proc_info::in, list(diag_msg)::out) is det. cse_nopull_msgs(ProcInfo, Msgs) :- proc_info_get_cse_nopull_contexts(ProcInfo, CseNoPullContexts), @@ -905,7 +905,7 @@ is_proc_pragma_exported([ExportProc | ExportProcs], PredId, ProcId, Context) :- :- pred report_determinism_problem(module_info::in, pred_proc_id::in, string::in, string::in, list(format_piece)::in, - determinism::in, determinism::in, error_msg::out) is det. + determinism::in, determinism::in, diag_msg::out) is det. report_determinism_problem(ModuleInfo, PredProcId, ErrorOrWarn, ProblemStr, ReasonPieces, DeclaredDetism, InferredDetism, Msg) :- diff --git a/compiler/det_infer_goal.m b/compiler/det_infer_goal.m index 2609b7065..5286ecba8 100644 --- a/compiler/det_infer_goal.m +++ b/compiler/det_infer_goal.m @@ -984,8 +984,8 @@ det_infer_par_conj(InstMap0, SolnContext, MaybePromiseEqvSolutionSets, SwitchContexts = [], det_diagnose_conj(InstMap0, SwitchContexts, detism_det, Goals, GoalMsgGroups, !DetInfo), - sort_error_msg_groups(GoalMsgGroups, SortedGoalMsgGroups), - SortedGoalMsgs = flatten_error_msg_groups(SortedGoalMsgGroups), + sort_diag_msg_groups(GoalMsgGroups, SortedGoalMsgGroups), + SortedGoalMsgs = flatten_diag_msg_groups(SortedGoalMsgGroups), Spec = error_spec($pred, severity_error, phase_detism_check, [msg(Context, Pieces)] ++ SortedGoalMsgs), det_info_add_error_spec(Spec, !DetInfo) @@ -1899,14 +1899,14 @@ noncanon_unify_verbose_would_require = % Describe the given list of failing contexts. % :- func failing_contexts_description(module_info, var_table, - list(failing_context)) = list(error_msg). + list(failing_context)) = list(diag_msg). failing_contexts_description(ModuleInfo, VarTable, FailingContexts) = list.map(failing_context_description(ModuleInfo, VarTable), FailingContexts). :- func failing_context_description(module_info, var_table, - failing_context) = error_msg. + failing_context) = diag_msg. failing_context_description(ModuleInfo, VarTable, FailingContext) = Msg :- FailingContext = failing_context(Context, FailingGoal), diff --git a/compiler/error_sort.m b/compiler/error_sort.m index aa5845292..cbb51915e 100644 --- a/compiler/error_sort.m +++ b/compiler/error_sort.m @@ -10,7 +10,7 @@ % File: error_sort.m. % Main author: zs. % -% This module sorts error_specs and error_msgs. +% This module sorts error_specs and diag_msgs. % %---------------------------------------------------------------------------% @@ -51,20 +51,20 @@ %---------------------------------------------------------------------------% -:- type error_msg_group - ---> error_msg_group(error_msg, list(error_msg)). +:- type diag_msg_group + ---> diag_msg_group(diag_msg, list(diag_msg)). -:- pred sort_error_msg_groups(list(error_msg_group)::in, - list(error_msg_group)::out) is det. +:- pred sort_diag_msg_groups(list(diag_msg_group)::in, + list(diag_msg_group)::out) is det. %---------------------------------------------------------------------------% -:- func flatten_error_msg_groups(list(error_msg_group)) = list(error_msg). -:- func flatten_error_msg_group(error_msg_group) = list(error_msg). +:- func flatten_diag_msg_groups(list(diag_msg_group)) = list(diag_msg). +:- func flatten_diag_msg_group(diag_msg_group) = list(diag_msg). %---------------------------------------------------------------------------% -:- pred sort_error_msgs(list(error_msg)::in, list(error_msg)::out) is det. +:- pred sort_diag_msgs(list(diag_msg)::in, list(diag_msg)::out) is det. %---------------------------------------------------------------------------% %---------------------------------------------------------------------------% @@ -87,14 +87,14 @@ standardize_error_specs(Specs, StdSpecs) :- standardize_error_spec(Spec0, StdSpec) :- ( Spec0 = error_spec(Id, Severity, Phase, Msgs0), - list.map(standardize_error_msg, Msgs0, StdMsgs) + list.map(standardize_diag_msg, Msgs0, StdMsgs) ; Spec0 = spec(Id, Severity, Phase, Context0, Pieces0), - StdMsgs = [error_msg(yes(Context0), treat_based_on_posn, 0u, + StdMsgs = [gen_msg(yes(Context0), treat_based_on_posn, 0u, [always(Pieces0)])] ; Spec0 = no_ctxt_spec(Id, Severity, Phase, Pieces0), - StdMsgs = [error_msg(no, treat_based_on_posn, 0u, + StdMsgs = [gen_msg(no, treat_based_on_posn, 0u, [always(Pieces0)])] ), ( @@ -105,9 +105,9 @@ standardize_error_spec(Spec0, StdSpec) :- StdSpec = error_spec(Id, Severity, Phase, StdMsgs) ). -:- pred standardize_error_msg(error_msg::in, std_error_msg::out) is det. +:- pred standardize_diag_msg(diag_msg::in, std_diag_msg::out) is det. -standardize_error_msg(Msg0, StdMsg) :- +standardize_diag_msg(Msg0, StdMsg) :- ( Msg0 = msg(Context, Pieces0), MaybeContext = yes(Context), @@ -126,7 +126,7 @@ standardize_error_msg(Msg0, StdMsg) :- TreatAsFirst = treat_based_on_posn, ExtraIndent = 0u ; - Msg0 = error_msg(MaybeContext, TreatAsFirst, ExtraIndent, + Msg0 = gen_msg(MaybeContext, TreatAsFirst, ExtraIndent, StdComponents) ; Msg0 = blank_msg(MaybeContext), @@ -139,10 +139,10 @@ standardize_error_msg(Msg0, StdMsg) :- % In this situation, we used to just fail, making both this predicate, % and its caller standardize_error_spec, semidet. % - % This was when we still had error_msgs that were conditional on + % This was when we still had diag_msgs that were conditional on % the value of an option. Ever since we moved all such conditionality % to the top level (to the severity of the error_spec), we never delete - % any error_msgs from an error_spec. The only way that execution can + % any diag_msgs from an error_spec. The only way that execution can % *now* get here is if the error_spec was *constructed* with zero % components. That would be a bug, which we catch here. % @@ -154,7 +154,7 @@ standardize_error_msg(Msg0, StdMsg) :- unexpected($pred, "StdComponents = []") ; StdComponents = [_ | _], - StdMsg = error_msg(MaybeContext, TreatAsFirst, + StdMsg = gen_msg(MaybeContext, TreatAsFirst, ExtraIndent, StdComponents) ). @@ -179,7 +179,7 @@ sort_std_error_specs_opt_table(OptionTable, StdSpecs, SortedStdSpecs) :- compare_std_error_specs(ReverseErrorOrder, SpecA, SpecB, Result) :- SpecA = error_spec(_, _, _, MsgsA), SpecB = error_spec(_, _, _, MsgsB), - compare_std_error_msg_lists(ReverseErrorOrder, MsgsA, MsgsB, MsgsResult), + compare_std_diag_msg_lists(ReverseErrorOrder, MsgsA, MsgsB, MsgsResult), ( MsgsResult = (=), compare(Result, SpecA, SpecB) @@ -190,11 +190,11 @@ compare_std_error_specs(ReverseErrorOrder, SpecA, SpecB, Result) :- Result = MsgsResult ). -:- pred compare_std_error_msg_lists(bool::in, - list(std_error_msg)::in, list(std_error_msg)::in, +:- pred compare_std_diag_msg_lists(bool::in, + list(std_diag_msg)::in, list(std_diag_msg)::in, comparison_result::out) is det. -compare_std_error_msg_lists(ReverseErrorOrder, MsgsA, MsgsB, Result) :- +compare_std_diag_msg_lists(ReverseErrorOrder, MsgsA, MsgsB, Result) :- ( MsgsA = [], MsgsB = [], @@ -210,11 +210,11 @@ compare_std_error_msg_lists(ReverseErrorOrder, MsgsA, MsgsB, Result) :- ; MsgsA = [HeadMsgA | TailMsgsA], MsgsB = [HeadMsgB | TailMsgsB], - compare_error_msgs(ReverseErrorOrder, + compare_diag_msgs(ReverseErrorOrder, coerce(HeadMsgA), coerce(HeadMsgB), HeadResult), ( HeadResult = (=), - compare_std_error_msg_lists(ReverseErrorOrder, + compare_std_diag_msg_lists(ReverseErrorOrder, TailMsgsA, TailMsgsB, Result) ; ( HeadResult = (>) @@ -226,16 +226,16 @@ compare_std_error_msg_lists(ReverseErrorOrder, MsgsA, MsgsB, Result) :- %---------------------------------------------------------------------------% -sort_error_msg_groups(MsgGroups0, MsgGroups) :- - list.sort_and_remove_dups(compare_error_msg_groups, MsgGroups0, MsgGroups). +sort_diag_msg_groups(MsgGroups0, MsgGroups) :- + list.sort_and_remove_dups(compare_diag_msg_groups, MsgGroups0, MsgGroups). -:- pred compare_error_msg_groups(error_msg_group::in, error_msg_group::in, +:- pred compare_diag_msg_groups(diag_msg_group::in, diag_msg_group::in, comparison_result::out) is det. -compare_error_msg_groups(GroupA, GroupB, Result) :- - GroupA = error_msg_group(HeadMsgA, TailMsgsA), - GroupB = error_msg_group(HeadMsgB, TailMsgsB), - compare_error_msgs(no, HeadMsgA, HeadMsgB, Result0), +compare_diag_msg_groups(GroupA, GroupB, Result) :- + GroupA = diag_msg_group(HeadMsgA, TailMsgsA), + GroupB = diag_msg_group(HeadMsgB, TailMsgsB), + compare_diag_msgs(no, HeadMsgA, HeadMsgB, Result0), ( Result0 = (=), ( @@ -253,9 +253,9 @@ compare_error_msg_groups(GroupA, GroupB, Result) :- ; TailMsgsA = [HeadTailMsgA | TailTailMsgsA], TailMsgsB = [HeadTailMsgB | TailTailMsgsB], - TailGroupA = error_msg_group(HeadTailMsgA, TailTailMsgsA), - TailGroupB = error_msg_group(HeadTailMsgB, TailTailMsgsB), - compare_error_msg_groups(TailGroupA, TailGroupB, Result) + TailGroupA = diag_msg_group(HeadTailMsgA, TailTailMsgsA), + TailGroupB = diag_msg_group(HeadTailMsgB, TailTailMsgsB), + compare_diag_msg_groups(TailGroupA, TailGroupB, Result) ) ; ( Result0 = (<) @@ -266,23 +266,23 @@ compare_error_msg_groups(GroupA, GroupB, Result) :- %---------------------------------------------------------------------------% -flatten_error_msg_groups(Groups) = Msgs :- - MsgLists = list.map(flatten_error_msg_group, Groups), +flatten_diag_msg_groups(Groups) = Msgs :- + MsgLists = list.map(flatten_diag_msg_group, Groups), list.condense(MsgLists, Msgs). -flatten_error_msg_group(Group) = Msgs :- - Group= error_msg_group(HeadMsg, TailMsgs), +flatten_diag_msg_group(Group) = Msgs :- + Group= diag_msg_group(HeadMsg, TailMsgs), Msgs = [HeadMsg | TailMsgs]. %---------------------------------------------------------------------------% -sort_error_msgs(Msgs0, Msgs) :- - list.sort_and_remove_dups(compare_error_msgs(no), Msgs0, Msgs). +sort_diag_msgs(Msgs0, Msgs) :- + list.sort_and_remove_dups(compare_diag_msgs(no), Msgs0, Msgs). -:- pred compare_error_msgs(bool::in, error_msg::in, error_msg::in, +:- pred compare_diag_msgs(bool::in, diag_msg::in, diag_msg::in, comparison_result::out) is det. -compare_error_msgs(ReverseErrorOrder, MsgA, MsgB, Result) :- +compare_diag_msgs(ReverseErrorOrder, MsgA, MsgB, Result) :- extract_msg_maybe_context(MsgA, MaybeContextA), extract_msg_maybe_context(MsgB, MaybeContextB), % The context comparison makes sense only if both Msgs have a context. @@ -329,7 +329,7 @@ compare_error_msgs(ReverseErrorOrder, MsgA, MsgB, Result) :- ) ). -:- func project_msg_components(error_msg) = list(error_msg_component). +:- func project_msg_components(diag_msg) = list(diag_msg_component). project_msg_components(Msg) = Components :- ( @@ -340,7 +340,7 @@ project_msg_components(Msg) = Components :- ; Msg = simple_msg(_, Components) ; - Msg = error_msg(_, _, _, Components) + Msg = gen_msg(_, _, _, Components) ; Msg = blank_msg(_), Components = [always([blank_line])] diff --git a/compiler/error_spec.m b/compiler/error_spec.m index 62878b776..ce91a301a 100644 --- a/compiler/error_spec.m +++ b/compiler/error_spec.m @@ -101,7 +101,7 @@ es_id :: string, es_severity :: spec_severity, es_phase :: spec_phase, - es_msgs :: list(error_msg) + es_msgs :: list(diag_msg) ). % An error_spec that is *intended* to contain a warning, @@ -114,7 +114,7 @@ es_id :: string, es_severity :: spec_severity, es_phase :: spec_phase, - es_msgs :: list(std_error_msg) + es_msgs :: list(std_diag_msg) ). % Many operations in the compiler may either succeed or fail. @@ -213,14 +213,14 @@ %---------------------------------------------------------------------------% -% An error message may have several components that may be printed under +% An diagnostic message may have several components that may be printed under % different circumstances. Some components are always printed; some are -% printed only if specific options have specific values. When an error -% specification is printed, we concatenate the list of all the -% format_pieces that should be printed. If this yields the empty list, -% we print nothing. Otherwise, we print them all out. +% printed only if the verbose option is set. When an diagnostic is printed, +% we concatenate the list of all the format_pieces that should be printed. +% If this yields the empty list, we print nothing. Otherwise, we print them +% all out. % -% When we print an error message in a list of error messages, we normally +% When we print an diagnostic message in a list of diagnostics, we normally % treat the first line of the first message differently than the rest: % we separate it from the context by one space, whereas following lines % are separated by three spaces. You can request that the first line of @@ -230,7 +230,7 @@ % the error_extra_indent field to a strictly positive value. % % The term simple_msg(Context, Components) is a shorthand for (and equivalent -% in every respect to) the term error_msg(yes(Context), treat_based_on_posn, +% in every respect to) the term gen_msg(yes(Context), treat_based_on_posn, % 0, Components). % % The term msg(Context, Pieces) is a shorthand for (and equivalent @@ -240,7 +240,7 @@ ---> always_treat_as_first ; treat_based_on_posn. -:- type error_msg +:- type diag_msg ---> msg( simplest_context :: prog_context, simplest_pieces :: list(format_piece) @@ -250,24 +250,24 @@ ) ; simple_msg( simple_context :: prog_context, - simple_components :: list(error_msg_component) + simple_components :: list(diag_msg_component) ) - ; error_msg( - error_context :: maybe(prog_context), - error_treat_as_first :: maybe_always_treat_as_first, - error_extra_indent :: uint, - error_components :: list(error_msg_component) + ; gen_msg( + gen_context :: maybe(prog_context), + gen_treat_as_first :: maybe_always_treat_as_first, + gen_extra_indent :: uint, + gen_components :: list(diag_msg_component) ) ; blank_msg( blank_context :: maybe(prog_context) ). -:- type std_error_msg =< error_msg - ---> error_msg( - error_context :: maybe(prog_context), - error_treat_as_first :: maybe_always_treat_as_first, - error_extra_indent :: uint, - error_components :: list(error_msg_component) +:- type std_diag_msg =< diag_msg + ---> gen_msg( + gen_context :: maybe(prog_context), + gen_treat_as_first :: maybe_always_treat_as_first, + gen_extra_indent :: uint, + gen_components :: list(diag_msg_component) ). :- type verbose_always_or_once @@ -276,7 +276,7 @@ % Message components marked as verbose_once should be printed % just once. -:- type error_msg_component +:- type diag_msg_component ---> always(list(format_piece)) % Print these components under all circumstances. @@ -597,11 +597,11 @@ :- pred append_prefix_and_maybe_verbose(maybe(color_name)::in, list(format_piece)::in, list(format_piece)::in, list(format_piece)::in, list(format_piece)::in, - error_msg_component::out) is det. + diag_msg_component::out) is det. %---------------------------------------------------------------------------% -:- pred extract_msg_maybe_context(error_msg::in, maybe(prog_context)::out) +:- pred extract_msg_maybe_context(diag_msg::in, maybe(prog_context)::out) is det. :- pred extract_spec_phase(error_spec::in, spec_phase::out) is det. @@ -614,15 +614,15 @@ %---------------------------------------------------------------------------% :- pred extract_spec_msgs_and_id(error_spec::in, - list(error_msg)::out, string::out) is det. + list(diag_msg)::out, string::out) is det. :- pred extract_spec_msgs_and_maybe_add_id(globals::in, error_spec::in, - list(error_msg)::out) is det. + list(diag_msg)::out) is det. :- pred maybe_add_error_spec_id(option_table::in, string::in, - list(error_msg)::in, list(error_msg)::out) is det. + list(diag_msg)::in, list(diag_msg)::out) is det. :- pred maybe_add_error_spec_id_std(option_table::in, string::in, - list(std_error_msg)::in, list(std_error_msg)::out) is det. + list(std_diag_msg)::in, list(std_diag_msg)::out) is det. %---------------------------------------------------------------------------% @@ -987,41 +987,41 @@ extract_msg_maybe_context(Msg, MaybeContext) :- ), MaybeContext = yes(Context) ; - ( Msg = error_msg(MaybeContext, _, _, _) + ( Msg = gen_msg(MaybeContext, _, _, _) ; Msg = blank_msg(MaybeContext) ) ). extract_spec_phase(Spec, Phase) :- ( - Spec = error_spec(_, _, Phase, _) - ; Spec = spec(_, _, Phase, _, _) ; Spec = no_ctxt_spec(_, _, Phase, _) + ; + Spec = error_spec(_, _, Phase, _) ). extract_spec_severity(Spec, Severity) :- ( - Spec = error_spec(_, Severity, _, _) - ; Spec = spec(_, Severity, _, _, _) ; Spec = no_ctxt_spec(_, Severity, _, _) + ; + Spec = error_spec(_, Severity, _, _) ). accumulate_contexts(Spec, !Contexts) :- ( - Spec = error_spec(_, _, _, Msgs), - list.foldl(accumulate_contexts_in_msg, Msgs, !Contexts) - ; Spec = spec(_, _, _, Context, _), set.insert(Context, !Contexts) ; Spec = no_ctxt_spec(_, _, _, _) + ; + Spec = error_spec(_, _, _, Msgs), + list.foldl(accumulate_contexts_in_msg, Msgs, !Contexts) ). -:- pred accumulate_contexts_in_msg(error_msg::in, +:- pred accumulate_contexts_in_msg(diag_msg::in, set(prog_context)::in, set(prog_context)::out) is det. accumulate_contexts_in_msg(Msg, !Contexts) :- @@ -1037,13 +1037,13 @@ accumulate_contexts_in_msg(Msg, !Contexts) :- extract_spec_msgs_and_id(Spec, Msgs, Id) :- ( - Spec = error_spec(Id, _Severity, _Phase, Msgs) - ; Spec = spec(Id, _Severity, _Phase, Context, Pieces), Msgs = [msg(Context, Pieces)] ; Spec = no_ctxt_spec(Id, _Severity, _Phase, Pieces), Msgs = [no_ctxt_msg(Pieces)] + ; + Spec = error_spec(Id, _Severity, _Phase, Msgs) ). %---------------------------------------------------------------------------% @@ -1068,7 +1068,7 @@ maybe_add_error_spec_id(OptionTable, Id, Msgs0, Msgs) :- ; Msgs0 = [HeadMsg | _], extract_msg_maybe_context(HeadMsg, MaybeHeadContext), - IdMsg = error_msg(MaybeHeadContext, treat_based_on_posn, 0u, + IdMsg = gen_msg(MaybeHeadContext, treat_based_on_posn, 0u, [always([words("error_spec id:"), fixed(Id), nl])]), Msgs = Msgs0 ++ [IdMsg] ) @@ -1089,7 +1089,7 @@ maybe_add_error_spec_id_std(OptionTable, Id, StdMsgs0, StdMsgs) :- ; StdMsgs0 = [StdHeadMsg | _], extract_msg_maybe_context(coerce(StdHeadMsg), MaybeHeadContext), - StdIdMsg = error_msg(MaybeHeadContext, treat_based_on_posn, 0u, + StdIdMsg = gen_msg(MaybeHeadContext, treat_based_on_posn, 0u, [always([words("error_spec id:"), fixed(Id), nl])]), StdMsgs = StdMsgs0 ++ [StdIdMsg] ) diff --git a/compiler/error_util.m b/compiler/error_util.m index 7ccc8ca2d..ce1fa60de 100644 --- a/compiler/error_util.m +++ b/compiler/error_util.m @@ -135,7 +135,7 @@ %---------------------------------------------------------------------------% -:- func start_each_msg_with_blank_line(list(error_msg)) = list(error_msg). +:- func start_each_msg_with_blank_line(list(diag_msg)) = list(diag_msg). %---------------------------------------------------------------------------% @@ -198,7 +198,7 @@ does_spec_print_anything_2(Spec) = Prints :- bool.or_list(PrintsList, Prints) ). -:- func does_msg_print_anything(error_msg) = bool. +:- func does_msg_print_anything(diag_msg) = bool. does_msg_print_anything(Msg) = Prints :- ( @@ -211,7 +211,7 @@ does_msg_print_anything(Msg) = Prints :- Prints = no ; ( Msg = simple_msg(_, MsgComponents) - ; Msg = error_msg(_, _, _, MsgComponents) + ; Msg = gen_msg(_, _, _, MsgComponents) ), ( MsgComponents = [], diff --git a/compiler/fact_table_gen.m b/compiler/fact_table_gen.m index a9a5189ac..4e1fab476 100644 --- a/compiler/fact_table_gen.m +++ b/compiler/fact_table_gen.m @@ -3868,7 +3868,7 @@ delete_temporary_file(FileName, !Specs, !IO) :- quote(FileName), suffix(":"), nl, words(ErrorMsg), suffix("."), nl], Spec = error_spec($pred, severity_error, phase_fact_table_check, - [error_msg(no, treat_based_on_posn, 0u, [always(Pieces)])]), + [gen_msg(no, treat_based_on_posn, 0u, [always(Pieces)])]), !:Specs = [Spec | !.Specs] ). @@ -3884,7 +3884,7 @@ add_call_system_error(Cmd, ErrorCode, !Specs, !IO) :- words("error executing system command"), quote(Cmd), suffix(":"), nl, words(ErrorMsg), suffix("."), nl], Spec = error_spec($pred, severity_error, phase_fact_table_check, - [error_msg(no, treat_based_on_posn, 0u, [always(Pieces)])]), + [gen_msg(no, treat_based_on_posn, 0u, [always(Pieces)])]), !:Specs = [Spec | !.Specs]. %---------------------------------------------------------------------------% @@ -3901,7 +3901,7 @@ add_file_open_error(MaybeContext, FileName, InOrOut, Error, !Specs, !IO) :- words("for"), words(InOrOut), suffix(":"), nl, words(ErrorMsg), nl], Spec = error_spec($pred, severity_error, phase_fact_table_check, - [error_msg(MaybeContext, treat_based_on_posn, 0u, [always(Pieces)])]), + [gen_msg(MaybeContext, treat_based_on_posn, 0u, [always(Pieces)])]), !:Specs = [Spec | !.Specs]. %---------------------------------------------------------------------------% diff --git a/compiler/mark_tail_calls.m b/compiler/mark_tail_calls.m index 7613f5c0a..d457a9a48 100644 --- a/compiler/mark_tail_calls.m +++ b/compiler/mark_tail_calls.m @@ -1315,7 +1315,7 @@ caller_proc_id_pieces(MaybeCallerProcId, ProcIdPieces) :- ). :- pred nontail_rec_call_reason_to_pieces(nontail_rec_call_reason::in, - prog_context::in, list(format_piece)::out, list(error_msg)::out) is det. + prog_context::in, list(format_piece)::out, list(diag_msg)::out) is det. nontail_rec_call_reason_to_pieces(Reason, Context, ReasonPieces, VerboseMsgs) :- diff --git a/compiler/mercury_compile_args.m b/compiler/mercury_compile_args.m index 79620d9df..cc3bc2ef8 100644 --- a/compiler/mercury_compile_args.m +++ b/compiler/mercury_compile_args.m @@ -473,7 +473,7 @@ report_option_error(OptionError) = Specs :- ), maybe_construct_prefixed_did_you_mean_pieces(Prefix, BaseOptionStr, OptionStrs, DidYouMeanPieces), - DidYouMeanMsg = error_msg(no, always_treat_as_first, 0u, + DidYouMeanMsg = gen_msg(no, always_treat_as_first, 0u, [always(DidYouMeanPieces)]), Msgs = [MainMsg, DidYouMeanMsg] else diff --git a/compiler/mode_errors.m b/compiler/mode_errors.m index 4df0f103f..1a63b1e55 100644 --- a/compiler/mode_errors.m +++ b/compiler/mode_errors.m @@ -1669,8 +1669,7 @@ mode_error_unschedulable_conjuncts_to_spec(ModeInfo, OoMErrors, Culprit) Phase = phase_mode_check(report_in_any_mode), Spec = error_spec($pred, severity_error, Phase, Msgs1 ++ Msgs2). -:- func prefix_with_blank_line(prog_context, list(error_msg)) - = list(error_msg). +:- func prefix_with_blank_line(prog_context, list(diag_msg)) = list(diag_msg). prefix_with_blank_line(Context, Msgs) = [BlankMsg | Msgs] :- BlankMsg = msg(Context, [blank_line]). @@ -1695,7 +1694,7 @@ is_error_important(Error) :- ). :- func mode_error_conjunct_to_msgs(prog_context, mode_info, delayed_goal) - = list(error_msg). + = list(diag_msg). mode_error_conjunct_to_msgs(Context, !.ModeInfo, DelayedGoal) = Msgs :- mode_info_get_module_info(!.ModeInfo, ModuleInfo), @@ -1750,7 +1749,7 @@ mode_error_conjunct_to_msgs(Context, !.ModeInfo, DelayedGoal) = Msgs :- % even if it turns out to be very short (which can happen e.g. % for unifications). Components2 = [always([nl, fixed(GoalStr), nl])], - Msg2 = error_msg(no, treat_based_on_posn, 0u, Components2), + Msg2 = gen_msg(no, treat_based_on_posn, 0u, Components2), Msgs = [Msg1, Msg2] ++ SubMsgs ) ). @@ -2260,20 +2259,20 @@ mode_error_in_callee_to_spec(!.ModeInfo, Vars, Insts, LaterMsgs0 = [LaterHead0 | LaterTail], ( LaterHead0 = msg(LaterContext, Pieces), - LaterHead = error_msg(yes(LaterContext), always_treat_as_first, + LaterHead = gen_msg(yes(LaterContext), always_treat_as_first, 0u, [always(Pieces)]) ; LaterHead0 = no_ctxt_msg(Pieces), - LaterHead = error_msg(no, always_treat_as_first, + LaterHead = gen_msg(no, always_treat_as_first, 0u, [always(Pieces)]) ; LaterHead0 = simple_msg(LaterContext, Components), - LaterHead = error_msg(yes(LaterContext), always_treat_as_first, + LaterHead = gen_msg(yes(LaterContext), always_treat_as_first, 0u, Components) ; - LaterHead0 = error_msg(MaybeLaterContext, _, + LaterHead0 = gen_msg(MaybeLaterContext, _, Indent, Components), - LaterHead = error_msg(MaybeLaterContext, always_treat_as_first, + LaterHead = gen_msg(MaybeLaterContext, always_treat_as_first, Indent, Components) ; LaterHead0 = blank_msg(MaybeLaterContext), @@ -2406,7 +2405,7 @@ purity_error_lambda_should_be_any_to_spec(ModeInfo, OoMVars) = Spec :- ; is_disjunctive. :- func merge_error_to_msgs(mode_info, prog_context, maybe_is_disjunctive, - merge_error) = list(error_msg). + merge_error) = list(diag_msg). merge_error_to_msgs(ModeInfo, MainContext, IsDisjunctive, MergeError) = Msgs :- MergeError = merge_error(Var, ContextsInsts0), @@ -2502,7 +2501,7 @@ count_ground_insts(ModuleInfo, Type, [ContextInst | ContextsInsts], ; report_inst_and_groundness. :- func report_inst_in_context(mode_info, report_inst_how, maybe(color_name), - format_piece, mer_type, pair(prog_context, mer_inst)) = error_msg. + format_piece, mer_type, pair(prog_context, mer_inst)) = diag_msg. report_inst_in_context(ModeInfo, ReportIsGround, MaybeColor, VarNamePiece, Type, Context - Inst) = Msg :- diff --git a/compiler/old_type_constraints.m b/compiler/old_type_constraints.m index 98e64db69..167b77b42 100644 --- a/compiler/old_type_constraints.m +++ b/compiler/old_type_constraints.m @@ -407,7 +407,7 @@ typecheck_one_predicate(PredId, !Environment, !HLDS, !Specs) :- % :- pred update_goal(pred_env::in, type_constraint_map::in, goal_forward_path_map::in, hlds_goal::in, hlds_goal::out, - list(error_msg)::out) is det. + list(diag_msg)::out) is det. update_goal(PredEnv, ConstraintMap, ForwardGoalPathMap, !Goal, Errors) :- Disjunctions = map.values(ConstraintMap), @@ -481,7 +481,7 @@ has_one_disjunct(tconstr_conj(C), C). % :- pred create_vartypes_map(prog_context::in, prog_varset::in, tvarset::in, prog_var_map::in, type_domain_map::in, simple_prog_var_map::in, - vartypes::out, list(error_msg)::out) is det. + vartypes::out, list(diag_msg)::out) is det. create_vartypes_map(Context, ProgVarSet, TVarSet, VarMap, DomainMap, ReplacementMap, VarTypes, Errors) :- @@ -498,7 +498,7 @@ create_vartypes_map(Context, ProgVarSet, TVarSet, VarMap, DomainMap, % :- pred find_variable_type(prog_context::in, prog_varset::in, tvarset::in, prog_var_map::in, type_domain_map::in, simple_prog_var_map::in, - prog_var::in, mer_type::out, maybe(error_msg)::out) is det. + prog_var::in, mer_type::out, maybe(diag_msg)::out) is det. find_variable_type(Context, ProgVarSet, TVarSet, VarMap, DomainMap, ReplacementMap, Var, Type, MaybeMsg) :- @@ -2075,7 +2075,7 @@ merge_type_constraints2(A, B, Result) :- % of the predicate call constraints (chosen arbitrarily). Otherwise, fail. % :- pred diagnose_ambig_pred_error(pred_env::in, list(conj_type_constraint)::in, - error_msg::out) is semidet. + diag_msg::out) is semidet. diagnose_ambig_pred_error(PredEnv, Conjunctions, Msg) :- head(Conjunctions, HeadConjunct), @@ -2089,7 +2089,7 @@ diagnose_ambig_pred_error(PredEnv, Conjunctions, Msg) :- Msg = simple_msg(Context, Pieces). :- pred ambig_pred_error_message(pred_env::in, pair(goal_id, pred_id)::in, - error_msg_component::out) is det. + diag_msg_component::out) is det. ambig_pred_error_message(PredEnv, (_ - PredId), Component) :- % XXX Should use describe_one_pred_name. @@ -2117,8 +2117,7 @@ pred_constraint_info(Constraint, Path - PredId) :- % that are present in all of these subsets. % :- pred diagnose_unsatisfiability_error(type_constraint_info::in, - prog_context::in, prog_varset::in, tvar::in, - error_msg::out) is det. + prog_context::in, prog_varset::in, tvar::in, diag_msg::out) is det. diagnose_unsatisfiability_error(TCInfo, Context, ProgVarSet, TypeVar, Msg) :- TCInfo = tconstr_info(VarMap, _, ConstraintMap, VarConstraints, @@ -2209,7 +2208,7 @@ next_min_unsat(Constraint, C, !D, !P, !MinUnsats) :- min_unsat_constraints(Constraint, !.D, !.P, !MinUnsats), set.insert(C, !D). -:- pred add_message_to_spec(error_msg::in, type_constraint_info::in, +:- pred add_message_to_spec(diag_msg::in, type_constraint_info::in, type_constraint_info::out) is det. add_message_to_spec(ErrMsg, !TCInfo) :- diff --git a/compiler/options_file.m b/compiler/options_file.m index d41bcb58d..21f82d4af 100644 --- a/compiler/options_file.m +++ b/compiler/options_file.m @@ -604,7 +604,7 @@ pathname_occurs_in_incl_stack_2(InclStack0, PathName, !TopDownIncludes) :- ) ). -:- func include_context_msg(pair(file_name, term_context)) = error_msg. +:- func include_context_msg(pair(file_name, term_context)) = diag_msg. include_context_msg(FileName - Context) = Msg :- Pieces = [words("The include directive for"), quote(FileName), diff --git a/compiler/parse_goal.m b/compiler/parse_goal.m index d4d20d2f8..37800ab95 100644 --- a/compiler/parse_goal.m +++ b/compiler/parse_goal.m @@ -28,10 +28,11 @@ %---------------------------------------------------------------------------% +:- type goal_result == maybe2(goal, list(warning_spec)). + % Convert a single term into a goal. % -:- pred parse_goal(term::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, +:- pred parse_goal(term::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. % Convert a term, possibly starting with `some [Vars]', into a list @@ -397,7 +398,7 @@ string_goal_kind(Functor, GoalKind) :- ). :- pred parse_non_call_goal(goal_kind::in, list(term)::in, term.context::in, - cord(format_piece)::in, maybe2(goal, list(warning_spec))::out, + cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. parse_non_call_goal(GoalKind, Args, Context, ContextPieces, MaybeGoal, @@ -532,8 +533,7 @@ parse_non_call_goal(GoalKind, Args, Context, ContextPieces, MaybeGoal, :- pred parse_goal_impure_semipure(goal_kind::in(goal_kind_purity), list(term)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, - prog_varset::in, prog_varset::out) is det. + goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_impure_semipure/7)). parse_goal_impure_semipure(GoalKind, ArgTerms, Context, ContextPieces, @@ -555,8 +555,7 @@ parse_goal_impure_semipure(GoalKind, ArgTerms, Context, ContextPieces, :- pred parse_goal_promise_purity(goal_kind::in(goal_kind_promise_purity), list(term)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, - prog_varset::in, prog_varset::out) is det. + goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_promise_purity/7)). parse_goal_promise_purity(GoalKind, ArgTerms, Context, ContextPieces, @@ -585,8 +584,7 @@ parse_goal_promise_purity(GoalKind, ArgTerms, Context, ContextPieces, :- pred parse_goal_disable_warnings(goal_kind::in(goal_kind_disable_warning), list(term)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, - prog_varset::in, prog_varset::out) is det. + goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_disable_warnings/7)). parse_goal_disable_warnings(GoalKind, ArgTerms, Context, ContextPieces, @@ -666,8 +664,7 @@ parse_goal_disable_warnings(GoalKind, ArgTerms, Context, ContextPieces, :- pred parse_goal_not(goal_kind::in(goal_kind_not), list(term)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, - prog_varset::in, prog_varset::out) is det. + goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_not/7)). parse_goal_not(GoalKind, ArgTerms, Context, ContextPieces, MaybeGoal, @@ -692,8 +689,7 @@ parse_goal_not(GoalKind, ArgTerms, Context, ContextPieces, MaybeGoal, :- pred parse_goal_some_all(goal_kind::in(goal_kind_some_all), list(term)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, - prog_varset::in, prog_varset::out) is det. + goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_some_all/7)). parse_goal_some_all(GoalKind, ArgTerms, Context, ContextPieces, @@ -760,8 +756,7 @@ parse_goal_some_all(GoalKind, ArgTerms, Context, ContextPieces, % to warrant a small amount of target language code duplication. % :- pred parse_goal_conj(goal_kind, list(term), - term.context, cord(format_piece), - maybe2(goal, list(warning_spec)), prog_varset, prog_varset). + term.context, cord(format_piece), goal_result, prog_varset, prog_varset). :- mode parse_goal_conj(in(goal_kind_conj), in, in, in, out, in, out) is det. :- mode parse_goal_conj(in(goal_kind_par_conj), @@ -840,8 +835,7 @@ parse_goal_conjunction(Functor, TermA, TermB, ContextPieces, !ConjunctsCord, %---------------------% :- pred parse_goal_semicolon(list(term)::in, - term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, + term.context::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_semicolon/6)). @@ -965,8 +959,7 @@ append_disjunct_to_cord(Goal, !DisjunctsCord) :- %---------------------% :- pred parse_goal_else(list(term)::in, - term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, + term.context::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_else/6)). @@ -1052,8 +1045,7 @@ parse_goal_else(ArgTerms, Context, ContextPieces, MaybeGoal, !VarSet) :- %---------------------% :- pred parse_goal_if(list(term)::in, - term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out) is det. + term.context::in, cord(format_piece)::in, goal_result::out) is det. :- pragma inline(pred(parse_goal_if/4)). parse_goal_if(ArgTerms, Context, _ContextPieces, MaybeGoal) :- @@ -1093,8 +1085,7 @@ parse_goal_if(ArgTerms, Context, _ContextPieces, MaybeGoal) :- %---------------------% :- pred parse_goal_then(list(term)::in, - term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, + term.context::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_then/6)). @@ -1148,8 +1139,7 @@ parse_goal_then(ArgTerms, Context, ContextPieces, MaybeGoal, !VarSet) :- %---------------------% :- pred parse_goal_catch_any(list(term)::in, - term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, + term.context::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_catch_any/6)). @@ -1195,8 +1185,7 @@ parse_goal_catch_any(ArgTerms, Context, ContextPieces, MaybeGoal, !VarSet) :- :- pred parse_goal_implication(goal_kind::in(goal_kind_implication), list(term)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, - prog_varset::in, prog_varset::out) is det. + goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_implication/7)). parse_goal_implication(GoalKind, ArgTerms, Context, ContextPieces, @@ -1235,8 +1224,7 @@ parse_goal_implication(GoalKind, ArgTerms, Context, ContextPieces, %---------------------% :- pred parse_goal_trace(list(term)::in, - term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, + term.context::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_trace/6)). @@ -1276,8 +1264,7 @@ parse_goal_trace(ArgTerms, Context, ContextPieces, MaybeGoal, !VarSet) :- %---------------------% :- pred parse_goal_atomic(list(term)::in, - term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, + term.context::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_atomic/6)). @@ -1318,8 +1305,7 @@ parse_goal_atomic(ArgTerms, Context, ContextPieces, MaybeGoal, !VarSet) :- :- pred parse_goal_promise_eqv_solns( goal_kind::in(goal_kind_promise_eqv_soln), - list(term)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, + list(term)::in, term.context::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_promise_eqv_solns/7)). @@ -1366,8 +1352,7 @@ parse_goal_promise_eqv_solns(GoalKind, ArgTerms, Context, ContextPieces, %---------------------% :- pred parse_goal_arbitrary(list(term)::in, - term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, + term.context::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_arbitrary/6)). @@ -1404,8 +1389,7 @@ parse_goal_arbitrary(ArgTerms, Context, ContextPieces, MaybeGoal, !VarSet) :- %---------------------% :- pred parse_goal_require_detism(goal_kind::in(goal_kind_require_detism), - list(term)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, + list(term)::in, term.context::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_require_detism/7)). @@ -1439,8 +1423,7 @@ parse_goal_require_detism(GoalKind, ArgTerms, Context, ContextPieces, %---------------------% :- pred parse_goal_require_complete_switch(list(term)::in, - term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, + term.context::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_require_complete_switch/6)). @@ -1483,8 +1466,7 @@ parse_goal_require_complete_switch(ArgTerms, Context, ContextPieces, :- pred parse_goal_require_switch_arm_detism( goal_kind::in(goal_kind_require_arm_detism), - list(term)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, + list(term)::in, term.context::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_require_switch_arm_detism/7)). @@ -1560,8 +1542,7 @@ parse_goal_require_switch_arm_detism(GoalKind, ArgTerms, %---------------------% :- pred parse_goal_event(list(term)::in, - term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, + term.context::in, cord(format_piece)::in, goal_result::out, prog_varset::in, prog_varset::out) is det. :- pragma inline(pred(parse_goal_event/6)). @@ -1635,7 +1616,7 @@ parse_goal_event(ArgTerms, Context, ContextPieces, MaybeGoal, !VarSet) :- :- pred parse_goal_true_fail(goal_kind::in(goal_kind_true_fail), list(term)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out) is det. + goal_result::out) is det. :- pragma inline(pred(parse_goal_true_fail/5)). parse_goal_true_fail(GoalKind, ArgTerms, Context, ContextPieces, MaybeGoal) :- @@ -1659,7 +1640,7 @@ parse_goal_true_fail(GoalKind, ArgTerms, Context, ContextPieces, MaybeGoal) :- %---------------------% :- pred parse_goal_equal(prog_varset::in, list(term)::in, term.context::in, - cord(format_piece)::in, maybe2(goal, list(warning_spec))::out) is det. + cord(format_piece)::in, goal_result::out) is det. :- pragma inline(pred(parse_goal_equal/5)). parse_goal_equal(VarSet, ArgTerms, Context, ContextPieces, MaybeGoal) :- @@ -2580,8 +2561,7 @@ parse_catch_any_term(ArrowTerm, _Context, ContextPieces, MaybeCatchAny, :- pred parse_catch_then_try_term_args(list(term)::in, maybe(catch_any_expr)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, - prog_varset::in, prog_varset::out) is det. + goal_result::out, prog_varset::in, prog_varset::out) is det. parse_catch_then_try_term_args(CatchTermArgs, MaybeCatchAnyExpr, Context, ContextPieces, MaybeGoal, !VarSet) :- @@ -2693,8 +2673,7 @@ parse_catch_arrow_term(ArrowTerm, _Context, ContextPieces, MaybeCatch, :- pred parse_else_then_try_term(term::in, list(catch_expr)::in, maybe(catch_any_expr)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, - prog_varset::in, prog_varset::out) is det. + goal_result::out, prog_varset::in, prog_varset::out) is det. parse_else_then_try_term(Term, CatchExprs, MaybeCatchAnyExpr, Context, ContextPieces, MaybeGoal, !VarSet) :- @@ -2731,8 +2710,7 @@ parse_else_then_try_term(Term, CatchExprs, MaybeCatchAnyExpr, :- pred parse_then_try_term(term::in, maybe(goal)::in, list(catch_expr)::in, maybe(catch_any_expr)::in, term.context::in, cord(format_piece)::in, - maybe2(goal, list(warning_spec))::out, - prog_varset::in, prog_varset::out) is det. + goal_result::out, prog_varset::in, prog_varset::out) is det. parse_then_try_term(ThenTryTerm, MaybeElse, CatchExprs, MaybeCatchAnyExpr, Context, ContextPieces, MaybeGoal, !VarSet) :- diff --git a/compiler/parse_module.m b/compiler/parse_module.m index b1bd59831..139379ae6 100644 --- a/compiler/parse_module.m +++ b/compiler/parse_module.m @@ -402,7 +402,7 @@ report_module_has_unexpected_name(FileName, ExpectedName, ExpectationContexts, [words("found module")] ++ color_as_incorrect([qual_sym_name(ActualName), suffix(".")]) ++ [nl], - MainMsg = error_msg(MaybeContext, always_treat_as_first, 0u, + MainMsg = gen_msg(MaybeContext, always_treat_as_first, 0u, [always(MainPieces)]), list.sort_and_remove_dups(ExpectationContexts, SortedExpectationContexts0), list.delete_all(SortedExpectationContexts0, dummy_context, @@ -413,7 +413,7 @@ report_module_has_unexpected_name(FileName, ExpectedName, ExpectationContexts, Spec = error_spec($pred, severity_error, phase_module_name, [MainMsg | SubMsgs]). -:- pred expectation_context_to_msg(prog_context::in, error_msg::out) is det. +:- pred expectation_context_to_msg(prog_context::in, diag_msg::out) is det. expectation_context_to_msg(Context, SubMsg) :- SubPieces = [words("The expected name is specified here."), nl], diff --git a/compiler/post_typecheck.m b/compiler/post_typecheck.m index 737b1a2f0..819b0b813 100644 --- a/compiler/post_typecheck.m +++ b/compiler/post_typecheck.m @@ -336,7 +336,7 @@ report_unsatisfied_constraints(ModuleInfo, PredId, PredInfo, Constraints) [words("The constraint is due to:")], [words("The constraints are due to:")]), ContextMsgsPrefix = msg(Context, DueToPieces), - ContextMsgsList = constrained_goals_to_error_msgs(ModuleInfo, + ContextMsgsList = constrained_goals_to_diag_msgs(ModuleInfo, ConstrainedGoals), ContextMsgs = [ContextMsgsPrefix | ContextMsgsList] ), @@ -399,11 +399,11 @@ gather_constraint_ids(ReverseConstraintMap, Constraint, !ConstraintIdSets) :- true ). -:- func constrained_goals_to_error_msgs(module_info, list(hlds_goal)) - = list(error_msg). +:- func constrained_goals_to_diag_msgs(module_info, list(hlds_goal)) + = list(diag_msg). -constrained_goals_to_error_msgs(_, []) = []. -constrained_goals_to_error_msgs(ModuleInfo, [Goal | Goals]) = [Msg | Msgs] :- +constrained_goals_to_diag_msgs(_, []) = []. +constrained_goals_to_diag_msgs(ModuleInfo, [Goal | Goals]) = [Msg | Msgs] :- ( Goals = [_, _ | _], Words = describe_constrained_goal(ModuleInfo, Goal), @@ -422,9 +422,9 @@ constrained_goals_to_error_msgs(ModuleInfo, [Goal | Goals]) = [Msg | Msgs] :- ), Goal = hlds_goal(_, GoalInfo), Context = goal_info_get_context(GoalInfo), - Msg = error_msg(yes(Context), treat_based_on_posn, 1u, + Msg = gen_msg(yes(Context), treat_based_on_posn, 1u, [always(Words ++ [Suffix | And])]), - Msgs = constrained_goals_to_error_msgs(ModuleInfo, Goals). + Msgs = constrained_goals_to_diag_msgs(ModuleInfo, Goals). :- func describe_constrained_goal(module_info, hlds_goal) = list(format_piece). @@ -785,7 +785,7 @@ var_and_type_to_pieces_pairs(MaxVarNameLen, VarName - TypeStr) :- pred explain_origins_of_unnamed_vars(module_info::in, var_table::in, set(prog_var)::in, var_origins_map::in, prog_var::in, var_origin::in, - cord(error_msg)::in, cord(error_msg)::out) is det. + cord(diag_msg)::in, cord(diag_msg)::out) is det. explain_origins_of_unnamed_vars(ModuleInfo, VarTable, AnonVars, _OriginsMap, Var, Origin, !AnonVarMsgsCord) :- diff --git a/compiler/simplify_goal_call.m b/compiler/simplify_goal_call.m index c5a14616d..6b34f964a 100644 --- a/compiler/simplify_goal_call.m +++ b/compiler/simplify_goal_call.m @@ -695,7 +695,7 @@ maybe_generate_warning_for_infinite_loop_call(PredId, ProcId, ArgVars, true ). -:- func shut_up_suspicious_recursion_msg = error_msg_component. +:- func shut_up_suspicious_recursion_msg = diag_msg_component. shut_up_suspicious_recursion_msg = Component :- Pieces = diff --git a/compiler/style_checks.m b/compiler/style_checks.m index 8c2cb953f..f2194ee74 100644 --- a/compiler/style_checks.m +++ b/compiler/style_checks.m @@ -790,7 +790,7 @@ report_non_contiguous_clauses(ModuleInfo, ItemKind, OtherPredIds, MainPredId, :- pred report_non_contiguous_clause_contexts(list(format_piece)::in, int::in, clause_item_number_region::in, clause_item_number_region::in, - list(clause_item_number_region)::in, list(error_msg)::out) is det. + list(clause_item_number_region)::in, list(diag_msg)::out) is det. report_non_contiguous_clause_contexts(PredPieces, GapNumber, FirstRegion, SecondRegion, LaterRegions, Msgs) :- diff --git a/compiler/term_constr_errors.m b/compiler/term_constr_errors.m index f1a3c591f..6c25b30e8 100644 --- a/compiler/term_constr_errors.m +++ b/compiler/term_constr_errors.m @@ -212,7 +212,7 @@ report_term2_errors(ModuleInfo, SCC, Errors, !Specs) :- :- pred describe_term2_errors(module_info::in, maybe(pred_proc_id)::in, int::in, list(term2_error)::in, - cord(error_msg)::in, cord(error_msg)::out) is det. + cord(diag_msg)::in, cord(diag_msg)::out) is det. describe_term2_errors(_, _, _, [], !ReasonMsgsCord). describe_term2_errors(ModuleInfo, Single, ErrNum0, [Error | Errors], @@ -224,7 +224,7 @@ describe_term2_errors(ModuleInfo, Single, ErrNum0, [Error | Errors], :- pred describe_term2_error(module_info::in, maybe(pred_proc_id)::in, maybe(int)::in, term2_error::in, - cord(error_msg)::in, cord(error_msg)::out) is det. + cord(diag_msg)::in, cord(diag_msg)::out) is det. describe_term2_error(ModuleInfo, Single, MaybeErrorNum, Error, !ReasonMsgsCord) :- @@ -239,7 +239,7 @@ describe_term2_error(ModuleInfo, Single, MaybeErrorNum, Error, MaybeErrorNum = no, Pieces = Pieces0 ), - ReasonMsg = error_msg(yes(Context), always_treat_as_first, 0u, + ReasonMsg = gen_msg(yes(Context), always_treat_as_first, 0u, [always(Pieces)]), cord.snoc(ReasonMsg, !ReasonMsgsCord). diff --git a/compiler/term_errors.m b/compiler/term_errors.m index 6d35d4670..f84d91f80 100644 --- a/compiler/term_errors.m +++ b/compiler/term_errors.m @@ -257,7 +257,7 @@ report_arg_size_errors(ModuleInfo, SCC, Errors, !Specs) :- !:Specs = [Spec | !.Specs]. :- pred describe_term_errors(module_info::in, maybe(pred_proc_id)::in, - list(term_error)::in, int::in, cord(error_msg)::in, cord(error_msg)::out, + list(term_error)::in, int::in, cord(diag_msg)::in, cord(diag_msg)::out, list(error_spec)::in, list(error_spec)::out) is det. describe_term_errors(_, _, [], _, !Msgs, !Specs). @@ -269,7 +269,7 @@ describe_term_errors(ModuleInfo, Single, [Error | Errors], ErrNum0, !Msgs, !Specs). :- pred describe_term_error(module_info::in, maybe(pred_proc_id)::in, - term_error::in, maybe(int)::in, cord(error_msg)::in, cord(error_msg)::out, + term_error::in, maybe(int)::in, cord(diag_msg)::in, cord(diag_msg)::out, list(error_spec)::in, list(error_spec)::out) is det. describe_term_error(ModuleInfo, Single, TermErrorContext, ErrorNum, @@ -286,7 +286,7 @@ describe_term_error(ModuleInfo, Single, TermErrorContext, ErrorNum, ErrorNum = no, Pieces = Pieces0 ), - ReasonMsg = error_msg(yes(Context), always_treat_as_first, 0u, + ReasonMsg = gen_msg(yes(Context), always_treat_as_first, 0u, [always(Pieces)]), cord.snoc(ReasonMsg, !ReasonMsgs), ( diff --git a/compiler/typecheck_error_overload.m b/compiler/typecheck_error_overload.m index e4d2e4634..b7c2ecc93 100644 --- a/compiler/typecheck_error_overload.m +++ b/compiler/typecheck_error_overload.m @@ -114,7 +114,7 @@ report_error_too_much_overloading(ClauseContext, Context, %---------------------------------------------------------------------------% :- func create_first_msg(type_error_clause_context, prog_context, - list(format_piece), list(format_piece)) = error_msg. + list(format_piece), list(format_piece)) = diag_msg. create_first_msg(ClauseContext, Context, InitPieces, VerbosePieces) = FirstMsg :- @@ -333,7 +333,7 @@ add_qualifiers_reminder = [ %---------------------------------------------------------------------------% :- func describe_overloaded_symbols(type_error_clause_context, prog_context, - overloaded_symbol_map) = list(error_msg). + overloaded_symbol_map) = list(diag_msg). describe_overloaded_symbols(ClauseContext, Context, OverloadedSymbolMap) = Msgs :- @@ -375,7 +375,7 @@ describe_overloaded_symbols(ClauseContext, Context, OverloadedSymbolMap) ). :- func describe_overloaded_symbol(module_info, - pair(overloaded_symbol, one_or_more(prog_context))) = list(error_msg). + pair(overloaded_symbol, one_or_more(prog_context))) = list(diag_msg). describe_overloaded_symbol(ModuleInfo, Symbol - OoMSortedContexts) = Msgs :- OoMSortedContexts = one_or_more(FirstContext, LaterContexts), @@ -410,12 +410,12 @@ describe_overloaded_symbol(ModuleInfo, Symbol - OoMSortedContexts) = Msgs :- ), LaterPieces = [words("That symbol is also overloaded here."), nl], FirstMsg = msg(FirstContext, FirstPieces), - LaterMsgs = list.map(context_to_error_msg(LaterPieces), LaterContexts), + LaterMsgs = list.map(context_to_diag_msg(LaterPieces), LaterContexts), Msgs = [FirstMsg | LaterMsgs]. -:- func context_to_error_msg(list(format_piece), prog_context) = error_msg. +:- func context_to_diag_msg(list(format_piece), prog_context) = diag_msg. -context_to_error_msg(Pieces, Context) = msg(Context, Pieces). +context_to_diag_msg(Pieces, Context) = msg(Context, Pieces). %---------------------------------------------------------------------------% :- end_module check_hlds.typecheck_error_overload. diff --git a/compiler/typecheck_error_type_assign.m b/compiler/typecheck_error_type_assign.m index 97a455e0c..ef794d3e7 100644 --- a/compiler/typecheck_error_type_assign.m +++ b/compiler/typecheck_error_type_assign.m @@ -31,10 +31,10 @@ %---------------------------------------------------------------------------% :- pred type_assign_set_msg_to_verbose_component(typecheck_info::in, - prog_varset::in, type_assign_set::in, error_msg_component::out) is det. + prog_varset::in, type_assign_set::in, diag_msg_component::out) is det. :- pred arg_type_assign_set_msg_to_verbose_component(typecheck_info::in, - prog_varset::in, args_type_assign_set::in, error_msg_component::out) + prog_varset::in, args_type_assign_set::in, diag_msg_component::out) is det. %---------------------------------------------------------------------------% diff --git a/compiler/typecheck_error_undef.m b/compiler/typecheck_error_undef.m index 00c2bdcee..575018834 100644 --- a/compiler/typecheck_error_undef.m +++ b/compiler/typecheck_error_undef.m @@ -197,7 +197,7 @@ report_error_pred_wrong_arity(ClauseContext, Context, SymNameArity, %---------------------% :- type undef_class - ---> undef_special(list(error_msg_component)) + ---> undef_special(list(diag_msg_component)) % This is not a reference to an undefined predicate, % but a badly-executed attempt at using Mercury's "keywords". ; undef_ordinary( @@ -268,7 +268,7 @@ is_undef_pred_reference_special(ClauseContext, SymNameArity, UndefClass) :- ). :- pred is_undef_pred_a_syntax_error(string::in, int::in, - list(error_msg_component)::out) is semidet. + list(diag_msg_component)::out) is semidet. is_undef_pred_a_syntax_error(PredName, PredFormArityInt, Components) :- ( @@ -351,7 +351,7 @@ is_undef_pred_a_syntax_error(PredName, PredFormArityInt, Components) :- Components = [always(Pieces)] ). -:- func report_apply_instead_of_pred = list(error_msg_component). +:- func report_apply_instead_of_pred = list(diag_msg_component). report_apply_instead_of_pred = Components :- MainPieces = [words("error: the language construct")] ++ @@ -506,7 +506,7 @@ report_error_pred_wrong_full_name(ClauseContext, Context, PredicateTable, %---------------------% -:- func report_error_func_instead_of_pred(prog_context) = error_msg. +:- func report_error_func_instead_of_pred(prog_context) = diag_msg. report_error_func_instead_of_pred(Context) = Msg :- Pieces = [words("(There is a *function* with that name, however."), nl] ++ @@ -592,7 +592,7 @@ language_builtin_functor("all", 2, "part of a goal"). language_builtin_functor("some", 2, "part of a goal"). :- pred language_builtin_functor_components(string::in, arity::in, - string::in, list(error_msg_component)::out) is det. + string::in, list(diag_msg_component)::out) is det. language_builtin_functor_components(Name, Arity, UsedAsWhat, Components) :- NameArity = name_arity(Name, Arity), @@ -630,7 +630,7 @@ language_builtin_functor_components(Name, Arity, UsedAsWhat, Components) :- %---------------------% :- pred syntax_functor_components(string::in, arity::in, - list(error_msg_component)::out) is semidet. + list(diag_msg_component)::out) is semidet. syntax_functor_components(FunctorName, Arity, Components) :- ( @@ -749,7 +749,7 @@ syntax_functor_components(FunctorName, Arity, Components) :- %---------------------% :- pred report_error_undef_du_ctor_std(type_error_clause_context::in, - prog_context::in, error_msg_component::in, du_ctor::in, + prog_context::in, diag_msg_component::in, du_ctor::in, list(cons_error)::in, error_spec::out) is det. report_error_undef_du_ctor_std(ClauseContext, Context, ContextComp, DuCtor, @@ -913,7 +913,7 @@ accumulate_field_names(FieldSymName, _OoMFieldDefns, !FieldNames) :- %---------------------------------------------------------------------------% -:- func report_cons_error(prog_context, cons_error) = list(error_msg). +:- func report_cons_error(prog_context, cons_error) = list(diag_msg). report_cons_error(Context, ConsError) = Msgs :- ( @@ -1007,7 +1007,7 @@ report_cons_error(Context, ConsError) = Msgs :- ). :- pred report_closure_construction_errors(sym_name::in, int::in, - list(int)::in, list(int)::in, list(error_msg_component)::out) is det. + list(int)::in, list(int)::in, list(diag_msg_component)::out) is det. report_closure_construction_errors(SymName, ConsIdArity, PredArities, FuncArities, PredFuncComps) :- @@ -1074,7 +1074,7 @@ report_closure_arities(PredOrFunc, Arities, Pieces) :- :- pred maybe_construct_missing_qualifier_msg(type_error_clause_context::in, prog_context::in, du_ctor::in, - list(format_piece)::out, list(error_msg)::out) is det. + list(format_piece)::out, list(diag_msg)::out) is det. maybe_construct_missing_qualifier_msg(ClauseContext, Context, DuCtor, AddendumPieces, QualMsgs) :- @@ -1222,7 +1222,7 @@ construct_arith_import_pieces(OpKind, OpStr) = Pieces :- %---------------------------------------------------------------------------% :- pred maybe_construct_did_you_mean_msg(module_info::in, prog_context::in, - du_ctor::in, list(error_msg)::out) is det. + du_ctor::in, list(diag_msg)::out) is det. maybe_construct_did_you_mean_msg(ModuleInfo, Context, DuCtor, DidYouMeanMsgs) :- @@ -1409,7 +1409,7 @@ accumulate_matching_pf_module_names(PredicateTable, SymName, PredId, %---------------------% :- func report_any_missing_module_qualifiers(type_error_clause_context, - prog_context, string, set(module_name)) = list(error_msg). + prog_context, string, set(module_name)) = list(diag_msg). report_any_missing_module_qualifiers(ClauseContext, Context, ItemName, ModuleNamesSet0) = Msgs :- diff --git a/compiler/unused_imports.m b/compiler/unused_imports.m index 31c37fcfd..dea141f49 100644 --- a/compiler/unused_imports.m +++ b/compiler/unused_imports.m @@ -362,7 +362,7 @@ maybe_generate_redundant_avail_warnings(ModuleName, [Avail | Avails], % :- pred add_msg_if_avail_as_general(module_name::in, avail_module::in, avail_module::in, - list(error_msg)::in, list(error_msg)::out) is det. + list(diag_msg)::in, list(diag_msg)::out) is det. add_msg_if_avail_as_general(ModuleName, ThisAvail, PrevAvail, !Msgs) :- ThisAvail = avail_module(ThisSection, ThisImportOrUse, _ThisContext), diff --git a/compiler/var_origins.m b/compiler/var_origins.m index fd630bc50..34a5f9e87 100644 --- a/compiler/var_origins.m +++ b/compiler/var_origins.m @@ -201,7 +201,7 @@ % : `V_7' represents the term `exception(Exception)'. % :- pred explain_var_origin(module_info::in, var_table::in, - prog_var::in, var_origin::in, list(error_msg)::out) is det. + prog_var::in, var_origin::in, list(diag_msg)::out) is det. %---------------------------------------------------------------------------% %---------------------------------------------------------------------------% diff --git a/compiler/write_error_spec.m b/compiler/write_error_spec.m index 116a05681..0dfd16d30 100644 --- a/compiler/write_error_spec.m +++ b/compiler/write_error_spec.m @@ -410,7 +410,7 @@ do_write_error_spec(Stream, OptionTable, LimitErrorContextsMap, ColorDb, :- type already_printed_verbose == set(list(format_piece)). :- pred collect_msgs(option_table::in, limit_error_contexts_map::in, - list(std_error_msg)::in, maybe_treat_as_first::in, + list(std_diag_msg)::in, maybe_treat_as_first::in, cord(msg_pieces)::in, cord(msg_pieces)::out, maybe_print_spec::in, maybe_print_spec::out, already_printed_verbose::in, already_printed_verbose::out, @@ -420,7 +420,7 @@ collect_msgs(_, _, [], _, !MsgsCord, !MaybePrintSpec, !AlreadyPrintedVerbose, !IO). collect_msgs(OptionTable, LimitErrorContextsMap, [StdMsg | StdMsgs], !.First, !MsgsCord, !MaybePrintSpec, !AlreadyPrintedVerbose, !IO) :- - StdMsg = error_msg(MaybeContext, TreatAsFirst, ExtraIndent, StdComponents), + StdMsg = gen_msg(MaybeContext, TreatAsFirst, ExtraIndent, StdComponents), Indent = ExtraIndent * indent2_increment, ( TreatAsFirst = always_treat_as_first, @@ -453,14 +453,14 @@ collect_msgs(OptionTable, LimitErrorContextsMap, [StdMsg | StdMsgs], !.First, %---------------------------------------------------------------------------% - % Collect all the format_pieces to print out in an error_msg - % (which contains a list of error_msg_components in the general case), + % Collect all the format_pieces to print out in a diag_msg + % (which contains a list of diag_msg_components in the general case), % but do not print them yet. We take a pair of I/O states as arguments % *only* so that we can record in an I/O-linked mutable the fact that % the verbose components of some messages are not marked to be printed. % :- pred collect_msg_components(option_table::in, - list(error_msg_component)::in, + list(diag_msg_component)::in, cord(format_piece)::in, cord(format_piece)::out, already_printed_verbose::in, already_printed_verbose::out, io::di, io::uo) is det. @@ -571,10 +571,10 @@ should_this_msg_be_printed(LimitErrorContextsMap, TreatAsFirst, Indent, ; Pieces = [HeadPiece | TailPieces], % We could add [nl] after TailPieces to ensure that pieces from - % different error_msgs end up separated by a newline. + % different diag_msgs end up separated by a newline. % However, we have eventually ended up being pretty consistent % about adding a nl, with or without an indent delta, to the end - % of all error_msgs anyway, so this is not needed. + % of all diag_msgs anyway, so this is not needed. OoMPieces = one_or_more(HeadPiece, TailPieces), MsgPieces = msg_pieces(MaybeContext, TreatAsFirst, Indent, OoMPieces), (