[Mono-bugs] [Bug 398363] New: [gmcs] iterator + "piping" == madness

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jun 8 15:41:43 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=398363


           Summary: [gmcs] iterator + "piping" == madness
           Product: Mono: Compilers
           Version: 1.9.0
          Platform: x86-64
        OS/Version: openSUSE 11.0
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jonpryor at vt.edu
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


"piping" == pass through iterator results w/o change; couldn't think of a
shorter description for summary.

Short, short version: gmcs completely screws up when compiling this block of
code:

      public static IEnumerable<T> Apply<T> (IEnumerable<T> self)
      {
        throw new NotSupportedException ();

        foreach (T t in self) {
          yield return t;
        }
      }

In particular, the `throw new NotSupportedException()` is not present in the
generated IL, and the function can be invoked without any exception being
generated (even if `self' is null!).

Full example:

  using System;
  using System.Collections.Generic;

  namespace Mono.Rocks {
    class IEnumerableRocks {
      public static IEnumerable<T> Apply<T> (IEnumerable<T> self)
      {
        throw new NotSupportedException ();

        foreach (T t in self) {
          yield return t;
        }
      }
    }

    class Test {
      static void Main ()
      {
        IEnumerableRocks.Apply<char>(null);
        Console.WriteLine ("should not be reached");
      }
    }
  }

Expected results:

A NotImplementedException thrown, and "should not be reached" should NOT be
displayed to the console.

Actual results:

"should not be reached" is displayed to the console, as the
NotImplementedException isn't thrown by IEnumerableRocks.Apply<T>().


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list