mirror of https://github.com/sbt/sbt.git
Merge pull request #1127 from retronym/topic/2.11-2.10-source-compat
using compat._ to plug source compatibility breakages
This commit is contained in:
commit
c9f83dde47
|
|
@ -59,6 +59,9 @@ object InputWrapper
|
|||
private[std] def wrapPrevious[T: c.WeakTypeTag](c: Context)(ts: c.Expr[Any], pos: c.Position): c.Expr[Option[T]] =
|
||||
wrapImpl[Option[T],InputWrapper.type](c, InputWrapper, WrapPreviousName)(ts, pos)
|
||||
|
||||
// TODO 2.11 Remove this after dropping 2.10.x support.
|
||||
private object HasCompat { val compat = ??? }; import HasCompat._
|
||||
|
||||
/** Wraps an arbitrary Tree in a call to the `<s>.<wrapName>` method of this module for later processing by an enclosing macro.
|
||||
* The resulting Tree is the manually constructed version of:
|
||||
*
|
||||
|
|
@ -67,6 +70,7 @@ object InputWrapper
|
|||
def wrapImpl[T: c.WeakTypeTag, S <: AnyRef with Singleton](c: Context, s: S, wrapName: String)(ts: c.Expr[Any], pos: c.Position)(implicit it: c.TypeTag[s.type]): c.Expr[T] =
|
||||
{
|
||||
import c.universe.{Apply=>ApplyTree,_}
|
||||
import compat._
|
||||
val util = new ContextUtil[c.type](c)
|
||||
val iw = util.singleton(s)
|
||||
val tpe = c.weakTypeOf[T]
|
||||
|
|
|
|||
|
|
@ -281,9 +281,13 @@ object TaskMacro
|
|||
private[this] def iTaskMacro[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[Task[T]] =
|
||||
Instance.contImpl[T,Id](c, TaskInstance, TaskConvert, MixedBuilder)(Left(t), Instance.idTransform)
|
||||
|
||||
// TODO 2.11 Remove this after dropping 2.10.x support.
|
||||
private object HasCompat { val compat = ??? }; import HasCompat._
|
||||
|
||||
private[this] def inputTaskDynMacro0[T: c.WeakTypeTag](c: Context)(t: c.Expr[Initialize[Task[T]]]): c.Expr[Initialize[InputTask[T]]] =
|
||||
{
|
||||
import c.universe.{Apply=>ApplyTree,_}
|
||||
import compat._
|
||||
|
||||
val tag = implicitly[c.WeakTypeTag[T]]
|
||||
val util = ContextUtil[c.type](c)
|
||||
|
|
|
|||
|
|
@ -32,12 +32,16 @@ object ContextUtil {
|
|||
def unexpectedTree[C <: Context](tree: C#Tree): Nothing = sys.error("Unexpected macro application tree (" + tree.getClass + "): " + tree)
|
||||
}
|
||||
|
||||
// TODO 2.11 Remove this after dropping 2.10.x support.
|
||||
private object HasCompat { val compat = ??? }; import HasCompat._
|
||||
|
||||
/** Utility methods for macros. Several methods assume that the context's universe is a full compiler (`scala.tools.nsc.Global`).
|
||||
* This is not thread safe due to the underlying Context and related data structures not being thread safe.
|
||||
* Use `ContextUtil[c.type](c)` to construct. */
|
||||
final class ContextUtil[C <: Context](val ctx: C)
|
||||
{
|
||||
import ctx.universe.{Apply=>ApplyTree,_}
|
||||
import compat._
|
||||
|
||||
val powerContext = ctx.asInstanceOf[reflect.macros.runtime.Context]
|
||||
val global: powerContext.universe.type = powerContext.universe
|
||||
|
|
|
|||
|
|
@ -9,11 +9,15 @@ package appmacro
|
|||
/** A `TupleBuilder` that uses a KList as the tuple representation.*/
|
||||
object KListBuilder extends TupleBuilder
|
||||
{
|
||||
// TODO 2.11 Remove this after dropping 2.10.x support.
|
||||
private object HasCompat { val compat = ??? }; import HasCompat._
|
||||
|
||||
def make(c: Context)(mt: c.Type, inputs: Inputs[c.universe.type]): BuilderResult[c.type] = new BuilderResult[c.type]
|
||||
{
|
||||
val ctx: c.type = c
|
||||
val util = ContextUtil[c.type](c)
|
||||
import c.universe.{Apply=>ApplyTree,_}
|
||||
import compat._
|
||||
import util._
|
||||
|
||||
val knilType = c.typeOf[KNil]
|
||||
|
|
|
|||
|
|
@ -14,10 +14,14 @@ object TupleNBuilder extends TupleBuilder
|
|||
final val MaxInputs = 11
|
||||
final val TupleMethodName = "tuple"
|
||||
|
||||
// TODO 2.11 Remove this after dropping 2.10.x support.
|
||||
private object HasCompat { val compat = ??? }; import HasCompat._
|
||||
|
||||
def make(c: Context)(mt: c.Type, inputs: Inputs[c.universe.type]): BuilderResult[c.type] = new BuilderResult[c.type]
|
||||
{
|
||||
val util = ContextUtil[c.type](c)
|
||||
import c.universe.{Apply=>ApplyTree,_}
|
||||
import compat._
|
||||
import util._
|
||||
|
||||
val global: Global = c.universe.asInstanceOf[Global]
|
||||
|
|
|
|||
Loading…
Reference in New Issue