aboutsummaryrefslogtreecommitdiff
path: root/tests/pending/run/t5565.scala
blob: c46068caf5d674d0825fd34236cc76f8608921b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import scala.language.reflectiveCalls
import scala.language.implicitConversions

object Test extends dotty.runtime.LegacyApp {
  implicit def doubleWithApproxEquals(d: Double): AnyRef{def ~==(v: Double,margin: Double): Boolean; def ~==$default$2: Double @scala.annotation.unchecked.uncheckedVariance} = new {
    def ~==(v: Double, margin: Double = 0.001): Boolean =
      math.abs(d - v) < margin
  }

  assert(math.abs(-4.0) ~== (4.0, 0.001))
  assert(math.abs(-4.0) ~== 4.0)
}