| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is extremely important to enable cross-versioning Scala 2.10 codebases
against Scala 2.11 using Jason's trick with:
// TODO 2.11 Remove this after dropping 2.10.x support.
private object HasCompat { val compat = ??? }; import HasCompat._
def impl(c: Context)(...): ... = {
import c.universe._
import compat._
...
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reflection API exhibits a tension inherent to experimental things:
on the one hand we want it to grow into a beautiful and robust API,
but on the other hand we have to deal with immaturity of underlying mechanisms
by providing not very pretty solutions to enable important use cases.
In Scala 2.10, which was our first stab at reflection API, we didn't
have a systematic approach to dealing with this tension, sometimes exposing
too much of internals (e.g. Symbol.deSkolemize) and sometimes exposing
too little (e.g. there's still no facility to change owners, to do typing
transformations, etc). This resulted in certain confusion with some internal
APIs living among public ones, scaring the newcomers, and some internal APIs
only available via casting, which requires intimate knowledge of the
compiler and breaks compatibility guarantees.
This led to creation of the `internal` API module for the reflection API,
which provides advanced APIs necessary for macros that push boundaries
of the state of the art, clearly demarcating them from the more or less
straightforward rest and providing compatibility guarantees on par with
the rest of the reflection API.
This commit does break source compatibility with reflection API in 2.10,
but the next commit is going to introduce a strategy of dealing with that.
|
|
|
|
|
|
|
|
|
|
|
| |
As per https://groups.google.com/forum/#!topic/scala-internals/8v2UL-LR9yY,
annotations don’t have to be represented as AnnotationInfos and can be
reduced to plain Trees.
Due to compatibility reasons and because of the limitations of the cake
pattern used in implementing current version of Reflection, we can’t
just say `type Annotation = Tree`, however what we can definitely do is
to deprecate all the methods on Annotation and expose `tree: Tree` instead.
|
|
Makes sure that almost every abstract type declared in reflection API
erases to a unique class, so that they can be adequately used for
method overloading to the same extent that tags allow them to be used
in pattern matching.
The only two exceptions from this rule are the types whose implementations
we do not control: FlagSet that is implemented as Long and RuntimeClass
that is implemented as java.lang.Class[_].
|