From 3fa900ca0ea244ac54df75dc2fd6d711739eface Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Wed, 19 Sep 2012 15:04:50 +0200 Subject: SI-6363 removes scala.reflect.base As the experience has shown, there's no need for a separate layer of reflection in scala-library.jar. Therefore I'm putting an end to it. --- .../neg/macro-invalidret-nonuniversetree.check | 4 +- .../macro-invalidret-nonuniversetree/Impls_1.scala | 3 +- test/files/pos/typetags.scala | 26 ++++--- test/files/run/abstypetags_serialize.scala | 3 +- test/files/run/exprs_serialize.scala | 3 +- .../macro-expand-implicit-argument/Macros_1.scala | 2 +- .../files/run/macro-typecheck-macrosdisabled.check | 4 +- .../run/macro-typecheck-macrosdisabled2.check | 4 +- test/files/run/newTags.check | 4 +- test/files/run/newTags.scala | 9 +-- .../files/run/reflection-magicsymbols-invoke.check | 2 +- .../files/run/reflection-magicsymbols-invoke.scala | 2 +- .../run/toolbox_typecheck_macrosdisabled.check | 82 +++++++++++----------- .../run/toolbox_typecheck_macrosdisabled2.check | 82 +++++++++++----------- test/files/run/typetags_serialize.check | 2 +- test/files/run/typetags_serialize.scala | 3 +- .../implicits-known-type-classes-res.scala | 3 +- 17 files changed, 121 insertions(+), 117 deletions(-) (limited to 'test') diff --git a/test/files/neg/macro-invalidret-nonuniversetree.check b/test/files/neg/macro-invalidret-nonuniversetree.check index 09df2c0a92..b3a4d0da80 100644 --- a/test/files/neg/macro-invalidret-nonuniversetree.check +++ b/test/files/neg/macro-invalidret-nonuniversetree.check @@ -1,7 +1,7 @@ Macros_Test_2.scala:2: error: macro implementation has wrong shape: required: (c: scala.reflect.macros.Context): c.Expr[Any] - found : (c: scala.reflect.macros.Context): reflect.basis.Literal -type mismatch for return type: reflect.basis.Literal does not conform to c.Expr[Any] + found : (c: scala.reflect.macros.Context): reflect.runtime.universe.Literal +type mismatch for return type: reflect.runtime.universe.Literal does not conform to c.Expr[Any] def foo = macro Impls.foo ^ one error found diff --git a/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala b/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala index 8311d474c2..f98376a2ba 100644 --- a/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala +++ b/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala @@ -1,5 +1,6 @@ import scala.reflect.macros.{Context => Ctx} +import scala.reflect.runtime.{universe => ru} object Impls { - def foo(c: Ctx) = scala.reflect.basis.Literal(scala.reflect.basis.Constant(42)) + def foo(c: Ctx) = ru.Literal(ru.Constant(42)) } diff --git a/test/files/pos/typetags.scala b/test/files/pos/typetags.scala index 33390d7b89..239a9b32ec 100644 --- a/test/files/pos/typetags.scala +++ b/test/files/pos/typetags.scala @@ -1,12 +1,16 @@ -import scala.reflect.{basis => rb} -import scala.reflect.runtime.{universe => ru} +// TODO come up with a non-trivial universe different from ru +// an rewrite this test, so that it makes sure that cross-universe implicit searches work +// +// import scala.reflect.{basis => rb} +// import scala.reflect.runtime.{universe => ru} +// object Test { +// def main(args: Array[String]) { +// def foo(implicit t: rb.TypeTag[List[Int]]) { +// println(t) +// val t2: ru.TypeTag[_] = t in ru.rootMirror +// println(t2) +// } +// } +// } -object Test { - def main(args: Array[String]) { - def foo(implicit t: rb.TypeTag[List[Int]]) { - println(t) - val t2: ru.TypeTag[_] = t in ru.rootMirror - println(t2) - } - } -} +object Test extends App \ No newline at end of file diff --git a/test/files/run/abstypetags_serialize.scala b/test/files/run/abstypetags_serialize.scala index 38a7aba325..93fb5dcd06 100644 --- a/test/files/run/abstypetags_serialize.scala +++ b/test/files/run/abstypetags_serialize.scala @@ -1,5 +1,6 @@ import java.io._ import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{currentMirror => cm} object Test extends App { @@ -13,7 +14,7 @@ object Test extends App { val fin = new ByteArrayInputStream(fout.toByteArray) val in = new ObjectInputStream(fin) - val retag = in.readObject().asInstanceOf[scala.reflect.basis.WeakTypeTag[_]].in(cm) + val retag = in.readObject().asInstanceOf[ru.WeakTypeTag[_]].in(cm) in.close() fin.close() diff --git a/test/files/run/exprs_serialize.scala b/test/files/run/exprs_serialize.scala index 075c902a34..c4310b0fe1 100644 --- a/test/files/run/exprs_serialize.scala +++ b/test/files/run/exprs_serialize.scala @@ -1,5 +1,6 @@ import java.io._ import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{currentMirror => cm} object Test extends App { @@ -13,7 +14,7 @@ object Test extends App { val fin = new ByteArrayInputStream(fout.toByteArray) val in = new ObjectInputStream(fin) - val reexpr = in.readObject().asInstanceOf[scala.reflect.basis.Expr[_]].in(cm) + val reexpr = in.readObject().asInstanceOf[ru.Expr[_]].in(cm) in.close() fin.close() diff --git a/test/files/run/macro-expand-implicit-argument/Macros_1.scala b/test/files/run/macro-expand-implicit-argument/Macros_1.scala index 86c4198870..b1665256cd 100644 --- a/test/files/run/macro-expand-implicit-argument/Macros_1.scala +++ b/test/files/run/macro-expand-implicit-argument/Macros_1.scala @@ -4,7 +4,7 @@ import scala.{specialized => spec} import language.experimental.macros -import scala.reflect.{ClassTag, TypeTag} +import scala.reflect.ClassTag import scala.reflect.macros.Context object Macros { diff --git a/test/files/run/macro-typecheck-macrosdisabled.check b/test/files/run/macro-typecheck-macrosdisabled.check index c560b0e4b5..c88d33b48e 100644 --- a/test/files/run/macro-typecheck-macrosdisabled.check +++ b/test/files/run/macro-typecheck-macrosdisabled.check @@ -7,7 +7,7 @@ $treecreator1.super.(); () }; - def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { + def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[U]): U#Tree = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; $u.Literal.apply($u.Constant.apply(2)) @@ -20,7 +20,7 @@ $typecreator2.super.(); () }; - def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = { + def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[U]): U#Type = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; $u.ConstantType.apply($u.Constant.apply(2)) diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check index 55e7913250..469f41aa94 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2.check +++ b/test/files/run/macro-typecheck-macrosdisabled2.check @@ -7,7 +7,7 @@ $treecreator1.super.(); () }; - def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { + def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[U]): U#Tree = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) @@ -20,7 +20,7 @@ $typecreator2.super.(); () }; - def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = { + def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[U]): U#Type = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor)) diff --git a/test/files/run/newTags.check b/test/files/run/newTags.check index 2cbc265d7a..0c1bd95eb2 100644 --- a/test/files/run/newTags.check +++ b/test/files/run/newTags.check @@ -1,5 +1,3 @@ -TypeRef(SingleType(SingleType(SingleType(NoPrefix,class ),module scala),module package),class List,List(TypeRef(ThisType(class scala),class Int,List()))) List[Int] -TypeRef(SingleType(ThisType(class scala),module Predef),class Map,List(TypeRef(SingleType(ThisType(class scala),module Predef),class String,List()), TypeRef(SingleType(ThisType(class scala),module Predef),class String,List()))) Map[String,String] -TypeTag[TypeRef(SingleType(ThisType(class scala),module Predef),class Map,List(TypeRef(SingleType(ThisType(class scala),module Predef),class String,List()), TypeRef(SingleType(ThisType(class scala),module Predef),class String,List())))] +TypeTag[Map[String,String]] diff --git a/test/files/run/newTags.scala b/test/files/run/newTags.scala index a758599515..c5199d4e55 100644 --- a/test/files/run/newTags.scala +++ b/test/files/run/newTags.scala @@ -1,14 +1,11 @@ -import scala.reflect.base.{Universe => BaseUniverse} -import scala.reflect.{basis => rb} +import scala.reflect.api.{Universe => ApiUniverse} import scala.reflect.runtime.{universe => ru} object Test extends App { - println(rb.typeOf[List[Int]]) println(ru.typeOf[List[Int]]) - def foo[T: rb.TypeTag] = { - println(rb.typeOf[T]) + def foo[T: ru.TypeTag] = { println(ru.typeOf[T]) - println(implicitly[BaseUniverse#TypeTag[T]]) + println(implicitly[ApiUniverse#TypeTag[T]]) } foo[Map[String, String]] } \ No newline at end of file diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check index 674716adfe..bef492eb54 100644 --- a/test/files/run/reflection-magicsymbols-invoke.check +++ b/test/files/run/reflection-magicsymbols-invoke.check @@ -121,4 +121,4 @@ testing String.+: 23 CTM testing Predef.classOf: class scala.ScalaReflectionException: Predef.classOf is a compile-time function, it cannot be invoked with mirrors testing Predef.classOf: class scala.ScalaReflectionException: scala.Predef.classOf[T]: Class[T] takes 0 arguments -testing Universe.reify: class scala.ScalaReflectionException: scala.reflect.base.Universe.reify is a macro, i.e. a compile-time function, it cannot be invoked with mirrors +testing Universe.reify: class scala.ScalaReflectionException: scala.reflect.api.Universe.reify is a macro, i.e. a compile-time function, it cannot be invoked with mirrors diff --git a/test/files/run/reflection-magicsymbols-invoke.scala b/test/files/run/reflection-magicsymbols-invoke.scala index 61ecc6458d..b38d1be7b2 100644 --- a/test/files/run/reflection-magicsymbols-invoke.scala +++ b/test/files/run/reflection-magicsymbols-invoke.scala @@ -90,5 +90,5 @@ object Test extends App { println("============\nCTM") test(PredefModule.moduleClass.typeSignature, Predef, "classOf") test(PredefModule.moduleClass.typeSignature, Predef, "classOf", typeOf[String]) - test(typeOf[scala.reflect.base.Universe], scala.reflect.runtime.universe, "reify", "2") + test(typeOf[scala.reflect.api.Universe], scala.reflect.runtime.universe, "reify", "2") } \ No newline at end of file diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.check b/test/files/run/toolbox_typecheck_macrosdisabled.check index 4d253f31fc..49e25bd0e7 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled.check @@ -1,41 +1,41 @@ -{ - val $u: ru.type = ru; - val $m: $u.Mirror = ru.runtimeMirror({ - final class $anon extends scala.AnyRef { - def (): anonymous class $anon = { - $anon.super.(); - () - }; - () - }; - new $anon() -}.getClass().getClassLoader()); - $u.Expr.apply[Int(2)]($m, { - final class $treecreator1 extends TreeCreator { - def (): $treecreator1 = { - $treecreator1.super.(); - () - }; - def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { - val $u: U = $m$untyped.universe; - val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; - $u.Literal.apply($u.Constant.apply(2)) - } - }; - new $treecreator1() - })($u.TypeTag.apply[Int(2)]($m, { - final class $typecreator2 extends TypeCreator { - def (): $typecreator2 = { - $typecreator2.super.(); - () - }; - def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = { - val $u: U = $m$untyped.universe; - val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; - $u.ConstantType.apply($u.Constant.apply(2)) - } - }; - new $typecreator2() - })) -} -ru.reify[Int](2) +{ + val $u: ru.type = ru; + val $m: $u.Mirror = ru.runtimeMirror({ + final class $anon extends scala.AnyRef { + def (): anonymous class $anon = { + $anon.super.(); + () + }; + () + }; + new $anon() +}.getClass().getClassLoader()); + $u.Expr.apply[Int(2)]($m, { + final class $treecreator1 extends TreeCreator { + def (): $treecreator1 = { + $treecreator1.super.(); + () + }; + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[U]): U#Tree = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.Literal.apply($u.Constant.apply(2)) + } + }; + new $treecreator1() + })($u.TypeTag.apply[Int(2)]($m, { + final class $typecreator2 extends TypeCreator { + def (): $typecreator2 = { + $typecreator2.super.(); + () + }; + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.ConstantType.apply($u.Constant.apply(2)) + } + }; + new $typecreator2() + })) +} +ru.reify[Int](2) diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check index 149c3def12..8bbe65e21b 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check @@ -1,41 +1,41 @@ -{ - val $u: ru.type = ru; - val $m: $u.Mirror = ru.runtimeMirror({ - final class $anon extends scala.AnyRef { - def (): anonymous class $anon = { - $anon.super.(); - () - }; - () - }; - new $anon() -}.getClass().getClassLoader()); - $u.Expr.apply[Array[Int]]($m, { - final class $treecreator1 extends TreeCreator { - def (): $treecreator1 = { - $treecreator1.super.(); - () - }; - def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { - val $u: U = $m$untyped.universe; - val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; - $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) - } - }; - new $treecreator1() - })($u.TypeTag.apply[Array[Int]]($m, { - final class $typecreator2 extends TypeCreator { - def (): $typecreator2 = { - $typecreator2.super.(); - () - }; - def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = { - val $u: U = $m$untyped.universe; - val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; - $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor)) - } - }; - new $typecreator2() - })) -} -ru.reify[Array[Int]](scala.Array.apply(2)) +{ + val $u: ru.type = ru; + val $m: $u.Mirror = ru.runtimeMirror({ + final class $anon extends scala.AnyRef { + def (): anonymous class $anon = { + $anon.super.(); + () + }; + () + }; + new $anon() +}.getClass().getClassLoader()); + $u.Expr.apply[Array[Int]]($m, { + final class $treecreator1 extends TreeCreator { + def (): $treecreator1 = { + $treecreator1.super.(); + () + }; + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[U]): U#Tree = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) + } + }; + new $treecreator1() + })($u.TypeTag.apply[Array[Int]]($m, { + final class $typecreator2 extends TypeCreator { + def (): $typecreator2 = { + $typecreator2.super.(); + () + }; + def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.MirrorOf[U]): U#Type = { + val $u: U = $m$untyped.universe; + val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; + $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModule.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asType.toTypeConstructor)) + } + }; + new $typecreator2() + })) +} +ru.reify[Array[Int]](scala.Array.apply(2)) diff --git a/test/files/run/typetags_serialize.check b/test/files/run/typetags_serialize.check index 1b898250fb..30952113f6 100644 --- a/test/files/run/typetags_serialize.check +++ b/test/files/run/typetags_serialize.check @@ -1,2 +1,2 @@ -java.io.NotSerializableException: scala.reflect.base.TypeTags$PredefTypeCreator +java.io.NotSerializableException: scala.reflect.api.TypeTags$PredefTypeCreator java.io.NotSerializableException: Test$$typecreator1$1 diff --git a/test/files/run/typetags_serialize.scala b/test/files/run/typetags_serialize.scala index 3917b69a93..3c842e6cc9 100644 --- a/test/files/run/typetags_serialize.scala +++ b/test/files/run/typetags_serialize.scala @@ -1,5 +1,6 @@ import java.io._ import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{currentMirror => cm} object Test extends App { @@ -13,7 +14,7 @@ object Test extends App { val fin = new ByteArrayInputStream(fout.toByteArray) val in = new ObjectInputStream(fin) - val retag = in.readObject().asInstanceOf[scala.reflect.basis.TypeTag[_]].in(cm) + val retag = in.readObject().asInstanceOf[ru.TypeTag[_]].in(cm) in.close() fin.close() diff --git a/test/scaladoc/resources/implicits-known-type-classes-res.scala b/test/scaladoc/resources/implicits-known-type-classes-res.scala index 9ad652947d..77c91aafce 100644 --- a/test/scaladoc/resources/implicits-known-type-classes-res.scala +++ b/test/scaladoc/resources/implicits-known-type-classes-res.scala @@ -6,7 +6,8 @@ package scala.test.scaladoc.implicits.typeclasses { class A[T] object A { import language.implicitConversions - import scala.reflect.{ClassTag, TypeTag} + import scala.reflect.ClassTag + import scala.reflect.runtime.universe.TypeTag implicit def convertNumeric [T: Numeric] (a: A[T]) = new B(implicitly[Numeric[T]]) implicit def convertIntegral [T: Integral] (a: A[T]) = new B(implicitly[Integral[T]]) implicit def convertFractional [T: Fractional] (a: A[T]) = new B(implicitly[Fractional[T]]) -- cgit v1.2.3