From 902d791065ef9ea38adea73683e1249f615b0491 Mon Sep 17 00:00:00 2001 From: Krzysztof Pado Date: Thu, 10 Aug 2017 18:56:42 +0200 Subject: [PATCH] Cross build with Scala 2.13.0-M1 --- .travis.yml | 1 + build.sbt | 2 +- .../org/scalamock/util/MacroAdapter.scala | 35 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 shared/src/main/scala-2.13.0-M1/org/scalamock/util/MacroAdapter.scala diff --git a/.travis.yml b/.travis.yml index f96a657a..eca6b2b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ scala: - "2.10.6" - "2.11.11" - "2.12.3" + - "2.13.0-M1" jdk: - oraclejdk8 diff --git a/build.sbt b/build.sbt index 7e808777..a68abdbb 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,5 @@ scalaVersion in ThisBuild := "2.10.6" -crossScalaVersions in ThisBuild := Seq("2.10.6", "2.11.11", "2.12.3") +crossScalaVersions in ThisBuild := Seq("2.10.6", "2.11.11", "2.12.3", "2.13.0-M1") scalaJSUseRhino in ThisBuild := true organization in ThisBuild := "org.scalamock" licenses in ThisBuild := Seq("MIT" -> url("https://opensource.org/licenses/MIT")) diff --git a/shared/src/main/scala-2.13.0-M1/org/scalamock/util/MacroAdapter.scala b/shared/src/main/scala-2.13.0-M1/org/scalamock/util/MacroAdapter.scala new file mode 100644 index 00000000..28b43ffa --- /dev/null +++ b/shared/src/main/scala-2.13.0-M1/org/scalamock/util/MacroAdapter.scala @@ -0,0 +1,35 @@ +// Copyright (c) 2011-2017 ScalaMock Contributors (https://github.com/paulbutcher/ScalaMock/graphs/contributors) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package org.scalamock.util + +class MacroAdapter[C <: MacroAdapter.Context](val ctx2: C) { + import ctx2.universe._ + + def freshTerm(prefix: String): TermName = ctx2.freshName(TermName(prefix)) + def internalTypeRef(pre: Type, sym: Symbol, args: List[Type]) = internal.typeRef(pre, sym, args) + def internalSuperType(thistpe: Type, supertpe: Type): Type = internal.superType(thistpe, supertpe) + def internalThisType(thistpe: Symbol) = internal.thisType(thistpe) + def internalTypeDef(p: Symbol): TypeDef = internal.typeDef(p) +} + +object MacroAdapter { + type Context = scala.reflect.macros.blackbox.Context +}