Fix some error messages for malformed pragmas.

compiler/parse_pragma.m:
    Improve error handling in several respects.

    First, for several kinds of pragmas the only error message we printed
    was some form of "something went wrong". Fix this by generating messages
    that say what part of the pragma has a problem, and what that problem is.

    Second, specify the "where" part more precisely, as a nested context
    (in construct A: in construct B: etc).

    Third, make the text of error messages more consistent, using patterns
    such as "expected abc, got def", and "In the Nth argument of xyz:".

    Fourth, don't stop looking for errors after finding one; keep looking
    for others.

    Also, replace a bunch of if-then-elses with switches, and break up
    a too-large predicate.

compiler/parse_sym_name.m:
    Add parse_sym_name_and_no_args, a version of the existing predicate
    try_parse_sym_name_and_no_args that generates an error message if it
    does not find what it is asked to look for.

    Use the same consistent error message phraseology as above (which we
    also use elsewhere in the compiler).

compiler/parse_item.m:
    Put a newline at the end of context pieces such as "In clause head:",
    so that the "error:" that follows is not buried in the middle of a line.

tests/invalid/bad_pragma.{m,err_exp}:
    Add a news test case for some of the updated error messages.

tests/invalid/Mmakefile:
    Enable the new test case.

tests/invalid/bad_foreign_enum.m:
    Add another bad foreign_enum to this test.

tests/invalid/bad_detism_category.err_exp:
tests/invalid/bad_foreign_code.err_exp:
tests/invalid/bad_foreign_enum.err_exp:
tests/invalid/bad_foreign_export.err_exp:
tests/invalid/bad_foreign_export_enum.err_exp:
tests/invalid/bad_foreign_import_module.err_exp:
tests/invalid/bad_foreign_proc.err_exp:
tests/invalid/bad_foreign_type.err_exp:
tests/invalid/bad_with_inst.err_exp:
tests/invalid/impl_def_literal_syntax.err_exp:
tests/invalid/invalid_float_literal.err_exp:
tests/invalid/null_char.err_exp:
tests/invalid/predmode.err_exp:
tests/invalid/require_tailrec_invalid.err_exp:
tests/invalid/some.err_exp:
tests/invalid/specified.err_exp:
tests/invalid/vars_in_wrong_places.err_exp:
    Expect the updated error messages.
This commit is contained in:
Zoltan Somogyi
2020-08-23 10:29:34 +10:00
parent c32ed67e20
commit 35a4f3a2dd
24 changed files with 1867 additions and 1029 deletions

View File

@@ -832,7 +832,8 @@ parse_clause(ModuleName, VarSet0, HeadTerm, BodyTerm0, Context, SeqNum,
then
MaybeFunctor = error2([Spec])
else
HeadContextPieces = cord.singleton(words("In equation head:")),
HeadContextPieces =
cord.from_list([words("In equation head:"), nl]),
parse_implicitly_qualified_sym_name_and_args(ModuleName,
FuncHeadTerm, VarSet, HeadContextPieces, MaybeFunctor)
)
@@ -843,7 +844,8 @@ parse_clause(ModuleName, VarSet0, HeadTerm, BodyTerm0, Context, SeqNum,
then
MaybeFunctor = error2([Spec])
else
HeadContextPieces = cord.singleton(words("In clause head:")),
HeadContextPieces =
cord.from_list([words("In clause head:"), nl]),
parse_implicitly_qualified_sym_name_and_args(ModuleName, HeadTerm,
VarSet, HeadContextPieces, MaybeFunctor)
)
@@ -890,10 +892,11 @@ parse_pred_or_func_decl_item(ModuleName, VarSet, Functor, ArgTerms,
(
IsInClass = decl_is_in_class,
PredOrFuncDeclPieces = [words("type class"), p_or_f(PredOrFunc),
words("method declaration:")]
words("method declaration:"), nl]
;
IsInClass = decl_is_not_in_class,
PredOrFuncDeclPieces = [p_or_f(PredOrFunc), words("declaration:")]
PredOrFuncDeclPieces =
[p_or_f(PredOrFunc), words("declaration:"), nl]
),
DetismContextPieces =
cord.from_list([words("In")] ++ PredOrFuncDeclPieces),
@@ -984,7 +987,7 @@ parse_pred_decl_base(PredOrFunc, ModuleName, VarSet, PredTypeTerm,
PurityAttrs, QuantConstrAttrs, MaybeIOM) :-
ContextPieces = cord.singleton(words("In")) ++
cord.from_list(pred_or_func_decl_pieces(PredOrFunc)) ++
cord.singleton(suffix(":")),
cord.from_list([suffix(":"), nl]),
get_class_context_and_inst_constraints_from_attrs(ModuleName, VarSet,
QuantConstrAttrs, ContextPieces, MaybeExistClassInstContext),
get_purity_from_attrs(Context, PurityAttrs, MaybePurity),
@@ -1116,16 +1119,18 @@ parse_func_decl_base(ModuleName, VarSet, Term, MaybeDet, IsInClass, Context,
MaybeIOM = error1(Specs)
;
MaybeFuncNameAndArgs = ok2(FuncName, ArgTerms),
ArgContextFunc = (func(ArgNum) = ContextPieces ++
ArgContextFunc =
( func(ArgNum) = ContextPieces ++
cord.from_list([words("in the"), nth_fixed(ArgNum),
words("argument:"), nl])),
words("argument:"), nl])
),
parse_type_and_modes(
constrain_some_inst_vars(InstConstraints),
dont_require_tm_mode, wnhii_func_arg,
VarSet, ArgContextFunc, ArgTerms, 1,
ArgTypesAndModes, [], ArgTMSpecs),
RetContextPieces = ContextPieces ++
cord.from_list([words("in the return value"), nl]),
cord.from_list([words("in the return value:"), nl]),
parse_type_and_mode(
constrain_some_inst_vars(InstConstraints),
dont_require_tm_mode, wnhii_func_return_arg,
@@ -1346,8 +1351,7 @@ parse_mode_decl(ModuleName, VarSet, Term, IsInClass, Context, SeqNum,
BeforeDetismTerm, MaybeMaybeDetism),
WithInstContextPieces = cord.from_list([
words("In the"), quote("with_inst"), words("annotation of a"),
DeclWords, words("declaration:")
]),
DeclWords, words("declaration:")]),
parse_with_inst_suffix(VarSet, WithInstContextPieces, BeforeDetismTerm,
BeforeWithInstTerm, MaybeWithInst),
BaseTerm = BeforeWithInstTerm,
@@ -1396,7 +1400,7 @@ parse_mode_decl_base(ModuleName, VarSet, Term, IsInClass, Context, SeqNum,
else
FuncTerm = desugar_field_access(MaybeSugaredFuncTerm),
ContextPieces = cord.from_list([words("In function"), decl("mode"),
words("declaration")]),
words("declaration:"), nl]),
parse_implicitly_qualified_sym_name_and_args(ModuleName, FuncTerm,
VarSet, ContextPieces, MaybeFunctorArgs),
(
@@ -1418,7 +1422,7 @@ parse_mode_decl_base(ModuleName, VarSet, Term, IsInClass, Context, SeqNum,
MaybeIOM = error1([Spec])
else
ContextPieces = cord.from_list([words("In"), decl("mode"),
words("declaration")]),
words("declaration:"), nl]),
parse_implicitly_qualified_sym_name_and_args(ModuleName, Term,
VarSet, ContextPieces, MaybeFunctorArgs),
(
@@ -1442,11 +1446,11 @@ parse_pred_mode_decl(Functor, ArgTerms, ModuleName, PredModeTerm, VarSet,
WithInst, MaybeDet, Context, SeqNum, QuantConstrAttrs, MaybeIOM) :-
ArgContextPieces = cord.from_list(
[words("In the mode declaration of the predicate"),
unqual_sym_name(Functor), suffix(":")]),
unqual_sym_name(Functor), suffix(":"), nl]),
parse_modes(allow_constrained_inst_var, VarSet, ArgContextPieces,
ArgTerms, MaybeArgModes0),
ContextPieces = cord.from_list([words("In predicate"), decl("mode"),
words("declaration")]),
words("declaration:"), nl]),
get_class_context_and_inst_constraints_from_attrs(ModuleName, VarSet,
QuantConstrAttrs, ContextPieces, MaybeConstraints),
( if
@@ -1496,16 +1500,16 @@ parse_func_mode_decl(Functor, ArgTerms, ModuleName, RetModeTerm, FullTerm,
VarSet, MaybeDetism, Context, SeqNum, QuantConstrAttrs, MaybeIOM) :-
ArgContextPieces = cord.from_list(
[words("In the mode declaration of the function"),
unqual_sym_name(Functor), suffix(":")]),
unqual_sym_name(Functor), suffix(":"), nl]),
parse_modes(allow_constrained_inst_var, VarSet, ArgContextPieces,
ArgTerms, MaybeArgModes0),
RetContextPieces = cord.from_list([words("In the return value"),
words("of the mode declaration of the function"),
unqual_sym_name(Functor), suffix(":")]),
unqual_sym_name(Functor), suffix(":"), nl]),
parse_mode(allow_constrained_inst_var, VarSet, RetContextPieces,
RetModeTerm, MaybeRetMode0),
QuantContextPieces = cord.from_list([words("In function"), decl("mode"),
words("declaration")]),
words("declaration:"), nl]),
get_class_context_and_inst_constraints_from_attrs(ModuleName, VarSet,
QuantConstrAttrs, QuantContextPieces, MaybeConstraints),
( if
@@ -1666,11 +1670,11 @@ get_class_context_and_inst_constraints_loop(ModuleName, VarSet,
(
QuantType = quant_type_exist,
TailContextPieces = [words("in first argument of"),
quote("some"), suffix(":")]
quote("some"), suffix(":"), nl]
;
QuantType = quant_type_univ,
TailContextPieces = [words("in first argument of"),
quote("all"), suffix(":")]
quote("all"), suffix(":"), nl]
),
VarsContextPieces = ContextPieces ++ cord.from_list(TailContextPieces),
parse_possibly_repeated_vars(VarsTerm, VarSet, VarsContextPieces,
@@ -1887,7 +1891,7 @@ parse_with_type_suffix(VarSet, Term, BeforeWithTypeTerm, MaybeWithType) :-
then
BeforeWithTypeTerm = BeforeWithTypeTermPrime,
ContextPieces = cord.from_list([words("In"), quote("with_type"),
words("annotation:")]),
words("annotation:"), nl]),
parse_type(no_allow_ho_inst_info(wnhii_type_qual),
VarSet, ContextPieces, TypeTerm, MaybeType),
(

File diff suppressed because it is too large Load Diff

View File

@@ -75,9 +75,11 @@
:- pred try_parse_sym_name_and_args_from_f_args(const::in, list(term(T))::in,
sym_name::out, list(term(T))::out) is semidet.
% A version of try_parse_sym_name_and_args that succeeds
% if the given term has no argument terms.
% Versions of parse_sym_name_and_args and try_parse_sym_name_and_args
% that require the given term to have no arguments.
%
:- pred parse_sym_name_and_no_args(varset::in, cord(format_component)::in,
term(T)::in, maybe1(sym_name)::out) is det.
:- pred try_parse_sym_name_and_no_args(term(T)::in, sym_name::out) is semidet.
% parse_implicitly_qualified_sym_name_and_args(ModuleName, Term,
@@ -176,7 +178,7 @@ parse_sym_name_and_args(VarSet, ContextPieces, Term, MaybeSymNameAndArgs) :-
Pieces = cord.list(ContextPieces) ++
[lower_case_next_if_not_first,
words("Error: module name expected before '.'"),
words("in qualified symbol name, not"),
words("in qualified symbol name, got"),
words(ModuleTermStr), suffix("."), nl],
Spec = simplest_spec($pred, severity_error,
phase_term_to_parse_tree, TermContext, Pieces),
@@ -187,7 +189,7 @@ parse_sym_name_and_args(VarSet, ContextPieces, Term, MaybeSymNameAndArgs) :-
TermStr = describe_error_term(GenericVarSet, Term),
Pieces = cord.list(ContextPieces) ++ [lower_case_next_if_not_first,
words("Error: identifier expected after '.'"),
words("in qualified symbol name, not"),
words("in qualified symbol name, got"),
words(TermStr), suffix("."), nl],
Spec = simplest_spec($pred, severity_error,
phase_term_to_parse_tree, TermContext, Pieces),
@@ -201,8 +203,8 @@ parse_sym_name_and_args(VarSet, ContextPieces, Term, MaybeSymNameAndArgs) :-
else
TermStr = describe_error_term(GenericVarSet, Term),
Pieces = cord.list(ContextPieces) ++ [lower_case_next_if_not_first,
words("Error: atom expected at"),
words(TermStr), suffix("."), nl],
words("Error: expected a symbol name, got"),
quote(TermStr), suffix("."), nl],
Spec = simplest_spec($pred, severity_error,
phase_term_to_parse_tree, get_term_context(Term), Pieces),
MaybeSymNameAndArgs = error2([Spec])
@@ -230,6 +232,78 @@ try_parse_sym_name_and_args_from_f_args(Functor, FunctorArgs, SymName, Args) :-
Args = FunctorArgs
).
parse_sym_name_and_no_args(VarSet, ContextPieces, Term, MaybeSymName) :-
( if
Term = term.functor(Functor, FunctorArgs, TermContext),
Functor = term.atom("."),
FunctorArgs = [ModuleTerm, NameArgsTerm]
then
( if NameArgsTerm = term.functor(term.atom(Name), Args, _) then
varset.coerce(VarSet, GenericVarSet),
parse_symbol_name(GenericVarSet, ModuleTerm, MaybeModule),
(
MaybeModule = ok1(Module),
SymName = qualified(Module, Name),
insist_on_no_args(ContextPieces, NameArgsTerm, SymName,
Args, MaybeSymName)
;
MaybeModule = error1(_),
ModuleTermStr = describe_error_term(GenericVarSet, ModuleTerm),
Pieces = cord.list(ContextPieces) ++
[lower_case_next_if_not_first,
words("Error: expected module name expected before '.'"),
words("in qualified symbol name, got"),
words(ModuleTermStr), suffix("."), nl],
Spec = simplest_spec($pred, severity_error,
phase_term_to_parse_tree, TermContext, Pieces),
MaybeSymName = error1([Spec])
)
else
varset.coerce(VarSet, GenericVarSet),
TermStr = describe_error_term(GenericVarSet, Term),
Pieces = cord.list(ContextPieces) ++ [lower_case_next_if_not_first,
words("Error: expected identifier after '.'"),
words("in qualified symbol name, got"),
words(TermStr), suffix("."), nl],
Spec = simplest_spec($pred, severity_error,
phase_term_to_parse_tree, TermContext, Pieces),
MaybeSymName = error1([Spec])
)
else
varset.coerce(VarSet, GenericVarSet),
( if Term = term.functor(term.atom(Name), Args, _) then
SymName = string_to_sym_name_sep(Name, "__"),
insist_on_no_args(ContextPieces, Term, SymName, Args, MaybeSymName)
else
TermStr = describe_error_term(GenericVarSet, Term),
Pieces = cord.list(ContextPieces) ++ [lower_case_next_if_not_first,
words("Error: atom expected at"),
words(TermStr), suffix("."), nl],
Spec = simplest_spec($pred, severity_error,
phase_term_to_parse_tree, get_term_context(Term), Pieces),
MaybeSymName = error1([Spec])
)
).
:- pred insist_on_no_args(cord(format_component)::in, term(T)::in,
sym_name::in, list(term(T))::in, maybe1(sym_name)::out) is det.
insist_on_no_args(ContextPieces, Term, SymName, Args, MaybeSymName) :-
(
Args = [],
MaybeSymName = ok1(SymName)
;
Args = [_ | _],
Name = sym_name_to_string(SymName),
Pieces = cord.list(ContextPieces) ++
[lower_case_next_if_not_first,
words("Error:"), quote(Name), words("has arguments,"),
words("expected none."), nl],
Spec = simplest_spec($pred, severity_error,
phase_term_to_parse_tree, get_term_context(Term), Pieces),
MaybeSymName = error1([Spec])
).
try_parse_sym_name_and_no_args(Term, SymName) :-
Term = term.functor(Functor, FunctorArgs, _TermContext),
Functor = term.atom(FunctorName),
@@ -272,7 +346,7 @@ parse_implicitly_qualified_sym_name_and_no_args(DefaultModuleName, Term,
;
Args0 = [_ | _],
ArgPieces = [words("Error: did not expect"),
qual_sym_name(SymName0), words(" to have any arguments."), nl],
qual_sym_name(SymName0), words("to have any arguments."), nl],
ArgSpec = simplest_spec($pred, severity_error,
phase_term_to_parse_tree, get_term_context(Term), ArgPieces),
ArgSpecs = [ArgSpec]

View File

@@ -71,6 +71,7 @@ SINGLEMODULE= \
bad_item_in_interface \
bad_module_name \
bad_mutable \
bad_pragma \
bad_pred_arity \
bad_sv_unify_msg \
bad_with_inst \

View File

@@ -1,24 +1,24 @@
bad_detism_category.m:015: In predicate declaration: error: invalid determinism
bad_detism_category.m:015: category `et'.
bad_detism_category.m:017: In function declaration: error: invalid determinism
bad_detism_category.m:017: category `et'.
bad_detism_category.m:015: In predicate declaration:
bad_detism_category.m:015: error: invalid determinism category `et'.
bad_detism_category.m:017: In function declaration:
bad_detism_category.m:017: error: invalid determinism category `et'.
bad_detism_category.m:019: Error: no clauses for predicate
bad_detism_category.m:019: `report_usage_message2'/2.
bad_detism_category.m:020: In mode declaration: error: invalid determinism
bad_detism_category.m:020: category `et'.
bad_detism_category.m:022: In predicate declaration: error: invalid determinism
bad_detism_category.m:022: category `et'.
bad_detism_category.m:024: In predicate declaration: error: invalid determinism
bad_detism_category.m:024: category `et'.
bad_detism_category.m:025: In predicate declaration: error: invalid determinism
bad_detism_category.m:025: category `et'.
bad_detism_category.m:027: In predicate declaration: error: invalid determinism
bad_detism_category.m:027: category `et'.
bad_detism_category.m:030: In type class predicate method declaration: error:
bad_detism_category.m:030: invalid determinism category `et'.
bad_detism_category.m:022: In predicate declaration:
bad_detism_category.m:022: error: invalid determinism category `et'.
bad_detism_category.m:024: In predicate declaration:
bad_detism_category.m:024: error: invalid determinism category `et'.
bad_detism_category.m:025: In predicate declaration:
bad_detism_category.m:025: error: invalid determinism category `et'.
bad_detism_category.m:027: In predicate declaration:
bad_detism_category.m:027: error: invalid determinism category `et'.
bad_detism_category.m:030: In type class predicate method declaration:
bad_detism_category.m:030: error: invalid determinism category `et'.
bad_detism_category.m:033: In type class method mode declaration: error:
bad_detism_category.m:033: invalid determinism category `et'.
bad_detism_category.m:035: In type class function method declaration: error:
bad_detism_category.m:035: invalid determinism category `et'.
bad_detism_category.m:037: In type class predicate method declaration: error:
bad_detism_category.m:037: invalid determinism category `et'.
bad_detism_category.m:035: In type class function method declaration:
bad_detism_category.m:035: error: invalid determinism category `et'.
bad_detism_category.m:037: In type class predicate method declaration:
bad_detism_category.m:037: error: invalid determinism category `et'.

View File

@@ -2,20 +2,27 @@ bad_foreign_code.m:017: Error: a `:- pragma foreign_code' declaration must have
bad_foreign_code.m:017: exactly two arguments.
bad_foreign_code.m:021: Error: a `:- pragma foreign_code' declaration must have
bad_foreign_code.m:021: exactly two arguments.
bad_foreign_code.m:025: Error: in the first argument of
bad_foreign_code.m:025: `:- pragma foreign_code' declaration: invalid
bad_foreign_code.m:025: language parameter. The valid language parameters are
bad_foreign_code.m:025: c, C, csharp, C#, erlang, Erlang, java and Java.
bad_foreign_code.m:029: Error: in the second argument of
bad_foreign_code.m:029: `:- pragma foreign_code' declaration: expected string
bad_foreign_code.m:029: for foreign code.
bad_foreign_code.m:033: Error: in the second argument of
bad_foreign_code.m:033: `:- pragma foreign_code' declaration: expected string
bad_foreign_code.m:033: for foreign code.
bad_foreign_code.m:043: Error: in the first argument of
bad_foreign_code.m:043: `:- pragma foreign_code' declaration: invalid
bad_foreign_code.m:043: language parameter. The valid language parameters are
bad_foreign_code.m:043: c, C, csharp, C#, erlang, Erlang, java and Java.
bad_foreign_code.m:044: Error: in the second argument of
bad_foreign_code.m:044: `:- pragma foreign_code' declaration: expected string
bad_foreign_code.m:044: for foreign code.
bad_foreign_code.m:025: In the first argument of `:- pragma foreign_code'
bad_foreign_code.m:025: declaration:
bad_foreign_code.m:025: error: expected the name of a foreign language, got
bad_foreign_code.m:025: `"InvalidLanguage"'.
bad_foreign_code.m:025: The valid languages are c, C, csharp, C#, erlang,
bad_foreign_code.m:025: Erlang, java and Java.
bad_foreign_code.m:029: In the second argument of `:- pragma foreign_code'
bad_foreign_code.m:029: declaration:
bad_foreign_code.m:029: error: expected a string containing foreign code, got
bad_foreign_code.m:029: `2222'.
bad_foreign_code.m:033: In the second argument of `:- pragma foreign_code'
bad_foreign_code.m:033: declaration:
bad_foreign_code.m:033: error: expected a string containing foreign code, got
bad_foreign_code.m:033: `include_file(3333)'.
bad_foreign_code.m:043: In the first argument of `:- pragma foreign_code'
bad_foreign_code.m:043: declaration:
bad_foreign_code.m:043: error: expected the name of a foreign language, got
bad_foreign_code.m:043: `"InvalidLanguage"'.
bad_foreign_code.m:043: The valid languages are c, C, csharp, C#, erlang,
bad_foreign_code.m:043: Erlang, java and Java.
bad_foreign_code.m:044: In the second argument of `:- pragma foreign_code'
bad_foreign_code.m:044: declaration:
bad_foreign_code.m:044: error: expected a string containing foreign code, got
bad_foreign_code.m:044: `6666'.

View File

@@ -1,23 +1,39 @@
bad_foreign_enum.m:044: Error: a `:- pragma foreign_enum' declaration must have
bad_foreign_enum.m:044: exactly three arguments.
bad_foreign_enum.m:048: Error: expected a non-empty list mapping constructors
bad_foreign_enum.m:048: to foreign values in `:- pragma foreign_enum'
bad_foreign_enum.m:048: declaration.
bad_foreign_enum.m:048: In first argument of `:- pragma foreign_enum'
bad_foreign_enum.m:048: declaration: error: invalid foreign language
bad_foreign_enum.m:048: In the first argument of `:- pragma foreign_enum'
bad_foreign_enum.m:048: declaration:
bad_foreign_enum.m:048: error: expected the name of a foreign language, got
bad_foreign_enum.m:048: `"InvalidLanguage"'.
bad_foreign_enum.m:052: In second argument of `:- pragma foreign_enum'
bad_foreign_enum.m:052: declaration: error: expected name/arity for type, got
bad_foreign_enum.m:048: The valid languages are c, C, csharp, C#, erlang,
bad_foreign_enum.m:048: Erlang, java and Java.
bad_foreign_enum.m:048: In the third argument of `:- pragma foreign_enum'
bad_foreign_enum.m:048: declaration:
bad_foreign_enum.m:048: error: the list mapping constructors to foreign
bad_foreign_enum.m:048: values must not be empty.
bad_foreign_enum.m:052: In the second argument of `:- pragma foreign_enum'
bad_foreign_enum.m:052: declaration:
bad_foreign_enum.m:052: error: expected `type_name/type_arity', got
bad_foreign_enum.m:052: `vegetable'.
bad_foreign_enum.m:059: In first argument of `:- pragma foreign_enum'
bad_foreign_enum.m:059: declaration: error: invalid foreign language
bad_foreign_enum.m:059: In the first argument of `:- pragma foreign_enum'
bad_foreign_enum.m:059: declaration:
bad_foreign_enum.m:059: error: expected the name of a foreign language, got
bad_foreign_enum.m:059: `"InvalidLanguage"'.
bad_foreign_enum.m:060: In second argument of `:- pragma foreign_enum'
bad_foreign_enum.m:060: declaration: error: expected name/arity for type, got
bad_foreign_enum.m:060: `meat'.
bad_foreign_enum.m:061: Error: expected a non-empty list mapping constructors
bad_foreign_enum.m:061: to foreign values in `:- pragma foreign_enum'
bad_foreign_enum.m:061: declaration.
bad_foreign_enum.m:067: Error: expected a valid mapping element, not `chicken'.
bad_foreign_enum.m:059: The valid languages are c, C, csharp, C#, erlang,
bad_foreign_enum.m:059: Erlang, java and Java.
bad_foreign_enum.m:060: In the second argument of `:- pragma foreign_enum'
bad_foreign_enum.m:060: declaration:
bad_foreign_enum.m:060: error: expected `type_name/type_arity', got `meat'.
bad_foreign_enum.m:061: In the third argument of `:- pragma foreign_enum'
bad_foreign_enum.m:061: declaration:
bad_foreign_enum.m:061: error: the list mapping constructors to foreign
bad_foreign_enum.m:061: values must not be empty.
bad_foreign_enum.m:067: Error: expected a mapping element of the form
bad_foreign_enum.m:067: `possibly_qualified_name - string', got `chicken'.
bad_foreign_enum.m:074: In `:- pragma foreign_enum' mapping constructor name:
bad_foreign_enum.m:074: error: atom expected at "goose".
bad_foreign_enum.m:081: Error: expected a mapping element of the form
bad_foreign_enum.m:081: `possibly_qualified_name - string', got `"goose"'.
bad_foreign_enum.m:082: Error: expected a mapping element of the form
bad_foreign_enum.m:082: `possibly_qualified_name - string', got `turkey'.
bad_foreign_enum.m:083: Error: expected a mapping element of the form
bad_foreign_enum.m:083: `possibly_qualified_name - string', got `X'.

View File

@@ -75,6 +75,14 @@
turkey - "561"
]).
% Ditto.
%
:- pragma foreign_enum("C", more_poultry/0, [
"goose",
turkey,
X
]).
% XXX TODO: we should generate more specific error messages in cases
% like the following:
%:- pragma foreign_enum("C", more_poultry/0, [

View File

@@ -1,24 +1,35 @@
bad_foreign_export.m:020: Error: a `:- pragma foreign_export' declaration must
bad_foreign_export.m:020: have exactly three arguments.
bad_foreign_export.m:024: In second argument of `:- pragma foreign_export'
bad_foreign_export.m:024: declaration: error: atom expected at 11111.
bad_foreign_export.m:028: In third argument of `:- pragma foreign_export'
bad_foreign_export.m:028: declaration: error: expected a non-empty string for
bad_foreign_export.m:028: the foreign language name of the exported
bad_foreign_export.m:028: procedure, got `22222'.
bad_foreign_export.m:032: In first argument of `:- pragma foreign_export'
bad_foreign_export.m:032: declaration: error: invalid foreign language
bad_foreign_export.m:024: In the second argument of `:- pragma foreign_export'
bad_foreign_export.m:024: declaration:
bad_foreign_export.m:024: error: expected a symbol name, got `11111'.
bad_foreign_export.m:028: In the third argument of `:- pragma foreign_export'
bad_foreign_export.m:028: declaration:
bad_foreign_export.m:028: error: expected a non-empty string for the foreign
bad_foreign_export.m:028: language name of the exported procedure, got
bad_foreign_export.m:028: `22222'.
bad_foreign_export.m:032: In the first argument of `:- pragma foreign_export'
bad_foreign_export.m:032: declaration:
bad_foreign_export.m:032: error: expected the name of a foreign language, got
bad_foreign_export.m:032: `"InvalidLanguage"'.
bad_foreign_export.m:037: In first argument of `:- pragma foreign_export'
bad_foreign_export.m:037: declaration: error: invalid foreign language
bad_foreign_export.m:032: The valid languages are c, C, csharp, C#, erlang,
bad_foreign_export.m:032: Erlang, java and Java.
bad_foreign_export.m:037: In the first argument of `:- pragma foreign_export'
bad_foreign_export.m:037: declaration:
bad_foreign_export.m:037: error: expected the name of a foreign language, got
bad_foreign_export.m:037: `"InvalidLanguage"'.
bad_foreign_export.m:038: In second argument of `:- pragma foreign_export'
bad_foreign_export.m:038: declaration: error: atom expected at 3333.
bad_foreign_export.m:039: In third argument of `:- pragma foreign_export'
bad_foreign_export.m:039: declaration: error: expected a non-empty string for
bad_foreign_export.m:039: the foreign language name of the exported
bad_foreign_export.m:039: procedure, got `4444'.
bad_foreign_export.m:044: In third argument of `:- pragma foreign_export'
bad_foreign_export.m:044: declaration: error: expected a non-empty string for
bad_foreign_export.m:044: the foreign language name of the exported
bad_foreign_export.m:044: procedure, got empty string.
bad_foreign_export.m:037: The valid languages are c, C, csharp, C#, erlang,
bad_foreign_export.m:037: Erlang, java and Java.
bad_foreign_export.m:038: In the second argument of `:- pragma foreign_export'
bad_foreign_export.m:038: declaration:
bad_foreign_export.m:038: error: expected a symbol name, got `3333'.
bad_foreign_export.m:039: In the third argument of `:- pragma foreign_export'
bad_foreign_export.m:039: declaration:
bad_foreign_export.m:039: error: expected a non-empty string for the foreign
bad_foreign_export.m:039: language name of the exported procedure, got
bad_foreign_export.m:039: `4444'.
bad_foreign_export.m:044: In the third argument of `:- pragma foreign_export'
bad_foreign_export.m:044: declaration:
bad_foreign_export.m:044: error: expected a non-empty string for the foreign
bad_foreign_export.m:044: language name of the exported procedure, got an
bad_foreign_export.m:044: empty string.

View File

@@ -1,25 +1,29 @@
bad_foreign_export_enum.m:017: Error: a `:- pragma foreign_export_enum'
bad_foreign_export_enum.m:017: declaration must have two, three or four
bad_foreign_export_enum.m:017: arguments.
bad_foreign_export_enum.m:021: In first argument of
bad_foreign_export_enum.m:021: In the first argument of
bad_foreign_export_enum.m:021: `:- pragma foreign_export_enum' declaration:
bad_foreign_export_enum.m:021: error: invalid foreign language
bad_foreign_export_enum.m:021: `"InvalidLanguage"'.
bad_foreign_export_enum.m:025: In second argument of
bad_foreign_export_enum.m:021: error: expected the name of a foreign
bad_foreign_export_enum.m:021: language, got `"InvalidLanguage"'.
bad_foreign_export_enum.m:021: The valid languages are c, C, csharp, C#,
bad_foreign_export_enum.m:021: erlang, Erlang, java and Java.
bad_foreign_export_enum.m:025: In the second argument of
bad_foreign_export_enum.m:025: `:- pragma foreign_export_enum' declaration:
bad_foreign_export_enum.m:025: error: expected name/arity for type, got
bad_foreign_export_enum.m:025: error: expected `type_name/type_arity', got
bad_foreign_export_enum.m:025: `fruit'.
bad_foreign_export_enum.m:028: In first argument of
bad_foreign_export_enum.m:028: In the first argument of
bad_foreign_export_enum.m:028: `:- pragma foreign_export_enum' declaration:
bad_foreign_export_enum.m:028: error: invalid foreign language
bad_foreign_export_enum.m:028: `"InvalidLanguage"'.
bad_foreign_export_enum.m:029: In second argument of
bad_foreign_export_enum.m:028: error: expected the name of a foreign
bad_foreign_export_enum.m:028: language, got `"InvalidLanguage"'.
bad_foreign_export_enum.m:028: The valid languages are c, C, csharp, C#,
bad_foreign_export_enum.m:028: erlang, Erlang, java and Java.
bad_foreign_export_enum.m:029: In the second argument of
bad_foreign_export_enum.m:029: `:- pragma foreign_export_enum' declaration:
bad_foreign_export_enum.m:029: error: expected name/arity for type, got
bad_foreign_export_enum.m:029: error: expected `type_name/type_arity', got
bad_foreign_export_enum.m:029: `fruit'.
bad_foreign_export_enum.m:030: Error: expected a list of attributes in the
bad_foreign_export_enum.m:030: third argument of a
bad_foreign_export_enum.m:030: `:- pragma foreign_export_enum' declaration,
bad_foreign_export_enum.m:030: got `1234'.
bad_foreign_export_enum.m:031: Error: expected list of mapping elements, not
bad_foreign_export_enum.m:030: In the third argument of
bad_foreign_export_enum.m:030: `:- pragma foreign_export_enum' declaration:
bad_foreign_export_enum.m:030: error: expected a list of attributes, got
bad_foreign_export_enum.m:030: `1234'.
bad_foreign_export_enum.m:031: Error: expected a list of mapping elements, got
bad_foreign_export_enum.m:031: `5678'.

View File

@@ -1,13 +1,20 @@
bad_foreign_import_module.m:018: Error: a `:- pragma foreign_import_module'
bad_foreign_import_module.m:018: declaration must have two arguments.
bad_foreign_import_module.m:022: In first argument of
bad_foreign_import_module.m:022: In the first argument of
bad_foreign_import_module.m:022: `:- pragma foreign_import_module'
bad_foreign_import_module.m:022: declaration: error: invalid foreign language
bad_foreign_import_module.m:022: `"InvalidForeignLang"'.
bad_foreign_import_module.m:027: In first argument of
bad_foreign_import_module.m:022: declaration:
bad_foreign_import_module.m:022: error: expected the name of a foreign
bad_foreign_import_module.m:022: language, got `"InvalidForeignLang"'.
bad_foreign_import_module.m:022: The valid languages are c, C, csharp, C#,
bad_foreign_import_module.m:022: erlang, Erlang, java and Java.
bad_foreign_import_module.m:027: In the first argument of
bad_foreign_import_module.m:027: `:- pragma foreign_import_module'
bad_foreign_import_module.m:027: declaration: error: invalid foreign language
bad_foreign_import_module.m:027: `"InvalidForeignLang"'.
bad_foreign_import_module.m:028: Error: invalid module name `int(int)' in
bad_foreign_import_module.m:027: declaration:
bad_foreign_import_module.m:027: error: expected the name of a foreign
bad_foreign_import_module.m:027: language, got `"InvalidForeignLang"'.
bad_foreign_import_module.m:027: The valid languages are c, C, csharp, C#,
bad_foreign_import_module.m:027: erlang, Erlang, java and Java.
bad_foreign_import_module.m:028: In the second argument of
bad_foreign_import_module.m:028: `:- pragma foreign_import_module'
bad_foreign_import_module.m:028: declaration.
bad_foreign_import_module.m:028: declaration:
bad_foreign_import_module.m:028: error: expected module name, got `int(int)'.

View File

@@ -2,28 +2,40 @@ bad_foreign_proc.m:017: Error: a `:- pragma foreign_proc' declaration must have
bad_foreign_proc.m:017: four arguments.
bad_foreign_proc.m:021: Error: a `:- pragma foreign_proc' declaration must have
bad_foreign_proc.m:021: four arguments.
bad_foreign_proc.m:030: In first argument of `:- pragma foreign_proc'
bad_foreign_proc.m:030: declaration: error: invalid foreign language
bad_foreign_proc.m:030: In the first argument of `:- pragma foreign_proc'
bad_foreign_proc.m:030: declaration:
bad_foreign_proc.m:030: error: expected the name of a foreign language, got
bad_foreign_proc.m:030: `"InvalidLanuage"'.
bad_foreign_proc.m:030: The valid languages are c, C, csharp, C#, erlang,
bad_foreign_proc.m:030: Erlang, java and Java.
bad_foreign_proc.m:039: In the second argument of `:- pragma foreign_proc'
bad_foreign_proc.m:039: declaration: error: atom expected at "foo".
bad_foreign_proc.m:039: declaration:
bad_foreign_proc.m:039: error: expected a symbol name, got `"foo"'.
bad_foreign_proc.m:043: In the third argument of `:- pragma foreign_proc'
bad_foreign_proc.m:043: declaration: error: expected an attribute list, found
bad_foreign_proc.m:043: "promise_pure".
bad_foreign_proc.m:043: declaration:
bad_foreign_proc.m:043: error: expected an attribute list, got
bad_foreign_proc.m:043: `"promise_pure"'.
bad_foreign_proc.m:053: In the third argument of `:- pragma foreign_proc'
bad_foreign_proc.m:053: declaration: error: conflicting attributes in
bad_foreign_proc.m:053: attribute list.
bad_foreign_proc.m:053: declaration:
bad_foreign_proc.m:053: error: conflicting attributes in attribute list.
bad_foreign_proc.m:060: In the fourth argument of `:- pragma foreign_proc'
bad_foreign_proc.m:060: declaration: error: expected a string containing
bad_foreign_proc.m:060: foreign code, got `5555'.
bad_foreign_proc.m:065: In first argument of `:- pragma foreign_proc'
bad_foreign_proc.m:065: declaration: error: invalid foreign language
bad_foreign_proc.m:060: declaration:
bad_foreign_proc.m:060: error: expected a string containing foreign code, got
bad_foreign_proc.m:060: `5555'.
bad_foreign_proc.m:065: In the first argument of `:- pragma foreign_proc'
bad_foreign_proc.m:065: declaration:
bad_foreign_proc.m:065: error: expected the name of a foreign language, got
bad_foreign_proc.m:065: `"InvalidLanguage"'.
bad_foreign_proc.m:065: The valid languages are c, C, csharp, C#, erlang,
bad_foreign_proc.m:065: Erlang, java and Java.
bad_foreign_proc.m:066: In the second argument of `:- pragma foreign_proc'
bad_foreign_proc.m:066: declaration: error: atom expected at "foo".
bad_foreign_proc.m:066: declaration:
bad_foreign_proc.m:066: error: expected a symbol name, got `"foo"'.
bad_foreign_proc.m:067: In the third argument of `:- pragma foreign_proc'
bad_foreign_proc.m:067: declaration: error: expected an attribute list, found
bad_foreign_proc.m:067: "promise_pure".
bad_foreign_proc.m:067: declaration:
bad_foreign_proc.m:067: error: expected an attribute list, got
bad_foreign_proc.m:067: `"promise_pure"'.
bad_foreign_proc.m:068: In the fourth argument of `:- pragma foreign_proc'
bad_foreign_proc.m:068: declaration: error: expected a string containing
bad_foreign_proc.m:068: foreign code, got `6666'.
bad_foreign_proc.m:068: declaration:
bad_foreign_proc.m:068: error: expected a string containing foreign code, got
bad_foreign_proc.m:068: `6666'.

View File

@@ -2,40 +2,54 @@ bad_foreign_type.m:017: Error: a `:- pragma foreign_type' declaration must have
bad_foreign_type.m:017: three or four arguments.
bad_foreign_type.m:021: Error: a `:- pragma foreign_type' declaration must have
bad_foreign_type.m:021: three or four arguments.
bad_foreign_type.m:025: In first argument of `:- pragma foreign_type'
bad_foreign_type.m:025: declaration: error: invalid foreign language
bad_foreign_type.m:025: In the first argument of `:- pragma foreign_type'
bad_foreign_type.m:025: declaration:
bad_foreign_type.m:025: error: expected the name of a foreign language, got
bad_foreign_type.m:025: `"InvalidLanguage"'.
bad_foreign_type.m:029: In second argument of `:- pragma foreign_type'
bad_foreign_type.m:029: declaration: error: atom expected at 1111.
bad_foreign_type.m:033: In third argument of `:- pragma foreign_type'
bad_foreign_type.m:033: declaration: error: expected a string specifying the
bad_foreign_type.m:033: foreign type descriptor, got `2222'.
bad_foreign_type.m:037: In fourth argument of `:- pragma foreign_type'
bad_foreign_type.m:037: declaration: error: expected a list of foreign type
bad_foreign_type.m:037: assertions, got `5555'.
bad_foreign_type.m:041: In fourth argument of `:- pragma foreign_type'
bad_foreign_type.m:041: declaration: error: expected a foreign type
bad_foreign_type.m:041: assertion, got `[not_an_assertion]'.
bad_foreign_type.m:045: In fourth argument of `:- pragma foreign_type'
bad_foreign_type.m:045: declaration: error: expected a foreign type
bad_foreign_type.m:045: assertion, got `["I\'m a string"]'.
bad_foreign_type.m:045: In fourth argument of `:- pragma foreign_type'
bad_foreign_type.m:045: declaration: error: expected a foreign type
bad_foreign_type.m:045: assertion, got `[3333, "I\'m a string"]'.
bad_foreign_type.m:025: The valid languages are c, C, csharp, C#, erlang,
bad_foreign_type.m:025: Erlang, java and Java.
bad_foreign_type.m:029: In the second argument of `:- pragma foreign_type'
bad_foreign_type.m:029: declaration:
bad_foreign_type.m:029: error: expected a symbol name, got `1111'.
bad_foreign_type.m:033: In the third argument of `:- pragma foreign_type'
bad_foreign_type.m:033: declaration:
bad_foreign_type.m:033: error: expected a string specifying the foreign type
bad_foreign_type.m:033: descriptor, got `2222'.
bad_foreign_type.m:037: In the fourth argument of `:- pragma foreign_type'
bad_foreign_type.m:037: declaration:
bad_foreign_type.m:037: error: expected a list of foreign type assertions,
bad_foreign_type.m:037: got `5555'.
bad_foreign_type.m:041: In the fourth argument of `:- pragma foreign_type'
bad_foreign_type.m:041: declaration:
bad_foreign_type.m:041: error: expected a foreign type assertion, got
bad_foreign_type.m:041: `[not_an_assertion]'.
bad_foreign_type.m:045: In the fourth argument of `:- pragma foreign_type'
bad_foreign_type.m:045: declaration:
bad_foreign_type.m:045: error: expected a foreign type assertion, got
bad_foreign_type.m:045: `["I\'m a string"]'.
bad_foreign_type.m:045: In the fourth argument of `:- pragma foreign_type'
bad_foreign_type.m:045: declaration:
bad_foreign_type.m:045: error: expected a foreign type assertion, got
bad_foreign_type.m:045: `[3333, "I\'m a string"]'.
bad_foreign_type.m:050: Error: expected `is'.
bad_foreign_type.m:055: In `:- pragma foreign_type' declaration: error:
bad_foreign_type.m:055: unrecognized `where' attribute `(foo is bar)'.
bad_foreign_type.m:055: Recognized `where' attributes have the form
bad_foreign_type.m:055: `equality is <<equality pred name>>' and
bad_foreign_type.m:055: `comparison is <<comparison pred name>>'.
bad_foreign_type.m:060: In first argument of `:- pragma foreign_type'
bad_foreign_type.m:060: declaration: error: invalid foreign language
bad_foreign_type.m:060: In the first argument of `:- pragma foreign_type'
bad_foreign_type.m:060: declaration:
bad_foreign_type.m:060: error: expected the name of a foreign language, got
bad_foreign_type.m:060: `"InvalidLanguage"'.
bad_foreign_type.m:061: In second argument of `:- pragma foreign_type'
bad_foreign_type.m:061: declaration: error: atom expected at 9999.
bad_foreign_type.m:062: In third argument of `:- pragma foreign_type'
bad_foreign_type.m:062: declaration: error: expected a string specifying the
bad_foreign_type.m:062: foreign type descriptor, got `[not_an_assertion]'.
bad_foreign_type.m:060: The valid languages are c, C, csharp, C#, erlang,
bad_foreign_type.m:060: Erlang, java and Java.
bad_foreign_type.m:061: In the second argument of `:- pragma foreign_type'
bad_foreign_type.m:061: declaration:
bad_foreign_type.m:061: error: expected a symbol name, got `9999'.
bad_foreign_type.m:062: In the third argument of `:- pragma foreign_type'
bad_foreign_type.m:062: declaration:
bad_foreign_type.m:062: error: expected a string specifying the foreign type
bad_foreign_type.m:062: descriptor, got `[not_an_assertion]'.
bad_foreign_type.m:066: In `:- pragma foreign_type' declaration: error:
bad_foreign_type.m:066: unrecognized `where' attribute `(bar is baaz)'.
bad_foreign_type.m:066: Recognized `where' attributes have the form
@@ -43,23 +57,29 @@ bad_foreign_type.m:066: `equality is <<equality pred name>>' and
bad_foreign_type.m:066: `comparison is <<comparison pred name>>'.
bad_foreign_type.m:071: Error: type `bar'/0 defined as foreign_type without
bad_foreign_type.m:071: being declared.
bad_foreign_type.m:075: In second argument of `:- pragma foreign_type'
bad_foreign_type.m:075: declaration: error: expected a type constructor and
bad_foreign_type.m:075: zero or more type variables as arguments, got `T'.
bad_foreign_type.m:081: In third argument of `:- pragma foreign_type'
bad_foreign_type.m:081: declaration: error: foreign type descriptor for
bad_foreign_type.m:081: language `C' must be a non-empty string.
bad_foreign_type.m:082: In third argument of `:- pragma foreign_type'
bad_foreign_type.m:082: declaration: error: foreign type descriptor for
bad_foreign_type.m:082: language `C#' must be a non-empty string.
bad_foreign_type.m:083: In third argument of `:- pragma foreign_type'
bad_foreign_type.m:083: declaration: error: foreign type descriptor for
bad_foreign_type.m:083: language `Java' must be a non-empty string.
bad_foreign_type.m:084: In third argument of `:- pragma foreign_type'
bad_foreign_type.m:084: declaration: error: foreign type descriptor for
bad_foreign_type.m:084: language `Erlang' must be an empty string.
bad_foreign_type.m:089: In fourth argument of `:- pragma foreign_type'
bad_foreign_type.m:089: declaration: error: foreign type assertion
bad_foreign_type.m:075: In the second argument of `:- pragma foreign_type'
bad_foreign_type.m:075: declaration:
bad_foreign_type.m:075: error: expected a type constructor and zero or more
bad_foreign_type.m:075: type variables as arguments, got `T'.
bad_foreign_type.m:081: In the third argument of `:- pragma foreign_type'
bad_foreign_type.m:081: declaration:
bad_foreign_type.m:081: error: foreign type descriptor for language `C' must
bad_foreign_type.m:081: be a non-empty string.
bad_foreign_type.m:082: In the third argument of `:- pragma foreign_type'
bad_foreign_type.m:082: declaration:
bad_foreign_type.m:082: error: foreign type descriptor for language `C#' must
bad_foreign_type.m:082: be a non-empty string.
bad_foreign_type.m:083: In the third argument of `:- pragma foreign_type'
bad_foreign_type.m:083: declaration:
bad_foreign_type.m:083: error: foreign type descriptor for language `Java'
bad_foreign_type.m:083: must be a non-empty string.
bad_foreign_type.m:084: In the third argument of `:- pragma foreign_type'
bad_foreign_type.m:084: declaration:
bad_foreign_type.m:084: error: foreign type descriptor for language `Erlang'
bad_foreign_type.m:084: must be an empty string.
bad_foreign_type.m:089: In the fourth argument of `:- pragma foreign_type'
bad_foreign_type.m:089: declaration:
bad_foreign_type.m:089: error: foreign type assertion
bad_foreign_type.m:089: `can_pass_as_mercury_type' is repeated.
bad_foreign_type.m:091: Warning: duplicate declaration for type `quux'/0.
bad_foreign_type.m:080: The previous declaration was here.

View File

@@ -0,0 +1,27 @@
bad_pragma.m:016: In the second argument of `:- pragma memo' declaration:
bad_pragma.m:016: error: expected one of `fast_loose', `specified(...)',
bad_pragma.m:016: `size_limit(...)', `statistics', `allow_reset', and
bad_pragma.m:016: `disable_warning_if_ignored', got `abracadabra'.
bad_pragma.m:016: In the second argument of `:- pragma memo' declaration:
bad_pragma.m:016: error: expected one of `fast_loose', `specified(...)',
bad_pragma.m:016: `size_limit(...)', `statistics', `allow_reset', and
bad_pragma.m:016: `disable_warning_if_ignored', got `xyzzy'.
bad_pragma.m:021: In the second argument of `:- pragma minimal_model'
bad_pragma.m:021: declaration:
bad_pragma.m:021: error: evaluation method minimal_model_stack_copy does not
bad_pragma.m:021: allow fast_loose tabling.
bad_pragma.m:022: In the second argument of `:- pragma minimal_model'
bad_pragma.m:022: declaration:
bad_pragma.m:022: error: evaluation method minimal_model_stack_copy does not
bad_pragma.m:022: allow size limits.
bad_pragma.m:023: In the second argument of `:- pragma minimal_model'
bad_pragma.m:023: declaration:
bad_pragma.m:023: error: evaluation method minimal_model_stack_copy does not
bad_pragma.m:023: allow disable_warning_if_ignored.
bad_pragma.m:030: Error: duplicate statistics attribute in `:- pragma memo'
bad_pragma.m:030: declaration.
bad_pragma.m:031: Error: duplicate allow_reset attribute in `:- pragma memo'
bad_pragma.m:031: declaration.
bad_pragma.m:036: In the second argument of `:- pragma memo' declaration:
bad_pragma.m:036: in the first argument of size_limit:
bad_pragma.m:036: error: expected a decimal integer, got `12.3'.

View File

@@ -0,0 +1,38 @@
%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
:- module bad_pragma.
:- interface.
:- pred foo1(int::in, int::out) is det.
:- pred foo2(int::in, int::out) is det.
:- pred foo3(int::in, int::out) is det.
:- pred foo4(int::in, int::out) is det.
:- implementation.
:- pragma memo(foo1/2, [xyzzy, abracadabra]).
foo1(N, N).
:- pragma minimal_model(foo2/2,
[fast_loose,
size_limit(42),
disable_warning_if_ignored]).
foo2(N, N).
:- pragma loop_check(foo3/2,
[allow_reset,
statistics,
statistics,
allow_reset]).
foo3(N, N).
:- pragma memo(foo4/2,
[size_limit(12.3)]).
foo4(N, N).

View File

@@ -3,8 +3,8 @@ bad_with_inst.m:012: error: `1234' is not a valid inst.
bad_with_inst.m:014: In the `with_inst' annotation of a function declaration:
bad_with_inst.m:014: error: `5678' is not a valid inst.
bad_with_inst.m:017: In the `with_inst' annotation of a type class predicate
bad_with_inst.m:017: method declaration: error: `"Hello"' is not a valid
bad_with_inst.m:017: inst.
bad_with_inst.m:017: method declaration:
bad_with_inst.m:017: error: `"Hello"' is not a valid inst.
bad_with_inst.m:019: In the `with_inst' annotation of a type class function
bad_with_inst.m:019: method declaration: error: `"World"' is not a valid
bad_with_inst.m:019: inst.
bad_with_inst.m:019: method declaration:
bad_with_inst.m:019: error: `"World"' is not a valid inst.

View File

@@ -1,23 +1,26 @@
impl_def_literal_syntax.m:011: Error: no clauses for predicate `g'/2.
impl_def_literal_syntax.m:012: Error: no clauses for predicate `h'/2.
impl_def_literal_syntax.m:014: In `:- pred' declaration: in the first argument:
impl_def_literal_syntax.m:014: In `:- pred' declaration:
impl_def_literal_syntax.m:014: in the first argument:
impl_def_literal_syntax.m:014: error: `$file' is not a type.
impl_def_literal_syntax.m:015: In `:- pred' declaration: error: atom expected
impl_def_literal_syntax.m:015: at $pred.
impl_def_literal_syntax.m:015: In `:- pred' declaration:
impl_def_literal_syntax.m:015: error: expected a symbol name, got `$pred'.
impl_def_literal_syntax.m:016: Syntax error at token 'u': operator or `.'
impl_def_literal_syntax.m:016: expected.
impl_def_literal_syntax.m:017: In `:- pred' declaration: in the first argument:
impl_def_literal_syntax.m:017: In `:- pred' declaration:
impl_def_literal_syntax.m:017: in the first argument:
impl_def_literal_syntax.m:017: error: `$file' is not a valid inst.
impl_def_literal_syntax.m:022: Error: symbol name expected at $file.
impl_def_literal_syntax.m:024: In clause head: error: atom expected at $line.
impl_def_literal_syntax.m:024: In clause head:
impl_def_literal_syntax.m:024: error: expected a symbol name, got `$line'.
impl_def_literal_syntax.m:027: In the definition of the inst `myinst': error:
impl_def_literal_syntax.m:027: an implementation defined literal such as
impl_def_literal_syntax.m:027: `$file' may not be a used as a bound inst.
impl_def_literal_syntax.m:030: In the definition of the inst `myinst2': error:
impl_def_literal_syntax.m:030: `$file' is not a valid inst.
impl_def_literal_syntax.m:032: Error: inst parameters must be variables.
impl_def_literal_syntax.m:034: In inst definition: error: atom expected at
impl_def_literal_syntax.m:034: $file.
impl_def_literal_syntax.m:034: In inst definition: error: expected a symbol
impl_def_literal_syntax.m:034: name, got `$file'.
impl_def_literal_syntax.m:041: Syntax error at token 'file': expected `,', `)',
impl_def_literal_syntax.m:041: or operator.
impl_def_literal_syntax.m:044: Syntax error at token 'file': expected `,', `)',

View File

@@ -18,16 +18,21 @@ invalid_float_literal.m:029: Syntax error at token `. ': unexpected token at
invalid_float_literal.m:029: start of (sub)term.
invalid_float_literal.m:029: Syntax error: unterminated exponent in float
invalid_float_literal.m:029: literal.
invalid_float_literal.m:031: In clause head: error: atom expected at 12.
invalid_float_literal.m:031: In clause head:
invalid_float_literal.m:031: error: expected a symbol name, got `12'.
invalid_float_literal.m:031: Syntax error: underscore before exponent.
invalid_float_literal.m:033: In clause head: error: atom expected at _12.
invalid_float_literal.m:033: In clause head:
invalid_float_literal.m:033: error: expected a symbol name, got `_12'.
invalid_float_literal.m:033: Syntax error: unterminated exponent in float
invalid_float_literal.m:033: literal.
invalid_float_literal.m:035: In clause head: error: atom expected at _123.
invalid_float_literal.m:035: In clause head:
invalid_float_literal.m:035: error: expected a symbol name, got `_123'.
invalid_float_literal.m:035: Syntax error: unterminated decimal literal.
invalid_float_literal.m:037: In clause head: error: atom expected at 123.
invalid_float_literal.m:037: In clause head:
invalid_float_literal.m:037: error: expected a symbol name, got `123'.
invalid_float_literal.m:037: Syntax error: underscore following decimal point.
invalid_float_literal.m:039: In clause head: error: atom expected at 123.
invalid_float_literal.m:039: In clause head:
invalid_float_literal.m:039: error: expected a symbol name, got `123'.
invalid_float_literal.m:039: Syntax error: unterminated decimal literal.
invalid_float_literal.m:041: Error: clause for predicate `-'/2
invalid_float_literal.m:041: without corresponding `:- pred' declaration.
@@ -39,11 +44,14 @@ invalid_float_literal.m:043: without corresponding `:- pred' declaration.
invalid_float_literal.m:043: Inferred :- pred +(T1, int).
invalid_float_literal.m:043: Syntax error: unterminated exponent in float
invalid_float_literal.m:043: literal.
invalid_float_literal.m:045: In clause head: error: atom expected at 12.
invalid_float_literal.m:045: In clause head:
invalid_float_literal.m:045: error: expected a symbol name, got `12'.
invalid_float_literal.m:045: Syntax error: underscore before exponent.
invalid_float_literal.m:047: In clause head: error: atom expected at _12.
invalid_float_literal.m:047: In clause head:
invalid_float_literal.m:047: error: expected a symbol name, got `_12'.
invalid_float_literal.m:047: Syntax error: unterminated exponent in float
invalid_float_literal.m:047: literal.
invalid_float_literal.m:049: In clause head: error: atom expected at _12.
invalid_float_literal.m:049: In clause head:
invalid_float_literal.m:049: error: expected a symbol name, got `_12'.
invalid_float_literal.m:049: Syntax error: unterminated exponent in float
invalid_float_literal.m:049: literal.

View File

@@ -2,7 +2,8 @@ null_char.m:017: Error: clause for predicate `int'/0
null_char.m:017: without corresponding `:- pred' declaration.
null_char.m:017: Inferred :- pred int.
null_char.m:017: Syntax error: null character is illegal in strings and names.
null_char.m:019: In clause head: error: atom expected at 1.
null_char.m:019: In clause head:
null_char.m:019: error: expected a symbol name, got `1'.
null_char.m:019: Syntax error: null character is illegal in strings and names.
null_char.m:021: Error: no clauses for predicate `wrong2'/1.
null_char.m:023: Syntax error at token `)': unexpected token at start of

View File

@@ -1,10 +1,14 @@
predmode.m:009: Error: some but not all arguments have modes.
predmode.m:009: The argument without a mode is the second.
predmode.m:017: In `:- pred' declaration: in the first argument:
predmode.m:017: In `:- pred' declaration:
predmode.m:017: in the first argument:
predmode.m:017: error: `1' is not a type.
predmode.m:017: In `:- pred' declaration: in the first argument:
predmode.m:017: In `:- pred' declaration:
predmode.m:017: in the first argument:
predmode.m:017: error: an integer such as `2' cannot be a valid mode.
predmode.m:017: In `:- pred' declaration: in the second argument:
predmode.m:017: In `:- pred' declaration:
predmode.m:017: in the second argument:
predmode.m:017: error: `"bad"' is not a type.
predmode.m:017: In `:- pred' declaration: in the second argument:
predmode.m:017: In `:- pred' declaration:
predmode.m:017: in the second argument:
predmode.m:017: error: a string such as `"worse"' cannot be a valid mode.

View File

@@ -13,27 +13,27 @@ require_tailrec_invalid.m:028: corresponding `:- func' declaration.
require_tailrec_invalid.m:031: Error: `:- pragma require_tail_recursion'
require_tailrec_invalid.m:031: declaration for undeclared mode of predicate
require_tailrec_invalid.m:031: `require_tailrec_invalid.length'/2.
require_tailrec_invalid.m:034: Error: Conflicting
require_tailrec_invalid.m:034: Error: conflicting
require_tailrec_invalid.m:034: `:- pragma require_tail_recursion' attributes:
require_tailrec_invalid.m:034: `error' conflicts with earlier attribute
require_tailrec_invalid.m:034: `warn'.
require_tailrec_invalid.m:037: Error: Conflicting
require_tailrec_invalid.m:037: Error: conflicting
require_tailrec_invalid.m:037: `:- pragma require_tail_recursion' attributes:
require_tailrec_invalid.m:037: `none' conflicts with earlier attribute
require_tailrec_invalid.m:037: `warn'.
require_tailrec_invalid.m:040: Error: Conflicting
require_tailrec_invalid.m:040: Error: conflicting
require_tailrec_invalid.m:040: `:- pragma require_tail_recursion' attributes:
require_tailrec_invalid.m:040: `none' conflicts with earlier attribute
require_tailrec_invalid.m:040: `error'.
require_tailrec_invalid.m:044: Error: Conflicting
require_tailrec_invalid.m:044: Error: conflicting
require_tailrec_invalid.m:044: `:- pragma require_tail_recursion' attributes:
require_tailrec_invalid.m:044: `self_recursion_only' conflicts with earlier
require_tailrec_invalid.m:044: attribute `self_or_mutual_recursion'.
require_tailrec_invalid.m:047: Error: Conflicting
require_tailrec_invalid.m:047: Error: conflicting
require_tailrec_invalid.m:047: `:- pragma require_tail_recursion' attributes:
require_tailrec_invalid.m:047: `none' conflicts with earlier attribute
require_tailrec_invalid.m:047: `self_or_mutual_recursion'.
require_tailrec_invalid.m:051: Error: Conflicting
require_tailrec_invalid.m:051: Error: conflicting
require_tailrec_invalid.m:051: `:- pragma require_tail_recursion' attributes:
require_tailrec_invalid.m:051: `none' conflicts with earlier attribute
require_tailrec_invalid.m:051: `self_recursion_only'.
@@ -43,17 +43,19 @@ require_tailrec_invalid.m:055: `blahblahblah'.
require_tailrec_invalid.m:059: Error: `:- pragma require_tail_recursion' pragma
require_tailrec_invalid.m:059: for `blahblahblah'/0 without corresponding
require_tailrec_invalid.m:059: `:- pred' declaration.
require_tailrec_invalid.m:061: Error: expected attribute list for
require_tailrec_invalid.m:061: In the second argument of
require_tailrec_invalid.m:061: `:- pragma require_tail_recursion'
require_tailrec_invalid.m:061: declaration, got `Woop'.
require_tailrec_invalid.m:064: Error: expected attribute list for
require_tailrec_invalid.m:061: declaration:
require_tailrec_invalid.m:061: error: expected attribute list, got `Woop'.
require_tailrec_invalid.m:064: In the second argument of
require_tailrec_invalid.m:064: `:- pragma require_tail_recursion'
require_tailrec_invalid.m:064: declaration, got `23'.
require_tailrec_invalid.m:071: Error: Conflicting
require_tailrec_invalid.m:064: declaration:
require_tailrec_invalid.m:064: error: expected attribute list, got `23'.
require_tailrec_invalid.m:071: Error: conflicting
require_tailrec_invalid.m:071: `:- pragma require_tail_recursion' attributes:
require_tailrec_invalid.m:071: `none' conflicts with earlier attribute
require_tailrec_invalid.m:071: `self_recursion_only'.
require_tailrec_invalid.m:071: Error: Conflicting
require_tailrec_invalid.m:071: Error: conflicting
require_tailrec_invalid.m:071: `:- pragma require_tail_recursion' attributes:
require_tailrec_invalid.m:071: `none' conflicts with earlier attribute
require_tailrec_invalid.m:071: `warn'.

