summaryrefslogblamecommitdiff
path: root/test/files/neg/t9041.scala
blob: 2bdef0d3ae1c0681844e454347f9890664d70c5a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                                                       
// False negative test, requires overloading in Cell.

trait Cell { def setCellValue(i: Int) = () ; def setCellValue(d: Double) = () }

trait Nope {
  def f = {
    trait CellSetter[A] {
      def setCell(cell: Cell, data: A): Unit
    }
    implicit val bigDecimalCellSetter = new CellSetter[math.BigDecimal]() {
      def setCell(cell: Cell, data: math.BigDecimal) { cell.setCellValue(data) }
    }
    implicit class RichCell(cell: Cell) {
      def setCellValue[A](data: A)(implicit cellSetter: CellSetter[A]) = cellSetter.setCell(cell, data)
    }
  }
}