-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Version
1.0-RC1+14-a287ac73+20250724-1908-SNAPSHOT
Scala Version
3.7.1
Expected Behavior
When a stream is defined using an Emit[Chunk] effect wrapped in Sync.ensure or Scope.ensure, and then the stream is run using .take the finalizer should run.
Actual Behavior
The finalizer does not run
Steps to Reproduce
Run the following tests:
"Sync.ensure" - {
"take" in run {
for
ref <- AtomicRef.init(List.empty[String])
stream = Stream:
Sync.ensure(ref.getAndUpdate("finalized" :: _)):
Loop(0)(i => ref.getAndUpdate(i.toString :: _).andThen(Emit.valueWith(Chunk(i))(Loop.continue(i + 1))))
emittedValues <- stream.take(5).run
refValues <- ref.get
yield assert(emittedValues == Chunk(0, 1, 2, 3, 4) && refValues == List("finalized", "4", "3", "2", "1", "0"))
}
}
"Scope.ensure" - {
"take" in run {
for
ref <- AtomicRef.init(List.empty[String])
stream = Stream:
Scope.run:
Scope.ensure(ref.getAndUpdate("finalized" :: _)).andThen:
Loop(0)(i => ref.getAndUpdate(i.toString :: _).andThen(Emit.valueWith(Chunk(i))(Loop.continue(i + 1))))
emittedValues <- stream.take(5).run
refValues <- ref.get
yield assert(emittedValues == Chunk(0, 1, 2, 3, 4) && refValues == List("finalized", "4", "3", "2", "1", "0"))
}
}Current Workaround
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working