New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using flow.collect { } causes cannot be cast to kotlinx.coroutines.flow.FlowCollector #3159
Comments
See #3107 |
Could you please provide a self-contained snippet of code that one can copy-paste and run? I've tried to run your example with some tweaks, but it seems working just fine. This is likely to be the compiler bug, as |
I've updated the dependency to 1.6 but missed changing the language version of kotlinCompileOptions in my grade file. It was still using 1.4, changing that to 1.6 fixed this issue. I'm closing this. |
This is caused by the legacy compiler when using Kotlin 1.6.10. Enable IR compiler by removing |
The compiler change does have some unwanted impacts on reflection-based annotation scanning, what's the proposed solution for dealing with this for systems that must use "useOldBackend" until those dependencies support the upgrade? |
You should report this "unwanted impact on reflection-based annotation scanning" as a separate regression in the current JVM IR backend to http://kotl.in/issue if you want a workaround for them to be implemented. The old backend and |
Hello Team,
We've recently updated to v1.6.0 and started to see these
cannot be cast to kotlinx.coroutines.flow.FlowCollector
exceptions when using this collect extension function . It mistakes it for this direct collect() function. Whenever this used to happen in the previous versions the fix was to use the correct import statementimport kotlinx.coroutines.flow.collect
(It doesn't work anymore).Here's an example code that causes this error.
Currently, our workaround, for now, is to do something like this
Here's the error log
The text was updated successfully, but these errors were encountered: