bug icon indicating copy to clipboard operation
bug copied to clipboard

2.13.2/3 regression: ScalaFX does not compile with "type mismatch" errors

Open jpsacha opened this issue 5 years ago • 4 comments

reproduction steps

In ScalaFX build script change Scala version from 2.13.1 to 2.13.3

using Scala 2.13.3,

problem

ScalaFX code compiles fine with Scala 2.13.1 (and 2.12 and 2.11). With 2.13.3 there is a series of errors that look like this:

[error] D:\ScalaFX\scalafx.git\scalafx\src\main\scala\scalafx\scene\control\cell\ChoiceBoxListCell.scala:154:79: type mismatch;
[error]  found   : scalafx.collections.ObservableBuffer[T]
[error]  required: T
[error]   def this(items: ObservableBuffer[T]) = this(new jfxscc.ChoiceBoxListCell[T](items))

This is likely due to some implicit conversion not being applied by 2.13.3.

jpsacha avatar Jun 27 '20 00:06 jpsacha

I minimized to the skeletal wrapper classes, ChoiceBoxListCell and ObservableBuffer, but didn't reproduce with simple java stubs for the javafx classes. Not sure what it doesn't like about javafx.

< |    |    |    |    |    solving for (T: ?T)
< |    |    |    |    |    [search #5] start `fx.ObservableBuffer[T]`, searching for adaptation to pt=fx.ObservableBuffer[T] => T (silent: <init> in fx) implicits disabled
---
> |    |    |    |    |    [search #5] start `{
> |    |    |    |    |      <init>(new jfxscc.ChoiceBoxListCell[T](items));
> |    |    |    |    |      ()
> |    |    |    |    |    }`, searching for adaptation to pt=fx.ObservableBuffer[T] => javafx.collections.ObservableList[T] (silent: <init> in fx) implicits disabled
> |    |    |    |    |    2 implicits in companion scope

som-snytt avatar Jun 28 '20 19:06 som-snytt

I've optimistically milestoned this for 2.13.4, but (as Som hints) this won't become actionable until it's further isolated/minimized

SethTisue avatar Jun 29 '20 19:06 SethTisue

Maybe scala/scala#8458? The same as #11774 applies:

  • 2.13.2-bin-4ec48ff is green
  • 2.13.2-bin-99afc54 is red

joroKr21 avatar Jul 12 '20 18:07 joroKr21

new J[T](p) does not compile in 2.13. Works in 2.12 and 3.

j.f(p) works.

Maybe just the conversion is broken in this context. Well, that is what OP said.

import language.implicitConversions

class JUser[T](j: J[T]) {
  //def this(p: P[T]) = this(new J[T](p))

  def f(p: P[T]): J[T] = new J[T](p)
  def ff[A](p: P[A]): J[A] = new J[A](p)

  def g(p: P[T]): Int = j.f(p)
}

class P[T]
object P {
  implicit def cv[T](p: P[T]): JList[T] = new JList[T]
}

class J[T](ts: T*) {
  def this(jlist: JList[T]) = this()
  def f(ts: T*) = 27
  def f(jlist: JList[T]) = 42
}

class JList[T]

som-snytt avatar Apr 15 '24 08:04 som-snytt