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
Correct, scala.collection.Set trait, make correct examples in ++ description #9519
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9519?orig=1 |
@soc said (edited on Nov 9, 2015 12:40:07 PM UTC): |
Harit Himanshu (hhimanshu) said (edited on Nov 10, 2015 2:46:11 AM UTC): * @usecase def ++[B](that: GenTraversableOnce[B]): $Coll[B]
* @inheritdoc
*
* Example:
* {{{
* scala> val a = List(1)
* a: List[Int] = List(1)
*
* scala> val b = List(2)
* b: List[Int] = List(2)
*
* scala> val c = a ++ b
* c: List[Int] = List(1, 2)
*
* scala> val d = List('a')
* d: List[Char] = List(a)
*
* scala> val e = c ++ d
* e: List[AnyVal] = List(1, 2, a)
* }}}
*
* @return a new $coll which contains all elements of this $coll
* followed by all elements of `that`.
*/
def ++[B >: A, That](that: GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That and there a a lot more Known Subclasses
::, AbstractBuffer, AbstractIterable, AbstractIterable, AbstractMap, AbstractMap, AbstractMap, AbstractSeq, AbstractSeq, AbstractSet, AbstractSet, AbstractTraversable, AnyRefMap, Appended, Appended, Appended, Appended, ArrayBuffer, ArrayLike, ArrayOps, ArraySeq, ArrayStack, BitSet, BitSet, BitSet, BitSet1, BitSet2, BitSetLike, BitSetN, Buffer, BufferLike, BufferProxy, Cons, DefaultKeySet, DefaultKeySet, DefaultKeySet, DefaultKeySortedSet, DefaultKeySortedSet, DefaultMap, DefaultMap, DefaultMapModel, DefaultValuesIterable, DefaultValuesIterable, DoubleLinkedList, DoubleLinkedListLike, DroppedWhile, DroppedWhile, DroppedWhile, DroppedWhile, DroppedWhile, Empty, EmptyView, EmptyView, EmptyView, EmptyView, Exclusive, Filtered, Filtered, Filtered, Filtered, Filtered, FilteredKeys, FilteredKeys, FlatMapped, FlatMapped, FlatMapped, FlatMapped, Forced, Forced, Forced, Forced, GenIterable, GenIterableLike, GenMap, GenMapLike, GenSeq, GenSeqLike, GenSet, GenSetLike, GenTraversable, HashMap, HashMap, HashMap1, HashSet, HashSet, HashTrieMap, HashTrieSet, History, ImmutableDefaultKeySet, ImmutableMapAdaptor, ImmutableSetAdaptor, Impl, Inclusive, Inclusive, IndexedSeq, IndexedSeq, IndexedSeq, IndexedSeqLike, IndexedSeqLike, IndexedSeqOptimized, IndexedSeqOptimized, IndexedSeqView, IntMap, Iterable, Iterable, Iterable, IterableForwarder, IterableLike, IterableProxy, IterableProxyLike, IterableView, IterableViewLike, LinearSeq, LinearSeq, LinearSeq, LinearSeqLike, LinearSeqOptimized, LinkedHashMap, LinkedHashSet, LinkedList, LinkedListLike, List, ListBuffer, ListMap, ListMap, ListSet, LongMap, LongMap, Map, Map, Map, Map, Map1, Map2, Map3, Map4, MapLike, MapLike, MapLike, MapProxy, MapProxy, MapProxy, MapProxyLike, Mapped, Mapped, Mapped, Mapped, MappedValues, MappedValues, MultiMap, MutableList, Nil, Node, Node, NumericRange, ObservableBuffer, ObservableMap, ObservableSet, OpenHashMap, PagedSeq, ParArray, ParHashMap, ParHashMap, ParHashSet, ParHashSet, ParIterable, ParIterable, ParIterable, ParIterableLike, ParMap, ParMap, ParMap, ParMapLike, ParMapLike, ParRange, ParSeq, ParSeq, ParSeq, ParSeqLike, ParSet, ParSet, ParSet, ParSetLike, ParSetLike, ParTrieMap, ParVector, Patched, Patched, Prepended, Prepended, PriorityQueue, PriorityQueueProxy, Queue, Queue, QueueProxy, Range, ResizableArray, Reversed, Reversed, Reversed, RevertibleHistory, Script, Seq, Seq, Seq, SeqForwarder, SeqLike, SeqLike, SeqProxy, SeqProxyLike, SeqView, SeqViewLike, Set, Set, Set, Set1, Set2, Set3, Set4, SetLike, SetLike, SetProxy, SetProxy, SetProxy, SetProxyLike, Sliced, Sliced, Sliced, Sliced, Sliced, SortedMap, SortedMap, SortedMapLike, SortedSet, SortedSet, SortedSet, SortedSetLike, Stack, Stack, StackProxy, Stream, StreamView, StreamViewLike, StringBuilder, StringLike, StringOps, SynchronizedBuffer, SynchronizedMap, SynchronizedPriorityQueue, SynchronizedQueue, SynchronizedSet, SynchronizedStack, SystemProperties, TakenWhile, TakenWhile, TakenWhile, TakenWhile, TakenWhile, Transformed, Transformed, Transformed, Transformed, Transformed, Traversable, Traversable, Traversable, TraversableForwarder, TraversableLike, TraversableProxy, TraversableProxyLike, TraversableView, TraversableViewLike, TreeMap, TreeSet, TreeSet, TrieMap, UnrolledBuffer, ValueSet, Vector, WithDefault, WithDefault, WithDefault, WithDefault, WithDefault, WithDefault, WrappedArray, WrappedString, Zipped, Zipped, Zipped, ZippedAll, ZippedAll, ZippedAll, ofBoolean, ofBoolean, ofByte, ofByte, ofChar, ofChar, ofDouble, ofDouble, ofFloat, ofFloat, ofInt, ofInt, ofLong, ofLong, ofRef, ofRef, ofShort, ofShort, ofUnit, ofUnit Would we have to fix all of them? or do we need to stop Ideas? |
@soc said: I think it could be limited to Set though, because they are invariant ... |
Harit Himanshu (hhimanshu) said (edited on Nov 12, 2015 3:03:05 PM UTC): |
@soc said: |
Harit Himanshu (hhimanshu) said: |
@SethTisue said: |
Harit Himanshu (hhimanshu) said (edited on Nov 26, 2015 5:08:50 AM UTC):
Where Would Please let me know if this understanding is correct, I would try to make the change and send out the pull request? Also, is there a way to validate by generating documentation locally? Your help is very much appreciated. |
@SethTisue said:
It certainly looks that way to me — seems worth a try.
yes, |
Harit Himanshu (hhimanshu) said: * @usecase def ++[B](that: GenTraversableOnce[B]): $Coll[B]
* @inheritdoc
*
* Example:
* {{{
* scala> val a = $Coll(1)
* a: $Coll[Int] = $Coll(1)
*
* scala> val b = $Coll(2)
* b: $Coll[Int] = $Coll(2)
*
* scala> val c = a ++ b
* c: $Coll[Int] = $Coll(1, 2)
*
* scala> val d = $Coll('a')
* d: $Coll[Char] = $Coll(a)
*
* scala> val e = c ++ d
* e: $Coll[AnyVal] = $Coll(1, 2, a)
* }}} when I build scaladoc GenTraversableLikescala> val a = `GenTraversable`(1)
a: `GenTraversable`[Int] = `GenTraversable`(1)
scala> val b = `GenTraversable`(2)
b: `GenTraversable`[Int] = `GenTraversable`(2)
scala> val c = a ++ b
c: `GenTraversable`[Int] = `GenTraversable`(1, 2)
scala> val d = `GenTraversable`('a')
d: `GenTraversable`[Char] = `GenTraversable`(a)
scala> val e = c ++ d
e: `GenTraversable`[AnyVal] = `GenTraversable`(1, 2, a) Listscala> val a = `List`(1)
a: `List`[Int] = `List`(1)
scala> val b = `List`(2)
b: `List`[Int] = `List`(2)
scala> val c = a ++ b
c: `List`[Int] = `List`(1, 2)
scala> val d = `List`('a')
d: `List`[Char] = `List`(a)
scala> val e = c ++ d
e: `List`[AnyVal] = `List`(1, 2, a) With my limited understanding, I started looking at other classes which provide examples and realized that every example that has been shown is between " { { { " and " } } } " and the code between them is not using Am I missing anything? |
Harit Himanshu (hhimanshu) said: |
@SethTisue said: |
Harit Himanshu (hhimanshu) said: |
@SethTisue said: I think I would suggest leaving the use case in, but simply removing the example from it. Incorrect examples are worse than no examples. (I'm tempted to suggest removing the use case from @VladUreche what do you think? should we just remove the example? |
Harit Himanshu (hhimanshu) said: |
@SethTisue said: Since Vlad hasn't chosen to weigh in, my last recommendation still stands: “I would suggest leaving the use case in, but simply removing the example from it. Incorrect examples are worse than no examples." |
Jim Van Horn (jwvh) said (edited on Oct 13, 2016 5:00:35 AM UTC): @usecase def ++[B](that: GenTraversableOnce[B]): $Coll[B] "$Coll" is not correct for Option. Some(a) ++ Some(b) does not return an Option. This is assuming the Std Lib code is correct and the documentation is wrong, not vice versa. |
@SethTisue said: |
@SethTisue said: |
Aravindh S (aravindhs) said: |
@SethTisue said: |
@Philippus said: |
http://www.scala-lang.org/api/current/index.html#scala.collection.immutable.Set
Set
use is not shown in the use case section.The text was updated successfully, but these errors were encountered: