Skip to content
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

SharedFlow.toList(mutableList): difference behavior between 1.6.4 vs 1.7.0-Beta #3706

Closed
hoc081098 opened this issue Apr 8, 2023 · 1 comment
Labels

Comments

@hoc081098
Copy link

hoc081098 commented Apr 8, 2023

Sometimes, I use this method to write simple test on SharedFlow.
Version 1.6.4 works well.
Since 1.7.0-Beta, this method is deprecated and the implementation seem be wrong

val acc = MutableList()
val job = scope.launch(start = Undispatched) {
  sharedFlow.toList(acc)
}

// later...

job.cancel()
assertContentEquals(
 expected = ...,
 actual = acc
)

IMO, the correct impl. is SharedFlow.toList(acc) = (this as Flow).toList(acc)

@hoc081098 hoc081098 added the bug label Apr 8, 2023
@hoc081098 hoc081098 changed the title SharedFlow.toList(mutableList): 1.6.4 vs 1.7.0-Beta difference behavior SharedFlow.toList(mutableList): difference behavior between 1.6.4 vs 1.7.0-Beta Apr 8, 2023
@psteiger
Copy link

psteiger commented Apr 9, 2023

+1 to this issue and proposed solution. Seems this commit changed the behavior: f981a1d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants