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

feedback at nemerle.org feedback at nemerle.org
Sun Nov 20 12:10:01 CET 2005


A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=569> 
======================================================================
Reported By:                malekith
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   569
Category:                   Compiler (type engine)
Reproducibility:            always
Severity:                   minor
Priority:                   high
Status:                     new
======================================================================
Date Submitted:             11-12-2005 13:40 CET
Last Modified:              11-20-2005 12:10 CET
======================================================================
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

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




More information about the bugs mailing list