[nem-bug] [Nemerle 0000698]: [0.9.3] Extension methods not visible
on nested types
feedback at nemerle.org
feedback at nemerle.org
Fri Jun 30 20:21:48 CEST 2006
A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=698>
======================================================================
Reported By: Snaury
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 698
Category: Compiler
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 06-30-2006 20:04 CEST
Last Modified: 06-30-2006 20:21 CEST
======================================================================
Summary: [0.9.3] Extension methods not visible on nested
types
Description:
Example code:
#pragma indent
public module Outer
public module Inner
public test(this o : object) : void
System.Console.WriteLine("test calle on object: {0}", o.ToString())
using Outer.Inner
public module Program
public Main() : void
def o = System.Object()
o.test() // error: there is no member named `test' in System.Object
with type ?
======================================================================
----------------------------------------------------------------------
Snaury - 06-30-06 20:10
----------------------------------------------------------------------
Ah, sorry, the correct code is this:
#pragma indent
public module Outer
public module Inner
public test(this o : object) : void
System.Console.WriteLine("test calle on object: {0}", o.ToString())
public test2(o : object) : void
o.test() // *** error here ***
using Outer
public module Program
public test3(this o : object) : void
o.test() // no error
public Main() : void
def o = System.Object()
o.test() // no error
o.test3() // no error
----------------------------------------------------------------------
nazgul - 06-30-06 20:14
----------------------------------------------------------------------
This is because in Outer, Inner is not 'opened'. If you declare using
Outer.Inner; at the top of the file, it should work.
----------------------------------------------------------------------
Snaury - 06-30-06 20:21
----------------------------------------------------------------------
Hmm, then it seems more like in Inner Outer is not opened (which is
strange, I can call static methods from Outer, why not extensions? see my
comment where I posted corrected code so that test becomes visible in
Program.Main, but is not visible in Inner itself). Anyway, using Outer at
the top of the file works, thanks for the reply!
Issue History
Date Modified Username Field Change
======================================================================
06-30-06 20:04 Snaury New Issue
06-30-06 20:10 Snaury Note Added: 0001325
06-30-06 20:14 nazgul Note Added: 0001326
06-30-06 20:21 Snaury Note Added: 0001327
======================================================================
More information about the bugs
mailing list