-
Notifications
You must be signed in to change notification settings - Fork 1k
Update overview.md #927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update overview.md #927
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,7 +102,7 @@ argument), `List[Int]`. | |
|
||
Once we have obtained the desired `Type` instance, we can inspect it, e.g.: | ||
|
||
scala> val decls = theType.declarations.take(10) | ||
scala> val decls = theType.decls.take(10) | ||
decls: Iterable[ru.Symbol] = List(constructor List, method companion, method isEmpty, method head, method tail, method ::, method :::, method reverse_:::, method mapConserve, method ++) | ||
|
||
#### Instantiating a Type at Runtime | ||
|
@@ -132,7 +132,7 @@ The second step involves obtaining a `ClassMirror` for class `Person` using | |
the `reflectClass` method. The `ClassMirror` provides access to the | ||
constructor of class `Person`. | ||
|
||
scala> val ctor = ru.typeOf[Person].declaration(ru.nme.CONSTRUCTOR).asMethod | ||
scala> val ctor = ru.typeOf[Person].decls(ru.nme.CONSTRUCTOR).asMethod | ||
ctor: scala.reflect.runtime.universe.MethodSymbol = constructor Person | ||
|
||
The symbol for `Person`s constructor can be obtained using only the runtime | ||
|
@@ -171,7 +171,7 @@ which makes all classes and types available that are loaded by the classloader | |
that also loaded the class of `p` (`Purchase`), which we need in order to | ||
access member `shipped`. | ||
|
||
scala> val shippingTermSymb = ru.typeOf[Purchase].declaration(ru.TermName("shipped")).asTerm | ||
scala> val shippingTermSymb = ru.typeOf[Purchase].decls(ru.TermName("shipped")).asTerm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code as is ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in #935? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||
shippingTermSymb: scala.reflect.runtime.universe.TermSymbol = method shipped | ||
|
||
We now look up the declaration of the `shipped` field, which gives us a | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SethTisue This PR introduced a bug, replacing
declaration
(singular) withdecls
(plural) here and on line 174 below. A fix is part of #935