scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
230 stars 21 forks source link

The types for `Set` and `Map` are noisy in REPL #12849

Open som-snytt opened 10 months ago

som-snytt commented 10 months ago

Reproduction steps

Scala version: 2.13.11

Welcome to Scala 2.13.11 (OpenJDK 64-Bit Server VM, Java 20.0.1).
Type in expressions for evaluation. Or try :help.

scala> Seq(42)
val res0: Seq[Int] = List(42)

scala> Set(42)
val res1: scala.collection.immutable.Set[Int] = Set(42)

scala> Map("a"->42)
val res2: scala.collection.immutable.Map[String,Int] = Map(a -> 42)

Problem

The types for Set and Map aliased in Predef instead of scala.package are noisy.

It makes it look like I accidentally summoned a type which is not the "default".

This issue is possibly different from "display shortest name given my imports".

SethTisue commented 10 months ago

reminds me of the business about whether to show Object or AnyRef. we would prefer the latter, but often we end up showing the former.

It makes it look like I accidentally summoned a type which is not the "default"

That's one way of looking at it, but it's also possible to think of it as the compiler helpfully showing you what the shortcut you used actually points to.

This issue is possibly different from "display shortest name given my imports".

Yeah, I'd say those are distinct. One's about imports, one's about aliases.