Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _overviews/reflection/annotations-names-scopes.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ supports the `sorted` method, which sorts members *in declaration order*.
The following example returns a list of the symbols of all final members
of the `List` class, in declaration order:

scala> val overridden = listTpe.decls.sorted.filter(_.isFinal)
overridden: List(method isEmpty, method map, method collect, method flatMap, method takeWhile, method span, method foreach, method reverse, method foldRight, method length, method lengthCompare, method forall, method exists, method contains, method find, method mapConserve, method toList)
scala> val finals = listTpe.decls.sorted.filter(_.isFinal)
finals: List(method isEmpty, method map, method collect, method flatMap, method takeWhile, method span, method foreach, method reverse, method foldRight, method length, method lengthCompare, method forall, method exists, method contains, method find, method mapConserve, method toList)

## Exprs

Expand Down
10 changes: 7 additions & 3 deletions _overviews/reflection/symbols-trees-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -701,18 +701,22 @@ method.
_Note:_ when using macros, one shouldn’t use `ToolBox.parse`. This is because
there’s already a `parse` method built into the macro context. For example:

bash$ scala -Yrepl-class-based:false

scala> import scala.language.experimental.macros
import scala.language.experimental.macros

scala> def impl(c: scala.reflect.macros.Context) = c.Expr[Unit](c.parse("println(2)"))
impl: (c: scala.reflect.macros.Context)c.Expr[Unit]
scala> def impl(c: scala.reflect.macros.whitebox.Context) = c.Expr[Unit](c.parse("println(2)"))
def impl(c: scala.reflect.macros.whitebox.Context): c.Expr[Unit]

scala> def test: Unit = macro impl
test: Unit
def test: Unit

scala> test
2

You can find more about the two `Context`s in [this Macros article]({{ site.baseurl }}/overviews/macros/blackbox-whitebox.html).

##### Typechecking with ToolBoxes

As earlier alluded to, `ToolBox`es enable one to do more than just
Expand Down