开发者

@BeanProperty causes "ambiguous reference" error, but does not appear to be ambiguous

开发者 https://www.devze.com 2023-03-20 05:33 出处:网络
class Foo(@BeanProperty var bar:String) { def setBar(d:Double) { bar = d.toString } } This produces \"error: ambiguous reference to overloaded definition,
class Foo(@BeanProperty var bar:String) {

  def setBar(d:Double) {
    bar = d.toString
  }

}

This produces "error: ambiguous reference to overloaded definition, both method setBar in class Foo of type (x$1: String)Unit and method setBar in class Foo of type (d: Double)Unit match expected type ? class Foo(@BeanProperty var bar:String) {"

How can setBar(x:String) be ambiguous with setBar(d:Double)? Or is that 开发者_如何学Cnot what the error message is trying to convey?


Looks like a bug. Please file an ticket on issues.scala-lang.org.

0

精彩评论

暂无评论...
验证码 换一张
取 消