Skip to content

Commit 6e27e97

Browse files
Merge pull request #11599 from dotty-staging/fix-9781
Fix #9781: add test
2 parents 356dbb3 + c211343 commit 6e27e97

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/pos/i9781.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
trait Txn[T <: Txn[T]]
2+
3+
trait Elem[T <: Txn[T]]
4+
5+
sealed trait State[+T]
6+
final case class Done[T <: Txn[T]](elem: Elem[T]) extends State[T]
7+
case object Busy extends State[Nothing]
8+
9+
trait Test[Out <: Txn[Out]] {
10+
def apply(opt: Option[State[Out]]): Any = opt match {
11+
case Some(state) =>
12+
state match {
13+
case Done(out) => "foo" // problem here
14+
case Busy => throw new IllegalStateException("Cyclic object graph")
15+
}
16+
17+
case None => "bar"
18+
}
19+
}

0 commit comments

Comments
 (0)