[nem-bug] [Nemerle 0000592]: ICE when mixing yield and functions

feedback at nemerle.org feedback at nemerle.org
Sun May 13 16:42:09 CEST 2007


The following issue has been set as RELATED TO issue 0001015.
======================================================================
<http://nemerle.org/bugs/view.php?id=592> 
======================================================================
Reported By:                nazgul
Assigned To:                malekith
======================================================================
Project:                    Nemerle
Issue ID:                   592
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
======================================================================
Date Submitted:             12-22-2005 22:14 CET
Last Modified:              05-08-2006 14:27 CEST
======================================================================
Summary:                    ICE when mixing yield and functions
Description: 
using System;
using System.Collections;

class X {
        delegate A () :  void;

        static GetIt (mutable  args :  array [int]) :  IEnumerable
        {
                foreach ( arg :> int in args) {
                        Console.WriteLine ("OUT: {0}", arg);
                        mutable  a = fun() {
                                Console.WriteLine ("arg: {0}", arg);
                                ();
                        };
                        a ();
                        yield arg;
                }
        }

        static Main () :  int
        {
                mutable  total = 0;
                foreach ( i :> int in GetIt (   array[ 1, 2, 3])){
                        Console.WriteLine ("Got: " + i);
                        total += i;
                }

                if (total != 6)

                {
                         1;

                }

                else
        {
        {

                 0;
        }
        }
        }
}

======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0001015 yield in local funs
======================================================================

----------------------------------------------------------------------
 malekith - 05-08-06 14:27 
----------------------------------------------------------------------
I'm affraid this is not easy fixable.

The foreach loop needs a new closure upon each iteration. We currently do
it by forcing it to reside in a separate function. OTOH C# uses several
closures per function (in case closures are used in loops), which makes
this work.

So some redesigns are required in T3 to support this.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
12-22-05 22:14 nazgul         New Issue                                    
05-05-06 13:27 malekith       Status                   new => assigned     
05-05-06 13:27 malekith       Assigned To               => malekith        
05-08-06 14:27 malekith       Note Added: 0001254                          
05-13-07 16:42 divan          Relationship added       related to 0001015  
======================================================================




More information about the bugs mailing list