[nem-bug] [Nemerle 0000707]: Bug in Extension method implementation
feedback at nemerle.org
feedback at nemerle.org
Fri Aug 18 23:40:44 CEST 2006
The following issue has been RESOLVED.
======================================================================
<http://nemerle.org/bugs/view.php?id=707>
======================================================================
Reported By: VladD2
Assigned To: nazgul
======================================================================
Project: Nemerle
Issue ID: 707
Category: Compiler
Reproducibility: always
Severity: minor
Priority: normal
Status: resolved
Resolution: fixed
Fixed in Version:
======================================================================
Date Submitted: 07-03-2006 08:13 CEST
Last Modified: 08-18-2006 23:40 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 21:00
----------------------------------------------------------------------
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
----------------------------------------------------------------------
nazgul - 08-18-06 23:40
----------------------------------------------------------------------
Fixed on trunk (r6553).
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
08-18-06 21:00 VladD2 Note Edited: 0001429
08-18-06 23:40 nazgul Status new => resolved
08-18-06 23:40 nazgul Resolution open => fixed
08-18-06 23:40 nazgul Assigned To => nazgul
08-18-06 23:40 nazgul Note Added: 0001430
======================================================================
More information about the bugs
mailing list