Skip to content

Type toString for both mono and polymorphic functions uses the plain-printed output #16676

Open
@Sporarum

Description

@Sporarum

Compiler version

Scala 3.2.0 / 3.2.1-RC2

Minimized example & Output

val function: Int => Int = (x: Int) => x
val polyfunction: [T] => T => T = [U] => (x: U) => x

function // somethingLambdaSomething: scala.Function1[Int, Int]
polyfunction // <function1>: 
/* scala.Polyfunction {
 *   def apply[T >: scala.Nothing <: scala.Any](x$1: T): T
 * }
 */

https://scastie.scala-lang.org/9VXAH9QKTyeSYE8UYdV5eQ

Expectation

val function: Int => Int = (x: Int) => x
val polyfunction: [T] => T => T = [U] => (x: U) => x

function // somethingLambdaSomething: Int => Int
polyfunction // <function1>: [T] => T => T

It's not that bad for Function1, but for polymorphic functions, it's really hard to parse, especially to newcomers !

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:polyfunctionarea:reportingError reporting including formatting, implicit suggestions, etc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions