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 inference does not work on methods using dependent types and parameters with default value #7234
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7234?orig=1 |
Julien Richard-Foy (julienrf) said (edited on Mar 8, 2013 10:15:46 PM UTC): trait Main {
trait A {
type B
}
def c(a: A, x: Int = 0)(b: a.B)
def ok(a: A)(b: a.B) = c(a, 42)(b)
def ok2(a: A)(b: a.B) = c(a)(b)
} |
@retronym said: Working on a fix: https://github.com/retronym/scala/compare/ticket/7234 Still a few subtle interactions to deal with. Here's a related crasher: trait Main {
trait A {
type B
}
trait C {
def c(a: A, x: Int = 0)(bs: a.B*)
def d(a: A, x: Int = 0)(b: a.B)
}
def c: C
def fail3(a: A)(b: a.B) = c.c(a)(Seq[A#B](b): _*) // should fail, crashes with .setInfo(null)
} |
Julien Richard-Foy (julienrf) said: |
this appears to be another manifestation of the same problem: scala> trait T; class C[T2 <: T](val t: T2, b: Boolean = true, n: Int = 0)
defined trait T
defined class C
scala> val t = new T { }
t: T = $anon$1@f2a1813
scala> new C[t.type](t)
res0: C[<refinement>.type] = C@7645f03e
scala> new C[t.type](t, n = 1)
<console>:15: error: type mismatch;
found : T
required: <refinement>.type
Error occurred in an application involving default arguments.
new C[t.type](t, n = 1)
^ @retronym remarks:
|
Here is a minimal test case that shows the problem:
If I remove the
x
parameter default value, or explicitly fill its value, it works fine.But compiling the above code produces the following error:
The text was updated successfully, but these errors were encountered: