File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed
src/compiler/scala/tools/nsc/typechecker Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -825,6 +825,16 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
825
825
}
826
826
orElse { _ =>
827
827
val resetTree = resetAttrs(original)
828
+ resetTree match {
829
+ case treeInfo.Applied (fun, targs, args) =>
830
+ if (fun.symbol != null && fun.symbol.isError)
831
+ // SI-9041 Without this, we leak error symbols past the typer!
832
+ // because the fallback typechecking notices the error-symbol,
833
+ // refuses to re-attempt typechecking, and presumes that someone
834
+ // else was responsible for issuing the related type error!
835
+ fun.setSymbol(NoSymbol )
836
+ case _ =>
837
+ }
828
838
debuglog(s " fallback on implicits: ${tree}/ $resetTree" )
829
839
val tree1 = typed(resetTree, mode)
830
840
// Q: `typed` already calls `pluginsTyped` and `adapt`. the only difference here is that
Original file line number Diff line number Diff line change
1
+ t9041.scala:11: error: could not find implicit value for parameter cellSetter: CellSetter[scala.math.BigDecimal]
2
+ def setCell(cell: Cell, data: math.BigDecimal) { cell.setCellValue(data) }
3
+ ^
4
+ one error found
Original file line number Diff line number Diff line change
1
+ // False negative test, requires overloading in Cell.
2
+
3
+ trait Cell { def setCellValue (i : Int ) = () ; def setCellValue (d : Double ) = () }
4
+
5
+ trait Nope {
6
+ def f = {
7
+ trait CellSetter [A ] {
8
+ def setCell (cell : Cell , data : A ): Unit
9
+ }
10
+ implicit val bigDecimalCellSetter = new CellSetter [math.BigDecimal ]() {
11
+ def setCell (cell : Cell , data : math.BigDecimal ) { cell.setCellValue(data) }
12
+ }
13
+ implicit class RichCell (cell : Cell ) {
14
+ def setCellValue [A ](data : A )(implicit cellSetter : CellSetter [A ]) = cellSetter.setCell(cell, data)
15
+ }
16
+ }
17
+ }
You can’t perform that action at this time.
0 commit comments