Closed
Description
When running a program which consumes opaque types as follows, it appears to be stuck on an infinite loop. Not sure what is going on here.
Minimized code
object Prices {
opaque type Price = BigDecimal
object Price{
given Ordering[Price] = summon[Ordering[BigDecimal]]
}
}
extension[K,V] (m1: Map[K,V]) def computeDiff(m2: Map[K,V])(using Ordering[K])(using orderAsc: Boolean = true): Unit = println("Ok....")
import Prices._
@main def mainz = {
println("begin")
val result = Map.empty[Price,Int].computeDiff(Map.empty[Price,Int])
println(s"end $result")
}
Scastie link: https://scastie.scala-lang.org/ajEagvzvTbitmzbqFt0Oxw
Output
begin
Expectation
Should successfully print the following:
begin
Ok....
end
This works if the Price
was swapped with BigDecimal
in the line
val result = Map.empty[Price,Int].computeDiff(Map.empty[Price,Int])
This is happening on 3.0.0-M3