[nem-bug] [Nemerle 0000657]: Unhandled Exception: Nemerle.Core.MatchFailureException in ncc

feedback at nemerle.org feedback at nemerle.org
Mon Apr 17 04:09:20 CEST 2006


The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=657> 
======================================================================
Reported By:                VladD2
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   657
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             04-17-2006 04:09 CEST
Last Modified:              04-17-2006 04:09 CEST
======================================================================
Summary:                    Unhandled Exception:
Nemerle.Core.MatchFailureException in ncc
Description: 
using System.Console;

def Sort[T](lst, gt)
{
  match (lst)
  { | [] => [] : list[T] // This cause of Unhandled Exception
    | head :: tail => Sort($[y | y in tail, gt(head, y)], gt) 
                    + [head]
                    + Sort($[y | y in tail, gt(y, head)], gt)
  }
}

WriteLine(Sort([9, 1, 2, 8, 3, 7, 4, 6, 5, 0], _ > _));
WriteLine(Sort(["B", "A", "Q", "Z", "T", "Z", "J", "C", "D", "H"],
  fun(x, y) { string.Compare(x, y) > 0 }));

If try to compile this code the result compiler crash:
Unhandled Exception: Nemerle.Core.MatchFailureException: Exception of type
'Nemerle.Core.MatchFailureException' was thrown.
   at _N_AutoModule._N_Sort1746[T](_N_closure1740 _N_Main_cp1745, list`1
lst, Function`3 gt) in C:\VS\Nemerle\Tests\Sort.n:line 5
   at _N_AutoModule._N_Sort1746[T](_N_closure1740 _N_Main_cp1745, list`1
lst, Function`3 gt) in C:\VS\Nemerle\Tests\Sort.n:line 7
   at _N_AutoModule.Main() in C:\VS\Nemerle\Tests\Sort.n:line 13
======================================================================

Issue History
Date Modified  Username       Field                    Change              
======================================================================
04-17-06 04:09 VladD2         New Issue                                    
======================================================================




More information about the bugs mailing list