diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index 0c73735c1aa2..2e4e1befff66 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -606,7 +606,7 @@ trait ImplicitRunInfo: private var parts: mutable.LinkedHashSet[Type] = _ private val partSeen = util.HashSet[Type]() - def traverse(t: Type) = + def traverse(t: Type) = try if partSeen.contains(t) then () else if implicitScopeCache.contains(t) then parts += t else @@ -638,6 +638,7 @@ trait ImplicitRunInfo: traverseChildren(t) case t => traverseChildren(t) + catch case ex: Throwable => handleRecursive("collectParts of", t.show, ex) def apply(tp: Type): collection.Set[Type] = parts = mutable.LinkedHashSet() diff --git a/tests/neg/i18171.scala b/tests/neg/i18171.scala new file mode 100644 index 000000000000..d269f70beb30 --- /dev/null +++ b/tests/neg/i18171.scala @@ -0,0 +1,10 @@ +type BAZ[T] = T match + case Any => DFVal[BAZREC[T]] + +type BAZREC[T] = T match + case NonEmptyTuple => Tuple.Map[T, BAZ] + +trait DFVal[T] + +def foo(relIdx: BAZ[Any]): Unit = + relIdx.bar // error