View File

@@ -1,5 +1,6 @@
some.m:010: In `:- pred' declaration: in first argument of `some': expected a
some.m:010: list of variables, got `junk'.
some.m:010: In `:- pred' declaration:
some.m:010: in first argument of `some':
some.m:010: expected a list of variables, got `junk'.
some.m:017: In first argument of `some': expected a list of variables and/or
some.m:017: state variables, got `junk'.
some.m:019: In first argument of `some': expected a list of variables and/or

View File

@@ -2,7 +2,10 @@ specified.m:141: Error in `:- pragma memo' declaration for predicate
specified.m:141: `specified.ap_lp_fib'/3:
specified.m:141: argument 3: argument tabling method `addr' is not compatible
specified.m:141: with output modes.
specified.m:158: Error: expected argument tabling method, not `implied'.
specified.m:158: In the second argument of `:- pragma memo' declaration:
specified.m:158: in the first argument of specified:
specified.m:158: error: expected one of `value', `addr', `promise_implied',
specified.m:158: and `output', got `implied'.
specified.m:173: Error in `:- pragma memo' declaration for predicate
specified.m:173: `specified.ap_li_fib'/3:
specified.m:173: not enough argument tabling methods specified.
@@ -13,5 +16,9 @@ specified.m:213: compatible with input modes.
specified.m:233: Error in `:- pragma memo' declaration for predicate
specified.m:233: `specified.vv_ll_fib'/3:
specified.m:233: too many argument tabling methods specified.
specified.m:277: Error: expected one or two arguments for `specified'.
specified.m:285: Error: expected hidden argument tabling method, not `voodoo'.
specified.m:277: In the second argument of `:- pragma memo' declaration:
specified.m:277: error: specified must have one or two arguments.
specified.m:285: In the second argument of `:- pragma memo' declaration:
specified.m:285: in the second argument of specified:
specified.m:285: error: expected either `hidden_arg_value' or
specified.m:285: `hidden_arg_addr', got `voodoo'.

