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

Critical: regression in type inference since 2.10.0-M6 with too many arguments lists #6311

Closed
scabug opened this issue Sep 3, 2012 · 5 comments

Comments

@scabug
Copy link

scabug commented Sep 3, 2012

This reduced example works in 2.9.x but not in recent 2.10.x:

def fooMinimal[T, Coll <: Traversable[T]](msg: String)(param1: Traversable[T])(param2: Coll): Traversable[T] = throw new Exception()
fooMinimal("")(List(1))(List(2))

-Xprint:typer shows that Coll is inferred to be Traversable[Nothing], while it should be Travesable[Int]

fooMinimal[Int, Traversable[Nothing]]("")(immutable.this.List.apply[Int](1))(immutable.this.List.apply[A](2));

The signature can't be that much simpler to trigger the bug. Some examples from the attachment:

//For the bug, the return type must mention T. Otherwise we get:
def fooWorks1[T, Coll <: Traversable[T]](msg: String)(param1: Traversable[T])(param2: Coll) = throw new Exception()
fooWorks1("")(List(1))(List(2))
//For the bug, there must be a parameter list before the mention of T. Otherwise we get:
def fooWorks2[T, Coll <: Traversable[T]](param1: Traversable[T])(param2: Coll): Traversable[T] = throw new Exception()
fooWorks2(List(1))(List(2))
def fooWorks3[T, Coll <: Traversable[T]](msg: String, param1: Traversable[T])(param2: Coll): Traversable[T] = throw new Exception()
fooWorks3("", List(1))(List(2))

The attachment contains the examples above and some other variations; it can be cleaned up and used as test file, after the bug is fixed.

I did this testing on v2.10.0-M7-34-gfc698b2 (as described by git describe); but both the original bug on my codebase and the reduced example compile with 2.10.0-M5 and fail with 2.10.0-M6.

@scabug
Copy link
Author

scabug commented Sep 3, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6311?orig=1
Reporter: @Blaisorblade
Affected Versions: 2.10.0-M6, 2.10.0-M7
Other Milestones: 2.10.0
See #4881
Attachments:

@scabug
Copy link
Author

scabug commented Sep 29, 2012

@retronym said:
The behaviour changed in 3bcd6f8c, a fix for #4881.

@scabug
Copy link
Author

scabug commented Sep 29, 2012

@odersky said:
I am OK with reverting that commit.

@scabug
Copy link
Author

scabug commented Sep 29, 2012

@paulp said:
scala/scala#1428

@scabug
Copy link
Author

scabug commented Oct 2, 2012

@gkossakowski said:
Fixed in scala/scala#1428

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