Closed Prometheus3375 closed 4 months ago
scala> val hs = HS("hi")
val hs: scala.collection.immutable.HashSet[String] = HashSet(hi)
scala> val empty = HS.empty[String]
val empty: scala.collection.immutable.HashSet[String] = HashSet()
scala> hs.subsetOf(empty)
val res2: Boolean = true
This is why I never use booleans. I'd rather flip a coin, because then at least I have a coin.
Also it would be nice to have a REPL that prints strings in quotes.
@scala/collections
Taking a look, in subsetOf
there is no NxD
case. Adding that (which results in false, we have more than one element where the other set has exactly one) fixes the symptom. Additionally, the failing data is a root with subnode, which breaks the invariant arity > 1. (arity is data elements + subnodes) Looking at construction now. I'll PR in a bit.
is it 2.13 specific?
@SethTisue yes. 2.13 collections rewrite plus CHAMP. The underused pun is "CHAMPing at the bit".
🎵 We are the CHAMPions 🎵
Reproduction steps
Scala version: 2.13.12
There are 4 tuples of sets to identify whether the 1st one is a subset of the second.
Expected behavior
For all 4 tuples the result should be false.
Actual behavior
Exceptions for tuples 2 and 4.
Additional information
For Scala version 2.12.18.