Files
mercury/tests/invalid/exported_foreign_enum.err_exp
Zoltan Somogyi f4bd666ec6 Simplify the handling of foreign_export_enums.
compiler/hlds_module.m:
    Change the representation of the mapping from Mercury constants
    to their exported foreign names from being a sym_name->string map
    to being a plain string->string map. Several parts of the compiler
    already required the sym_name key to be unqualified, which meant
    that its information content was just the constant's name anyway.
    This change enforces that invariant by encoding it in the data type.

    Document the fields of exported_enum_info. Put those fields into
    an order that makes this documentation flow logically.

compiler/add_foreign_enum.m:
    Rationalize the way foreign_export_enums (FEEs) are processed and checked.
    Check each entry in the override map just once, when it is first processed,
    and string away its module qualification then (after checking it).
    (Leaving the qualification check until later was probably the reason
    for the choice of a sym_name->string map in the old version.)

    Check whether the override map deviates from a bijection by keeping track
    of which Mercury constant names and which foreign names we have seen so
    far. This allows the error messages about "not a bijection" to say *why*
    the mapping is not a bijection. It also fixes an old bug that generated
    a "not a bijection" error for override maps that *were* bijections,
    but were bijections that covered only *some* of the enum type's constants.

    In error messages that include lists of constants or foreign names,
    consistently precede those lists with nl_indent_delta(2).

    Use a more consistent variable naming scheme.

compiler/export.m:
compiler/ml_type_gen.m:
    Conform to the changes in hlds_module.m.

tests/invalid/ee_invalid.err_exp:
tests/invalid/exported_foreign_enum.err_exp:
    Include the updated error messages in these expected outputs.

    Don't expect *any* error message for the FEE on line 75 of ee_invalid.m,
    which has a bijective (though incomplete) override map.
2018-02-24 13:50:52 +11:00

23 lines
1.4 KiB
Plaintext

exported_foreign_enum.m:052: In `:- pragma foreign_export_enum' declaration for
exported_foreign_enum.m:052: type `exported_foreign_enum.foo'/0:
exported_foreign_enum.m:052: error: `exported_foreign_enum.foo'/0 is not an
exported_foreign_enum.m:052: enumeration type.
exported_foreign_enum.m:052: It has this non-zero arity constructor:
exported_foreign_enum.m:052: `foo'/1.
exported_foreign_enum.m:054: In `:- pragma foreign_enum' declaration for type
exported_foreign_enum.m:054: `exported_foreign_enum.foo'/0:
exported_foreign_enum.m:054: error: `exported_foreign_enum.foo'/0 is not an
exported_foreign_enum.m:054: enumeration type.
exported_foreign_enum.m:054: It has this non-zero arity constructor:
exported_foreign_enum.m:054: `foo'/1.
exported_foreign_enum.m:073: In `:- pragma foreign_enum' declaration for type
exported_foreign_enum.m:073: `exported_foreign_enum.t1'/0:
exported_foreign_enum.m:073: error: `exported_foreign_enum.t1'/0 is not an
exported_foreign_enum.m:073: enumeration type.
exported_foreign_enum.m:073: It has this non-zero arity constructor:
exported_foreign_enum.m:073: `f13'/1.
exported_foreign_enum.m:100: In `:- pragma foreign_enum' declaration for type
exported_foreign_enum.m:100: `exported_foreign_enum.t3'/0:
exported_foreign_enum.m:100: error: `exported_foreign_enum.t3'/0 is not an
exported_foreign_enum.m:100: enumeration type; it is an equivalence type.