我找到了Scala编译器错误吗?

时间:2013-01-05 07:55:42

标签: scala compiler-bug

在Scala 2.9.1中,这不能编译,失败,未找到:值b

case class CaseClass(field: String)

object SomeObject {
  //val kludge = field

  def x(input: (CaseClass, String) => CaseClass): Unit = ()
  val field = x((a, b) => a.copy(field = b))
}

但是,这样做:

case class CaseClass(field: String)

object SomeObject {
  val kludge = field

  def x(input: (CaseClass, String) => CaseClass): Unit = ()
  val field = x((a, b) => a.copy(field = b))
}  

唯一的区别是注释行。如果这不是一个错误,为什么这是预期的行为?

0 个答案:

没有答案