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
7c9ee6e687
|
|
@ -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