[m-dev.] diff: disable post_typecheck for class methods

David Glen JEFFERY dgj at cs.mu.OZ.AU
Tue Jul 6 16:32:29 AEST 1999


Estimated hours taken: 0.5

compiler/purity.m:
	Do not check for unbound type variables in the body of a class
	method. The class method body is not filled in until all semantic
	analysis is done, so performing the check will produce spurious
	warning messages in the case where there is an existentially
	quantified tvar on the class method.

tests/valid/typeclass_exist_method.m:
	A test case for this.
tests/valid/Mmakefile:
	Turn this test case on.

cvs diff: Diffing .
Index: purity.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/purity.m,v
retrieving revision 1.14
diff -u -t -r1.14 purity.m
--- purity.m	1999/06/30 17:12:38	1.14
+++ purity.m	1999/07/05 07:19:34
@@ -259,7 +259,13 @@
                 ModuleInfo, NumErrors0, NumErrors) -->
         { module_info_preds(ModuleInfo0, Preds0) },
         { map__lookup(Preds0, PredId, PredInfo0) },
-        (       
+        { pred_info_get_markers(PredInfo0, Markers) },
+        ( 
+                { check_marker(Markers, class_method) }
+        ->
+                { PredInfo = PredInfo0 },
+                { NumErrors1 = NumErrors0 }
+        ;       
                 { pred_info_is_imported(PredInfo0)
                 ; pred_info_is_pseudo_imported(PredInfo0) }
         ->
cvs diff: Diffing notes

[ I can't get a lock in the tests directory, but I've just added
  typeclass_exist_method.m to the list of test cases in the valid
  directory's Mmakefile and added the file typeclass_exist_method.m itself ].

New file: typeclass_exist_method.m:
=============================================================================
:- module typeclass_exist_method.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.

:- typeclass toto(T) where
  [
  ].

:- typeclass toto2(T) where
  [
      some[V] (pred gen_toto(T::in, V::out) is det => toto(V))
  ].

main -->
        io__write("Hello World"), nl,
        io__print(0).
:- end_module typeclass_exist_method.



dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) | If your thesis is utterly vacuous
PhD student,                    | Use first-order predicate calculus.
Dept. of Comp. Sci. & Soft. Eng.|     With sufficient formality
The University of Melbourne     |     The sheerist banality
Australia                       | Will be hailed by the critics: "Miraculous!"
                                |     -- Anon.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list