Closed
Description
minimized code
... Sorry, I don't have a minimised form. But the error is reproducible in #6744, and the error detail is:
[error] -- [E007] Type Mismatch Error: /d/dotty/compiler/src/dotty/tools/dotc/printing/Formatting.scala:215:46
[error] 215 | val toExplain: List[(String, Recorded)] = seen.toList.flatMap {
[error] | ^
[error] |Found: List[(String, Object & dotty.tools.dotc.printing.Showable)]
[error] |Required: List[(String, dotty.tools.dotc.printing.Formatting.Recorded)]
[error] 216 | case (key, entry :: Nil) =>
[error] 217 | if (needsExplanation(entry)) (key.str, entry) :: Nil else Nil
[error] 218 | case (key, entries) =>
[error] 219 | for (alt <- entries) yield {
[error] 220 | val tickedString = seen.record(key.str, key.isType, alt)
[error] 221 | (tickedString, alt)
[error] 222 | }
[error] 223 | }.sortBy(_._1)
[error] one error found
expectation
It shouldn't error, as proven by helping the inferencer out by assigning the result of the flatMap op to val res: List[(String, Recorded)]
and then returning that.