Closed scabug closed 6 years ago
Imported From: https://issues.scala-lang.org/browse/SI-9320?orig=1 Reporter: @refried
@som-snytt said: Blocks have result expressions, so the Unit is supplied. But you can use inner.children.init to exclude it.
@refried said (edited on May 20, 2015 12:59:50 PM UTC): How can I predict whether a tree contains an extraneous element to exclude though? I don’t want to chop off something important by accident.
@som-snytt said: The value at the end of a block can never be a top-level element in a package. Basically, filter on
scala> import PartialFunction.{ cond => when }
import PartialFunction.{cond=>when}
scala> def isTop(t: Tree) = when (t) { case _: ImplDef | _: Import => true }
isTop: (t: Tree)Boolean
Or for arbitrary trees, maybe you can get away with putting them in a package object.
closing all quasiquotes tickets; see #10755
@SethTisue I was lobbying to rename cond
already years ago, see previous comment.
I was lobbying
drain the swamp!
I'm running into some issues trying to combine Trees with quasiquoting:
This is no problem:
But:
And:
Sorry if not a bug!