-
Notifications
You must be signed in to change notification settings - Fork 21
Overload resolution should not consider default arguments #8197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8197?orig=1 |
@adriaanm said: I haven't checked, but is it legal in java to assign |
Jarek Sacha (jpsacha) said: The code that does not compile looks like this import scalafx.beans.property.ObjectProperty
def skin: ObjectProperty[javafx.scene.control.Skin[_]] = delegate.skinProperty skinProperty is a JavaFX method of Interface Skin<C extends Skinnable> This may be a bug in JavaFX API, most likely import scalafx.beans.property.ObjectProperty
def skin: ObjectProperty[jfxsc.Skin[_ <: jfxsc.Skinnable]] = {
val p = delegate.skinProperty
p.asInstanceOf[javafx.beans.property.ObjectProperty[jfxsc.Skin[_ <: jfxsc.Skinnable]]]
} though it is quite ugly. Note that there is an implicit conversion from package scalafx.beans.property
object ObjectProperty {
implicit def sfxObjectProperty2jfx[T <: Any](op: ObjectProperty[T]) = op.delegate
...
} where I did not find yet workarounds for the other compilation errors shown in the original report. The third error is a bit similar. But the second is reporting some type invariance issues, it may be a different thing. |
@adriaanm said: |
Jarek Sacha (jpsacha) said:
|
Stephen Compall (s11001001) said: |
@adriaanm said: |
Jarek Sacha (jpsacha) said:
Looks that is is using
|
@adriaanm said: |
Jarek Sacha (jpsacha) said:
|
@adriaanm said (edited on Feb 15, 2014 4:05:13 AM UTC): new SplitMenuButton {
text = "SplitMenuButton 1"
onAction = {ae: ActionEvent => {println(ae.eventType + " occurred on SplitMenuButton")}}
items = List(
new MenuItem("MenuItem A") {
onAction = {ae: ActionEvent => {println(ae.eventType + " occurred on Menu Item A")}}
},
new MenuItem("MenuItem B")
)
}, |
@adriaanm said: |
Jarek Sacha (jpsacha) said (edited on Feb 15, 2014 5:11:30 AM UTC): new SplitMenuButton() should get a default constructor parameter supplied (delegate = new jfxsc.SplitMenuButton()). Sorry I an not able to provide a reduced example. In simple examples similar code with one of the constructor had a default parameter and other has a has a T* argument compiles fine. There looks to be something more involved here. I look more tomorrow. Some other way of simplifying this is below. A thing that may help is that if I use scalafx library (build for 2.10) but 2.11.0-M8 compiler and try to instantiate
I get similar error
Just for a reference SBT setup looks like this:
I need to run, I will try to attach a sample project tomorrow. |
@adriaanm said: Welcome to Scala version 2.11.0-M8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65).
Type in expressions to have them evaluated.
Type :help for more information.
scala> class Foo(val x: String = "a") {
| def this(bla: Int*) {
| this("a")
| }
| }
defined class Foo
scala> new Foo
<console>:10: error: ambiguous reference to overloaded definition,
both constructor Foo in class Foo of type (bla: Int*)Foo
and constructor Foo in class Foo of type (x: String)Foo
match argument types ()
new Foo
^ Welcome to Scala version 2.10.4-RC1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65).
Type in expressions to have them evaluated.
Type :help for more information.
scala> class Foo(val x: String = "a") {
| def this(bla: Int*) {
| this("a")
| }
| }
defined class Foo
scala> new Foo
res0: Foo = Foo@77892f2c |
@adriaanm said: |
@adriaanm said: |
@adriaanm said: |
@paulp said: |
@adriaanm said: |
@adriaanm said: |
@retronym said: |
Jarek Sacha (jpsacha) said: |
@adriaanm said: |
@adriaanm said: I don't expect this to break scalafx since we put in a regression test, but please let me know if somehow it breaks anything for you. |
Jarek Sacha (jpsacha) said: |
@adriaanm said: |
ScalaFX does not compile with Scala 2.11-M8. It builds fine with Scala 2.10.3 (and 2.9.3). There are a couple of errors related to type parameters. Here what you get if you try to compile ScalaFX 1.0.0-M7 with Scala 2.11.0-M8:
You can download source code that was tested from here:
https://code.google.com/p/scalafx/downloads/detail?name=scalafx-1.0.0-M7-sources.jar
To build you need Java 1.7.0_45 or newer and SBT 0.13.1
You need to create environment variable JAVA_HOME pointing to the location of JDK. Details are in README-SBT.txt in the root directory.
The text was updated successfully, but these errors were encountered: