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
Invisible forward reference when using implicit class #6278
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6278?orig=1 |
@som-snytt said: "Pretty ugly", that useful oxymoron; but for now, limited to the three cases. As nice issue tracker feature would be: when I create a ticket, let me post my test code which gets put immediately into the repo under tests/pending with the useful file name; then PR acceptance means that test passes and the test is moved to non-pending and the ticket is closed. |
@som-snytt said (edited on Sep 2, 2012 1:04:06 AM UTC): |
@som-snytt said (edited on Aug 23, 2012 6:59:57 PM UTC): |
@jsuereth said: scala> object tiny {
|
| def main(args: Array[String]) {
| ok(); nope()
| }
| def ok() {
| class Foo(val i: Int) {
| def foo[A](body: =>A): A = body
| }
| implicit def toFoo(i: Int): Foo = new Foo(i)
|
| val k = 1
| k foo println("k?")
| val j = 2
| }
| def nope() {
| implicit class Foo(val i: Int) {
| def foo[A](body: =>A): A = body
| }
|
| val k = 1
| k foo println("k?")
| //lazy
| val j = 2
| }
| }
<console>:28: error: forward reference extends over definition of value j
k foo println("k?") |
@som-snytt said: Amended PR: |
@retronym said: |
@som-snytt said: |
@retronym said: |
@som-snytt said: Learned about git format-patch and git am. Was that the most appropriate workflow? A vermicious knid ate my patch file. |
@retronym said: |
@som-snytt said: |
@som-snytt said: |
Implicit def synthesis from an implicit class suffers from the dread forward reference bug.
The text was updated successfully, but these errors were encountered: