boo-lang / boo

The Boo Programming Language.
BSD 3-Clause "New" or "Revised" License
874 stars 148 forks source link

Unable to define a LINQ extension method #110

Closed masonwheeler closed 7 years ago

masonwheeler commented 9 years ago
namespace MyNamespace

import System
import System.Collections.Generic
import Boo.Lang.Compiler

[Extension]
def IndexWhere[of T]([Required] coll as IEnumerable[of T], [Required] filter as Func[of T, bool]) as IEnumerable[of int]:
    return IndexWhereImpl(coll, filter)

private def IndexWhereImpl[of T](coll as IEnumerable[of T], filter as Func[of T, bool]) as IEnumerable[of int]:
    index = 0
    for value in coll:
        if filter(value):
            yield index
        ++index

Expected: This should work Observed: Internal compiler error: Failed to create 'MyNamespace.MyNamespaceModule.$IndexWhereImpl$248.$' type.. (BCE0055)