[nem-bug] [Nemerle 0000719]: NotNull doesn't work with generic function parameters

feedback at nemerle.org feedback at nemerle.org
Fri Jul 14 06:36:19 CEST 2006


The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=719> 
======================================================================
Reported By:                aleksey
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   719
Category:                   The Macro Library
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             07-14-2006 06:36 CEST
Last Modified:              07-14-2006 06:36 CEST
======================================================================
Summary:                    NotNull doesn't work with generic function
parameters
Description: 
Example:
def foo[T]([NotNull] bar : T) : void
{
    // some code
}

Error message:
error: comparing a value type T.722 to System.Object (a `null' literal?)
with reference equality

Minimal example without NotNull macro:
def foo[T](bar : T) : bool
{
	bar != null
	// the only workaround which seems to work
	// (bar : object) != null
}

C# example which works:
static class Foobar
{
	static bool Foo<T>(T bar)
	{
		return bar != null;
	}

	static void Main()
	{
		System.Console.WriteLine(Foo(20));
	}
}
======================================================================

Issue History
Date Modified  Username       Field                    Change              
======================================================================
07-14-06 06:36 aleksey        New Issue                                    
======================================================================




More information about the bugs mailing list