[Ironruby-core] Code Review: TypeInferenceBugs (take 2)

Tomas Matousek Tomas.Matousek at microsoft.com
Tue Feb 23 16:53:22 EST 2010

  tfpt review "/shelveset:TypeInferenceBugs;REDMOND\tomat"
  Comment  : 
  Fixes bugs in type inference:
    1) By-ref generic parameter
    public void Foo<T>(ref T x);
    2) Multiple generic parameters
    public IEnumerable<TResult> Select<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, TResult> selector);
    3) Generic arrays 
    public int Foo<T>(T[] x);
    4) Type shape difference
    public static int f5<T>(Dictionary<Dictionary<string, T>, Dictionary<int, T>> arg);
    C.f5( Dictionary[List[str], Dictionary[int, str]]() )
    In general type inference seems to need more test coverage - various type shapes, arrays, ref/out with and w/o strong boxes, params array, params dict, optional, named combinations.
    I've added a few tests for the cases above to Ruby unit tests.
  Implements IInferableInvokable on blocks so that they can be coerced to Func<object*> and Action<object*> delegates:
  Enumerable.select([1,2,3], lambda { |x| x + 1 }).each { |a| puts a }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: TypeInferenceBugs.diff
Type: application/octet-stream
Size: 11921 bytes
Desc: TypeInferenceBugs.diff
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100223/d503b2b9/attachment.obj>

More information about the Ironruby-core mailing list