diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-02-17 19:35:17 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-02-18 09:23:38 +0100 |
commit | 00283e6d8dfb9d884e9598b96fb7b3b5f5600ee3 (patch) | |
tree | 8253a467fdefb0179f90dce49ecaa437daf9ed6c /src | |
parent | afecfe90cd98a657ce83f3e833c940518563064e (diff) | |
download | scala-00283e6d8dfb9d884e9598b96fb7b3b5f5600ee3.tar.gz scala-00283e6d8dfb9d884e9598b96fb7b3b5f5600ee3.tar.bz2 scala-00283e6d8dfb9d884e9598b96fb7b3b5f5600ee3.zip |
makes sure compat._ provides full compatibility with 2.10.x
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._
...
}
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/api/Internals.scala | 38 | ||||
-rw-r--r-- | src/reflect/scala/reflect/api/Types.scala | 4 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Internals.scala | 1 |
3 files changed, 43 insertions, 0 deletions
diff --git a/src/reflect/scala/reflect/api/Internals.scala b/src/reflect/scala/reflect/api/Internals.scala index 37406385c8..01700345d1 100644 --- a/src/reflect/scala/reflect/api/Internals.scala +++ b/src/reflect/scala/reflect/api/Internals.scala @@ -280,6 +280,10 @@ trait Internals { self: Universe => /** A creator for `RefinedType` types. */ + def refinedType(parents: List[Type], decls: Scope, clazz: Symbol): RefinedType + + /** A creator for `RefinedType` types. + */ def refinedType(parents: List[Type], owner: Symbol): Type /** A creator for `RefinedType` types. @@ -785,6 +789,9 @@ trait Internals { self: Universe => @deprecated("Use `internal.reificationSupport` instead", "2.11.0") val build: ReificationSupportApi + @deprecated("Use `internal.ReificationSupportApi` instead", "2.11.0") + type BuildApi = ReificationSupportApi + /** This trait provides support for importers, a facility to migrate reflection artifacts between universes. * ''Note: this trait should typically be used only rarely.'' * @@ -1030,6 +1037,37 @@ trait Internals { self: Universe => def newScopeWith(elems: Symbol*): Scope = internal.newScopeWith(elems: _*) + /** Scala 2.10 compatibility enrichments for BuildApi. */ + implicit class CompatibleBuildApi(api: BuildApi) { + /** @see [[BuildApi.setInfo]] */ + @deprecated("Use `internal.reificationSupport.setInfo` instead", "2.11.0") + def setTypeSignature[S <: Symbol](sym: S, tpe: Type): S = internal.reificationSupport.setInfo(sym, tpe) + + /** @see [[BuildApi.FlagsRepr]] */ + @deprecated("Use `internal.reificationSupport.FlagsRepr` instead", "2.11.0") + def flagsFromBits(bits: Long): FlagSet = internal.reificationSupport.FlagsRepr(bits) + + /** @see [[BuildApi.noSelfType]] */ + @deprecated("Use `noSelfType` instead", "2.11.0") + def emptyValDef: ValDef = noSelfType + + /** @see [[BuildApi.mkThis]] */ + @deprecated("Use `internal.reificationSupport.mkThis` instead", "2.11.0") + def This(sym: Symbol): Tree = internal.reificationSupport.mkThis(sym) + + /** @see [[BuildApi.mkSelect]] */ + @deprecated("Use `internal.reificationSupport.mkSelect` instead", "2.11.0") + def Select(qualifier: Tree, sym: Symbol): Select = internal.reificationSupport.mkSelect(qualifier, sym) + + /** @see [[BuildApi.mkIdent]] */ + @deprecated("Use `internal.reificationSupport.mkIdent` instead", "2.11.0") + def Ident(sym: Symbol): Ident = internal.reificationSupport.mkIdent(sym) + + /** @see [[BuildApi.mkTypeTree]] */ + @deprecated("Use `internal.reificationSupport.mkTypeTree` instead", "2.11.0") + def TypeTree(tp: Type): TypeTree = internal.reificationSupport.mkTypeTree(tp) + } + /** Scala 2.10 compatibility enrichments for Tree. */ implicit class CompatibleTree(tree: Tree) { /** @see [[InternalApi.freeTerms]] */ diff --git a/src/reflect/scala/reflect/api/Types.scala b/src/reflect/scala/reflect/api/Types.scala index 0e176170f8..f6995dd5de 100644 --- a/src/reflect/scala/reflect/api/Types.scala +++ b/src/reflect/scala/reflect/api/Types.scala @@ -657,6 +657,10 @@ trait Types { /** @see [[InternalApi.refinedType]] */ @deprecated("Use `internal.refinedType` instead", "2.11.0") def apply(parents: List[Type], decls: Scope)(implicit token: CompatToken): RefinedType = internal.refinedType(parents, decls) + + /** @see [[InternalApi.refinedType]] */ + @deprecated("Use `internal.refinedType` instead", "2.11.0") + def apply(parents: List[Type], decls: Scope, clazz: Symbol)(implicit token: CompatToken): RefinedType = internal.refinedType(parents, decls, clazz) } /** The API that all refined types support. diff --git a/src/reflect/scala/reflect/internal/Internals.scala b/src/reflect/scala/reflect/internal/Internals.scala index e8bf842e6e..e9916cf7d1 100644 --- a/src/reflect/scala/reflect/internal/Internals.scala +++ b/src/reflect/scala/reflect/internal/Internals.scala @@ -113,6 +113,7 @@ trait Internals extends api.Internals { def constantType(value: Constant): ConstantType = self.ConstantType(value) def typeRef(pre: Type, sym: Symbol, args: List[Type]): Type = self.TypeRef(pre, sym, args) def refinedType(parents: List[Type], decls: Scope): RefinedType = self.RefinedType(parents, decls) + def refinedType(parents: List[Type], decls: Scope, clazz: Symbol): RefinedType = self.RefinedType(parents, decls, clazz) def refinedType(parents: List[Type], owner: Symbol): Type = self.refinedType(parents, owner) def refinedType(parents: List[Type], owner: Symbol, decls: Scope): Type = self.RefinedType(parents, decls, owner) def refinedType(parents: List[Type], owner: Symbol, decls: Scope, pos: Position): Type = self.refinedType(parents, owner, decls, pos) |