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

dependent method types + default args #7371

Closed
scabug opened this issue Apr 15, 2013 · 3 comments
Closed

dependent method types + default args #7371

scabug opened this issue Apr 15, 2013 · 3 comments

Comments

@scabug
Copy link

scabug commented Apr 15, 2013

The product of a quick game of feature-interaction bingo.

scala> object O { def foo(a: String)(b: a.type = a): a.type = b; { val x = ""; foo(x)() } }
<console>:7: error: type mismatch;
 found   : String
 required: x$1.type
       object O { def foo(a: String)(b: a.type = a): a.type = b; { val x = ""; foo(x)() } }
                                                                                  ^
@scabug
Copy link
Author

scabug commented Apr 15, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7371?orig=1
Reporter: @retronym

@scabug
Copy link
Author

scabug commented Aug 27, 2013

@oxbowlakes said (edited on Aug 27, 2013 3:40:15 PM UTC):
I think this is the same issue:

scala> class GBP {
     | class C(val i: Int)
     | def add(c: C) = println(c.i)
     | }
defined class GBP

scala>  object util { def c(p: GBP)(i: Int = 1): p.C = new p.C(i) }
defined module util

scala> class Sub extends GBP {add(util.c(this)())}
<console>:17: error: type mismatch;
 found   : x$1.C
 required: Sub.this.C
       class Sub extends GBP {add(util.c(this)())}
                                              ^

If this might seem esoteric, it's annoying because it means I cannot create a useful GridBagPanel.Constraints "constructor" which takes default arguments. Providing the argument works just fine:

scala> class Sub extends GBP {add(util.c(this)(1))}
defined class Sub

@scabug
Copy link
Author

scabug commented Jan 3, 2015

Alexander Bulaev (alexbool) said:
Any news on this? Agree, this is kind of annoying :(

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

3 participants