Type-annotating coroutine iterators doesn't properly respect literal return types

Version: 0.601.0.6010507 (64bit)

When you annotate a coroutine iterator to return literal types, it does not respect the literal at all and instead genericizes it. In the example below, the inferred type should still be 'foo' | 'bar' but it gets reported as string | string (does it even make sense?)

But what’s baffling is that it is clearly aware of the literal type. In the example below, it correctly warns of an incompatibility when trying to cast the literal to a different one, and tells you the actual type of it:

So it definitely knows that it’s returning a literal, yet it does not want to show it as one?

1 Like

Thanks for the report! I filed a ticket in our internal database and we’ll follow up when we have an update for you.

1 Like