import swing._
object PeerTest extends SimpleSwingApplication {
def top = new MainFrame {
val p = peer.getMousePosition
}
}
gives
error: ambiguous reference to overloaded definition,
both method getMousePosition in class Container of type (x$1: Boolean)java.awt.Point
and method getMousePosition in class Component of type ()java.awt.Point
match expected type ?
val p = peer.getMousePosition
but adding the type
val p: Point = peer.getMousePosition
makes it ok. Why?
edit: causes problem:
class A {
def value() = 123
}
class B extends A {
def value(b: Boolean) = 42
}
object Main extends App {
println ((new B).value)
}
doesn't cause problem:
class A {
def value() = 123
def value(b: Boolean) = 42
}
class B extends A {}
object Main extends App {
println ((new B).value)
}
So I think the answer has to explain why it only occurs when the methods are in different classes.