diff --git a/compiler/src/dotty/tools/dotc/printing/Formatting.scala b/compiler/src/dotty/tools/dotc/printing/Formatting.scala index d33e0af00ddb..fb2b44adc015 100644 --- a/compiler/src/dotty/tools/dotc/printing/Formatting.scala +++ b/compiler/src/dotty/tools/dotc/printing/Formatting.scala @@ -106,7 +106,7 @@ object Formatting { else nonSensicalStartTag + str + nonSensicalEndTag } - private type Recorded = AnyRef /*Symbol | TypeParamRef | SkolemType */ + private type Recorded = AnyRef /*Symbol | ParamRef | SkolemType */ private class Seen extends mutable.HashMap[String, List[Recorded]] { @@ -187,6 +187,7 @@ object Formatting { private def explanations(seen: Seen)(implicit ctx: Context): String = { def needsExplanation(entry: Recorded) = entry match { case param: TypeParamRef => ctx.typerState.constraint.contains(param) + case param: TermParamRef => false case skolem: SkolemType => true case sym: Symbol => ctx.gadt.bounds.contains(sym) && ctx.gadt.bounds(sym) != TypeBounds.empty diff --git a/tests/neg/i4377.scala b/tests/neg/i4377.scala new file mode 100644 index 000000000000..1ae668843a0f --- /dev/null +++ b/tests/neg/i4377.scala @@ -0,0 +1,4 @@ +object App { + type T[A <: ((a : A) => a.type)] = A + val a: T[_] = ??? // error +}