When I create a generator using an interface (or abstract class) I must cast the concrete instance to the interface. Why does the Generator not know that B is a implementation of the interface of A?

/// Test Code
interface A {}
class B : A{}

// Fails
auto testGen1 = new Generator!A({
    yield (new B());
});

// Succeeds
auto testGen2 = new Generator!A({
    yield ( cast(A) new B());
});

Reply via email to