mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 03:43:51 +00:00
compiler/add_foreign_enum.m:
compiler/check_type_inst_mode_defns.m:
There used to be unnecessary differences between how we reported
foreign_enum and foreign_export_enum pragmas for non-enum du types.
Fir this by using the same code for reporting this problem for
both pragmas. Make this code use the best parts of each original approach.
tests/invalid/ee_invalid.err_exp:
tests/invalid/exported_foreign_enum.err_exp:
Expect the updated text.
3.8 KiB
3.8 KiB
ee_invalid.m:039: Error: `:- pragma foreign_export_enum' declarations are not
ee_invalid.m:039: allowed for builtin types such as `int'/0.
ee_invalid.m:043: In `:- pragma foreign_export_enum' declaration:
ee_invalid.m:043: error: the type `undefined_type'/0 is undefined.
ee_invalid.m:047: Error: the Mercury definition of `ee_invalid.foo'/1 is not an
ee_invalid.m:047: enumeration type, so there must not be any
ee_invalid.m:047: `:- pragma foreign_export_enum' declarations for it.
ee_invalid.m:010: That Mercury definition is here.
ee_invalid.m:010: It has this non-zero arity constructor:
ee_invalid.m:010: `foo'/1.
ee_invalid.m:051: Error: the Mercury definition of `ee_invalid.bar'/0 is an
ee_invalid.m:051: equivalence type, not an enumeration type, so there must
ee_invalid.m:051: not be any `:- pragma foreign_export_enum' declarations for
ee_invalid.m:051: it.
ee_invalid.m:013: That Mercury definition is here.
ee_invalid.m:058: Error: the Mercury definition of `ee_invalid.baz'/0 is a
ee_invalid.m:058: foreign type, not an enumeration type, so there must not be
ee_invalid.m:058: any `:- pragma foreign_export_enum' declarations for it.
ee_invalid.m:020: That Mercury definition is here.
ee_invalid.m:063: In `:- pragma foreign_export_enum' declaration for type
ee_invalid.m:063: `ee_invalid.alphabet'/0:
ee_invalid.m:063: error: the following symbol is not a constructor of the
ee_invalid.m:063: type:
ee_invalid.m:063: `deg'.
ee_invalid.m:068: In `:- pragma foreign_export_enum' declaration for type
ee_invalid.m:068: `ee_invalid.alphabet'/0:
ee_invalid.m:068: error: the following symbol has a module qualification that
ee_invalid.m:068: is not compatible with the type definition:
ee_invalid.m:068: `foo.def'.
ee_invalid.m:073: In `:- pragma foreign_export_enum' declaration for type
ee_invalid.m:073: `ee_invalid.alphabet'/0:
ee_invalid.m:073: error: the following symbol is not a constructor of the
ee_invalid.m:073: type:
ee_invalid.m:073: `deg'.
ee_invalid.m:073: In `:- pragma foreign_export_enum' declaration for type
ee_invalid.m:073: `ee_invalid.alphabet'/0:
ee_invalid.m:073: error: the specified mapping between the names of Mercury
ee_invalid.m:073: constructors and the corresponding foreign names is
ee_invalid.m:073: inconsistent.
ee_invalid.m:073: The following foreign name is repeated:
ee_invalid.m:073: `ABC'.
ee_invalid.m:077: In `:- pragma foreign_export_enum' declaration for type
ee_invalid.m:077: `ee_invalid.alphabet'/0:
ee_invalid.m:077: error: the specified mapping between the names of Mercury
ee_invalid.m:077: constructors and the corresponding foreign names is
ee_invalid.m:077: inconsistent.
ee_invalid.m:077: The following Mercury constructor name is repeated:
ee_invalid.m:077: `abc'.
ee_invalid.m:083: In `:- pragma foreign_export_enum' declaration for type
ee_invalid.m:083: `ee_invalid.strange_names'/0:
ee_invalid.m:083: error: some of the constructors of the type cannot be
ee_invalid.m:083: converted into valid identifiers.
ee_invalid.m:083: The problematic foreign names are:
ee_invalid.m:083: `!@THIS',
ee_invalid.m:083: `#$WON'T',
ee_invalid.m:083: `%^WORK'.
ee_invalid.m:039: allowed for builtin types such as `int'/0.
ee_invalid.m:043: In `:- pragma foreign_export_enum' declaration:
ee_invalid.m:043: error: the type `undefined_type'/0 is undefined.
ee_invalid.m:047: Error: the Mercury definition of `ee_invalid.foo'/1 is not an
ee_invalid.m:047: enumeration type, so there must not be any
ee_invalid.m:047: `:- pragma foreign_export_enum' declarations for it.
ee_invalid.m:010: That Mercury definition is here.
ee_invalid.m:010: It has this non-zero arity constructor:
ee_invalid.m:010: `foo'/1.
ee_invalid.m:051: Error: the Mercury definition of `ee_invalid.bar'/0 is an
ee_invalid.m:051: equivalence type, not an enumeration type, so there must
ee_invalid.m:051: not be any `:- pragma foreign_export_enum' declarations for
ee_invalid.m:051: it.
ee_invalid.m:013: That Mercury definition is here.
ee_invalid.m:058: Error: the Mercury definition of `ee_invalid.baz'/0 is a
ee_invalid.m:058: foreign type, not an enumeration type, so there must not be
ee_invalid.m:058: any `:- pragma foreign_export_enum' declarations for it.
ee_invalid.m:020: That Mercury definition is here.
ee_invalid.m:063: In `:- pragma foreign_export_enum' declaration for type
ee_invalid.m:063: `ee_invalid.alphabet'/0:
ee_invalid.m:063: error: the following symbol is not a constructor of the
ee_invalid.m:063: type:
ee_invalid.m:063: `deg'.
ee_invalid.m:068: In `:- pragma foreign_export_enum' declaration for type
ee_invalid.m:068: `ee_invalid.alphabet'/0:
ee_invalid.m:068: error: the following symbol has a module qualification that
ee_invalid.m:068: is not compatible with the type definition:
ee_invalid.m:068: `foo.def'.
ee_invalid.m:073: In `:- pragma foreign_export_enum' declaration for type
ee_invalid.m:073: `ee_invalid.alphabet'/0:
ee_invalid.m:073: error: the following symbol is not a constructor of the
ee_invalid.m:073: type:
ee_invalid.m:073: `deg'.
ee_invalid.m:073: In `:- pragma foreign_export_enum' declaration for type
ee_invalid.m:073: `ee_invalid.alphabet'/0:
ee_invalid.m:073: error: the specified mapping between the names of Mercury
ee_invalid.m:073: constructors and the corresponding foreign names is
ee_invalid.m:073: inconsistent.
ee_invalid.m:073: The following foreign name is repeated:
ee_invalid.m:073: `ABC'.
ee_invalid.m:077: In `:- pragma foreign_export_enum' declaration for type
ee_invalid.m:077: `ee_invalid.alphabet'/0:
ee_invalid.m:077: error: the specified mapping between the names of Mercury
ee_invalid.m:077: constructors and the corresponding foreign names is
ee_invalid.m:077: inconsistent.
ee_invalid.m:077: The following Mercury constructor name is repeated:
ee_invalid.m:077: `abc'.
ee_invalid.m:083: In `:- pragma foreign_export_enum' declaration for type
ee_invalid.m:083: `ee_invalid.strange_names'/0:
ee_invalid.m:083: error: some of the constructors of the type cannot be
ee_invalid.m:083: converted into valid identifiers.
ee_invalid.m:083: The problematic foreign names are:
ee_invalid.m:083: `!@THIS',
ee_invalid.m:083: `#$WON'T',
ee_invalid.m:083: `%^WORK'.