bug icon indicating copy to clipboard operation
bug copied to clipboard

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

Open som-snytt opened this issue 2 years ago • 1 comments

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".

som-snytt avatar Aug 23 '23 01:08 som-snytt

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.

SethTisue avatar Aug 23 '23 01:08 SethTisue