Nice/src/nice/tools/typing Types.java,1.12,1.13

Daniel Bonniot <[email protected]>
Newsgroups gmane.comp.lang.nice.cvs
Message-ID <[email protected]>
Update of /cvsroot/nice/Nice/src/nice/tools/typing
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10143/src/nice/tools/typing

Modified Files:
	Types.java 
Log Message:
Handle methods that are partly specialized by existing imported methods.


Index: Types.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/nice/tools/typing/Types.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Types.java	12 Jan 2005 18:50:35 -0000	1.12
--- Types.java	8 Mar 2005 16:03:26 -0000	1.13
***************
*** 307,310 ****
--- 307,345 ----
  
    /**
+      @returns true if functional types t1 and t2 have a partly common domain.
+               that is, there exists some types that belong to both domains.
+   */
+   public static boolean domainsIntersect(Polytype t1, Polytype t2)
+   {
+     Typing.enter();
+ 
+     try {
+ 
+       try {
+ 
+         Constraint.enter(t1.getConstraint());
+         Constraint.enter(t2.getConstraint());
+ 
+         // There exists argument types ...
+         Monotype[] args = MonotypeVar.news(parameters(t2).length);
+         Typing.introduce(args);
+ 
+         // ... that can be used for both methods ...
+         Typing.leq(args, parameters(t1));
+         Typing.leq(args, parameters(t2));
+       }
+       finally {
+         Typing.leave();
+       }
+     }
+     catch (TypingEx ex) {
+       return false;
+     }
+ 
+     // OK, there is an intersection
+     return true;
+   }
+ 
+   /**
       @returns true if the spec type specializes type parameters of the original
         type (which can not be checked at runtime during dispatch, and therefore



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.