mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 15:26:31 +00:00
Estimated hours taken: 10
Make an addition to the type class info structure; add type infos for
any type variables from the head of the instance declaration which are
unconstrained, and make the class method call mechanism insert these as
arguments to method calls. The implementations of methods expect to be passed
a type info for each unconstrained type variable and a type class info for
each constraint. Previously we were not passing the appropriate type infos.
Also move the documentation about the type class transformation from
polymorphism.m to a new file, compiler/notes/type_class_transformation.html.
compiler/base_typeclass_info.m:
Generate the appropriate part of the new structure in the
base_typeclass_info.
compiler/polymorphism.m:
Add the appropriate type infos to the typeclass_info.
compiler/type_util.m:
Add a new predicate `get_unconstrained_tvars'.
runtime/mercury_deep_copy_body.h:
Update copy_typeclass_info to reflect the new structure.
runtime/mercury_ho_call.c:
Copy the extra type infos to the beginning of the arguments when
doing a class method call.
runtime/mercury_type_info.h:
Update the macros used to access the type class info.
compiler/notes/type_class_transformation.html:
The documentation about the type class transformation has been
moved from polymorphism.m to here. This change corrects that
documentation in several places and updates that documentation to
reflect the changes to the typeclass_info structure from this diff.
tests/hard_coded/typeclasses/instance_unconstrained_tvar.exp:
tests/hard_coded/typeclasses/instance_unconstrained_tvar.m:
A test case for this change.
tests/hard_coded/typeclasses/Mmakefile:
Turn this test case on. For the moment, type specialisation is
turned off for this test case as the specialiser does not insert the
extra type infos that are needed.