Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Generic calls don't work with async #538

Closed
@harryterkelsen

Description

@harryterkelsen
import 'dart:async';

class A {
  Future<int> bar() async {
    var result = await foo/*<int>*/(1);
    return result + 1;
  }

  Future/*<T>*/ foo/*<T>*/(/*=T*/ x) async {
    var result = await new Future/*<T>*/.value(x);
    return result;
  }
}

Future<Null> main() async {
  var a = new A();
  var x = await a.bar();
  print(x);
}

generates this:

  hello.A = class A extends core.Object {
    bar() {
      return dart.async((function*() {
        let result = (yield this.foo(core.int)(1));
        return dart.notNull(result) + 1;
      }).bind(this), core.int);
    }
    foo(x) {
      return dart.async(function*(x) {
        let result = (yield async.Future$(T).value(x));
        return result;
      }, T, x);
    }
  };
  dart.setSignature(hello.A, {
    methods: () => ({
      bar: [async.Future$(core.int), []],
      foo: [T => [async.Future$(T), [T]]]
    })
  });
  hello.main = function() {
    return dart.async(function*() {
      let a = new hello.A();
      let x = (yield a.bar());
      core.print(x);
    }, core.Null);
  };

The foo method isn't taking the T type parameter.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions