boş özellik Testi Tanımlı: Kutusuz Etiketli Tip gibi bileşik tipi parametresi ile (Vaka sınıf arkadaşı nesne üretme hatasıyla
scala> val a : Int with Test = 10.asInstanceOf[Int with Test]
a: Int with Test = 10
ve vaka sınıfında: bileşik tip eskiden ne
trait Test
):
scala> case class Foo(a: Int with Test)
error: type mismatch;
found : Double
required: AnyRef
Note: an implicit exists from scala.Double => java.lang.Double, but
methods inherited from Object are rendered ambiguous. This is to avoid
a blanket implicit which would convert any scala.Double to any AnyRef.
You may wish to use a type ascription: `x: java.lang.Double`.
Ama mükemmel için çalışmak olduğunu:
scala> case class Foo(a: List[Int] with Test)
defined class Foo
Ve yöntemi tanımıyla hiçbir sorun:
scala> def foo(a: Int with Test) = ???
foo: (a: Int with Test)Nothing
Scala versiyonu 2.10.3
normal derleyici davranış mı?
Bu [bilinen bir sorundur] olduğu (https://issues.scala-lang.org/browse/SI-5183). –