BitSet does not conform to Set[Int] in match type
See original GitHub issueCompiler version
3.1.3-RC1-bin-20220228-fa08d00-NIGHTLY
Minimized code
import scala.collection.immutable.BitSet
type SetFor[A] <: Set[A] = A match
case Int => BitSet
case A => Set[A]
Output
case Int => BitSet
^^^^^^
Found: collection.BitSet
Required: Set[A]
Expectation
Compile and match correctly.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
no match for operator - c++
I am trying to write a function that asks the user to input multiple hex strings to a console and then convert those...
Read more >BitSet
A BitSet is not safe for multithreaded use without external synchronization. ... public void set (int fromIndex, int toIndex, boolean value).
Read more >Bit Array and Bit Set API Review (The end of a GSoC Project)
As BitSet is essentially a Set<Int> in its API. Therefore, not conforming to SetAlgebra is naturally an interesting choice. Instead, useful ...
Read more >C++ Standard Library Defect Reports and Accepted Issues
Returns: An object of type bitset<N>::reference such that (*this)[pos] ... that can be passed to a locale constructor, but there is no matching...
Read more >std::bitset
The class template bitset represents a fixed-size sequence of N bits. Bitsets can be manipulated by standard logic operators and converted ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Btw, I also tried to find something that works and failed, and can’t tell exactly why it fails while LeafElem and leafElem work. Perhaps it’s some solace. 🙂 I’m not never sure where match type questions are being asked and answered…
I assume there was just an error in reproduction or minimisation and you meant
scala.collection.immutable.BitSet
, as in:Here’s the -explain output:
So looks like when
A
is matched withInt
,A := Int
(or perhapsA =:= Int
) isn’t added to the constraints such that this is true.