行爲似乎涉及到「延伸」,如圖下面的單元測試存在:單元測試吊延伸
typedef dynamic GetFromThing<T extends Thing>(T target);
typedef GetFromThing<T> DefGetFromThing<T extends Thing>(dynamic def);
typedef dynamic GetFromT<T>(T target);
typedef GetFromT<T> DefGetFromT<T>(dynamic def);
class Thing {
int value;
}
class Test {
static final GetFromThing<Thing> fromThingSimple = (Thing target) {
return target.value;
};
static final DefGetFromThing<Thing> fromThing = (dynamic def) {
return (target) => null;
};
static final DefGetFromT<int> fromInt = (dynamic def) {
return (target) => null;
};
}
main() {
test('this works',() {
var temp1 = Test.fromThingSimple(new Thing());
});
test('this works too',() {
var temp = Test.fromInt(10);
});
test('should let me call lexically closed functions',() {
var temp = Test.fromThing(10); // <-- causes test to hang
});
}
嘗試提交一個錯誤? https://code.google.com/p/dart/issues/entry – 2013-03-26 05:24:56