logo       

Nice/src/bossa/syntax typedef.nice,1.4,1.5 NiceMethod.java,1.44,1.45 Monoty: msg#00035

Subject: Nice/src/bossa/syntax typedef.nice,1.4,1.5 NiceMethod.java,1.44,1.45 Monotype.java,1.37,1.38
Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3596/src/bossa/syntax

Modified Files:
        typedef.nice NiceMethod.java Monotype.java 
Log Message:
Fix methods declared inside classes with less type parameters than their
parents (fixes bug #1084559).


Index: typedef.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typedef.nice,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** typedef.nice        8 Dec 2004 23:03:37 -0000       1.4
--- typedef.nice        17 Dec 2004 20:45:08 -0000      1.5
***************
*** 719,728 ****
    if (def == null)
      return null;
!       
    let params = def.parentParams;
!   
    if (params == null)
      return null;
!       
    // Look for missing type parameters
    int missing = 0;
--- 719,728 ----
    if (def == null)
      return null;
! 
    let params = def.parentParams;
! 
    if (params == null)
      return null;
! 
    // Look for missing type parameters
    int missing = 0;
***************
*** 742,746 ****
     requires exactly these type parameters because it specializes its parent.
   */
! ?mlsub.typing.Monotype getTypeWithTC( TypeConstructor tc, 
mlsub.typing.Monotype[] sourceParams )
  {
    ?CTypeDefinition def = cast(getTypeDefinition(tc));
--- 742,746 ----
     requires exactly these type parameters because it specializes its parent.
   */
! ?mlsub.typing.Monotype getTypeWithTC(TypeConstructor tc, 
mlsub.typing.Monotype[] sourceParams )
  {
    ?CTypeDefinition def = cast(getTypeDefinition(tc));
***************
*** 767,771 ****
        fullParams[i] = params[i];
  
!   if (used < sourceParams.length)
      return null;
  
--- 767,771 ----
        fullParams[i] = params[i];
  
!   if (sourceParams != null && used < sourceParams.length)
      return null;
  

Index: Monotype.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Monotype.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** Monotype.java       1 Dec 2004 02:00:31 -0000       1.37
--- Monotype.java       17 Dec 2004 20:45:10 -0000      1.38
***************
*** 17,20 ****
--- 17,21 ----
  
  import mlsub.typing.MonotypeVar;
+ import mlsub.typing.TypeConstructor;
  import nice.tools.typing.PrimitiveType;
  
***************
*** 279,282 ****
--- 280,325 ----
  
    /****************************************************************
+    * Wrapper for delaying resolution of constructed monotypes.
+    ****************************************************************/
+ 
+   static Monotype createSure(final TypeConstructor tc, final 
mlsub.typing.Monotype[] params)
+   {
+     return new Monotype() {
+         boolean containsAlike() { return false; }
+ 
+         public mlsub.typing.Monotype rawResolve(TypeMap typeMap)
+         {
+           try{
+             return sure(new mlsub.typing.MonotypeConstructor(tc, params));
+           }
+           catch(mlsub.typing.BadSizeEx e){
+             // See if this is a class with default type parameters
+             mlsub.typing.Monotype res = dispatch.getTypeWithTC(tc, params);
+             if (res != null)
+               return sure(res);
+ 
+             throw User.error(this, "Class " + tc +
+                              Util.has(e.expected, "type parameter", 
e.actual));
+           }
+         }
+ 
+         Monotype substitute(Map m)
+         {
+           return this;
+         }
+ 
+         public Location location()
+         {
+           return Location.nowhere();
+         }
+ 
+         public String toString()
+         {
+           return tc + ( params != null ? Util.map("<",",",">",params) : "");
+         }
+       };
+   }
+ 
+   /****************************************************************
     * Nullness markers
     ****************************************************************/

Index: NiceMethod.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceMethod.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** NiceMethod.java     16 Dec 2004 20:18:46 -0000      1.44
--- NiceMethod.java     17 Dec 2004 20:45:10 -0000      1.45
***************
*** 89,93 ****
        constraint.addAtoms(thisConstraint.getAtoms());
  
!     mlsub.typing.Monotype thisType;
  
      // "alike" is not created for a non-abstract interface
--- 89,93 ----
        constraint.addAtoms(thisConstraint.getAtoms());
  
!     Monotype thisType;
  
      // "alike" is not created for a non-abstract interface
***************
*** 109,115 ****
          atom = new mlsub.typing.TypeConstructorLeqCst(alikeTC, tc);
        constraint.addAtom(AtomicConstraint.create(atom));
!       
!       thisType = new mlsub.typing.MonotypeConstructor(alikeTC, 
c.getTypeParameters());
!       
        if (hasAlike)
          {
--- 109,118 ----
          atom = new mlsub.typing.TypeConstructorLeqCst(alikeTC, tc);
        constraint.addAtom(AtomicConstraint.create(atom));
! 
!       thisType = Monotype.create
!           (Monotype.sure
!            (new mlsub.typing.MonotypeConstructor
!             (alikeTC, c.getTypeParameters())));
! 
        if (hasAlike)
          {
***************
*** 121,131 ****
        }
      else
!       thisType = 
!       new mlsub.typing.MonotypeConstructor(tc, c.getTypeParameters());
!     
!     params.addThis(Monotype.create(Monotype.sure(thisType)));
!     
      if (body == null)
!       return new NiceMethod(name, constraint, returnType, params, contract, 
                              isOverride);
      else
--- 124,134 ----
        }
      else
!       thisType =
!       Monotype.createSure(tc, c.getTypeParameters());
! 
!     params.addThis(thisType);
! 
      if (body == null)
!       return new NiceMethod(name, constraint, returnType, params, contract,
                              isOverride);
      else



-------------------------------------------------------
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://productguide.itmanagersjournal.com/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe