diff --git a/compiler/error_sort.m b/compiler/error_sort.m index 5f5ad2224..aa5845292 100644 --- a/compiler/error_sort.m +++ b/compiler/error_sort.m @@ -74,74 +74,89 @@ :- import_module bool. :- import_module getopt. :- import_module maybe. +:- import_module require. :- import_module term_context. %---------------------------------------------------------------------------% standardize_error_specs(Specs, StdSpecs) :- - list.filter_map(standardize_error_spec, Specs, StdSpecs). + list.map(standardize_error_spec, Specs, StdSpecs). -:- pred standardize_error_spec(error_spec::in, std_error_spec::out) is semidet. +:- pred standardize_error_spec(error_spec::in, std_error_spec::out) is det. standardize_error_spec(Spec0, StdSpec) :- - require_det ( - ( - Spec0 = error_spec(Id, Severity, Phase, Msgs0), - list.filter_map(standardize_error_msg, Msgs0, StdMsgs) - ; - Spec0 = spec(Id, Severity, Phase, Context0, Pieces0), - StdMsgs = [error_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, - [always(Pieces0)])] - ) + ( + Spec0 = error_spec(Id, Severity, Phase, Msgs0), + list.map(standardize_error_msg, Msgs0, StdMsgs) + ; + Spec0 = spec(Id, Severity, Phase, Context0, Pieces0), + StdMsgs = [error_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, + [always(Pieces0)])] ), ( + StdMsgs = [], + unexpected($pred, "StdMsgs = []") + ; StdMsgs = [_ | _], StdSpec = error_spec(Id, Severity, Phase, StdMsgs) - ; - StdMsgs = [], - % Spec0 would result in nothing being printed. - fail ). -:- pred standardize_error_msg(error_msg::in, std_error_msg::out) is semidet. +:- pred standardize_error_msg(error_msg::in, std_error_msg::out) is det. standardize_error_msg(Msg0, StdMsg) :- - require_det ( - ( - Msg0 = msg(Context, Pieces0), - MaybeContext = yes(Context), - TreatAsFirst = treat_based_on_posn, - ExtraIndent = 0u, - StdComponents = [always(Pieces0)] - ; - Msg0 = no_ctxt_msg(Pieces0), - MaybeContext = no, - TreatAsFirst = treat_based_on_posn, - ExtraIndent = 0u, - StdComponents = [always(Pieces0)] - ; - Msg0 = simple_msg(Context, StdComponents), - MaybeContext = yes(Context), - TreatAsFirst = treat_based_on_posn, - ExtraIndent = 0u - ; - Msg0 = error_msg(MaybeContext, TreatAsFirst, ExtraIndent, - StdComponents) - ; - Msg0 = blank_msg(MaybeContext), - TreatAsFirst = always_treat_as_first, - ExtraIndent = 0u, - StdComponents = [always([blank_line])] - ), + ( + Msg0 = msg(Context, Pieces0), + MaybeContext = yes(Context), + TreatAsFirst = treat_based_on_posn, + ExtraIndent = 0u, + StdComponents = [always(Pieces0)] + ; + Msg0 = no_ctxt_msg(Pieces0), + MaybeContext = no, + TreatAsFirst = treat_based_on_posn, + ExtraIndent = 0u, + StdComponents = [always(Pieces0)] + ; + Msg0 = simple_msg(Context, StdComponents), + MaybeContext = yes(Context), + TreatAsFirst = treat_based_on_posn, + ExtraIndent = 0u + ; + Msg0 = error_msg(MaybeContext, TreatAsFirst, ExtraIndent, + StdComponents) + ; + Msg0 = blank_msg(MaybeContext), + TreatAsFirst = always_treat_as_first, + ExtraIndent = 0u, + StdComponents = [always([blank_line])] + ), + ( + StdComponents = [], + % 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 + % 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 + % *now* get here is if the error_spec was *constructed* with zero + % components. That would be a bug, which we catch here. + % + % We *could* use the type system to enforce the "no empty list of + % components" rule, but the type analysis system cannot handle + % any subtype of the list type with acceptable performance, and + % using the one_or_more type instead in error_specs would be + % inconvenient. + unexpected($pred, "StdComponents = []") + ; + StdComponents = [_ | _], StdMsg = error_msg(MaybeContext, TreatAsFirst, ExtraIndent, StdComponents) - ), - % Don't return StdMsg if StdComponents is empty. - StdComponents = [_ | _]. + ). %---------------------------------------------------------------------------% diff --git a/compiler/error_spec.m b/compiler/error_spec.m index c71caeaf9..5b3e32b5e 100644 --- a/compiler/error_spec.m +++ b/compiler/error_spec.m @@ -606,6 +606,8 @@ :- pred extract_spec_phase(error_spec::in, spec_phase::out) is det. +:- pred extract_spec_severity(error_spec::in, spec_severity::out) is det. + :- pred accumulate_contexts(error_spec::in, set(prog_context)::in, set(prog_context)::out) is det. @@ -999,6 +1001,15 @@ extract_spec_phase(Spec, Phase) :- Spec = no_ctxt_spec(_, _, Phase, _) ). +extract_spec_severity(Spec, Severity) :- + ( + Spec = error_spec(_, Severity, _, _) + ; + Spec = spec(_, Severity, _, _, _) + ; + Spec = no_ctxt_spec(_, Severity, _, _) + ). + accumulate_contexts(Spec, !Contexts) :- ( Spec = error_spec(_, _, _, Msgs), diff --git a/compiler/make_hlds_error.m b/compiler/make_hlds_error.m index ad7eeb12e..4dcd27277 100644 --- a/compiler/make_hlds_error.m +++ b/compiler/make_hlds_error.m @@ -306,7 +306,7 @@ maybe_report_undefined_pred_error(ModuleInfo, PredOrFunc, SymName, module_info_get_predicate_table(ModuleInfo, PredicateTable), predicate_table_lookup_pf_sym(PredicateTable, is_fully_qualified, PredOrFunc, SymName, AllArityPredIds), - gather_porf_arities(ModuleInfo, AllArityPredIds, PredOrFunc, + gather_porf_arities(ModuleInfo, PredOrFunc, AllArityPredIds, PorFArities), set.delete(PredFormArity, PorFArities, OtherPredFormArities), % The sorting is to make the error message easier to read. @@ -316,7 +316,21 @@ maybe_report_undefined_pred_error(ModuleInfo, PredOrFunc, SymName, FullPredOrFuncStr = pred_or_func_to_full_str(PredOrFunc), ( OtherPredFormAritiesList = [], - Spec = error_spec($pred, severity_error, phase_pt2h, [MainMsg]) + ( + InferTypes = no, + VerbosePieces = [words("(Use"), quote("--infer-types"), + words("to enable type inference.)"), nl], + InferMsg = simple_msg(Context, + [always(MainPieces), + verbose_only(verbose_once, VerbosePieces)]), + Spec = error_spec($pred, severity_error, phase_pt2h, + [InferMsg]) + ; + InferTypes = yes, + % Any reminder about type inference would be redundant. + Spec = spec($pred, severity_error, phase_pt2h, + Context, MainPieces) + ) ; ( OtherPredFormAritiesList = [OtherPredFormArity], @@ -350,13 +364,13 @@ maybe_report_undefined_pred_error(ModuleInfo, PredOrFunc, SymName, % procedures which have the right pred_or_func field (WantedPorF), % and return their original arities. % -:- pred gather_porf_arities(module_info::in, list(pred_id)::in, - pred_or_func::in, set(pred_form_arity)::out) is det. +:- pred gather_porf_arities(module_info::in, pred_or_func::in, + list(pred_id)::in, set(pred_form_arity)::out) is det. -gather_porf_arities(_ModuleInfo, [], _WantedPorF, set.init). -gather_porf_arities(ModuleInfo, [PredId | PredIds], WantedPorF, +gather_porf_arities(_ModuleInfo, _WantedPorF, [], set.init). +gather_porf_arities(ModuleInfo, WantedPorF, [PredId | PredIds], !:PorFArities) :- - gather_porf_arities(ModuleInfo, PredIds, WantedPorF, !:PorFArities), + gather_porf_arities(ModuleInfo, WantedPorF, PredIds, !:PorFArities), module_info_pred_info(ModuleInfo, PredId, PredInfo), PorF = pred_info_is_pred_or_func(PredInfo), ( if PorF = WantedPorF then diff --git a/compiler/mode_errors.m b/compiler/mode_errors.m index 4a807f0b7..4df0f103f 100644 --- a/compiler/mode_errors.m +++ b/compiler/mode_errors.m @@ -665,8 +665,8 @@ mode_error_unify_var_var_to_spec(ModeInfo, X, Y, InstX, InstY) = Spec :- [words("variable")] ++ color_as_subject([quote(mercury_var_to_name_only(VarTable, Y))]) ++ has_instantiatedness(ModeInfo, yes(color_inconsistent), InstY, "."), - Spec = spec($pred, severity_error, - phase_mode_check(report_in_any_mode), Context, Preamble ++ Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_error, Phase, Context, Preamble ++ Pieces). %---------------------------------------------------------------------------% @@ -691,8 +691,8 @@ mode_error_unify_var_poly_to_spec(ModeInfo, Var, VarInst) = Spec :- words("be ground (or have inst"), quote("any"), suffix(")."), words("Unifications of polymorphically-typed variables with"), words("partially instantiated modes are not allowed.")], - Spec = error_spec($pred, severity_error, - phase_mode_check(report_in_any_mode), + Phase = phase_mode_check(report_in_any_mode), + Spec = error_spec($pred, severity_error, Phase, [simple_msg(Context, [always(Preamble ++ MainPieces), verbose_only(verbose_once, VerbosePieces)])]). @@ -729,8 +729,8 @@ mode_error_unify_var_functor_to_spec(ModeInfo, X, ConsId, ArgVars, [words("term")] ++ color_as_subject([words_quote(FunctorConsIdStr)]) ++ has_instantiatedness(ModeInfo, InstColor, FakeTermInst, "."), - Spec = spec($pred, severity_error, - phase_mode_check(report_in_any_mode), Context, Preamble ++ Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_error, Phase, Context, Preamble ++ Pieces). %---------------------------------------------------------------------------% @@ -750,8 +750,8 @@ mode_error_unify_var_lambda_to_spec(ModeInfo, X, InstX, InstY) = Spec :- has_instantiatedness(ModeInfo, InstColor, InstX, ",") ++ color_as_subject([words("lambda expression")]) ++ has_instantiatedness(ModeInfo, InstColor, InstY, "."), - Spec = spec($pred, severity_error, - phase_mode_check(report_in_any_mode), Context, Preamble ++ Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_error, Phase, Context, Preamble ++ Pieces). %---------------------------------------------------------------------------% @@ -821,8 +821,9 @@ mode_error_unify_var_multimode_pf_to_spec(ModeInfo, X, PredMultiModeError) p_or_f(PredOrFunc), suffix("'s"), words("modes")] ++ EndPieces ++ [nl] ), - Spec = spec($pred, severity_error, phase_mode_check(report_in_any_mode), - Context, Preamble ++ StartPieces ++ DetailPieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_error, Phase, Context, + Preamble ++ StartPieces ++ DetailPieces). :- func named_and_unnamed_vars_to_pieces(var_table, color_name, list(prog_var)) = list(format_piece). @@ -868,8 +869,8 @@ mode_error_non_ground_non_local_lambda_var_to_spec(ModeInfo, Var, VarInst) words("of lambda goals is")] ++ color_as_correct([quote("ground"), suffix(".")]) ++ [nl], - Spec = spec($pred, severity_error, - phase_mode_check(report_in_any_mode), Context, Preamble ++ Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_error, Phase, Context, Preamble ++ Pieces). %---------------------------------------------------------------------------% @@ -919,8 +920,8 @@ mode_error_higher_order_unify_to_spec(ModeInfo, LHSVar, RHS, Type, PredOrFunc) words("writing an explicit universal quantification, e.g."), quote("all [X] call(PredA, X) <=> call(PredB, X)"), suffix(","), words("instead of"), quote("PredA = PredB"), suffix("."), nl], - Spec = error_spec($pred, severity_error, - phase_mode_check(report_in_any_mode), + Phase = phase_mode_check(report_in_any_mode), + Spec = error_spec($pred, severity_error, Phase, [simple_msg(Context, [always(Preamble ++ MainPieces), verbose_only(verbose_once, VerbosePieces)])]). @@ -1028,8 +1029,8 @@ mode_error_clobbered_var_is_live_to_spec(ModeInfo, Var) = Spec :- [words("is")] ++ color_as_incorrect([words("still live.")]) ++ [nl], - Spec = spec($pred, severity_error, - phase_mode_check(report_in_any_mode), Context, Preamble ++ Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_error, Phase, Context, Preamble ++ Pieces). %---------------------------------------------------------------------------% @@ -1046,8 +1047,8 @@ mode_error_callee_pred_has_no_mode_decl_to_spec(ModeInfo, PredId) = Spec :- Pieces = [words("error: there is")] ++ color_as_incorrect([words("no mode declaration")]) ++ [words("for")] ++ PredDotPieces ++ [nl], - Spec = spec($pred, severity_error, - phase_mode_check(report_in_any_mode), Context, Preamble ++ Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_error, Phase, Context, Preamble ++ Pieces). %---------------------------------------------------------------------------% @@ -1770,8 +1771,8 @@ mode_error_merge_par_conj_to_spec(ModeInfo, MergeErrors) = Spec :- merge_error_to_msgs(ModeInfo, Context, is_not_disjunctive), one_or_more_to_list(MergeErrors)), list.condense(MergeMsgLists, MergeMsgs), - Spec = error_spec($pred, severity_error, - phase_mode_check(report_in_any_mode), + Phase = phase_mode_check(report_in_any_mode), + Spec = error_spec($pred, severity_error, Phase, [msg(Context, Preamble ++ MainPieces) | MergeMsgs]). %---------------------------------------------------------------------------% @@ -1790,8 +1791,8 @@ mode_error_merge_disj_to_spec(ModeInfo, MergeContext, MergeErrors) = Spec :- merge_error_to_msgs(ModeInfo, Context, is_disjunctive), one_or_more_to_list(MergeErrors)), list.condense(MergeMsgLists, MergeMsgs), - Spec = error_spec($pred, severity_error, - phase_mode_check(report_in_any_mode), + Phase = phase_mode_check(report_in_any_mode), + Spec = error_spec($pred, severity_error, Phase, [msg(Context, Preamble ++ MainPieces) | MergeMsgs]). :- func merge_context_to_string(merge_context) = string. @@ -1946,8 +1947,8 @@ mode_error_coerce_error_to_spec(ModeInfo, Errors) = Spec :- [words("is not a subtype of"), quote(ToTypeStr), suffix("."), nl] ), Pieces = [words("mode error:")] ++ TermPathPieces ++ ReasonPieces, - Spec = spec($pred, severity_error, - phase_mode_check(report_in_any_mode), Context, Preamble ++ Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_error, Phase, Context, Preamble ++ Pieces). :- func make_term_path_piece(coerce_error_term_path_step) = list(format_piece). @@ -2027,8 +2028,8 @@ mode_error_nonground_trace_goal_to_spec(ModeInfo, HeadNGVar, TailNGVars) words("expects to get from the surrounding code,"), words(IsOrAre)] ++ color_as_incorrect([words("not ground")]) ++ [words("at entry to the trace goal."), nl], - Spec = spec($pred, severity_error, - phase_mode_check(report_in_any_mode), Context, Preamble ++ Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_error, Phase, Context, Preamble ++ Pieces). %---------------------------------------------------------------------------% @@ -2119,8 +2120,8 @@ mode_error_bind_locked_var_to_spec(ModeInfo, Reason, Var, VarInst, Inst) color_as_incorrect([words("two or more conjuncts.")]) ++ [nl] ), - Spec = error_spec($pred, severity_error, - phase_mode_check(report_in_any_mode), + Phase = phase_mode_check(report_in_any_mode), + Spec = error_spec($pred, severity_error, Phase, [simple_msg(Context, [always(Preamble ++ MainPieces), verbose_only(verbose_always, VerbosePieces)])]). @@ -2184,8 +2185,8 @@ mode_error_unexpected_final_inst_to_spec(ModeInfo, RawArgNum, Var, report_inst(ModeInfo, quote_short_inst, [suffix("."), nl], [nl_indent_delta(1)], [suffix("."), nl_indent_delta(-1)], ExpectedInst)), - Spec = spec($pred, severity_error, - phase_mode_check(report_in_any_mode), Context, Preamble ++ Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_error, Phase, Context, Preamble ++ Pieces). %---------------------------------------------------------------------------% @@ -2280,8 +2281,8 @@ mode_error_in_callee_to_spec(!.ModeInfo, Vars, Insts, ), LaterMsgs = start_each_msg_with_blank_line([LaterHead | LaterTail]) ), - Spec = error_spec($pred, severity_error, - phase_mode_check(report_in_any_mode), [InitMsg | LaterMsgs]) + Phase = phase_mode_check(report_in_any_mode), + Spec = error_spec($pred, severity_error, Phase, [InitMsg | LaterMsgs]) ; CalleeModeErrors = [], unexpected($pred, "no error") @@ -2351,8 +2352,8 @@ purity_error_should_be_in_promise_purity_scope_to_spec(NegCtxtDesc, [words("has inst")] ++ color_as_incorrect([quote("any")]) ++ [words("and appears in the body."), nl] ), - Spec = spec($pred, severity_error, - phase_mode_check(report_in_any_mode), Context, Preamble ++ Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_error, Phase, Context, Preamble ++ Pieces). %---------------------------------------------------------------------------% @@ -2390,8 +2391,8 @@ purity_error_lambda_should_be_any_to_spec(ModeInfo, OoMVars) = Spec :- words("Function expressions with inst"), quote("any"), words("can be written"), quote("any_func(Args) = Result is det :- ..."), suffix("."), nl]), - Spec = error_spec($pred, severity_error, - phase_mode_check(report_in_any_mode), + Phase = phase_mode_check(report_in_any_mode), + Spec = error_spec($pred, severity_error, Phase, [simple_msg(Context, [Always, VerboseOnly])]). %---------------------------------------------------------------------------% @@ -2705,8 +2706,8 @@ mode_warning_cannot_succeed_var_var(ModeInfo, X, Y, InstX, InstY) = Spec :- has_instantiatedness(ModeInfo, MaybeColor, InstX, ",") ++ color_as_subject([quote(NameY)]) ++ has_instantiatedness(ModeInfo, MaybeColor, InstY, "."), - Spec = spec($pred, severity_warning(warn_dodgy_simple_code), - phase_mode_check(report_only_if_in_all_modes), + Phase = phase_mode_check(report_only_if_in_all_modes), + Spec = spec($pred, severity_warning(warn_dodgy_simple_code), Phase, Context, Preamble ++ Pieces). %---------------------------------------------------------------------------% @@ -2739,8 +2740,8 @@ mode_warning_cannot_succeed_var_functor(ModeInfo, X, InstX, ConsId) = Spec :- [words("cannot succeed."), nl] ++ color_as_subject([quote(NameX)]) ++ has_instantiatedness(ModeInfo, yes(color_incorrect), InstX, "."), - Spec = spec($pred, severity_warning(warn_dodgy_simple_code), - phase_mode_check(report_only_if_in_all_modes), + Phase = phase_mode_check(report_only_if_in_all_modes), + Spec = spec($pred, severity_warning(warn_dodgy_simple_code), Phase, Context, Preamble ++ Pieces). %---------------------------------------------------------------------------% @@ -2762,8 +2763,9 @@ mode_warning_cannot_succeed_ground_occur_check(ModeInfo, X, ConsId) = Spec :- color_as_incorrect([quote(NameX), words("cannot be equal"), words("to a term containing itself.")]) ++ [nl], - Spec = spec($pred, severity_warning(warn_dodgy_simple_code), - phase_mode_check(report_in_any_mode), Context, Preamble ++ Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_warning(warn_dodgy_simple_code), Phase, + Context, Preamble ++ Pieces). %---------------------------------------------------------------------------% %---------------------------------------------------------------------------% diff --git a/compiler/modes.m b/compiler/modes.m index 47f00e622..5be88fffb 100644 --- a/compiler/modes.m +++ b/compiler/modes.m @@ -558,8 +558,8 @@ report_max_iterations_exceeded(ModuleInfo) = Spec :- words("option to increase the limit."), words("(The current limit is"), int_fixed(MaxIterations), words("iterations.)"), nl], - Spec = no_ctxt_spec($pred, severity_error, - phase_mode_check(report_in_any_mode), Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = no_ctxt_spec($pred, severity_error, Phase, Pieces). % copy_pred_bodies(OldPredIdTable, ProcId, !ModuleInfo): % @@ -759,33 +759,17 @@ maybe_report_error_no_modes(ModuleInfo, PredId, PredInfo) = Specs :- Specs = [] ; InferModesOpt = no, - pred_info_get_markers(PredInfo, Markers), - ( if marker_is_present(Markers, marker_no_pred_decl) then - % Generate an error_spec that prints nothing. - % While we don't want the user to see the error message, - % we need the severity_error to stop the compiler - % from proceeding to process this predicate further. - % For example, to determinism analysis, where it could - % generate misleading errors about the determinism declaration - % (added implicitly by the compiler) being wrong. - % There is no risk of the compilation failing without - % *any* error indication, since we generated an error message - % when we added the marker. - Msgs = [] - else - PredDescPieces = describe_one_pred_name(ModuleInfo, - yes(color_subject), should_not_module_qualify, [], PredId), - MainPieces = [words("Error:")] ++ PredDescPieces ++ - color_as_incorrect([words("has no mode declaration.")]) ++ - [nl], - VerbosePieces = - [words("(Use"), quote("--infer-modes"), - words("to enable mode inference.)"), nl], - Msgs = - [simple_msg(Context, - [always(MainPieces), - verbose_only(verbose_once, VerbosePieces)])] - ), + PredDescPieces = describe_one_pred_name(ModuleInfo, + yes(color_subject), should_not_module_qualify, [], PredId), + MainPieces = [words("Error:")] ++ PredDescPieces ++ + color_as_incorrect([words("has no mode declaration.")]) ++ + [nl], + VerbosePieces = [words("(Use"), quote("--infer-modes"), + words("to enable mode inference.)"), nl], + Msgs = + [simple_msg(Context, + [always(MainPieces), + verbose_only(verbose_once, VerbosePieces)])], pred_info_get_context(PredInfo, Context), Phase = phase_mode_check(report_in_any_mode), Spec = error_spec($pred, severity_error, Phase, Msgs), @@ -1853,8 +1837,8 @@ report_eval_method_requires_ground_args(ProcInfo, TabledMethod) = Spec :- words("is not currently implemented."), nl], Msg = simple_msg(Context, [always(MainPieces), verbose_only(verbose_once, VerbosePieces)]), - Spec = error_spec($pred, severity_error, - phase_mode_check(report_in_any_mode), [Msg]). + Phase = phase_mode_check(report_in_any_mode), + Spec = error_spec($pred, severity_error, Phase, [Msg]). :- func report_eval_method_destroys_uniqueness(proc_info, tabled_eval_method) = error_spec. @@ -1874,8 +1858,8 @@ report_eval_method_destroys_uniqueness(ProcInfo, TabledMethod) = Spec :- words("which would destroy their uniqueness."), nl], Msg = simple_msg(Context, [always(MainPieces), verbose_only(verbose_once, VerbosePieces)]), - Spec = error_spec($pred, severity_error, - phase_mode_check(report_in_any_mode), [Msg]). + Phase = phase_mode_check(report_in_any_mode), + Spec = error_spec($pred, severity_error, Phase, [Msg]). :- func report_wrong_mode_for_main(proc_info) = error_spec. @@ -1887,8 +1871,8 @@ report_wrong_mode_for_main(ProcInfo) = Spec :- color_as_incorrect([words("must have mode"), quote("(di, uo)"), suffix(".")]) ++ [nl], - Spec = spec($pred, severity_error, - phase_mode_check(report_in_any_mode), Context, Pieces). + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, severity_error, Phase, Context, Pieces). %-----------------------------------------------------------------------------% @@ -2029,8 +2013,8 @@ report_mode_inference_message(ModuleInfo, OutputDetism, PredInfo, ProcInfo, ), Pieces = [words(Verb), words(Detail), nl], Severity = severity_informational(inform_inferred_modes), - Spec = spec($pred, Severity, phase_mode_check(report_in_any_mode), - Context, Pieces) + Phase = phase_mode_check(report_in_any_mode), + Spec = spec($pred, Severity, Phase, Context, Pieces) ). %-----------------------------------------------------------------------------% diff --git a/compiler/opt_format_call_errors.m b/compiler/opt_format_call_errors.m index a64320618..7cf379217 100644 --- a/compiler/opt_format_call_errors.m +++ b/compiler/opt_format_call_errors.m @@ -148,8 +148,8 @@ report_format_mismatch(ModuleInfo, PredId, MaybePos, HeadError, TailErrors, words("in call to")] ++ PredNameDotPieces ++ [nl] ++ ErrorPieces, Phase = phase_simplify(report_in_any_mode), - Spec = spec($pred, severity_warning(warn_known_bad_format_calls), - Phase, Context, Pieces), + Severity = severity_warning(warn_known_bad_format_calls), + Spec = spec($pred, Severity, Phase, Context, Pieces), Specs = [Spec] ). diff --git a/compiler/simplify_proc.m b/compiler/simplify_proc.m index 7b5d12db1..296352cbb 100644 --- a/compiler/simplify_proc.m +++ b/compiler/simplify_proc.m @@ -467,7 +467,7 @@ simplify_proc_analyze_and_format_calls(ProgressStream, ImplicitStreamWarnings, ImplicitStreamWarnings, !.ModuleInfo, PredInfo0, !.ProcInfo, Goal0, MaybeGoal1, FormatSpecs1, VarTable0, VarTable1), ( if - had_some_unknown_format_calls(FormatSpecs1), + had_some_unknown_format_calls(FormatSpecs1) = yes, % We found some format calls that we couldn't optimize because % we don't know either the format string or the list of values % to be printed. Try to fix this by moving copies of the format call @@ -545,24 +545,15 @@ simplify_proc_analyze_and_format_calls(ProgressStream, ImplicitStreamWarnings, % of the goal that we will not be using. ). -:- pred had_some_unknown_format_calls(list(error_spec)::in) is semidet. +:- func had_some_unknown_format_calls(list(error_spec)) = bool. -had_some_unknown_format_calls([]) :- - fail. -had_some_unknown_format_calls([Spec | Specs]) :- - require_complete_switch [Spec] - ( - Spec = spec(_, Severity, _, _, _), - ( if Severity = severity_warning(warn_unknown_format_calls) then - true - else - had_some_unknown_format_calls(Specs) - ) - ; - ( Spec = no_ctxt_spec(_, _, _, _) - ; Spec = error_spec(_, _, _, _) - ), - unexpected($pred, "unexpected form of error_spec") +had_some_unknown_format_calls([]) = no. +had_some_unknown_format_calls([Spec | Specs]) = SomeUnknown :- + extract_spec_severity(Spec, Severity), + ( if Severity = severity_warning(warn_unknown_format_calls) then + SomeUnknown = yes + else + SomeUnknown = had_some_unknown_format_calls(Specs) ). :- pred push_format_calls_into_branches_in_goal(module_info::in, diff --git a/tests/invalid/Mercury.options b/tests/invalid/Mercury.options index 5618070bd..5c917bbdd 100644 --- a/tests/invalid/Mercury.options +++ b/tests/invalid/Mercury.options @@ -23,12 +23,14 @@ MCFLAGS-bad_ambiguity_msg += -E MCFLAGS-bad_exported_mode += --infer-all --no-intermodule-optimization MCFLAGS-bug150_partial_color += --ignore-color-scheme-envvar MCFLAGS-bug150_partial_color += --color-scheme specified@incorrect=203 +MCFLAGS-bug113 += -E # Intermodule optimization changes the number of an unnamed variable # whose automatically-constructed "name" shows up in the .err file. MCFLAGS-bug214 += --allow-stubs --no-warn-stubs MCFLAGS-bug214 += --no-intermodule-optimization # Mantis bug 238 shows up in bug238.m only with --constraint-propagation. MCFLAGS-bug238 += --constraint-propagation +MCFLAGS-bug476 += -E MCFLAGS-children += --no-intermodule-optimization MCFLAGS-coerce_implied_mode += --halt-at-warn MCFLAGS-coerce_infer += --infer-all @@ -70,6 +72,7 @@ MCFLAGS-method_impl += --warn-too-private-instances MCFLAGS-missing_det_decls += --no-infer-det -E MCFLAGS-missing_interface_import2 += --no-intermodule-optimization MCFLAGS-mode_inf += --infer-all -E +MCFLAGS-mode_without_pred += -E MCFLAGS-mpj_1 += --infer-all -E MCFLAGS-mpj_3 += --warn-too-private-instances MCFLAGS-mpj_4 += --warn-too-private-instances @@ -80,6 +83,7 @@ MCFLAGS-overloading += --no-intermodule-optimization MCFLAGS-pragma_c_code_no_det += --warn-inferred-erroneous MCFLAGS-range_restrict += --warn-too-private-instances MCFLAGS-record_syntax_errors += -E +MCFLAGS-ref_to_implicit_pred += -E MCFLAGS-string_format_bad += --halt-at-warn MCFLAGS-string_format_bad += --warn-known-bad-format-calls MCFLAGS-string_format_bad += --warn-unknown-format-calls @@ -125,6 +129,7 @@ MCFLAGS-one_member += -E MCFLAGS-oisu_check_add_pragma_errors += --no-halt-at-invalid-interface MCFLAGS-polymorphic_unification += -E MCFLAGS-test_type_spec += -E +MCFLAGS-typeclass_mode_2 += -E MCFLAGS-require_tailrec_1 += -O0 --optimise-tailcalls MCFLAGS-require_tailrec_1 += --no-warn-non-tail-recursion diff --git a/tests/invalid/bug113.err_exp b/tests/invalid/bug113.err_exp index 63698d475..b00dccb5e 100644 --- a/tests/invalid/bug113.err_exp +++ b/tests/invalid/bug113.err_exp @@ -3,6 +3,7 @@ bug113.m:019: warning: module `list' is imported in the inte bug113.m:019: not used in the interface. bug113.m:032: Error: clause for function `new'/1 without a corresponding bug113.m:032: `:- func' declaration. +bug113.m:032: (Use `--infer-types' to enable type inference.) bug113.m:032: Inferred :- func new(T1) = T2. bug113.m:034: Error: clause for function `new'/2 without a corresponding bug113.m:034: `:- func' declaration. diff --git a/tests/invalid/bug476.err_exp b/tests/invalid/bug476.err_exp index d7d818b7b..73dc49217 100644 --- a/tests/invalid/bug476.err_exp +++ b/tests/invalid/bug476.err_exp @@ -4,3 +4,4 @@ bug476.m:068: Error: the predicate `bug476.mark'/4 is [38;5;2 bug476.m:034: Here is its previous definition. bug476.m:070: Error: clause for predicate `input_stream_mark'/3 without a bug476.m:070: corresponding `:- pred' declaration. +bug476.m:070: (Use `--infer-types' to enable type inference.) diff --git a/tests/invalid/mode_without_pred.err_exp b/tests/invalid/mode_without_pred.err_exp index 78d7885c7..d6b1e2b4b 100644 --- a/tests/invalid/mode_without_pred.err_exp +++ b/tests/invalid/mode_without_pred.err_exp @@ -1,5 +1,6 @@ mode_without_pred.m:017: Error: `:- mode' declaration for function `f1'/1 mode_without_pred.m:017: without a corresponding `:- func' declaration. +mode_without_pred.m:017: (Use `--infer-types' to enable type inference.) mode_without_pred.m:017: Inferred :- func f1(mode_without_pred.t) = int. mode_without_pred.m:017: In declaration of function `f1'/1: mode_without_pred.m:017: error: a field access function for an exported field diff --git a/tests/invalid/multimode_syntax.err_exp b/tests/invalid/multimode_syntax.err_exp index 1361f2de1..674247a33 100644 --- a/tests/invalid/multimode_syntax.err_exp +++ b/tests/invalid/multimode_syntax.err_exp @@ -1,6 +1,7 @@ multimode_syntax.m:015: Error: function `func0'/0 has no clauses. multimode_syntax.m:017: Error: clause for predicate `::'/2 without a multimode_syntax.m:017: corresponding `:- pred' declaration. +multimode_syntax.m:017: (Use `--infer-types' to enable type inference.) multimode_syntax.m:017: In clause for predicate `::'/2: multimode_syntax.m:017: in argument 1 of clause head: multimode_syntax.m:017: error: the language construct `='/2 should be used as diff --git a/tests/invalid/record_syntax_errors.err_exp b/tests/invalid/record_syntax_errors.err_exp index 173eb2328..aa2f17797 100644 --- a/tests/invalid/record_syntax_errors.err_exp +++ b/tests/invalid/record_syntax_errors.err_exp @@ -1,6 +1,7 @@ record_syntax_errors.m:027: Error: `:- mode' declaration for function record_syntax_errors.m:027: `field8'/1 without a corresponding `:- func' record_syntax_errors.m:027: declaration. +record_syntax_errors.m:027: (Use `--infer-types' to enable type inference.) record_syntax_errors.m:027: Inferred :- func field8(record_syntax_errors.cons2) record_syntax_errors.m:027: = int. record_syntax_errors.m:033: In DCG field update goal: diff --git a/tests/invalid/ref_to_implicit_pred.err_exp b/tests/invalid/ref_to_implicit_pred.err_exp index a3700eacd..a73339881 100644 --- a/tests/invalid/ref_to_implicit_pred.err_exp +++ b/tests/invalid/ref_to_implicit_pred.err_exp @@ -3,6 +3,9 @@ ref_to_implicit_pred.m:008: `test'/0 is not satis ref_to_implicit_pred.m:008: Declared `det', inferred `failure'. ref_to_implicit_pred.m:013: Error: clause for predicate `p'/2 without a ref_to_implicit_pred.m:013: corresponding `:- pred' declaration. +ref_to_implicit_pred.m:013: (Use `--infer-types' to enable type inference.) ref_to_implicit_pred.m:013: Inferred :- pred p((pred), (pred)). +ref_to_implicit_pred.m:013: Error: predicate `p'/2 has no mode declaration. +ref_to_implicit_pred.m:013: (Use `--infer-modes' to enable mode inference.) ref_to_implicit_pred.m:014: Error: the predicate or function `p'/2 is ref_to_implicit_pred.m:014: undefined. diff --git a/tests/invalid/typeclass_mode_2.err_exp b/tests/invalid/typeclass_mode_2.err_exp index 02842e732..201e51202 100644 --- a/tests/invalid/typeclass_mode_2.err_exp +++ b/tests/invalid/typeclass_mode_2.err_exp @@ -2,4 +2,7 @@ typeclass_mode_2.m:009: Error: mode declaration for type class method predicate typeclass_mode_2.m:009: `p'/1 without a corresponding predicate declaration. typeclass_mode_2.m:014: Error: clause for predicate `p'/1 without a typeclass_mode_2.m:014: corresponding `:- pred' declaration. +typeclass_mode_2.m:014: (Use `--infer-types' to enable type inference.) typeclass_mode_2.m:014: Inferred :- pred p(T1). +typeclass_mode_2.m:014: Error: predicate `p'/1 has no mode declaration. +typeclass_mode_2.m:014: (Use `--infer-modes' to enable mode inference.) diff --git a/tests/invalid/types.err_exp b/tests/invalid/types.err_exp index 2f868d46f..a05f32535 100644 --- a/tests/invalid/types.err_exp +++ b/tests/invalid/types.err_exp @@ -15,6 +15,7 @@ types.m:021: error: wrong number of arguments (0 types.m:021: in call to predicate `p'. types.m:023: Error: clause for predicate `r'/0 without a corresponding types.m:023: `:- pred' declaration. +types.m:023: (Use `--infer-types' to enable type inference.) types.m:024: In clause for predicate `r'/0: types.m:024: error: call to undefined predicate `s'/0. types.m:024: (Did you mean `<', `>', `a', `p', `q', `r' or `z'?) diff --git a/tests/invalid_nodepend/Mercury.options b/tests/invalid_nodepend/Mercury.options index 33e2da510..735ac4259 100644 --- a/tests/invalid_nodepend/Mercury.options +++ b/tests/invalid_nodepend/Mercury.options @@ -6,8 +6,8 @@ MCFLAGS-bad_foreign_type += -E MCFLAGS-bad_pragma += --no-halt-at-invalid-interface MCFLAGS-bigtest += --no-halt-at-invalid-interface MCFLAGS-bigtest += -E -MCFLAGS-bug410 += --no-warn-unneeded-final-statevars -MCFLAGS-constrained_poly_insts += --no-halt-at-invalid-interface +MCFLAGS-bug410 += --no-warn-unneeded-final-statevars -E +MCFLAGS-constrained_poly_insts += --no-halt-at-invalid-interface -E MCFLAGS-duplicate_modes += -E MCFLAGS-errors_1 += --no-halt-at-invalid-interface MCFLAGS-errors_2 += --no-halt-at-invalid-interface @@ -23,17 +23,17 @@ MCFLAGS-fundeps_vars += --no-halt-at-invalid-interface -E MCFLAGS-impl_def_literal_syntax += --no-halt-at-invalid-interface MCFLAGS-inst_list_dup += --no-halt-at-invalid-interface MCFLAGS-instance_bug += -E -MCFLAGS-invalid_binary_literal += --no-halt-at-invalid-interface +MCFLAGS-invalid_binary_literal += --no-halt-at-invalid-interface -E MCFLAGS-invalid_decimal_literal += --no-halt-at-invalid-interface -MCFLAGS-invalid_float_literal += --no-halt-at-invalid-interface -MCFLAGS-invalid_hex_literal += --no-halt-at-invalid-interface +MCFLAGS-invalid_float_literal += --no-halt-at-invalid-interface -E +MCFLAGS-invalid_hex_literal += --no-halt-at-invalid-interface -E MCFLAGS-invalid_main += --no-halt-at-invalid-interface -MCFLAGS-invalid_octal_literal += --no-halt-at-invalid-interface +MCFLAGS-invalid_octal_literal += --no-halt-at-invalid-interface -E MCFLAGS-invalid_typeclass += --no-halt-at-invalid-interface MCFLAGS-kind += --no-halt-at-invalid-interface MCFLAGS-no_exports += --no-halt-at-invalid-interface MCFLAGS-no_exports += -E --halt-at-warn -MCFLAGS-null_char += --no-halt-at-invalid-interface +MCFLAGS-null_char += --no-halt-at-invalid-interface -E MCFLAGS-occurs += --no-halt-at-invalid-interface MCFLAGS-predmode += -E MCFLAGS-prog_io_erroneous += --no-halt-at-invalid-interface -E @@ -43,11 +43,11 @@ MCFLAGS-reserved_type_name += --no-halt-at-invalid-interface MCFLAGS-specified += --no-halt-at-invalid-interface MCFLAGS-subtype_invalid_supertype += --no-halt-at-invalid-interface MCFLAGS-test_some += --no-halt-at-invalid-interface -MCFLAGS-test_with_type += --no-halt-at-invalid-interface +MCFLAGS-test_with_type += --no-halt-at-invalid-interface -E MCFLAGS-type_vars += -E MCFLAGS-typeclass_no_param += --no-halt-at-invalid-interface MCFLAGS-typeclass_test_1 += --no-halt-at-invalid-interface -MCFLAGS-typeclass_test_2 += --no-halt-at-invalid-interface +MCFLAGS-typeclass_test_2 += --no-halt-at-invalid-interface -E MCFLAGS-typeclass_test_3 += --no-halt-at-invalid-interface MCFLAGS-typeclass_test_3 += -E MCFLAGS-types += --no-halt-at-invalid-interface -E diff --git a/tests/invalid_nodepend/bigtest.err_exp b/tests/invalid_nodepend/bigtest.err_exp index afd120900..08d194ba3 100644 --- a/tests/invalid_nodepend/bigtest.err_exp +++ b/tests/invalid_nodepend/bigtest.err_exp @@ -16,10 +16,12 @@ bigtest.m:006: Error: `export_pred' is not a valid bigtest.m:007: Error: `export_type' is not a valid declaration type. bigtest.m:009: Error: clause for predicate `fact'/0 without a corresponding bigtest.m:009: `:- pred' declaration. +bigtest.m:009: (Use `--infer-types' to enable type inference.) bigtest.m:009: Inferred :- pred fact. +bigtest.m:009: Error: predicate `fact'/0 has no mode declaration. +bigtest.m:009: (Use `--infer-modes' to enable mode inference.) bigtest.m:010: Syntax error at token ':-': operator precedence error. bigtest.m:013: Error: `incorrect_declaration' is not a valid declaration type. bigtest.m:015: Error: predicate `p'/1 has no mode declaration. -bigtest.m:015: (Use `--infer-modes' to enable mode inference.) bigtest.m:030: Error: in definitions of equivalence types, the type name must bigtest.m:030: be followed by `==', not `='. diff --git a/tests/invalid_nodepend/bug410.err_exp b/tests/invalid_nodepend/bug410.err_exp index eda5ebd1f..26de428b6 100644 --- a/tests/invalid_nodepend/bug410.err_exp +++ b/tests/invalid_nodepend/bug410.err_exp @@ -1,6 +1,9 @@ bug410.m:055: Error: clause for predicate `make_titles'/3 without a bug410.m:055: corresponding `:- pred' declaration. +bug410.m:055: (Use `--infer-types' to enable type inference.) bug410.m:055: Inferred :- pred make_titles(pred(V_1, V_2, V_2), V_2, T3). +bug410.m:055: Error: predicate `make_titles'/3 has no mode declaration. +bug410.m:055: (Use `--infer-modes' to enable mode inference.) bug410.m:055: Inferred :- mode make_titles(di(/* unique */(pred(out, in, out) bug410.m:055: is det)), (ground >> not_reached), out(not_reached)). bug410.m:055: Inferred :- mode make_titles(di(/* unique */(pred(out, in, out) diff --git a/tests/invalid_nodepend/constrained_poly_insts.err_exp b/tests/invalid_nodepend/constrained_poly_insts.err_exp index 7b6816c4c..77a0e226c 100644 --- a/tests/invalid_nodepend/constrained_poly_insts.err_exp +++ b/tests/invalid_nodepend/constrained_poly_insts.err_exp @@ -12,13 +12,17 @@ constrained_poly_insts.m:020: Error: inconsistent constraints on inst variables constrained_poly_insts.m:020: I and J in predicate declaration. constrained_poly_insts.m:029: Error: clause for predicate `q'/2 without a constrained_poly_insts.m:029: corresponding `:- pred' declaration. +constrained_poly_insts.m:029: (Use `--infer-types' to enable type inference.) constrained_poly_insts.m:029: Inferred :- pred q(T1, T1). +constrained_poly_insts.m:029: Error: predicate `q'/2 has no mode declaration. +constrained_poly_insts.m:029: (Use `--infer-modes' to enable mode inference.) constrained_poly_insts.m:031: Error: clause for function `s'/1 without a constrained_poly_insts.m:031: corresponding `:- func' declaration. constrained_poly_insts.m:031: Inferred :- func s(T1) = T1. constrained_poly_insts.m:032: Error: clause for predicate `t'/4 without a constrained_poly_insts.m:032: corresponding `:- pred' declaration. constrained_poly_insts.m:032: Inferred :- pred t(T1, T1, T3, T3). +constrained_poly_insts.m:032: Error: predicate `t'/4 has no mode declaration. constrained_poly_insts.m:033: In clause for `u(in((I =< ground)), out((I =< constrained_poly_insts.m:033: ground)))': constrained_poly_insts.m:033: mode error: argument 2 became too instantiated. diff --git a/tests/invalid_nodepend/invalid_binary_literal.err_exp b/tests/invalid_nodepend/invalid_binary_literal.err_exp index 81d051273..04915df07 100644 --- a/tests/invalid_nodepend/invalid_binary_literal.err_exp +++ b/tests/invalid_nodepend/invalid_binary_literal.err_exp @@ -32,6 +32,7 @@ invalid_binary_literal.m:033: Syntax error: a binary literal cannot end with an invalid_binary_literal.m:033: underscore. invalid_binary_literal.m:035: Error: clause for predicate `b11'/0 without a invalid_binary_literal.m:035: corresponding `:- pred' declaration. +invalid_binary_literal.m:035: (Use `--infer-types' to enable type inference.) invalid_binary_literal.m:035: Inferred :- pred b11. invalid_binary_literal.m:035: Syntax error: a decimal literal cannot end with invalid_binary_literal.m:035: an underscore. diff --git a/tests/invalid_nodepend/invalid_float_literal.err_exp b/tests/invalid_nodepend/invalid_float_literal.err_exp index f0acfdf23..0aafebf23 100644 --- a/tests/invalid_nodepend/invalid_float_literal.err_exp +++ b/tests/invalid_nodepend/invalid_float_literal.err_exp @@ -35,6 +35,7 @@ invalid_float_literal.m:039: digits; it should not appear just before a invalid_float_literal.m:039: decimal point. invalid_float_literal.m:041: Error: clause for predicate `-'/2 without a invalid_float_literal.m:041: corresponding `:- pred' declaration. +invalid_float_literal.m:041: (Use `--infer-types' to enable type inference.) invalid_float_literal.m:041: Inferred :- pred '-'(T1, int). invalid_float_literal.m:041: Syntax error: unterminated exponent in float invalid_float_literal.m:041: literal. diff --git a/tests/invalid_nodepend/invalid_hex_literal.err_exp b/tests/invalid_nodepend/invalid_hex_literal.err_exp index c546091e8..85136cd04 100644 --- a/tests/invalid_nodepend/invalid_hex_literal.err_exp +++ b/tests/invalid_nodepend/invalid_hex_literal.err_exp @@ -32,6 +32,7 @@ invalid_hex_literal.m:033: Syntax error: a hexadecimal literal cannot end with invalid_hex_literal.m:033: an underscore. invalid_hex_literal.m:035: Error: clause for predicate `xff'/0 without a invalid_hex_literal.m:035: corresponding `:- pred' declaration. +invalid_hex_literal.m:035: (Use `--infer-types' to enable type inference.) invalid_hex_literal.m:035: Inferred :- pred xff. invalid_hex_literal.m:035: Syntax error: a decimal literal cannot end with an invalid_hex_literal.m:035: underscore. diff --git a/tests/invalid_nodepend/invalid_octal_literal.err_exp b/tests/invalid_nodepend/invalid_octal_literal.err_exp index dbba0157d..a0416dfce 100644 --- a/tests/invalid_nodepend/invalid_octal_literal.err_exp +++ b/tests/invalid_nodepend/invalid_octal_literal.err_exp @@ -28,6 +28,7 @@ invalid_octal_literal.m:033: Syntax error: an octal literal cannot end with an invalid_octal_literal.m:033: underscore. invalid_octal_literal.m:035: Error: clause for predicate `o77'/0 without a invalid_octal_literal.m:035: corresponding `:- pred' declaration. +invalid_octal_literal.m:035: (Use `--infer-types' to enable type inference.) invalid_octal_literal.m:035: Inferred :- pred o77. invalid_octal_literal.m:035: Syntax error: a decimal literal cannot end with an invalid_octal_literal.m:035: underscore. diff --git a/tests/invalid_nodepend/null_char.err_exp b/tests/invalid_nodepend/null_char.err_exp index f1aeb9221..002f7a42e 100644 --- a/tests/invalid_nodepend/null_char.err_exp +++ b/tests/invalid_nodepend/null_char.err_exp @@ -1,5 +1,6 @@ null_char.m:017: Error: clause for predicate `int'/0 without a corresponding null_char.m:017: `:- pred' declaration. +null_char.m:017: (Use `--infer-types' to enable type inference.) null_char.m:017: Inferred :- pred int. null_char.m:017: Syntax error: the null character is illegal in strings and null_char.m:017: names. diff --git a/tests/invalid_nodepend/test_with_type.err_exp b/tests/invalid_nodepend/test_with_type.err_exp index d0916d1dd..61f4a3cef 100644 --- a/tests/invalid_nodepend/test_with_type.err_exp +++ b/tests/invalid_nodepend/test_with_type.err_exp @@ -11,6 +11,7 @@ test_with_type.m:022: error: expected the type after `with_type' to be a test_with_type.m:022: higher order function type, but it is not. test_with_type.m:023: Error: `:- mode' declaration for function `with_type_2'/3 test_with_type.m:023: without a corresponding `:- func' declaration. +test_with_type.m:023: (Use `--infer-types' to enable type inference.) test_with_type.m:025: In the declaration of predicate `with_type_3': test_with_type.m:025: error: the `with_type` and `with_inst` annotations are test_with_type.m:025: incompatible, because they specify two types but three diff --git a/tests/invalid_nodepend/typeclass_test_2.err_exp b/tests/invalid_nodepend/typeclass_test_2.err_exp index 064f59813..67ad3d682 100644 --- a/tests/invalid_nodepend/typeclass_test_2.err_exp +++ b/tests/invalid_nodepend/typeclass_test_2.err_exp @@ -10,4 +10,5 @@ typeclass_test_2.m:023: got typeclass_test_2.m:023: ((type_num / 0) is foo_type_num). typeclass_test_2.m:026: Error: clause for function `foo_type_num'/1 without a typeclass_test_2.m:026: corresponding `:- func' declaration. +typeclass_test_2.m:026: (Use `--infer-types' to enable type inference.) typeclass_test_2.m:026: Inferred :- func foo_type_num(T1) = int. diff --git a/tests/invalid_nodepend/types.err_exp b/tests/invalid_nodepend/types.err_exp index 2cb68daeb..45b253645 100644 --- a/tests/invalid_nodepend/types.err_exp +++ b/tests/invalid_nodepend/types.err_exp @@ -9,6 +9,7 @@ types.m:011: Error: the function symbol `f'/1 occur types.m:011: definition of type constructor `t'/0. types.m:023: Error: clause for predicate `r'/0 without a corresponding types.m:023: `:- pred' declaration. +types.m:023: (Use `--infer-types' to enable type inference.) types.m:026: Error: clause for predicate `a'/1 without a corresponding types.m:026: `:- pred' declaration. types.m:053: Error: the type `t'/2 has this declaration, but it has no