Skip to content

Commit 9f9db42

Browse files
authored
Merge pull request #2 from codiff/scala3-compilation-issue
Fix Scala 3 compilation issue
2 parents 64e4b26 + f08bf16 commit 9f9db42

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

  • core/src/main/scala/com/codiff/fairstream

core/src/main/scala/com/codiff/fairstream/Fair.scala

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ object Fair {
5858
case c: Choice[A @unchecked] => Choice(c.a, mplus(right, c.rest))
5959
case inc: Incomplete[A @unchecked] =>
6060
right match {
61-
case Nil => inc
62-
case One(b) => Choice(b, inc.step)
63-
case Choice(b, r2) => Choice(b, mplus(inc.step, r2))
64-
case Incomplete(j) => Incomplete(mplus(inc.step, j))
61+
case Nil => inc
62+
case One(b) => Choice(b, inc.step)
63+
case c: Choice[A @unchecked] => Choice(c.a, mplus(inc.step, c.rest))
64+
case inc2: Incomplete[A @unchecked] =>
65+
Incomplete(mplus(inc.step, inc2.step))
6566
}
6667
}
6768

@@ -77,11 +78,11 @@ object Fair {
7778
stream match {
7879
case Nil => acc.reverse
7980
case One(a) => (a :: acc).reverse
80-
case Choice(a, r) =>
81-
runM(maxDepth, maxResults.map(_ - 1), r, a :: acc)
82-
case Incomplete(i) =>
81+
case c: Choice[A @unchecked] =>
82+
runM(maxDepth, maxResults.map(_ - 1), c.rest, c.a :: acc)
83+
case i: Incomplete[A @unchecked] =>
8384
if (maxDepth.exists(_ <= 0)) acc.reverse
84-
else runM(maxDepth.map(_ - 1), maxResults, i, acc)
85+
else runM(maxDepth.map(_ - 1), maxResults, i.step, acc)
8586
}
8687
}
8788

0 commit comments

Comments
 (0)