Files
mercury/tests/invalid_submodules/unresolved_overloading.err_exp
Zoltan Somogyi f32a26b4b3 Make the from_int method in enum cless a predicate.
library/enum.m:
    As above.

NEWS.md:
    Announce this breaking change.

library/bool.m:
library/char.m:
library/int.m:
library/term.m:
library/uint.m:
tests/hard_coded/deep_copy_exist.m:
tests/typeclasses/extract_typeinfo2.m:
    Conform to the change in enum.m.

compiler/pred_table.m:
    When typechecking leaves am ambiguity unresolved, a predicate
    in this module used to pick one of the candidate matches effectively
    at random to "resolve" it.

    After the change to enum.m, this led to a compiler abort when compiling
    uint.m. The ambiguity was between uint.from_int/2 and the new
    enum.from_int/2. The old algorithm picked enum.from_int/2, and tried
    to look up its class constraints in the current class context; this failed
    with an abort, because the current class context was empty.

    Fix this by choosing the match (or *a* match) with the fewest typeclass
    constraints to "resolve" any ambiguities.

tests/invalid/overload_resolution_preference.{m,err_exp}:
    A test case for the change to pred_table.m.

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

tests/invalid_submodules/unresolved_overloading.err_exp:
    Update this expected output after the change to pred_table.m.
2024-08-09 21:43:03 +02:00

13 lines
951 B
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unresolved_overloading.m:026: Error: unresolved overloading for predicate
unresolved_overloading.m:026: `annoying'. The matches are
unresolved_overloading.m:026: `unresolved_overloading.annoying'/3,
unresolved_overloading.m:026: `unresolved_overloading.sub.annoying'/3.
unresolved_overloading.m:026: You need to use an explicit module qualifier to
unresolved_overloading.m:026: select the one you intend to refer to.
unresolved_overloading.m:026: Proceeding on the assumption that the intended
unresolved_overloading.m:026: match is `unresolved_overloading.annoying'/3.
unresolved_overloading.m:026: If this assumption is incorrect, other error
unresolved_overloading.m:026: messages may be reported for this predicate or
unresolved_overloading.m:026: function solely because of this wrong
unresolved_overloading.m:026: assumption.