[nem-bug] [Nemerle 0000744]: Nemerle has problems with converting values to/from Nullable

feedback at nemerle.org feedback at nemerle.org
Fri Aug 18 20:23:02 CEST 2006


The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=744> 
======================================================================
Reported By:                Snaury
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   744
Category:                   Compiler
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             08-18-2006 20:23 CEST
Last Modified:              08-18-2006 20:23 CEST
======================================================================
Summary:                    Nemerle has problems with converting values to/from
Nullable
Description: 
// 1.n
using Utility;

public module Utility
{
  public parseint(str : string, cond : bool) : int?
  {
    if(cond)
     int.Parse(str)
    else
     null
  }
}

def n = parseint("1", true);
System.Console.WriteLine(n :> int);

// nbuild 1.n
ncc.exe -no-color -out:1.exe 1.n
1.n:10:6:10:10: error: expected int-, got System.Object+ in computation
branch: the `null' literal is not a valid value of type int
1.n:10:6:10:10: hint: this means two branches of ``if'' or ``match'' have
different types
1.n:5:3:11:4: error: expected System.Nullable[int], got int- in function
return type: System.Int32 is not a subtype of System.Nullable [simple
require]
1.n:15:26:15:34: error: cannot convert System.Nullable[int] to int
error: child process exited abnormally
... while compiling 1.n
======================================================================

Issue History
Date Modified  Username       Field                    Change              
======================================================================
08-18-06 20:23 Snaury         New Issue                                    
======================================================================




More information about the bugs mailing list