mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-25 06:14:18 +00:00
Estimated hours taken: 1 Branches: main Fix a bug (#27) reported by Ralph. The compiler was aborting on instances that contained type variables that were not wrapped in functors. The problem is that the name mangling scheme used to mangle the names of method wrapper predicates cannot handle instances that contain unwrapped type variables. The compiler already has code to check for this, but that check was not being performed until *after* it had attempted to introduce the method wrapper predicates. The fix is to reorder the phases of check_typeclass.m so that we perform the check on the types in an instance first and only run the remaining phases if the first one succeeds. compiler/check_typeclass.m: Reorder the phases within this module so that we don't attempt to introduce method wrapper predicates for invalid instances. Update the documentation in this module to conform to the above change. Remove some unnecessary module qualification. tests/invalid/Mercury.options: tests/invalid/Mmakefile: tests/invalid/instance_var_bug.{m,err_exp}: Test for the above bug. tests/invalid/bad_instance.err_exp: Update this. The error message for the missing concrete instance won't be emitted with the above change. Note, we have a separate test case, tests/invalid/missing_concrete_instance, that exercises that error message.
5 lines
274 B
Plaintext
5 lines
274 B
Plaintext
instance_var_bug.m:014: In instance declaration for `instance_var_bug.tc(V)':
|
|
instance_var_bug.m:014: the first arg is a type variable
|
|
instance_var_bug.m:014: types in instance declarations must be functors with
|
|
instance_var_bug.m:014: distinct variables as arguments
|