Scalatest 3.0.0-M11, FunSuite, and warnValueDiscard

57 views
Skip to first unread message

Matt

unread,
Nov 4, 2015, 9:36:32 PM11/4/15
to scalatest-users
For code cleanliness reasons, my projects report a compiler error for discarded non-unit values.  Because of the changes to Assertion, this has led to hundreds of compiler errors going from M10 -> M11.

class ExampleTest extends FunSuite with Matchers {

  test
("this used to compile") {
   
(1 + 1) shouldBe(2)
 
}
}

`test` has a Unit return type.  Now that the matchers return an `Assertion`, the compiler errors out telling me that I'm throwing away a value.  The only way to fix it is to explicitely return Unit:

class ExampleTest extends FunSuite with Matchers {

  test
("this used to compile") {
   
(1 + 1) shouldBe(2)
   
()
 
}
}

Anyway we can preserve the original example? 

Bill Venners

unread,
Nov 4, 2015, 10:08:14 PM11/4/15
to scalate...@googlegroups.com
Hi Matt,

Yes, we are planning on changing that Unit to Any. Just learned about this problem today in fact:

https://github.com/scalatest/scalatest/issues/764

I'll try and get an M12 out as soon as possible with that change.

Bill

--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalate...@googlegroups.com
To unsubscribe from this group, send email to
scalatest-use...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Bill Venners
Artima, Inc.
http://www.artima.com

Bill Venners

unread,
Nov 5, 2015, 5:12:37 AM11/5/15
to scalate...@googlegroups.com
Deploying a 3.0.0-SNAP9 right now. May need to do the sonatype gymnastics after a second half nights sleep. Right now we're in the middle of modularization so it is hard to make changes without incurring merge problems, but I wanted to get something out for you to try.

Bill

Bill Venners

unread,
Nov 5, 2015, 10:36:35 AM11/5/15
to scalate...@googlegroups.com
Hi Matt,

ScalaTest and Scalactic 3.0.0-SNAP9 is released for Scala 2.10 and 2.11 and Scala.js 0.6.5. In this the Unit result type has been changed to Any. Please give this a try and let me know if it does indeed get rid of those warnings in your project.

Thanks.

Bill
Reply all
Reply to author
Forward
0 new messages