2

Closed

Strange error with generics and modules

description

The code below gives the error "Could not find symbol D" on the last D in the declaration of compose2. Removing the import of M1, moving compose to below compose2, or removing the type parameter A from reduce all remove the error.
module M1
{
  export function reduce <A> (ar, f, e?) : Array<A>
  {
    return Array.prototype.reduce.apply(ar, e ? [f, e] : [f]);
  };
};

module M2
{
  import A = M1
  export function compose()
  {
    A.reduce(arguments, compose2);
  };

  export function compose2 <B,C,D> (g : (x:B) => C, f : (x:D) => B) : (x:D) => C
  {
    return function (x) { return g(f(x)); }
  };
};
Closed Jul 18, 2013 at 1:47 AM by danquirk
This is now fixed

comments

danquirk wrote Jun 21, 2013 at 3:33 AM

Strange indeed, thanks for the report, marking as active.