-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Infinite loop during typing match types #13431
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
Comments
Is there any debug setting to help finding out which file could be the problem? The alternative of bisecting the code base after every change is not going well... |
did you try using the |
Thanks, no that setting doesn't change anything. Here's a stack trace captured randomly while it was running (bit different code than before with 3.0.2): Details
|
Here's a self-contained reproducer: object Test:
summon[TailSwitch[Nothing, HNil, HNil]]
sealed trait HList
sealed trait HNil extends HList
case object HNil extends HNil
final case class ::[+H, +T <: HList](head: H, tail: T) extends HList
sealed trait TailSwitch[L <: HList, T <: HList, R <: HList]:
type Out <: HList
object TailSwitch:
implicit def tailSwitch[L <: HList, T <: HList, R <: HList]
: TailSwitch[L, T, R] { type Out = TailSwitch0[L, L, T, T, R, HNil] } = ???
type Reverse0[Acc <: HList, L <: HList] <: HList = L match
case HNil => Acc
case ::[h, t] => Reverse0[h :: Acc, t]
type Reverse1[L <: HList] <: HList = L match
case HNil => HNil
case ::[h, t] => Reverse0[h :: HNil, t]
type Prepend0[A <: HList, B <: HList] <: HList = A match
case HNil => B
case ::[h, t] => ::[h, Prepend0[t, B]]
type TailSwitch0[L <: HList, LI <: HList, T <: HList, TI <: HList, R <: HList, RI <: HList] <: HList = TI match
case L => R
case _ =>
LI match
case T => Prepend0[Reverse1[RI], R]
case HNil =>
TI match
case ::[_, t] => TailSwitch0[L, HNil, T, t, R, RI]
case ::[h, t] =>
TI match
case HNil => TailSwitch0[L, t, T, HNil, R, h :: RI]
case ::[_, tt] => TailSwitch0[L, t, T, tt, R, h :: RI] and a stack trace while it was running with 3.0.2:
|
The good news is that since #12768 was merged to master yesterday, the above reproducer no longer hangs. And neither does sirthias/parboiled2@3cc460f which instead now emits a number of errors:
|
I assume this can be closed then? |
Compiler version
3.0.1
Reproducer
Try to compile code from this commit:
sirthias/parboiled2@3cc460f
with
parboiledCoreJVM/Test/compile
runs into an infinite loop.Expectation
There's probably some error here leading to the infinite loop but it's hard to debug without any error message. The documentation seems to imply that these situations are caught and somehow handled but that doesn't seem to be the case here.
I can try to minimize further if needed.
The text was updated successfully, but these errors were encountered: