mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-20 00:15:27 +00:00
Estimated hours taken: 5
Branches: main
Fix a bug reported by Fergus, which caused an abort when a
user-defined unification or comparison predicate was ill-typed.
compiler/intermod.m:
Don't attempt to module qualify the unification
and comparison routines for type declarations that
won't be used on the current back-end -- they won't
have been typechecked. They will be ignored when read
back in, but we put them in the `.opt' file because
it is sometimes useful to test compiling a module
against a workspace using a grade different to that
used to build the workspace.
compiler/type_util.m:
Choose the correct unification/comparison predicates for
the current back-end where there are both Mercury and
foreign definitions for a type.
compiler/make_hlds.m:
compiler/foreign.m:
Move have_foreign_type_for_backend to foreign.m, for
use by intermod.m.
doc/reference_manual.texi:
Clarify the documentation about user-defined unification and
comparison predicates for foreign types.
tests/invalid/Mmakefile:
tests/invalid/illtyped_compare.{m,err_exp}:
Add a test case.
tests/invalid/make_opt_error.{m,err_exp}:
This change caused the error in this test case to not
be reported any more (it occurred in code not used
on the back-end being compiled for). Fix the test
so an error is reported.
16 lines
202 B
Mathematica
16 lines
202 B
Mathematica
:- module make_opt_error.
|
|
|
|
:- interface.
|
|
|
|
:- type coord.
|
|
|
|
:- func x(coord) = int.
|
|
:- func y(coord) = int.
|
|
|
|
:- implementation.
|
|
|
|
:- type coord ---> coord(x :: int, y :: int).
|
|
|
|
x(C) = C ^ x.
|
|
y(C) = C ^ y.
|