Skip to content

Show root of stackoverflow in IsFullyDefinedAccumulator #12649

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

Merged
merged 1 commit into from
May 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/neg/i12640.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package x

trait CpsMonad[F[_]]:
def pure[A](x:A): F[A]
def flatMap[A,B](fa:F[A])(f: A=>F[B]): F[B]

abstract sealed class CpsStream[-F[_],+T]

case class Cons[F[_],T](head:T, tailFun: ()=>F[CpsStream[F,T]]) extends CpsStream[F,T]

case class Empty[F[_]]() extends CpsStream[F,Nothing]

def unfold[S,F[_]:CpsMonad,T](s0:S)(f:S => F[Option[(S,T)]]):F[CpsStream[F,T]] =
summon[CpsMonad[F]].flatMap(f(s0)){
case Some(s1,a) => Cons(a, () => unfold(s1,f)) // error // error
case None => summon[CpsMonad[F]].pure(Empty[F]())
}