Because == works, I would assume that the assertEquals above should also work, but it do not. Looking at this code it seems it should work. Indeed, when I don't use singleton types, it does. However ComparePriority1 and ComparePriority2 don't seem to be working as expected.
Is this expected?
TIA
[error] 608 | assertEquals(ICons("5", 5,IEmpT), ff1b)
[error] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] |Can't compare these two types:
[error] | First type: icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type]
[error] | Second type: icollection.IMap.ICons[("5" : String), (5 : Int), icollection.IMap.IEmpT]
[error] |Possible ways to fix this error:
[error] | Alternative 1: provide an implicit instance for Compare[icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type], icollection.IMap.ICons[("5" : String), (5 : Int), icollection.IMap.IEmpT]]
[error] | Alternative 2: upcast either type into `Any` or a shared supertype.
[error] |I found:
[error] |
[error] | munit.Compare.compareSubtypeWithSupertype[
[error] | icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type],
[error] | icollection.IMap.ICons[("5" : String), (5 : Int), icollection.IMap.IEmpT]](
[error] | /* missing */
[error] | summon[icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type] <:<
[error] | icollection.IMap.ICons[("5" : String), (5 : Int), icollection.IMap.IEmpT]]
[error] | )
[error] |
[error] |But no implicit values were found that match type icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type] <:<
[error] | icollection.IMap.ICons[("5" : String), (5 : Int), icollection.IMap.IEmpT].
[error] -- [E172] Type Error: /home/hmf/VSCodeProjects/sploty/meta/test/src/icollection/IMapSpec.scala:609:16
[error] 609 | assertEquals(ff1b, ICons("5", 5,IEmpT))
[error] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] |Can't compare these two types:
[error] | First type: icollection.IMap.ICons[("5" : String), (5 : Int), icollection.IMap.IEmpT]
[error] | Second type: icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type]
[error] |Possible ways to fix this error:
[error] | Alternative 1: provide an implicit instance for Compare[icollection.IMap.ICons[("5" : String), (5 : Int), icollection.IMap.IEmpT], icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type]]
[error] | Alternative 2: upcast either type into `Any` or a shared supertype.
[error] |I found:
[error] |
[error] | munit.Compare.compareSubtypeWithSupertype[
[error] | icollection.IMap.ICons[("5" : String), (5 : Int), icollection.IMap.IEmpT],
[error] | icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type]](
[error] | /* missing */
[error] | summon[
[error] | icollection.IMap.ICons[("5" : String), (5 : Int), icollection.IMap.IEmpT]
[error] | <:< icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type]]
[error] | )
[error] |
[error] |But no implicit values were found that match type icollection.IMap.ICons[("5" : String), (5 : Int), icollection.IMap.IEmpT] <:<
[error] | icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type].
[warn] -- Warning: /home/hmf/VSCodeProjects/sploty/meta/test/src/icollection/IMapSpec.scala:882:19
Using veersion 3.4.2-RC1.
I have the following definitions that implement a map version of an HList:
The following non-commented code compiles in Scala 3 (3.4.2-RC1):
The commented code above fails. I can compare the values with
==
without any problem as shown below:However the following fails to compile with errors shown at the end:
Because
==
works, I would assume that theassertEquals
above should also work, but it do not. Looking at this code it seems it should work. Indeed, when I don't use singleton types, it does. HoweverComparePriority1
andComparePriority2
don't seem to be working as expected.Is this expected?
TIA