[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:14:06 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:14 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.

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                          
======================================================================




More information about the bugs mailing list