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

REPL displays different function types identically #5327

Closed
scabug opened this issue Dec 19, 2011 · 5 comments
Closed

REPL displays different function types identically #5327

scabug opened this issue Dec 19, 2011 · 5 comments
Assignees

Comments

@scabug
Copy link

scabug commented Dec 19, 2011

  1. REPL displays types of higher-order curried functions ambiguously, for example:

scala> Set(1).fold _
res8: Int => (Int, Int) => Int => Int =

At the first glance, res8 looks like a function that should be called like this: res8(0)((1,2))(3)(4)

To remove ambiguity, this type should be displayed as following:
res8: Int => ((Int, Int) => Int) => Int =

  1. REPL displays types of function with n parameters and with one n-tuple parameter identically:

scala> var a: ((Int,Int))=>Int = null
a: (Int, Int) => Int = null
scala> var b: (Int,Int)=>Int = null
b: (Int, Int) => Int = null
scala> val t = (0,0)
t: (Int, Int) = (0,0)
scala> b(t)
:16: error: not enough arguments for method apply: (v1: Int, v2: Int)Int in trait Function2.
scala> a(t)
java.lang.NullPointerException

To remove ambiguity, these types should be displayed as following:
a: ((Int, Int)) => Int = null
b: (Int, Int) => Int = null

@scabug
Copy link
Author

scabug commented Dec 19, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5327?orig=1
Reporter: Karol Stasiak (karols)
Affected Versions: 2.9.1
Duplicates #5398

@scabug
Copy link
Author

scabug commented Dec 19, 2011

@dcsobral said:
Trunk:

scala> var a: ((Int,Int))=>Int = null
a: ((Int, Int)) => Int = null

scala> var b: (Int,Int)=>Int = null
b: (Int, Int) => Int = null

@scabug
Copy link
Author

scabug commented Dec 19, 2011

@paulp said:
Duplicate.

@scabug scabug closed this as completed Dec 19, 2011
@scabug
Copy link
Author

scabug commented Mar 5, 2012

Robin Palotai (literon) said:
If this is the duplicate, which is the main issue? It is still not resolved in 2.9.1-1 (seems fine in 2.10-M2), and I would be very happy to have it right in 2.9.x.

@scabug
Copy link
Author

scabug commented Mar 5, 2012

@paulp said:
2.9.1-1 has one new line of code. It's in 2.9.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants