- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
++ ambiguous on Set[Any]
Tue, 2009-05-26, 22:58
scala> Set[Any]("abc") ++ Set("def")
:5: error: ambiguous reference to overloaded definition,
both method ++ in trait Addable of type (Traversable[Any])scala.collection.immutable.Set[Any]
and method ++ in trait TraversableTemplate of type [B >: Any,That](Traversable[B])(implicit scala.collection.generic.BuilderFactory[B,That,scala.collection.immutable.Set[Any]])That
match argument types (scala.collection.immuta...
Set[Any]("abc") ++ Set("def")
^
But as long as the lhs isn't an Any set, it's okay with creating one:
scala> Set("abc") ++ Set(5)
res0: scala.collection.immutable.Set[Any] = Set(abc, 5)