From f8a5b0048bd08a3bdcdffd1395954e0e92ee753b Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 1 May 2018 13:05:04 +0200 Subject: drop support for Scala 2.11 as of 0.10.0 also upgrade Scala 2.12.4 -> 2.12.6 --- .../scala/async/internal/TransformUtils.scala | 17 ++++++-------- .../run/uncheckedBounds/UncheckedBoundsSpec.scala | 26 ++-------------------- 2 files changed, 9 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/main/scala/scala/async/internal/TransformUtils.scala b/src/main/scala/scala/async/internal/TransformUtils.scala index 016ffc1..be56bb7 100644 --- a/src/main/scala/scala/async/internal/TransformUtils.scala +++ b/src/main/scala/scala/async/internal/TransformUtils.scala @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2014 Lightbend Inc. + * Copyright (C) 2012-2018 Lightbend Inc. */ package scala.async.internal @@ -406,15 +406,12 @@ private[async] trait TransformUtils { } // ===================================== - // Copy/Pasted from Scala 2.10.3. See SI-7694. - private lazy val UncheckedBoundsClass = { - try c.mirror.staticClass("scala.reflect.internal.annotations.uncheckedBounds") - catch { case _: ScalaReflectionException => NoSymbol } - } - final def uncheckedBounds(tp: Type): Type = { - if ((tp.typeArgs.isEmpty && (tp match { case _: TypeRef => true; case _ => false}))|| UncheckedBoundsClass == NoSymbol) tp + // Copy/Pasted from Scala 2.10.3. See scala/bug#7694 + private lazy val UncheckedBoundsClass = + c.mirror.staticClass("scala.reflect.internal.annotations.uncheckedBounds") + final def uncheckedBounds(tp: Type): Type = + if ((tp.typeArgs.isEmpty && (tp match { case _: TypeRef => true; case _ => false}))) tp else withAnnotation(tp, Annotation(UncheckedBoundsClass.asType.toType, Nil, ListMap())) - } // ===================================== /** @@ -608,4 +605,4 @@ private[async] trait TransformUtils { } case object ContainsAwait -case object NoAwait \ No newline at end of file +case object NoAwait diff --git a/src/test/scala/scala/async/run/uncheckedBounds/UncheckedBoundsSpec.scala b/src/test/scala/scala/async/run/uncheckedBounds/UncheckedBoundsSpec.scala index 5eb1f32..e728242 100644 --- a/src/test/scala/scala/async/run/uncheckedBounds/UncheckedBoundsSpec.scala +++ b/src/test/scala/scala/async/run/uncheckedBounds/UncheckedBoundsSpec.scala @@ -7,8 +7,7 @@ import scala.async.TreeInterrogation class UncheckedBoundsSpec { @Test def insufficientLub_SI_7694() { - suppressingFailureBefore2_10_3 { - eval( s""" + eval( s""" object Test { import _root_.scala.async.run.toughtype._ import _root_.scala.async.internal.AsyncId.{async, await} @@ -17,12 +16,10 @@ class UncheckedBoundsSpec { } } """, compileOptions = s"-cp ${toolboxClasspath} ") - } } @Test def insufficientLub_SI_7694_ScalaConcurrent() { - suppressingFailureBefore2_10_3 { - eval( s""" + eval( s""" object Test { import _root_.scala.async.run.toughtype._ import _root_.scala.async.Async.{async, await} @@ -33,25 +30,6 @@ class UncheckedBoundsSpec { } } """, compileOptions = s"-cp ${toolboxClasspath} ") - } } - private def suppressingFailureBefore2_10_3(body: => Any) { - try { - body - } catch { - case x: Throwable => - // @uncheckedBounds was only introduced in 2.10.3/ 2.11.0-M5, so avoid reporting this test failure in those cases. - scala.util.Properties.versionNumberString match { - case "2.10.0" | "2.10.1" | "2.10.2" | "2.11.0-M4" => // ignore, the @uncheckedBounds doesn't exist yet - case _ => - val annotationExists = - reflect.runtime.currentMirror.staticClass("scala.reflect.internal.annotations.uncheckedBounds") == reflect.runtime.universe.NoSymbol - if (annotationExists) - Assert.fail("@uncheckedBounds not found in scala-reflect.jar") - else - Assert.fail(s"@uncheckedBounds exists, but it didn't prevent this failure: $x") - } - } - } } -- cgit v1.2.3