Created
September 18, 2012 16:00
-
-
Save j3h/3743916 to your computer and use it in GitHub Desktop.
Possible scala compiler bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* If I remove the definition of unused (or make it private[this]), | |
* then it fails to compile with: | |
* | |
* $ ./bin/scala -version | |
* Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL | |
* | |
* $ ./bin/scala ~/broken.scala | |
* /Users/jhoyt/broken.scala:18: error: not found: value i | |
* val x = (f: Foo, i: Int) => f.copy(x = i) | |
* ^ | |
* one error found | |
*/ | |
object Broken { | |
case class Foo(x: Int) | |
private val unused = Foo(1).copy(x = 2) | |
val x = (f: Foo, i: Int) => f.copy(x = i) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment