We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
see code
final override def sum[B >: Int](implicit num: Numeric[B]): Int = { if (isEmpty) 0 else if (numRangeElements == 1) head else (numRangeElements.toLong * (head + last) / 2).toInt }
test that show that such implementation is wrong
scala> object mynum extends Numeric[Int] { | // Members declared in scala.math.Numeric | def fromInt(x: Int): Int = ??? | def minus(x: Int,y: Int): Int = ??? | def negate(x: Int): Int = ??? | def plus(x: Int,y: Int): Int = ??? | def times(x: Int,y: Int): Int = ??? | def toDouble(x: Int): Double = ??? | def toFloat(x: Int): Float = ??? | def toInt(x: Int): Int = ??? | def toLong(x: Int): Long = ??? | | // Members declared in scala.math.Ordering | def compare(x: Int,y: Int): Int = ??? | } defined module mynum scala> (1 to 100).sum(mynum) res0: Int = 5050
This test should throw scala.NotImplementedError
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-7443?orig=1 Reporter: @DarkDimius Affected Versions: 2.10.1, 2.10.3
Sorry, something went wrong.
@adriaanm said: scala/scala#3124
DarkDimius
No branches or pull requests
see code
test that show that such implementation is wrong
This test should throw scala.NotImplementedError
The text was updated successfully, but these errors were encountered: