Skip to content
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

Regression: compilation error "ambiguous reference to overloaded definition" with java varargs #8376

Closed
scabug opened this issue Mar 7, 2014 · 7 comments

Comments

@scabug
Copy link

scabug commented Mar 7, 2014

Code that compiles with Scala 2.10.3, but does not compile with 2.11.0-RC1. Earlier I was testing with JavaFX in Java 7 (#8197). Just tested with JavaFX 8, where there are some API changes, compared to 7, causing errors with 2.11.0-RC1.

Here is a sample error:

[error] ...\scalafx.hg-sfx-8\scalafx\src\main\scala\scalafx\delegate\AlignmentPropertyDelegate.scala:33: ambiguous reference to overloaded definition,
[error] both method select in object Bindings of type (x$1: Any, x$2: <repeated...>[String])javafx.beans.binding.ObjectBinding[javafx.geometry.Pos]
[error] and  method select in object Bindings of type (x$1: javafx.beans.value.ObservableValue[_], x$2: <repeated...>[String])javafx.beans.binding.ObjectBinding[javafx.geometry.Pos]
[error] match argument types (javafx.beans.property.ReadOnlyObjectProperty[_$1],String)
[error]   def alignment = jfxbb.Bindings.select[jfxg.Pos](delegate, "alignment")
[error]                                        ^

There are two overloaded methods for jfxbb.Bindings.select In JavaFX 8

static <T> ObjectBinding<T> select(java.lang.Object root, java.lang.String... steps)
static <T> ObjectBinding<T> select(ObservableValue<?> root, java.lang.String... steps)

I think I seen it before in some issue already in JIRA but can't remember the link.

@scabug
Copy link
Author

scabug commented Mar 7, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8376?orig=1
Reporter: Jarek Sacha (jpsacha)
Affected Versions: 2.11.0-RC1
Attachments:

@scabug
Copy link
Author

scabug commented Mar 7, 2014

@adriaanm said:
Could you explain which overload you'd expect to be picked and why the other isn't applicable? Ideally with some self-contained example.

@scabug
Copy link
Author

scabug commented Mar 7, 2014

@adriaanm said:
I'm assigning to 2.11.1-RC1 until it's clear that the API changes in Java 8 aren't the cause, and that it's indeed a Scala bug.

@scabug
Copy link
Author

scabug commented Mar 10, 2014

Jarek Sacha (jpsacha) said (edited on Mar 10, 2014 2:33:57 PM UTC):
Attached is a simple SBT project with fist level minimization of the issue. There are two source files. One in Java implementing an overloaded select method. One in Scala that is attempting to use that method. It is intended for Java 7. Compiles fine in Scala 2.10.3 (no warnings), but not in 2.11.0-RC1.

This is really issue with 2.11.0-RC1, not with Java 8.

@scabug
Copy link
Author

scabug commented Mar 10, 2014

@gkossakowski said:
Thanks Jarek for self-contained test case. I'm bisecting it now.

@scabug
Copy link
Author

scabug commented Mar 10, 2014

@gkossakowski said:
Regressed in 0fe56b9770331d258cc71b609af343e02be3f65f.

Elevating it to Blocker for 2.11.0-RC2 for further investigation.

@scabug
Copy link
Author

scabug commented Mar 10, 2014

@retronym said:
scala/scala#3615

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants