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
regression in type inference #7226
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7226?orig=1 |
@retronym said: trait HK {
type Rep[X]
// okay
def unzip2[A, B](ps: Rep[List[(A, B)]])
unzip2(null.asInstanceOf[Rep[List[(Int, String)]]])
// okay
def unzipHK[A, B, C[_]](ps: Rep[C[(A, B)]])
unzipHK(null.asInstanceOf[Rep[List[(Int, String)]]])
// fail
def unzipHKRet[A, B, C[_]](ps: Rep[C[(A, B)]]): (Rep[C[A]], Rep[C[B]])
unzipHKRet(null.asInstanceOf[Rep[List[(Int, String)]]])
} |
@adriaanm said: defining (note the existentials in the return type) def unzip1[A, B, C[_]](ps: Rep[C[(A, B)]]): (Rep[C[_]], Rep[C[_]]) results in the inferred: def doUnzip1[T1 >: Nothing <: Any, T2 >: Nothing <: Any](ps: HK.this.Rep[List[(T1, T2)]]): (HK.this.Rep[List[_]], HK.this.Rep[List[_]]) = HK.this.unzip1[T1, T2, List](ps) |
@paulp said (edited on Mar 9, 2013 4:20:15 AM UTC): % ./working/bin/scalac -Yinfer-debug -d /tmp /scala/trunk/test/files/pos/t7226.scala
[solve types] solving for A, B, C in ?A, ?B, ?C
[infer method] solving for A, B, C in (ps: HK.this.Rep[C[(A, B)]])(HK.this.Rep[C[A]], HK.this.Rep[C[B]])
based on (HK.this.Rep[List[(T1, T2)]])(HK.this.Rep[C[A]], HK.this.Rep[C[B]])
(solved: A=T1, B=T2, C=List) After: % scalac3 -Yinfer-debug -d /tmp /scala/trunk/test/files/pos/t7226.scala
[solve types] solving for A, B, C in ?A, ?B, ?C
[infer method] solving for A, B, C in (ps: HK.this.Rep[C[(A, B)]])(HK.this.Rep[C[A]], HK.this.Rep[C[B]])
based on (HK.this.Rep[List[(T1, T2)]])(HK.this.Rep[C[A]], HK.this.Rep[C[B]])
(solved: A=(T1, T2), C=List) |
@retronym said: |
@retronym said: |
@paulp said: I believe 2.10.2 is the earliest which can be considered. This has been in there 7 months, and it's in 2.10.0 - and it's not a risk-free fix. |
@adriaanm said: |
Compiles in 2.9.2, not in 2.10.0.
The commit in which it regressed is scala/scala@0cde930b19 ; I don't yet see how.
The text was updated successfully, but these errors were encountered: