[nem-bug] [Nemerle 0000976]: closure with "this" in constructor

feedback at nemerle.org feedback at nemerle.org
Tue Apr 10 08:03:29 CEST 2007


The following issue requires your FEEDBACK.
======================================================================
<http://nemerle.org/bugs/view.php?id=976> 
======================================================================
Reported By:                divan
Assigned To:                divan
======================================================================
Project:                    Nemerle
Issue ID:                   976
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     feedback
======================================================================
Date Submitted:             03-20-2007 13:00 CET
Last Modified:              04-10-2007 08:03 CEST
======================================================================
Summary:                    closure with "this" in constructor
Description: 
class A {
  mutable x : int;
  static q () : void {}
  static w (_ : void -> void) : void {}
  public this (mutable y : int = 7) {
//  q (); //i suppose it should produce error when uncommented too
    --y;
    base ();
    this.x = 1;
    def f() {++x};
    f (); 
    w (f);
}
  public static Main () : void {
    System.Console.WriteLine (A ().x)
  }
}

Prints "2" when line is uncommented, should write
"error: closure utilizing 'this' reference is not allowed when base ctor
call is not placed at the beginning of current ctor"
======================================================================

----------------------------------------------------------------------
 divan - 04-09-07 07:00 
----------------------------------------------------------------------
Fixed on trunk r7581.



----------------------------------------------------------------------
 divan - 04-10-07 08:03 
----------------------------------------------------------------------
Feature request: allow such closures in ctors if they aren't used before
base() call.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
03-20-07 13:00 divan          New Issue                                    
04-09-07 06:59 divan          Note Added: 0001837                          
04-09-07 06:59 divan          Assigned To               => divan           
04-09-07 06:59 divan          Status                   new => assigned     
04-09-07 06:59 divan          Resolution               open => fixed       
04-09-07 06:59 divan          Summary                  closure with "this" in
constructor => closure with \"this\" in constructor
04-09-07 06:59 divan          Description Updated                          
04-09-07 06:59 divan          Status                   assigned => resolved
04-09-07 06:59 divan          Summary                  closure with "this" in
constructor => closure with \"this\" in constructor
04-09-07 06:59 divan          Description Updated                          
04-09-07 07:00 divan          Note Edited: 0001837                         
04-10-07 08:03 divan          Note Added: 0001839                          
04-10-07 08:03 divan          Status                   resolved => feedback
04-10-07 08:03 divan          Summary                  closure with "this" in
constructor => closure with \"this\" in constructor
04-10-07 08:03 divan          Description Updated                          
======================================================================




More information about the bugs mailing list