Files
mercury/tests/invalid_purity/purity.err_exp
Zoltan Somogyi 62d9fcbe4b Ignore (mostly) comments inside foreign_procs.
compiler/foreign.m:
    When returning the list of identifiers inside a foreign_proc's code,
    ignore the contents of comments. This means that warnings about
    variable names that occur in the foreign_proc's argument list
    but do not occur in the foreign_proc's code cannot be shut up anymore
    by mention the variable name in comments.

    The "mostly" part is that typecheck.m still looks at the bodies
    of foreign_procs without knowing about comments. Fixing that
    will be part a future change.

NEWS.md:
    Announce this breaking change.

compiler/fact_table_gen.m:
    When we try to generate a foreign_proc's body for a fact table
    but cannot do so due to the fact table file not being readable,
    add a marker to the predicate that the fact table is for.

compiler/hlds_markers.m:
    Update the documentation of the existing predicate marker
    we use for this.

compiler/make_hlds_warn.m:
    Do not warn about singleton variables in foreign_proc bodies
    that are empty due to missing fact table files.

library/array.m:
library/io.file.m:
library/profiling_builtin.m:
library/stm_builtin.m:
library/table_builtin.m:
library/term_size_prof_builtin.m:
tests/invalid/erroneous_throw_promise.m:
tests/invalid/foreign_procs_exist_type.m:
tests/invalid/foreign_purity_mismatch.m:
tests/invalid/gh72_errors.m:
tests/invalid_purity/purity.m:
tests/valid/solv.m:
    Shut up warnings about singletons in foreign_procs by adding a _ prefix
    to the names of the relevant arguments, and delete the comments
    that can no longer do that job.

tests/invalid/foreign_purity_mismatch.err_exp:
tests/invalid/gh72_errors.err_exp:
tests/invalid/gh72_errors.err_exp2:
tests/invalid/gh72_errors.err_exp3:
tests/invalid_purity/purity.err_exp:
    Expect updated line numbers.

tests/warnings/warn_return.{m,err_exp}:
    Extend this test case to test that

    - we DO warn about return statements outside comments, but
    - we DO NOT warn about return statements inside comments.
2026-01-28 13:34:30 +11:00

3.6 KiB

purity.m:112: Warning: predicate `w1'/0 is declared impure, but is actually
purity.m:112: pure.
purity.m:116: Warning: predicate `w2'/0 is declared semipure, but is actually
purity.m:116: pure.
purity.m:120: Warning: predicate `w3'/0 is declared impure, but is actually
purity.m:120: semipure.
purity.m:125: Warning: unnecessary `promise_pure' pragma for predicate `w4'/0.
purity.m:130: Error: predicate `w5'/0 is declared impure but promised pure.
purity.m:136: Error: predicate `w6'/0 is declared semipure but promised pure.
purity.m:145: Error: predicate `e1'/0 is impure. It must either be declared
purity.m:145: impure, or promised pure.
purity.m:150: Error: predicate `e2'/0 is semipure. It must either be declared
purity.m:150: semipure, or promised pure.
purity.m:155: Error: predicate `e3'/0 is impure. It must either be declared
purity.m:155: impure, or promised semipure.
purity.m:163: In call to impure predicate `purity.imp'/0:
purity.m:163: purity error: call must be preceded by an `impure' indicator.
purity.m:168: In call to semipure predicate `purity.semi'/0:
purity.m:168: purity error: call must be preceded by a `semipure' indicator.
purity.m:173: In clause for `e6':
purity.m:173: in argument 1 of call to predicate `purity.in'/1:
purity.m:173: mode error: variable `X' has instantiatedness `free',
purity.m:173: expected instantiatedness was `ground'.
purity.m:173: The goal could not be reordered, because it was followed by an
purity.m:173: impure goal.
purity.m:174: This is the location of the impure goal.
purity.m:180: In clause for `e7':
purity.m:180: in argument 1 of call to predicate `purity.imp1'/1:
purity.m:180: mode error: variable `X' has instantiatedness `free',
purity.m:180: expected instantiatedness was `ground'.
purity.m:180: The goal could not be reordered, because it was impure.
purity.m:183: Error: unification predicate for type `e8' is impure, but it must
purity.m:183: be pure.
purity.m:198: Error: unification predicate for type `e9' is semipure, but it
purity.m:198: must be pure.
purity.m:216: In call to impure predicate `purity.imp1'/1:
purity.m:216: purity error: call must be preceded by an `impure' indicator.
purity.m:216: Purity error: the body of the lambda expression is impure, but
purity.m:216: the lambda expression itself was declared pure.
purity.m:222: In call to semipure predicate `purity.semi'/1:
purity.m:222: purity error: call must be preceded by a `semipure' indicator.
purity.m:222: Purity error: the body of the lambda expression is semipure, but
purity.m:222: the lambda expression itself was declared pure.
For more information, recompile with `-E'.