Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Possible scala compiler bug

View broken.scala
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
* 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
Something went wrong with that request. Please try again.