Nice/testsuite/compiler/methods generalization.testsuite,1.4,1.5

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

Modified Files:
	generalization.testsuite 
Log Message:
Handle methods that are partly specialized by existing imported methods.


Index: generalization.testsuite
===================================================================
RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/generalization.testsuite,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** generalization.testsuite	13 Oct 2004 15:44:08 -0000	1.4
--- generalization.testsuite	8 Mar 2005 16:03:24 -0000	1.5
***************
*** 35,38 ****
--- 35,88 ----
  
  /// PASS
+   /// package a
+   /// Toplevel
+ class Top {} class Bot extends Top {}
+ 
+ class A
+ {
+   boolean ran = false;
+ 
+   void foo(Top x) { ran = true; }
+ }
+ 
+   /// package b import a
+   let a = new a.A();
+   doIt(a);
+   assert a.ran;
+ 
+   /// Toplevel
+ abstract interface Fooable
+ {
+   void foo(Bot b);
+ }
+ 
+ class a.A implements Fooable;
+ 
+ <Fooable F> void doIt(F fooable) = fooable.foo(new Bot());
+ 
+ 
+ /// PASS
+   // Real-world situation for the above.
+   doIt(System.out);
+ 
+   using(let w = new PrintWriter(new OutputStreamWriter(System.out))) {
+     doIt(w);
+   }
+ 
+   /// Toplevel
+ import java.io.*;
+ 
+ abstract interface Printer
+ {
+   void print(String);
+ }
+ 
+ class java.io.PrintStream implements Printer;
+ class java.io.PrintWriter implements Printer;
+ 
+ <Printer P> void doIt(P printer) = printer.print("hello\n");
+ 
+ 
+ /// PASS
    let c = new ArrayList();
    c.addTwice("A");



-------------------------------------------------------
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.