a new set that contains all elements of this set and that also contains elem.
If this was correct, then it would never return the same set, even if the element was already included.
But, the default Set actually does return itself:
Welcome to Scala 2.13.1 (OpenJDK 64-Bit Server VM, Java 11.0.6).
Type in expressions for evaluation. Or try :help.
> val set = Set(1,2,3)
set: scala.collection.immutable.Set[Int] = Set(1, 2, 3)
> val set2 = set + 3
set2: scala.collection.immutable.Set[Int] = Set(1, 2, 3)
> set eq set2
res0: Boolean = true
There is no guarantee.
I could imagine the Set is effectively some kind of lazily evaluated view and trying to add another element would trigger the evaluation.