[nem-bug] [Nemerle 0001056]: incorrect matching of nullable types

feedback at nemerle.org feedback at nemerle.org
Fri Oct 26 14:54:08 CEST 2007


The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=1056> 
======================================================================
Reported By:                hi_octane
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   1056
Category:                   Compiler (match compiler)
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             10-26-2007 14:54 CEST
Last Modified:              10-26-2007 14:54 CEST
======================================================================
Summary:                    incorrect matching of nullable types
Description: 
the following code:

def a : int? = 10;      
match(a)
{
  | null => WriteLine("is null!");
  //| 10 => WriteLine("ten (10)");  unexpectedly we're unable to use
constants at all
  | x => WriteLine($"x = $x");
}

-- types "is null!" with any value stored in a. While the C# compiler
performs well with the similar code:

int? a = 10;
switch(a)
{
  case null:
    Console.WriteLine("is null!");
    break;

  case 10:
    Console.WriteLine("ten (10)");
    break;

  default:
    Console.WriteLine("a = " + Convert.ToString(a));
    break;
}
======================================================================

Issue History
Date Modified  Username       Field                    Change              
======================================================================
10-26-07 14:54 hi_octane      New Issue                                    
======================================================================




More information about the bugs mailing list