[nem-bug] [Nemerle 0000707]: Bug in Extension method implementation

feedback at nemerle.org feedback at nemerle.org
Fri Aug 18 20:59:35 CEST 2006


A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=707> 
======================================================================
Reported By:                VladD2
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   707
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             07-03-2006 08:13 CEST
Last Modified:              08-18-2006 20:59 CEST
======================================================================
Summary:                    Bug in Extension method implementation
Description: 
using System;
using System.Console;

public module M1
{
  public Sort[T](this source : array[T]) : array[T]
  {
    Array.Sort(source);
    source
  }
}

WriteLine(array[4,1,3,8,2].Sort());

Retort errors:
Main.n(13,11,13,32): error : trying to access static member (method
System.Array.Sort(array : array [T.754]) : void) through an instance
...
======================================================================

----------------------------------------------------------------------
 VladD2 - 07-15-06 01:29 
----------------------------------------------------------------------
One more example of this bug:
using System.Console;
using Nemerle.Utility;

def ary = array[0,1,2,3,4,5,6,7,8,9];
def j = 3;

WriteLine(ary.Exists(elem => elem == j));
====================================================
Main.n(7,11,7,21): error : trying to access static member (method
System.Array.Exists(array : array [T.771], match :
System.Predicate[T.771]) : bool) through an instance

----------------------------------------------------------------------
 VladD2 - 08-18-06 20:59 
----------------------------------------------------------------------
One more examle.

using System;
`
module Ext
{
  public IsNullOrEmpty(this str : string) : bool
  {
    string.IsNullOrEmpty(str);
  }
}

def test(str : string)
{
  Console.WriteLine(str.IsNullOrEmpty());
}

test("test");
test("");
test(null);


ncc uotput:
Main.n(13,21,13,38): error : trying to access static member (method
System.String.IsNullOrEmpty(value : string) : bool) through an instance

Issue History
Date Modified  Username       Field                    Change              
======================================================================
07-03-06 08:13 VladD2         New Issue                                    
07-15-06 01:29 VladD2         Note Added: 0001372                          
08-18-06 20:59 VladD2         Note Added: 0001429                          
======================================================================




More information about the bugs mailing list