- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Problems with immutable.Set#++
Mon, 2009-06-22, 21:59
scala> Set(1, 2) ++ List(2, 3) // This works fine
res0: scala.collection.immutable.Set[Int] = Set(1, 2, 3)
scala> (Set(1, 2): Set[Any]) ++ List(2, 3) // This blows up
<console>:5: error: ambiguous reference to overloaded definition,
both method ++ in trait Addable of type (elems: Traversable[Any])scala.collection.immutable.Set[Any]
and method ++ in trait TraversableTemplate of type [B >: Any,That](that: Traversable[B])(implicit bf: scala.collection.generic.BuilderFactory[B,That,scala.collection.immutable.Set[Any]])That
match argument types (List[I...
(Set(1, 2): Set[Any]) ++ (List(2, 3))
^
Oops...
Worst thing is, I have no idea why one works but the other doesn't.
--j
res0: scala.collection.immutable.Set[Int] = Set(1, 2, 3)
scala> (Set(1, 2): Set[Any]) ++ List(2, 3) // This blows up
<console>:5: error: ambiguous reference to overloaded definition,
both method ++ in trait Addable of type (elems: Traversable[Any])scala.collection.immutable.Set[Any]
and method ++ in trait TraversableTemplate of type [B >: Any,That](that: Traversable[B])(implicit bf: scala.collection.generic.BuilderFactory[B,That,scala.collection.immutable.Set[Any]])That
match argument types (List[I...
(Set(1, 2): Set[Any]) ++ (List(2, 3))
^
Oops...
Worst thing is, I have no idea why one works but the other doesn't.
--j
On Mon, Jun 22, 2009 at 01:59:45PM -0700, Jorge Ortiz wrote:
> scala> Set(1, 2) ++ List(2, 3) // This works fine
> res0: scala.collection.immutable.Set[Int] = Set(1, 2, 3)
>
> scala> (Set(1, 2): Set[Any]) ++ List(2, 3) // This blows up
> :5: error: ambiguous reference to overloaded definition,
Late to the party, bub!