You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using ToolBox to typecheck a tree, e.g. created with quasiquotes, the reporting FrontEnd can miss some of the reported infos.
tools.reflect.FrontEnd uses a LinkedHashSet to store reported infos. The case class Info contains the position, a message and a severity. For quasiquotes, the position is always NoPosition and, thus, infos with the same severity and message are only stored once in the set.
The following code compiles a tree which should report two warnings, but it only gives me one:
importscala.reflect.runtime.currentMirrorimportscala.reflect.runtime.universe._importscala.tools.reflect.{FrontEnd, ToolBox}
valreporter=newFrontEnd {
overridedefdisplay(info: Info) {}
overridedefinteractive() {}
}
valtoolbox= currentMirror.mkToolBox(reporter)
valtree=q"object A { def foo[T](t: T) = 1.isInstanceOf[T]; def bar[T](t: T) = 1.isInstanceOf[T] }"valtypedTree= toolbox.typecheck(tree)
println(reporter.infos) // Set(Info(NoPosition,abstract type T is unchecked since it is eliminated by erasure,WARNING))
I would have expected to get a list of two warnings.
The text was updated successfully, but these errors were encountered:
When using ToolBox to typecheck a tree, e.g. created with quasiquotes, the reporting FrontEnd can miss some of the reported infos.
tools.reflect.FrontEnd uses a LinkedHashSet to store reported infos. The case class Info contains the position, a message and a severity. For quasiquotes, the position is always NoPosition and, thus, infos with the same severity and message are only stored once in the set.
The following code compiles a tree which should report two warnings, but it only gives me one:
I would have expected to get a list of two warnings.
The text was updated successfully, but these errors were encountered: