Skip to content

Commit 9ef1b8d

Browse files
OlivierBlanvillainallanrenucci
authored andcommitted
Fix ShowTests: Make Show contravariant
1 parent a142b98 commit 9ef1b8d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

library/src/dotty/Show.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package dotty
22

3-
trait Show[T] {
3+
trait Show[-T] {
44
def show(t: T): String
55
}
66

library/test/dotty/ShowTests.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,12 @@ class ShowTests {
5858
@Test def showMaps = {
5959
val mp = scala.collection.immutable.Map("str1" -> "val1", "str2" -> "val2")
6060
assertEquals("Map(\"str1\" -> \"val1\", \"str2\" -> \"val2\")", mp.show)
61+
assertEquals("Map()", Map().show)
6162
}
6263

6364
@Test def withoutShow = {
6465
case class Car(model: String, manufacturer: String, year: Int)
65-
6666
assertEquals("Car(Mustang,Ford,1967)", Car("Mustang", "Ford", 1967).show)
67-
assertEquals("Map()", Map[Nothing, Nothing]().show)
6867
}
6968

7069
@Test def partialShow = {

0 commit comments

Comments
 (0)