Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Sporarum opened this issue Jan 13, 2023 · 7 comments
Labels
area:polyfunction area:reporting Error reporting including formatting, implicit suggestions, etc

Comments

@Sporarum
Copy link
Contributor

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 !

@Sporarum Sporarum added area:polyfunction stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 13, 2023
@Kordyjan Kordyjan added area:reporting Error reporting including formatting, implicit suggestions, etc and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 13, 2023
@SethTisue SethTisue added the Spree Suitable for a future Spree label Jan 19, 2023
@scala-center-bot
Copy link

This issue was picked for the Issue Spree No. 27 of 07 March 2023 which takes place in a week from now. @Sporarum, @KuceraMartin, @mprzysucha will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

@Sporarum Sporarum self-assigned this Mar 7, 2023
@Sporarum
Copy link
Contributor Author

Sporarum commented Mar 7, 2023

Hello everyone,
I'm preparing some preliminaries for the spree
For this purpose, I opened a branch on dotty staging: fix-i16676

@Sporarum
Copy link
Contributor Author

Sporarum commented Mar 7, 2023

From what I have seen so far, there seems to be a high likelihood that this is an issue with Mdoc and not an issue with the compiler, as for example:

polyfunction: Nothing

Correctly prints out [T] => (x: T) => T in the narrowing error message:

https://scastie.scala-lang.org/XwdltwxWTT6EbIMDi8t2ZQ

@Sporarum
Copy link
Contributor Author

Sporarum commented Mar 7, 2023

The only places I have been able to replicate the issue is in scastie and in metals worksheets which both use Mdoc

@Sporarum
Copy link
Contributor Author

Opened issue on Mdoc

@mbovel
Copy link
Member

mbovel commented Mar 20, 2023

Removing the Spree label as @Sporarum is assigned to this issue.

@mbovel mbovel removed the Spree Suitable for a future Spree label Mar 20, 2023
@Sporarum
Copy link
Contributor Author

As this seems not to be an issue with Mdoc in the end, more exploration is needed, I will therefore put it back as a Spree issue

Reasons for why it is probably not Mdoc can be found here:
scalameta/mdoc#758

@Sporarum Sporarum added the Spree Suitable for a future Spree label Mar 23, 2023
@Sporarum Sporarum removed their assignment Mar 23, 2023
@mbovel mbovel removed the Spree Suitable for a future Spree label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:polyfunction area:reporting Error reporting including formatting, implicit suggestions, etc
Projects
None yet
Development

No branches or pull requests

5 participants