Thanks for the response! Though I do not try to use dynamic dispatch for 
iterators, am I wrong? I directly check runtime type inside of the iterator, so 
it is always using the only iterator version , `Ast` one, isn't it?

Anyway, I found my original problem. It was because type `D` can only hold 
instances of type `B` by definition, but I'm returning `var Ast`, so I could 
potentially assign anything (for example `A`) to it, which would be invalid.

As a solution I changed `var Ast` in iterator return type to `var B` and 
removed all conversions to `Ast` inside. In my original problem, not this 
simplified one, it required 4 iterators with different return types, but oh 
well. Thanks anyway!

Reply via email to