View File

@@ -12,14 +12,17 @@ vars_in_wrong_places.m:006: `:- implementation' declaration.
vars_in_wrong_places.m:006: The following assumes that the missing
vars_in_wrong_places.m:006: declaration is an `:- implementation'
vars_in_wrong_places.m:006: declaration.
vars_in_wrong_places.m:006: In clause head: error: atom expected at Oops1.
vars_in_wrong_places.m:007: In equation head: error: atom expected at Oops2.
vars_in_wrong_places.m:008: In equation head: error: atom expected at Oops3.
vars_in_wrong_places.m:009: In `:- pred' declaration: error: atom expected at
vars_in_wrong_places.m:009: Oops4.
vars_in_wrong_places.m:006: In clause head:
vars_in_wrong_places.m:006: error: expected a symbol name, got `Oops1'.
vars_in_wrong_places.m:007: In equation head:
vars_in_wrong_places.m:007: error: expected a symbol name, got `Oops2'.
vars_in_wrong_places.m:008: In equation head:
vars_in_wrong_places.m:008: error: expected a symbol name, got `Oops3'.
vars_in_wrong_places.m:009: In `:- pred' declaration:
vars_in_wrong_places.m:009: error: expected a symbol name, got `Oops4'.
vars_in_wrong_places.m:010: In `:- func' declaration:
vars_in_wrong_places.m:010: error: atom expected at Oops5.
vars_in_wrong_places.m:011: In `:- mode' declaration error: atom expected at
vars_in_wrong_places.m:011: Oops6.
vars_in_wrong_places.m:012: In function `:- mode' declaration error: atom
vars_in_wrong_places.m:012: expected at Oops7.
vars_in_wrong_places.m:010: error: expected a symbol name, got `Oops5'.
vars_in_wrong_places.m:011: In `:- mode' declaration:
vars_in_wrong_places.m:011: error: expected a symbol name, got `Oops6'.
vars_in_wrong_places.m:012: In function `:- mode' declaration:
vars_in_wrong_places.m:012: error: expected a symbol name, got `Oops7'.