[nem-bug] [Nemerle 0000569]: list/Nil/Cons mismatch with local generic function

feedback at nemerle.org feedback at nemerle.org
Mon May 22 18:03:35 CEST 2006


The following issue has been CLOSED
======================================================================
<http://nemerle.org/bugs/view.php?id=569> 
======================================================================
Reported By:                malekith
Assigned To:                malekith
======================================================================
Project:                    Nemerle
Issue ID:                   569
Category:                   Compiler (type engine)
Reproducibility:            always
Severity:                   minor
Priority:                   high
Status:                     closed
Resolution:                 not fixable
Fixed in Version:           
======================================================================
Date Submitted:             11-12-2005 13:40 CET
Last Modified:              05-22-2006 18:03 CEST
======================================================================
Summary:                    list/Nil/Cons mismatch with local generic function
Description: 
def isSorted[Element](sequence) where Element: System.IComparable[Element]
{
  | head::nextOne::tail =>
    isSorted(nextOne::tail) && (head: Element).CompareTo(nextOne: Element)
!= 1
  | []
  | _::[] => true
}

isSorted ([1,2,3]);

======================================================================

----------------------------------------------------------------------
 malekith - 11-20-05 12:10 
----------------------------------------------------------------------
simpler example:

def isSorted['a](_)
{
  | x1 :: x2 :: xs =>
    isSorted(x2 :: xs) &&
    x1.CompareTo(x2) != 1
  | []
  | [_] => true
}

isSorted ([1,2,3]);

this is strange, because removing ['a] makes it work

----------------------------------------------------------------------
 malekith - 11-20-05 13:19 
----------------------------------------------------------------------
The problem is here:

            | LocalValue.Kind.Function (fun_header, _) =>
              mutable sub = null;
              mutable typarms = [];

              def fnty =
                if (fun_header.typarms.IsEmpty)
                  local.Type
                else {
                  // XXX this fixes entire type, but we cannot do any
better
                  // I guess
                  (sub, typarms) = Subst.Fresh (fun_header.typarms);
                  sub.Apply (local.Type.Fix ())
                }

              _ = Expect (expected, fnty, "local function reference");
              result = TExpr.LocalFunRef (expected, local, typarms);


i'm not sure if this is easy fixable....

----------------------------------------------------------------------
 malekith - 05-05-06 12:41 
----------------------------------------------------------------------
We now fix the type for sure before using generic local function. This
cannot be easily fixed in the current framework.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
11-12-05 13:40 malekith       New Issue                                    
11-12-05 13:41 malekith       Priority                 normal => high      
11-12-05 13:41 malekith       Description Updated                          
11-12-05 13:41 malekith       Additional Information Updated                    
11-20-05 12:10 malekith       Note Added: 0001031                          
11-20-05 13:19 malekith       Note Added: 0001032                          
05-05-06 12:41 malekith       Status                   new => resolved     
05-05-06 12:41 malekith       Resolution               open => not fixable 
05-05-06 12:41 malekith       Assigned To               => malekith        
05-05-06 12:41 malekith       Note Added: 0001231                          
05-05-06 12:41 malekith       Description Updated                          
05-05-06 12:41 malekith       Additional Information Updated                    
05-22-06 18:03 nazgul         Status                   resolved => closed  
======================================================================




More information about the bugs mailing list