Fix https://issues.scala-lang.org/browse/SI-7751.