You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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] |Firsttype: icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type]
[error] |Secondtype: icollection.IMap.ICons[("5":String), (5:Int), icollection.IMap.IEmpT]
[error] |Possible ways to fix thiserror:
[error] |Alternative1: provide an implicit instance forCompare[icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type], icollection.IMap.ICons[("5":String), (5:Int), icollection.IMap.IEmpT]]
[error] |Alternative2: upcast either typeinto `Any` or a shared supertype.
[error] |Ifound:
[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 matchtypeicollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type] <:<
[error] | icollection.IMap.ICons[("5":String), (5:Int), icollection.IMap.IEmpT].
[error] -- [E172] TypeError:/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] |Firsttype: icollection.IMap.ICons[("5":String), (5:Int), icollection.IMap.IEmpT]
[error] |Secondtype: icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type]
[error] |Possible ways to fix thiserror:
[error] |Alternative1: provide an implicit instance forCompare[icollection.IMap.ICons[("5":String), (5:Int), icollection.IMap.IEmpT], icollection.IMap.ICons[String, Int, icollection.IMap.IEmpT.type]]
[error] |Alternative2: upcast either typeinto `Any` or a shared supertype.
[error] |Ifound:
[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 matchtypeicollection.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
The text was updated successfully, but these errors were encountered:
hmf
changed the title
When using singleton types assertEquals does not work but `== does
When using singleton types assertEquals does not work but == does
Apr 21, 2024
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
The text was updated successfully, but these errors were encountered: