diff options
813 files changed, 8995 insertions, 2528 deletions
@@ -220,6 +220,8 @@ PROPERTIES <property name="build-strap.dir" value="${build.dir}/strap"/> <property name="build-docs.dir" value="${build.dir}/scaladoc"/> <property name="build-libs.dir" value="${build.dir}/libs"/> + <property name="build-sbt.dir" value="${build.dir}/sbt-interface"/> + <property name="dists.dir" value="${basedir}/dists"/> @@ -2050,6 +2052,74 @@ LIBRARIES (Forkjoin, FJBG, ASM) </target> <!-- =========================================================================== +SBT Compiler Interface +============================================================================ --> + + <target name="sbt.start" depends="init"> + <!-- TODO - Put this in init? Allow this to be overriden simply --> + <property name="sbt.latest.version" value="0.12.0"/> + + + <property name="sbt.src.dir" value="${build-sbt.dir}/${sbt.latest.version}/src"/> + <property name="sbt.lib.dir" value="${build-sbt.dir}/${sbt.latest.version}/lib"/> + + + + <property name="sbt.interface.jar" value="${sbt.lib.dir}/interface.jar"/> + <property name="sbt.interface.url" value="http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/interface/${sbt.latest.version}/jars/interface.jar"/> + <property name="sbt.interface.src.jar" value="${sbt.src.dir}/compiler-interface-src.jar"/> + <property name="sbt.interface.src.url" value="http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/${sbt.latest.version}/jars/compiler-interface-src.jar"/> + + <!-- Ensure directories exist --> + <mkdir dir="${sbt.src.dir}"/> + <mkdir dir="${sbt.lib.dir}"/> + + <condition property="sbt.available"> + <and> + <available file="${sbt.interface.jar}"/> + <available file="${sbt.interface.src.jar}"/> + </and> + </condition> + + </target> + + <target name="sbt.libs" depends="sbt.start" unless="sbt.available"> + <get src="${sbt.interface.url}" dest="${sbt.interface.jar}"/> + <get src="${sbt.interface.src.url}" dest="${sbt.interface.src.jar}"/> + <!-- Explode sources --> + <unzip src="${sbt.interface.src.jar}" dest="${sbt.src.dir}"/> + </target> + + <target name="sbt.compile" depends="sbt.libs,quick.done"> + <stopwatch name="quick.sbt-interface.timer"/> + <mkdir dir="${build-sbt.dir}/classes"/> + <scalacfork + destdir="${build-sbt.dir}/classes" + compilerpathref="quick.classpath" + params="${scalac.args.quick}" + srcdir="${sbt.src.dir}" + jvmargs="${scalacfork.jvmargs}"> + <include name="**/*.scala"/> + <compilationpath> + <pathelement location="${build-quick.dir}/classes/library"/> + <pathelement location="${build-quick.dir}/classes/reflect"/> + <pathelement location="${build-quick.dir}/classes/compiler"/> + <pathelement location="${sbt.interface.jar}"/> + <path refid="forkjoin.classpath"/> + </compilationpath> + </scalacfork> + <touch file="${build-sbt.dir}/sbt-interface.complete" verbose="no"/> + <stopwatch name="quick.sbt-interface.timer" action="total"/> + </target> + + <target name="sbt.done" depends="sbt.compile"> + </target> + + <target name="sbt.clean" depends="init"> + <delete dir="${build-sbt.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/> + </target> + +<!-- =========================================================================== DOCUMENTATION ============================================================================ --> @@ -2372,6 +2442,10 @@ BOOTRAPING TEST AND TEST SUITE </target> <!-- this target will run only those tests found in test/debug --> + <target name="test.sbt" depends="sbt.done"> + </target> + + <!-- this target will run only those tests found in test/debug --> <target name="test.debug"> <antcall target="test.suite"> <param name="partest.srcdir" value="debug" /> @@ -2470,7 +2544,7 @@ BOOTRAPING TEST AND TEST SUITE </partest> </target> - <target name="test.done" depends="test.suite, test.continuations.suite, test.scaladoc, test.stability"/> + <target name="test.done" depends="test.suite, test.continuations.suite, test.scaladoc, test.stability, test.sbt"/> <!-- =========================================================================== DISTRIBUTION @@ -2586,7 +2660,7 @@ TEST AND DISTRIBUTION BUNDLE (ALL) <target name="all.done" depends="dist.done, test.done"/> - <target name="all.clean" depends="locker.clean, docs.clean, dist.clean"/> + <target name="all.clean" depends="locker.clean, docs.clean, dist.clean, sbt.clean"/> <!-- =========================================================================== STABLE REFERENCE (STARR) diff --git a/lib/scala-compiler-src.jar.desired.sha1 b/lib/scala-compiler-src.jar.desired.sha1 index 6840b60528..95973402e6 100644 --- a/lib/scala-compiler-src.jar.desired.sha1 +++ b/lib/scala-compiler-src.jar.desired.sha1 @@ -1 +1 @@ -6a03de33fb670e1b1a9930234adb6d1d6435323d ?scala-compiler-src.jar +67257bb7ce010e2ceac800d737e202cfbfc2a1f6 ?scala-compiler-src.jar diff --git a/lib/scala-compiler.jar.desired.sha1 b/lib/scala-compiler.jar.desired.sha1 index 393820f481..7f023e00be 100644 --- a/lib/scala-compiler.jar.desired.sha1 +++ b/lib/scala-compiler.jar.desired.sha1 @@ -1 +1 @@ -cf6aab754bcf77ab433e2b05d1f452e13f24cedc ?scala-compiler.jar +c52277de9e76187f34a5ae073e5d2aacc592ac50 ?scala-compiler.jar diff --git a/lib/scala-library-src.jar.desired.sha1 b/lib/scala-library-src.jar.desired.sha1 index cefff7eec9..f2d287f120 100644 --- a/lib/scala-library-src.jar.desired.sha1 +++ b/lib/scala-library-src.jar.desired.sha1 @@ -1 +1 @@ -02dcd8656f99eabbad8d9dce06a33d4f6f8d7c38 ?scala-library-src.jar +40b9c97e0c3abea4c460b73ca178f60a3bfea242 ?scala-library-src.jar diff --git a/lib/scala-library.jar.desired.sha1 b/lib/scala-library.jar.desired.sha1 index f7f2321177..99a06c2024 100644 --- a/lib/scala-library.jar.desired.sha1 +++ b/lib/scala-library.jar.desired.sha1 @@ -1 +1 @@ -6a035e798a94c6ca051e6a7663293cfee3d7136f ?scala-library.jar +0a8e0e39e1e6713323a2e659aab743ccfa57c071 ?scala-library.jar diff --git a/lib/scala-reflect-src.jar.desired.sha1 b/lib/scala-reflect-src.jar.desired.sha1 index fb09e9d585..1752dec7f6 100644 --- a/lib/scala-reflect-src.jar.desired.sha1 +++ b/lib/scala-reflect-src.jar.desired.sha1 @@ -1 +1 @@ -ecb9dd737935812a6399a3426e9126908ef870b2 ?scala-reflect-src.jar +d1abf389fbf5dfc95889a181d28f94a6779c6165 ?scala-reflect-src.jar diff --git a/lib/scala-reflect.jar.desired.sha1 b/lib/scala-reflect.jar.desired.sha1 index dc5b7abd0e..4cc99695e0 100644 --- a/lib/scala-reflect.jar.desired.sha1 +++ b/lib/scala-reflect.jar.desired.sha1 @@ -1 +1 @@ -344f3feafa4bd155b13ba7a6ab3efd605f8f8388 ?scala-reflect.jar +02b44e860b9b9abd1353bbaa1004b3f0004dd0b3 ?scala-reflect.jar diff --git a/src/build/genprod.scala b/src/build/genprod.scala index 8c91128de0..83a65e6876 100644 --- a/src/build/genprod.scala +++ b/src/build/genprod.scala @@ -6,6 +6,8 @@ ** |/ ** \* */ +import language.postfixOps + /** This program generates the ProductN, TupleN, FunctionN, * and AbstractFunctionN, where 0 <= N <= MAX_ARITY. * @@ -75,7 +77,7 @@ package %s if (args.length != 1) { println("please give path of output directory") - exit(-1) + sys.exit(-1) } val out = args(0) def writeFile(node: scala.xml.Node) { @@ -96,7 +98,7 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz */ object FunctionZero extends Function(0) { override def genprodString = "\n// genprod generated these sources at: " + new java.util.Date() - override def covariantSpecs = "@specialized " + override def covariantSpecs = "@specialized(Specializable.Primitives) " override def descriptiveComment = " " + functionNTemplate.format("javaVersion", "anonfun0", """ * val javaVersion = () => sys.props("java.version") @@ -111,8 +113,8 @@ object FunctionZero extends Function(0) { object FunctionOne extends Function(1) { override def classAnnotation = "@annotation.implicitNotFound(msg = \"No implicit view available from ${T1} => ${R}.\")\n" - override def contravariantSpecs = "@specialized(scala.Int, scala.Long, scala.Float, scala.Double, scala.AnyRef) " - override def covariantSpecs = "@specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double, scala.AnyRef) " + override def contravariantSpecs = "@specialized(scala.Int, scala.Long, scala.Float, scala.Double/*, scala.AnyRef*/) " + override def covariantSpecs = "@specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double/*, scala.AnyRef*/) " override def descriptiveComment = " " + functionNTemplate.format("succ", "anonfun1", """ @@ -169,7 +171,7 @@ object Function { class Function(val i: Int) extends Group("Function") with Arity { def descriptiveComment = "" - def functionNTemplate = + def functionNTemplate = """ * In the following example, the definition of %s is a * shorthand for the anonymous class definition %s: @@ -226,7 +228,7 @@ class Function(val i: Int) extends Group("Function") with Arity { } def tupleMethod = { - def comment = + def comment = """ /** Creates a tupled version of this function: instead of %d arguments, * it accepts a single [[scala.Tuple%d]] argument. * @@ -275,7 +277,7 @@ object TupleOne extends Tuple(1) object TupleTwo extends Tuple(2) { override def imports = Tuple.zipImports - override def covariantSpecs = "@specialized(Int, Long, Double, Char, Boolean, AnyRef) " + override def covariantSpecs = "@specialized(Int, Long, Double, Char, Boolean/*, AnyRef*/) " override def moreMethods = """ /** Swaps the elements of this `Tuple`. * @return a new Tuple where the first element is the second element of this Tuple and the diff --git a/src/compiler/scala/reflect/makro/runtime/AbortMacroException.scala b/src/compiler/scala/reflect/macros/runtime/AbortMacroException.scala index a68910859d..f45dde8a85 100644 --- a/src/compiler/scala/reflect/makro/runtime/AbortMacroException.scala +++ b/src/compiler/scala/reflect/macros/runtime/AbortMacroException.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime import scala.reflect.internal.util.Position diff --git a/src/compiler/scala/reflect/makro/runtime/Aliases.scala b/src/compiler/scala/reflect/macros/runtime/Aliases.scala index 760f7fc54d..8b742755cd 100644 --- a/src/compiler/scala/reflect/makro/runtime/Aliases.scala +++ b/src/compiler/scala/reflect/macros/runtime/Aliases.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime trait Aliases { diff --git a/src/compiler/scala/reflect/makro/runtime/CapturedVariables.scala b/src/compiler/scala/reflect/macros/runtime/CapturedVariables.scala index 021b93ceee..78fb7100b0 100644 --- a/src/compiler/scala/reflect/makro/runtime/CapturedVariables.scala +++ b/src/compiler/scala/reflect/macros/runtime/CapturedVariables.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime trait CapturedVariables { diff --git a/src/compiler/scala/reflect/makro/runtime/Context.scala b/src/compiler/scala/reflect/macros/runtime/Context.scala index 68964b7abb..8bbfef44a3 100644 --- a/src/compiler/scala/reflect/makro/runtime/Context.scala +++ b/src/compiler/scala/reflect/macros/runtime/Context.scala @@ -1,9 +1,9 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime import scala.tools.nsc.Global -abstract class Context extends scala.reflect.makro.Context +abstract class Context extends scala.reflect.macros.Context with Aliases with CapturedVariables with Infrastructure diff --git a/src/compiler/scala/reflect/makro/runtime/Enclosures.scala b/src/compiler/scala/reflect/macros/runtime/Enclosures.scala index 360a4b8e8a..ebde4447d7 100644 --- a/src/compiler/scala/reflect/makro/runtime/Enclosures.scala +++ b/src/compiler/scala/reflect/macros/runtime/Enclosures.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime trait Enclosures { diff --git a/src/compiler/scala/reflect/makro/runtime/Evals.scala b/src/compiler/scala/reflect/macros/runtime/Evals.scala index 0574359a19..348e29cdd7 100644 --- a/src/compiler/scala/reflect/makro/runtime/Evals.scala +++ b/src/compiler/scala/reflect/macros/runtime/Evals.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime import scala.reflect.runtime.{universe => ru} diff --git a/src/compiler/scala/reflect/makro/runtime/ExprUtils.scala b/src/compiler/scala/reflect/macros/runtime/ExprUtils.scala index e301dfc2a4..672699f00e 100644 --- a/src/compiler/scala/reflect/makro/runtime/ExprUtils.scala +++ b/src/compiler/scala/reflect/macros/runtime/ExprUtils.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime trait ExprUtils { @@ -29,7 +29,7 @@ trait ExprUtils { def literal(x: Double) = Expr[Double](Literal(Constant(x)))(TypeTag.Double) - def literal(x: String) = Expr[String](Literal(Constant(x)))(TypeTag[String](definitions.StringClass.asTypeConstructor)) + def literal(x: String) = Expr[String](Literal(Constant(x)))(TypeTag[String](definitions.StringClass.toTypeConstructor)) def literal(x: Char) = Expr[Char](Literal(Constant(x)))(TypeTag.Char) } diff --git a/src/compiler/scala/reflect/makro/runtime/Exprs.scala b/src/compiler/scala/reflect/macros/runtime/Exprs.scala index b680b56bab..4217a6a404 100644 --- a/src/compiler/scala/reflect/makro/runtime/Exprs.scala +++ b/src/compiler/scala/reflect/macros/runtime/Exprs.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime trait Exprs { diff --git a/src/compiler/scala/reflect/makro/runtime/FrontEnds.scala b/src/compiler/scala/reflect/macros/runtime/FrontEnds.scala index 6644c579ac..69fa416f8f 100644 --- a/src/compiler/scala/reflect/makro/runtime/FrontEnds.scala +++ b/src/compiler/scala/reflect/macros/runtime/FrontEnds.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime trait FrontEnds extends scala.tools.reflect.FrontEnds { diff --git a/src/compiler/scala/reflect/makro/runtime/Infrastructure.scala b/src/compiler/scala/reflect/macros/runtime/Infrastructure.scala index 76c4b21731..19fb03364e 100644 --- a/src/compiler/scala/reflect/makro/runtime/Infrastructure.scala +++ b/src/compiler/scala/reflect/macros/runtime/Infrastructure.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime import scala.tools.nsc.util.ScalaClassLoader diff --git a/src/compiler/scala/reflect/makro/runtime/Names.scala b/src/compiler/scala/reflect/macros/runtime/Names.scala index 3f43b15d90..ee9f3a56d3 100644 --- a/src/compiler/scala/reflect/makro/runtime/Names.scala +++ b/src/compiler/scala/reflect/macros/runtime/Names.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime trait Names { diff --git a/src/compiler/scala/reflect/makro/runtime/Parsers.scala b/src/compiler/scala/reflect/macros/runtime/Parsers.scala index ac8d09f592..6d89b71f39 100644 --- a/src/compiler/scala/reflect/makro/runtime/Parsers.scala +++ b/src/compiler/scala/reflect/macros/runtime/Parsers.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime import language.existentials diff --git a/src/compiler/scala/reflect/makro/runtime/Reifiers.scala b/src/compiler/scala/reflect/macros/runtime/Reifiers.scala index 10b5ae5f42..ab1de4288b 100644 --- a/src/compiler/scala/reflect/makro/runtime/Reifiers.scala +++ b/src/compiler/scala/reflect/macros/runtime/Reifiers.scala @@ -1,9 +1,9 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Gilles Dubochet */ -package scala.reflect.makro +package scala.reflect.macros package runtime trait Reifiers { diff --git a/src/compiler/scala/reflect/makro/runtime/Settings.scala b/src/compiler/scala/reflect/macros/runtime/Settings.scala index 8288180b8d..9c24273cd7 100644 --- a/src/compiler/scala/reflect/makro/runtime/Settings.scala +++ b/src/compiler/scala/reflect/macros/runtime/Settings.scala @@ -1,13 +1,13 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime trait Settings { self: Context => def settings: List[String] = { - val optionName = universe.settings.XmacroSettings.name - val settings = compilerSettings.find(opt => opt.startsWith(optionName)).map(opt => opt.substring(optionName.length + 1)).getOrElse("") - settings.split(",").toList + val us = universe.settings + import us._ + userSetSettings collectFirst { case x: MultiStringSetting if x.name == XmacroSettings.name => x.value } getOrElse Nil } def compilerSettings: List[String] = universe.settings.recreateArgs @@ -33,4 +33,4 @@ trait Settings { try op finally setCompilerSettings(old) } -}
\ No newline at end of file +} diff --git a/src/compiler/scala/reflect/makro/runtime/Traces.scala b/src/compiler/scala/reflect/macros/runtime/Traces.scala index 225ee1f62b..0238e9f84e 100644 --- a/src/compiler/scala/reflect/makro/runtime/Traces.scala +++ b/src/compiler/scala/reflect/macros/runtime/Traces.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime trait Traces extends util.Traces { diff --git a/src/compiler/scala/reflect/makro/runtime/TypeTags.scala b/src/compiler/scala/reflect/macros/runtime/TypeTags.scala index 4f9b287674..2bc2fe6384 100644 --- a/src/compiler/scala/reflect/makro/runtime/TypeTags.scala +++ b/src/compiler/scala/reflect/macros/runtime/TypeTags.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime trait TypeTags { diff --git a/src/compiler/scala/reflect/makro/runtime/Typers.scala b/src/compiler/scala/reflect/macros/runtime/Typers.scala index e43b0459ea..9fa8567ada 100644 --- a/src/compiler/scala/reflect/makro/runtime/Typers.scala +++ b/src/compiler/scala/reflect/macros/runtime/Typers.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package runtime trait Typers { @@ -37,7 +37,7 @@ trait Typers { def inferImplicitView(tree: Tree, from: Type, to: Type, silent: Boolean = true, withMacrosDisabled: Boolean = false, pos: Position = enclosingPosition): Tree = { macroLogVerbose("inferring implicit view from %s to %s for %s, macros = %s".format(from, to, tree, !withMacrosDisabled)) - val viewTpe = universe.appliedType(universe.definitions.FunctionClass(1).asTypeConstructor, List(from, to)) + val viewTpe = universe.appliedType(universe.definitions.FunctionClass(1).toTypeConstructor, List(from, to)) inferImplicit(tree, viewTpe, isView = true, silent = silent, withMacrosDisabled = withMacrosDisabled, pos = pos) } diff --git a/src/compiler/scala/reflect/makro/util/Traces.scala b/src/compiler/scala/reflect/macros/util/Traces.scala index 2363cc4bac..6c2f115994 100644 --- a/src/compiler/scala/reflect/makro/util/Traces.scala +++ b/src/compiler/scala/reflect/macros/util/Traces.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package util trait Traces { diff --git a/src/compiler/scala/reflect/reify/Errors.scala b/src/compiler/scala/reflect/reify/Errors.scala index 1b72b3075b..5e15c5ad3a 100644 --- a/src/compiler/scala/reflect/reify/Errors.scala +++ b/src/compiler/scala/reflect/reify/Errors.scala @@ -1,7 +1,7 @@ package scala.reflect.reify -import scala.reflect.makro.ReificationError -import scala.reflect.makro.UnexpectedReificationError +import scala.reflect.macros.ReificationError +import scala.reflect.macros.UnexpectedReificationError trait Errors { self: Reifier => diff --git a/src/compiler/scala/reflect/reify/Reifier.scala b/src/compiler/scala/reflect/reify/Reifier.scala index 8fba7274be..53e01309cb 100644 --- a/src/compiler/scala/reflect/reify/Reifier.scala +++ b/src/compiler/scala/reflect/reify/Reifier.scala @@ -1,8 +1,8 @@ package scala.reflect.reify import scala.tools.nsc.Global -import scala.reflect.makro.ReificationError -import scala.reflect.makro.UnexpectedReificationError +import scala.reflect.macros.ReificationError +import scala.reflect.macros.UnexpectedReificationError import scala.reflect.reify.utils.Utils /** Given a tree or a type, generate a tree that when executed at runtime produces the original tree or type. @@ -115,7 +115,7 @@ abstract class Reifier extends States // todo. maybe try `resetLocalAttrs` once the dust settles var importantSymbols = Set[Symbol]( NothingClass, AnyClass, SingletonClass, PredefModule, ScalaRunTimeModule, TypeCreatorClass, TreeCreatorClass, MirrorOfClass, - BaseUniverseClass, ApiUniverseClass, JavaUniverseClass, ReflectRuntimePackage, ReflectRuntimeCurrentMirror) + BaseUniverseClass, JavaUniverseClass, ReflectRuntimePackage, ReflectRuntimeCurrentMirror) importantSymbols ++= importantSymbols map (_.companionSymbol) importantSymbols ++= importantSymbols map (_.moduleClass) importantSymbols ++= importantSymbols map (_.linkedClassOfClass) diff --git a/src/compiler/scala/reflect/reify/Taggers.scala b/src/compiler/scala/reflect/reify/Taggers.scala index 4e30d0acf8..a8523fe686 100644 --- a/src/compiler/scala/reflect/reify/Taggers.scala +++ b/src/compiler/scala/reflect/reify/Taggers.scala @@ -1,7 +1,7 @@ package scala.reflect.reify -import scala.reflect.makro.{ReificationError, UnexpectedReificationError} -import scala.reflect.makro.runtime.Context +import scala.reflect.macros.{ReificationError, UnexpectedReificationError} +import scala.reflect.macros.runtime.Context abstract class Taggers { val c: Context diff --git a/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala b/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala index 38c8fedac5..59651bcdf9 100644 --- a/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala +++ b/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala @@ -36,7 +36,7 @@ trait GenSymbols { else if (sym.isEmptyPackageClass) mirrorMirrorSelect(nme.EmptyPackageClass) else if (sym.isModuleClass) - Select(Select(reify(sym.sourceModule), nme.asModuleSymbol), nme.moduleClass) + Select(Select(reify(sym.sourceModule), nme.asModule), nme.moduleClass) else if (sym.isPackage) mirrorMirrorCall(nme.staticPackage, reify(sym.fullName)) else if (sym.isLocatable) { diff --git a/src/compiler/scala/reflect/reify/codegen/GenTypes.scala b/src/compiler/scala/reflect/reify/codegen/GenTypes.scala index c49e5b3342..c762a28f99 100644 --- a/src/compiler/scala/reflect/reify/codegen/GenTypes.scala +++ b/src/compiler/scala/reflect/reify/codegen/GenTypes.scala @@ -30,7 +30,7 @@ trait GenTypes { val tsym = tpe.typeSymbolDirect if (tsym.isClass && tpe == tsym.typeConstructor && tsym.isStatic) - Select(Select(reify(tsym), nme.asTypeSymbol), nme.asTypeConstructor) + Select(Select(reify(tsym), nme.asType), nme.toTypeConstructor) else tpe match { case tpe @ NoType => reifyMirrorObject(tpe) @@ -42,7 +42,7 @@ trait GenTypes { mirrorBuildCall(nme.thisPrefix, mirrorMirrorSelect(nme.EmptyPackageClass)) case tpe @ ThisType(clazz) if clazz.isModuleClass && clazz.isStatic => val module = reify(clazz.sourceModule) - val moduleClass = Select(Select(module, nme.asModuleSymbol), nme.moduleClass) + val moduleClass = Select(Select(module, nme.asModule), nme.moduleClass) mirrorFactoryCall(nme.ThisType, moduleClass) case tpe @ ThisType(_) => reifyProduct(tpe) @@ -94,7 +94,7 @@ trait GenTypes { } case success => if (reifyDebug) println("implicit search has produced a result: " + success) - state.reificationIsConcrete &= concrete || success.tpe <:< TypeTagClass.asTypeConstructor + state.reificationIsConcrete &= concrete || success.tpe <:< TypeTagClass.toTypeConstructor Select(Apply(Select(success, nme.in), List(Ident(nme.MIRROR_SHORT))), nme.tpe) } if (result != EmptyTree) return result @@ -109,7 +109,7 @@ trait GenTypes { def searchForManifest(typer: analyzer.Typer): Tree = analyzer.inferImplicit( EmptyTree, - appliedType(FullManifestClass.asTypeConstructor, List(tpe)), + appliedType(FullManifestClass.toTypeConstructor, List(tpe)), reportAmbiguous = false, isView = false, context = typer.context, diff --git a/src/compiler/scala/reflect/reify/package.scala b/src/compiler/scala/reflect/reify/package.scala index 80011368a8..a253effc1c 100644 --- a/src/compiler/scala/reflect/reify/package.scala +++ b/src/compiler/scala/reflect/reify/package.scala @@ -1,9 +1,8 @@ package scala.reflect import language.implicitConversions -import language.experimental.macros import scala.reflect.base.{Universe => BaseUniverse} -import scala.reflect.makro.{Context, ReificationError, UnexpectedReificationError} +import scala.reflect.macros.{Context, ReificationError, UnexpectedReificationError} import scala.tools.nsc.Global package object reify { @@ -29,7 +28,7 @@ package object reify { import definitions._ val enclosingErasure = reifyEnclosingRuntimeClass(global)(typer0) // JavaUniverse is defined in scala-reflect.jar, so we must be very careful in case someone reifies stuff having only scala-library.jar on the classpath - val isJavaUniverse = JavaUniverseClass != NoSymbol && universe.tpe <:< JavaUniverseClass.asTypeConstructor + val isJavaUniverse = JavaUniverseClass != NoSymbol && universe.tpe <:< JavaUniverseClass.toTypeConstructor if (isJavaUniverse && !enclosingErasure.isEmpty) Apply(Select(universe, nme.runtimeMirror), List(Select(enclosingErasure, sn.GetClassLoader))) else Select(universe, nme.rootMirror) } @@ -69,7 +68,7 @@ package object reify { if (isThisInScope) { val enclosingClasses = typer0.context.enclosingContextChain map (_.tree) collect { case classDef: ClassDef => classDef } val classInScope = enclosingClasses.headOption getOrElse EmptyTree - if (!classInScope.isEmpty) reifyRuntimeClass(global)(typer0, classInScope.symbol.asTypeConstructor, concrete = true) + if (!classInScope.isEmpty) reifyRuntimeClass(global)(typer0, classInScope.symbol.toTypeConstructor, concrete = true) else Select(This(tpnme.EMPTY), sn.GetClass) } else EmptyTree } diff --git a/src/compiler/scala/reflect/reify/utils/Extractors.scala b/src/compiler/scala/reflect/reify/utils/Extractors.scala index 86265ec77a..ebe3957e69 100644 --- a/src/compiler/scala/reflect/reify/utils/Extractors.scala +++ b/src/compiler/scala/reflect/reify/utils/Extractors.scala @@ -20,11 +20,6 @@ trait Extractors { // () // }; // def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = { - // val $u: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe]; - // val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; - // applyImpl($m).asInstanceOf[U#Tree]; - // } - // def applyImpl[U >: Nothing <: scala.reflect.api.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($u.Select($u.Select($u.build.This($m.staticPackage("scala.collection.immutable").moduleClass), $u.newTermName("List")), $u.newTermName("apply")), List($u.Literal($u.Constant(1)), $u.Literal($u.Constant(2)))) @@ -40,7 +35,7 @@ trait Extractors { // def apply[U >: Nothing <: 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($u.ThisType($m.staticPackage("scala.collection.immutable").moduleClass), $m.staticClass("scala.collection.immutable.List"), List($m.staticClass("scala.Int").asTypeConstructor)) + // $u.TypeRef($u.ThisType($m.staticPackage("scala.collection.immutable").moduleClass), $m.staticClass("scala.collection.immutable.List"), List($m.staticClass("scala.Int").toTypeConstructor)) // } // }; // new $typecreator1() @@ -51,23 +46,7 @@ trait Extractors { val tparamu = newTypeName("U") val (reifierBase, reifierName, reifierTpt, reifierUniverse) = flavor match { case tpnme.REIFY_TYPECREATOR_PREFIX => (TypeCreatorClass, nme.apply, SelectFromTypeTree(Ident(tparamu), tpnme.Type), BaseUniverseClass) - case tpnme.REIFY_TREECREATOR_PREFIX => (TreeCreatorClass, nme.applyImpl, SelectFromTypeTree(Ident(BaseUniverseClass), tpnme.Tree), ApiUniverseClass) - case _ => throw new Error(s"unexpected flavor $flavor") - } - val reifierPreamble = flavor match { - case tpnme.REIFY_TYPECREATOR_PREFIX => Nil - case tpnme.REIFY_TREECREATOR_PREFIX => List[Tree]( - DefDef(NoMods, - nme.apply, - List(TypeDef(Modifiers(PARAM), tparamu, List(), TypeBoundsTree(Ident(NothingClass), CompoundTypeTree(Template(List(Ident(BaseUniverseClass), Ident(SingletonClass)), emptyValDef, List()))))), - List(List(ValDef(Modifiers(PARAM), nme.MIRROR_UNTYPED, AppliedTypeTree(Ident(MirrorOfClass), List(Ident(tparamu))), EmptyTree))), - SelectFromTypeTree(Ident(tparamu), tpnme.Tree), - Block( - ValDef(NoMods, nme.UNIVERSE_SHORT, Ident(ApiUniverseClass), TypeApply(Select(Select(Ident(nme.MIRROR_UNTYPED), nme.universe), nme.asInstanceOf_), List(Ident(ApiUniverseClass)))), - ValDef(NoMods, nme.MIRROR_SHORT, Select(Ident(nme.UNIVERSE_SHORT), tpnme.Mirror), TypeApply(Select(Ident(nme.MIRROR_UNTYPED), nme.asInstanceOf_), List(Select(Ident(nme.UNIVERSE_SHORT), tpnme.Mirror)))), - TypeApply(Select(Apply(TypeApply(Ident(reifierName), List(SingletonTypeTree(Ident(nme.UNIVERSE_SHORT)))), List(Ident(nme.MIRROR_SHORT))), nme.asInstanceOf_), List(SelectFromTypeTree(Ident(tparamu), tpnme.Tree))) - )) - ) + case tpnme.REIFY_TREECREATOR_PREFIX => (TreeCreatorClass, nme.apply, SelectFromTypeTree(Ident(tparamu), tpnme.Tree), BaseUniverseClass) case _ => throw new Error(s"unexpected flavor $flavor") } val reifierBody = { @@ -98,8 +77,7 @@ trait Extractors { Template(List(Ident(reifierBase)), emptyValDef, List( - DefDef(NoMods, nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))) - ) ++ reifierPreamble ++ List( + DefDef(NoMods, nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))), DefDef(NoMods, reifierName, List(TypeDef(Modifiers(PARAM), tparamu, List(), TypeBoundsTree(Ident(NothingClass), CompoundTypeTree(Template(List(Ident(reifierUniverse), Ident(SingletonClass)), emptyValDef, List()))))), @@ -128,7 +106,7 @@ trait Extractors { case Block( List(udef @ ValDef(_, _, _, universe), mdef @ ValDef(_, _, _, mirror)), Apply( - Apply(TypeApply(_, List(ttpe @ TypeTree())), List(_, Block(List(ClassDef(_, _, _, Template(_, _, List(_, _, DefDef(_, _, _, _, _, Block(_ :: _ :: symbolTable1, rtree)))))), _))), + Apply(TypeApply(_, List(ttpe @ TypeTree())), List(_, Block(List(ClassDef(_, _, _, Template(_, _, List(_, DefDef(_, _, _, _, _, Block(_ :: _ :: symbolTable1, rtree)))))), _))), // todo. doesn't take into account optimizations such as $u.TypeTag.Int or the upcoming closure optimization List(Apply(TypeApply(tagFactory @ Select(_, _), _), List(_, Block(List(ClassDef(_, _, _, Template(_, _, List(_, DefDef(_, _, _, _, _, Block(_ :: _ :: symbolTable2, rtpe)))))), _)))))) if udef.name == nme.UNIVERSE_SHORT && mdef.name == nme.MIRROR_SHORT => diff --git a/src/compiler/scala/reflect/reify/utils/NodePrinters.scala b/src/compiler/scala/reflect/reify/utils/NodePrinters.scala index 6394e1eac2..420f55c0e0 100644 --- a/src/compiler/scala/reflect/reify/utils/NodePrinters.scala +++ b/src/compiler/scala/reflect/reify/utils/NodePrinters.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.reflect.reify diff --git a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl index 256b5088e9..4f0646c6fb 100644 --- a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl +++ b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl @@ -1,7 +1,7 @@ #!/usr/bin/env bash # ############################################################################## -# Copyright 2002-2011, LAMP/EPFL +# Copyright 2002-2012 LAMP/EPFL # # This is free software; see the distribution for copying conditions. # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A diff --git a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl index 5949689b24..3c0d1d77ca 100644 --- a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl +++ b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl @@ -1,7 +1,7 @@ @@echo off
rem ##########################################################################
-rem # Copyright 2002-2011, LAMP/EPFL
+rem # Copyright 2002-2012 LAMP/EPFL
rem #
rem # This is free software; see the distribution for copying conditions.
rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
diff --git a/src/compiler/scala/tools/cmd/CommandLine.scala b/src/compiler/scala/tools/cmd/CommandLine.scala index ced3a97380..1359274748 100644 --- a/src/compiler/scala/tools/cmd/CommandLine.scala +++ b/src/compiler/scala/tools/cmd/CommandLine.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/Demo.scala b/src/compiler/scala/tools/cmd/Demo.scala index 61d63eb246..439c21e4a0 100644 --- a/src/compiler/scala/tools/cmd/Demo.scala +++ b/src/compiler/scala/tools/cmd/Demo.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/FromString.scala b/src/compiler/scala/tools/cmd/FromString.scala index d473796f39..d4b828fd0a 100644 --- a/src/compiler/scala/tools/cmd/FromString.scala +++ b/src/compiler/scala/tools/cmd/FromString.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/Instance.scala b/src/compiler/scala/tools/cmd/Instance.scala index c22294aed5..966211805e 100644 --- a/src/compiler/scala/tools/cmd/Instance.scala +++ b/src/compiler/scala/tools/cmd/Instance.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/Interpolation.scala b/src/compiler/scala/tools/cmd/Interpolation.scala index f08ebe0e1a..e9cf37761a 100644 --- a/src/compiler/scala/tools/cmd/Interpolation.scala +++ b/src/compiler/scala/tools/cmd/Interpolation.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/Meta.scala b/src/compiler/scala/tools/cmd/Meta.scala index d06586e25c..98d5e1f953 100644 --- a/src/compiler/scala/tools/cmd/Meta.scala +++ b/src/compiler/scala/tools/cmd/Meta.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/Opt.scala b/src/compiler/scala/tools/cmd/Opt.scala index 3c494134db..b5633f6e03 100644 --- a/src/compiler/scala/tools/cmd/Opt.scala +++ b/src/compiler/scala/tools/cmd/Opt.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/Parser.scala b/src/compiler/scala/tools/cmd/Parser.scala index 46204c172a..9e7c9b7805 100644 --- a/src/compiler/scala/tools/cmd/Parser.scala +++ b/src/compiler/scala/tools/cmd/Parser.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/Property.scala b/src/compiler/scala/tools/cmd/Property.scala index 8df8c66d72..aae5bebcc8 100644 --- a/src/compiler/scala/tools/cmd/Property.scala +++ b/src/compiler/scala/tools/cmd/Property.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/Reference.scala b/src/compiler/scala/tools/cmd/Reference.scala index 204ca22b69..77fe01051e 100644 --- a/src/compiler/scala/tools/cmd/Reference.scala +++ b/src/compiler/scala/tools/cmd/Reference.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/Spec.scala b/src/compiler/scala/tools/cmd/Spec.scala index 929f52673a..d503cb7cb7 100644 --- a/src/compiler/scala/tools/cmd/Spec.scala +++ b/src/compiler/scala/tools/cmd/Spec.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/gen/AnyVals.scala b/src/compiler/scala/tools/cmd/gen/AnyVals.scala index 9d0795b2f6..7842603af7 100644 --- a/src/compiler/scala/tools/cmd/gen/AnyVals.scala +++ b/src/compiler/scala/tools/cmd/gen/AnyVals.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/gen/Codegen.scala b/src/compiler/scala/tools/cmd/gen/Codegen.scala index 59b58563d1..b94c640f1c 100644 --- a/src/compiler/scala/tools/cmd/gen/Codegen.scala +++ b/src/compiler/scala/tools/cmd/gen/Codegen.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/gen/CodegenSpec.scala b/src/compiler/scala/tools/cmd/gen/CodegenSpec.scala index 7f4b9c1bb0..cca1627a69 100644 --- a/src/compiler/scala/tools/cmd/gen/CodegenSpec.scala +++ b/src/compiler/scala/tools/cmd/gen/CodegenSpec.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/cmd/package.scala b/src/compiler/scala/tools/cmd/package.scala index 8e74e6169e..5be98a460a 100644 --- a/src/compiler/scala/tools/cmd/package.scala +++ b/src/compiler/scala/tools/cmd/package.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/CompilationUnits.scala b/src/compiler/scala/tools/nsc/CompilationUnits.scala index 54b114bf82..6d3fd2e09e 100644 --- a/src/compiler/scala/tools/nsc/CompilationUnits.scala +++ b/src/compiler/scala/tools/nsc/CompilationUnits.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/CompileClient.scala b/src/compiler/scala/tools/nsc/CompileClient.scala index dc65bf780e..af6d2b1536 100644 --- a/src/compiler/scala/tools/nsc/CompileClient.scala +++ b/src/compiler/scala/tools/nsc/CompileClient.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala index fb278db2bf..d26828650f 100644 --- a/src/compiler/scala/tools/nsc/CompileServer.scala +++ b/src/compiler/scala/tools/nsc/CompileServer.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala index 7d2abd42fd..2dd17025ad 100644 --- a/src/compiler/scala/tools/nsc/CompileSocket.scala +++ b/src/compiler/scala/tools/nsc/CompileSocket.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/CompilerCommand.scala b/src/compiler/scala/tools/nsc/CompilerCommand.scala index 4c8a27083a..eb8a93f33d 100644 --- a/src/compiler/scala/tools/nsc/CompilerCommand.scala +++ b/src/compiler/scala/tools/nsc/CompilerCommand.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/CompilerRun.scala b/src/compiler/scala/tools/nsc/CompilerRun.scala index e6428235e2..278ccdd5a5 100644 --- a/src/compiler/scala/tools/nsc/CompilerRun.scala +++ b/src/compiler/scala/tools/nsc/CompilerRun.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/ConsoleWriter.scala b/src/compiler/scala/tools/nsc/ConsoleWriter.scala index c06db8f0b8..0d25fa9306 100644 --- a/src/compiler/scala/tools/nsc/ConsoleWriter.scala +++ b/src/compiler/scala/tools/nsc/ConsoleWriter.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2006-2011 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/EvalLoop.scala b/src/compiler/scala/tools/nsc/EvalLoop.scala index 5cbd79839a..da03419d8a 100644 --- a/src/compiler/scala/tools/nsc/EvalLoop.scala +++ b/src/compiler/scala/tools/nsc/EvalLoop.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala b/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala index 836d22192c..c953824bf7 100644 --- a/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala +++ b/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Lex Spoon */ diff --git a/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala b/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala index f91cb854c6..b2f27d1925 100644 --- a/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala +++ b/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2006-2011 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL * @author Lex Spoon */ diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 83335c4f62..2b0f082051 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/Main.scala b/src/compiler/scala/tools/nsc/Main.scala index 8b7e76e994..3f9d91a23f 100644 --- a/src/compiler/scala/tools/nsc/Main.scala +++ b/src/compiler/scala/tools/nsc/Main.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/MainBench.scala b/src/compiler/scala/tools/nsc/MainBench.scala index 0037de7b94..48465ba316 100644 --- a/src/compiler/scala/tools/nsc/MainBench.scala +++ b/src/compiler/scala/tools/nsc/MainBench.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/MainGenericRunner.scala b/src/compiler/scala/tools/nsc/MainGenericRunner.scala index cc1139f8a7..bb8a1d11a6 100644 --- a/src/compiler/scala/tools/nsc/MainGenericRunner.scala +++ b/src/compiler/scala/tools/nsc/MainGenericRunner.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2006-2011 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL * @author Lex Spoon */ @@ -58,6 +58,10 @@ class MainGenericRunner { def isI = !settings.loadfiles.isDefault def dashi = settings.loadfiles.value + // Deadlocks on startup under -i unless we disable async. + if (isI) + settings.Yreplsync.value = true + def combinedCode = { val files = if (isI) dashi map (file => File(file).slurp()) else Nil val str = if (isE) List(dashe) else Nil diff --git a/src/compiler/scala/tools/nsc/MainTokenMetric.scala b/src/compiler/scala/tools/nsc/MainTokenMetric.scala index 5373638f5b..11d5f4209e 100644 --- a/src/compiler/scala/tools/nsc/MainTokenMetric.scala +++ b/src/compiler/scala/tools/nsc/MainTokenMetric.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/NewLinePrintWriter.scala b/src/compiler/scala/tools/nsc/NewLinePrintWriter.scala index 94df5020c2..6517637620 100644 --- a/src/compiler/scala/tools/nsc/NewLinePrintWriter.scala +++ b/src/compiler/scala/tools/nsc/NewLinePrintWriter.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/ObjectRunner.scala b/src/compiler/scala/tools/nsc/ObjectRunner.scala index 24ae0089a2..3401431ba9 100644 --- a/src/compiler/scala/tools/nsc/ObjectRunner.scala +++ b/src/compiler/scala/tools/nsc/ObjectRunner.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Lex Spoon */ diff --git a/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala b/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala index 6d6b99e53e..282de02aba 100644 --- a/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala +++ b/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/PhaseAssembly.scala b/src/compiler/scala/tools/nsc/PhaseAssembly.scala index a9e029e485..e69382be21 100644 --- a/src/compiler/scala/tools/nsc/PhaseAssembly.scala +++ b/src/compiler/scala/tools/nsc/PhaseAssembly.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Anders Bach Nielsen * @version 1.0 */ diff --git a/src/compiler/scala/tools/nsc/Phases.scala b/src/compiler/scala/tools/nsc/Phases.scala index 896fcb3ca1..d2274b108b 100644 --- a/src/compiler/scala/tools/nsc/Phases.scala +++ b/src/compiler/scala/tools/nsc/Phases.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/Properties.scala b/src/compiler/scala/tools/nsc/Properties.scala index c83ccfeef1..701d0c8ac4 100644 --- a/src/compiler/scala/tools/nsc/Properties.scala +++ b/src/compiler/scala/tools/nsc/Properties.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2006-2011 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL * @author Stephane Micheloud */ diff --git a/src/compiler/scala/tools/nsc/ScalaDoc.scala b/src/compiler/scala/tools/nsc/ScalaDoc.scala index c6fdb4b891..ea37307ff3 100644 --- a/src/compiler/scala/tools/nsc/ScalaDoc.scala +++ b/src/compiler/scala/tools/nsc/ScalaDoc.scala @@ -1,5 +1,5 @@ /* scaladoc, a documentation generator for Scala - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky * @author Geoffrey Washburn */ diff --git a/src/compiler/scala/tools/nsc/ScriptRunner.scala b/src/compiler/scala/tools/nsc/ScriptRunner.scala index 14c508548a..d64396bec7 100644 --- a/src/compiler/scala/tools/nsc/ScriptRunner.scala +++ b/src/compiler/scala/tools/nsc/ScriptRunner.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala index d57d5546fa..7c062a57bb 100644 --- a/src/compiler/scala/tools/nsc/Settings.scala +++ b/src/compiler/scala/tools/nsc/Settings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/SubComponent.scala b/src/compiler/scala/tools/nsc/SubComponent.scala index a3e451f32f..fc3316fb7f 100644 --- a/src/compiler/scala/tools/nsc/SubComponent.scala +++ b/src/compiler/scala/tools/nsc/SubComponent.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala index d0d0b4b5f4..8526920cd7 100755 --- a/src/compiler/scala/tools/nsc/ast/DocComments.scala +++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/ast/NodePrinters.scala b/src/compiler/scala/tools/nsc/ast/NodePrinters.scala index 4afd3545b9..1fdf4c631e 100644 --- a/src/compiler/scala/tools/nsc/ast/NodePrinters.scala +++ b/src/compiler/scala/tools/nsc/ast/NodePrinters.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/ast/Printers.scala b/src/compiler/scala/tools/nsc/ast/Printers.scala index 94d0c4f45e..8b92f0acd6 100644 --- a/src/compiler/scala/tools/nsc/ast/Printers.scala +++ b/src/compiler/scala/tools/nsc/ast/Printers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala index e02d605965..043834ae55 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala index 91935854f4..2ee38d4b91 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala index be5909a67f..ca8a377c6f 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -72,8 +72,6 @@ abstract class TreeGen extends reflect.internal.TreeGen with TreeDSL { Annotated(Ident(nme.synthSwitch), expr) } - def hasSynthCaseSymbol(t: Tree) = (t.symbol ne null) && (t.symbol hasFlag (CASE | SYNTHETIC)) - // TODO: would be so much nicer if we would know during match-translation (i.e., type checking) // whether we should emit missingCase-style apply (and isDefinedAt), instead of transforming trees post-factum class MatchMatcher { @@ -94,13 +92,13 @@ abstract class TreeGen extends reflect.internal.TreeGen with TreeDSL { case Apply(Apply(TypeApply(Select(tgt, nme.runOrElse), targs), List(scrut)), List(matcher)) if opt.virtPatmat => // println("virt match: "+ (tgt, targs, scrut, matcher) + "for:\n"+ matchExpr ) caseVirtualizedMatch(matchExpr, tgt, targs, scrut, matcher) // optimized version of virtpatmat - case Block(stats, matchEndDef) if opt.virtPatmat && (stats forall hasSynthCaseSymbol) => + case Block(stats, matchEndDef) if opt.virtPatmat && (stats forall treeInfo.hasSynthCaseSymbol) => // the assumption is once we encounter a case, the remainder of the block will consist of cases // the prologue may be empty, usually it is the valdef that stores the scrut val (prologue, cases) = stats span (s => !s.isInstanceOf[LabelDef]) caseVirtualizedMatchOpt(matchExpr, prologue, cases, matchEndDef, identity) // optimized version of virtpatmat - case Block(outerStats, orig@Block(stats, matchEndDef)) if opt.virtPatmat && (stats forall hasSynthCaseSymbol) => + case Block(outerStats, orig@Block(stats, matchEndDef)) if opt.virtPatmat && (stats forall treeInfo.hasSynthCaseSymbol) => val (prologue, cases) = stats span (s => !s.isInstanceOf[LabelDef]) caseVirtualizedMatchOpt(matchExpr, prologue, cases, matchEndDef, m => copyBlock(matchExpr, outerStats, m)) case other => diff --git a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala index 569cb4977b..e755553e25 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala index 9a6d32be01..381b834a0c 100644 --- a/src/compiler/scala/tools/nsc/ast/Trees.scala +++ b/src/compiler/scala/tools/nsc/ast/Trees.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/ast/parser/BracePair.scala b/src/compiler/scala/tools/nsc/ast/parser/BracePair.scala index 9ec51c3758..a079763aa2 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/BracePair.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/BracePair.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/ast/parser/BracePatch.scala b/src/compiler/scala/tools/nsc/ast/parser/BracePatch.scala index 73c8a94a99..28df4ab7ef 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/BracePatch.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/BracePatch.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/ast/parser/Change.scala b/src/compiler/scala/tools/nsc/ast/parser/Change.scala index 9b8ed0dfd5..d5eec5c676 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Change.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Change.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc.ast.parser diff --git a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala index 12b39d9e9c..991ee39258 100755 --- a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Burak Emir */ diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index cde971085d..391874c488 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/ast/parser/Patch.scala b/src/compiler/scala/tools/nsc/ast/parser/Patch.scala index cee8be2716..9880ca9148 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Patch.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Patch.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc.ast.parser diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala index 7ccd6785bb..f99b9a66c9 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala index a4b45482de..5afec611e9 100755 --- a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Burak Emir */ diff --git a/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala b/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala index e310611e68..2ea34ff532 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/ast/parser/Tokens.scala b/src/compiler/scala/tools/nsc/ast/parser/Tokens.scala index a4a062609b..7e7972f9dd 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Tokens.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Tokens.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala index 90f9d538c1..ab856f09b8 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/JavaPlatform.scala b/src/compiler/scala/tools/nsc/backend/JavaPlatform.scala index 80b0f640a4..ef020175c4 100644 --- a/src/compiler/scala/tools/nsc/backend/JavaPlatform.scala +++ b/src/compiler/scala/tools/nsc/backend/JavaPlatform.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/backend/MSILPlatform.scala b/src/compiler/scala/tools/nsc/backend/MSILPlatform.scala index f4176c46b8..90b6df635e 100644 --- a/src/compiler/scala/tools/nsc/backend/MSILPlatform.scala +++ b/src/compiler/scala/tools/nsc/backend/MSILPlatform.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/backend/Platform.scala b/src/compiler/scala/tools/nsc/backend/Platform.scala index f770713093..bff4b54446 100644 --- a/src/compiler/scala/tools/nsc/backend/Platform.scala +++ b/src/compiler/scala/tools/nsc/backend/Platform.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala index aab944f65a..5e3ba5d355 100644 --- a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala +++ b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala b/src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala index d6fab2eb63..c6d9f8713a 100644 --- a/src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala +++ b/src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala index 86533c713e..3f0cef6703 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/CheckerException.scala b/src/compiler/scala/tools/nsc/backend/icode/CheckerException.scala index 0a7a155970..feb1939827 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/CheckerException.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/CheckerException.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala index ffc6640743..62b25ad069 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index c46b650949..a480429026 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala index 8f7fdab64c..0d688d51f2 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala index 631b71d83a..81fd285cdb 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala @@ -1,9 +1,9 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala index f71c8de449..1c5c9224f2 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala index 00f4a9d262..8f475a4198 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -170,6 +170,7 @@ trait Members { var sourceFile: SourceFile = NoSourceFile var returnType: TypeKind = _ var recursive: Boolean = false + var bytecodeHasEHs = false // set by ICodeReader only, used by Inliner to prevent inlining (SI-6188) /** local variables and method parameters */ var locals: List[Local] = Nil diff --git a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala index 13457bfe58..4311fe9df5 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala b/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala index 72220184d2..3e4b453fd8 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/Printers.scala b/src/compiler/scala/tools/nsc/backend/icode/Printers.scala index d34d93f147..bcffb23b40 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Printers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Printers.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/Repository.scala b/src/compiler/scala/tools/nsc/backend/icode/Repository.scala index 663b626bef..4e06b96d2a 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Repository.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Repository.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala index 1ec2cf017a..0cacce10f9 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala index 8a2ec9a191..041c597b0c 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala index 4427da92c8..d1d8e4a385 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala index 9f43e1b84c..74745fe6fc 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala index 5f261ba05e..38d4cd414f 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/LubException.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/LubException.scala index ec0553209f..8a9104044f 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/LubException.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/LubException.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/ProgramPoint.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/ProgramPoint.scala index a8c69eb71a..19e6b16283 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/ProgramPoint.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/ProgramPoint.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala index 69de0dfa90..6f9302c97b 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/SemiLattice.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/SemiLattice.scala index cfce0878ed..8a1b411451 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/SemiLattice.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/SemiLattice.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala index 962c47f443..6bd3ac5791 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -736,7 +736,13 @@ abstract class TypeFlowAnalysis { val succs = point.successors filter relevantBBs succs foreach { p => assert((p.predecessors filter isOnPerimeter).isEmpty) - val updated = lattice.lub(List(output, in(p)), p.exceptionHandlerStart) + val existing = in(p) + // TODO move the following assertion to typeFlowLattice.lub2 for wider applicability (ie MethodTFA in addition to MTFAGrowable). + assert(existing == lattice.bottom || + p.exceptionHandlerStart || + (output.stack.length == existing.stack.length), + "Trying to merge non-bottom type-stacks with different stack heights. For a possible cause see SI-6157.") + val updated = lattice.lub(List(output, existing), p.exceptionHandlerStart) if(updated != in(p)) { in(p) = updated enqueue(p) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala b/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala index ff68aba845..485864d8e3 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index f681de93b6..194ceca504 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -932,7 +932,6 @@ abstract class GenASM extends SubComponent with BytecodeWriters { ca } - // TODO this method isn't exercised during bootstrapping. Open question: is it bug free? private def arrEncode(sb: ScalaSigBytes): Array[String] = { var strs: List[String] = Nil val bSeven: Array[Byte] = sb.sevenBitsMayBeZero @@ -941,14 +940,15 @@ abstract class GenASM extends SubComponent with BytecodeWriters { var offset = 0 var encLength = 0 while(offset < bSeven.size) { - val newEncLength = encLength.toLong + (if(bSeven(offset) == 0) 2 else 1) - if(newEncLength > 65535) { + val deltaEncLength = (if(bSeven(offset) == 0) 2 else 1) + val newEncLength = encLength.toLong + deltaEncLength + if(newEncLength >= 65535) { val ba = bSeven.slice(prevOffset, offset) strs ::= new java.lang.String(ubytesToCharArray(ba)) encLength = 0 prevOffset = offset } else { - encLength += 1 + encLength += deltaEncLength offset += 1 } } @@ -1173,6 +1173,8 @@ abstract class GenASM extends SubComponent with BytecodeWriters { debuglog("No forwarder for '%s' from %s to '%s'".format(m, jclassName, moduleClass)) else if (conflictingNames(m.name)) log("No forwarder for " + m + " due to conflict with " + linkedClass.info.member(m.name)) + else if (m.hasAccessBoundary) + log(s"No forwarder for non-public member $m") else { log("Adding static forwarder for '%s' from %s to '%s'".format(m, jclassName, moduleClass)) if (m.isAccessor && m.accessed.hasStaticAnnotation) { @@ -2565,6 +2567,19 @@ abstract class GenASM extends SubComponent with BytecodeWriters { case JUMP(whereto) => if (nextBlock != whereto) { jcode goTo labels(whereto) + } else if(m.exh.exists(eh => eh.covers(b))) { + // SI-6102: Determine whether eliding this JUMP results in an empty range being covered by some EH. + // If so, emit a NOP in place of the elided JUMP, to avoid "java.lang.ClassFormatError: Illegal exception table range" + val isSthgLeft = b.toList.exists { + case _: LOAD_EXCEPTION => false + case _: SCOPE_ENTER => false + case _: SCOPE_EXIT => false + case _: JUMP => false + case _ => true + } + if(!isSthgLeft) { + emit(asm.Opcodes.NOP) + } } case CJUMP(success, failure, cond, kind) => diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenAndroid.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenAndroid.scala index e3da5c486b..78bab15724 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenAndroid.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenAndroid.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud */ diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 0ae2adac84..bad4ecc647 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Iulian Dragos */ diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVMUtil.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVMUtil.scala index 807a3dd0bb..edcdd8f434 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVMUtil.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVMUtil.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Iulian Dragos */ diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala index d23571b517..465a0c61e8 100644 --- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala +++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Nikolay Mihaylov */ diff --git a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala index ff45bb8fd1..7772ccbdd5 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Iulian Dragos */ diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala index 5cc6e78e9d..fd949576e1 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Iulian Dragos */ diff --git a/src/compiler/scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala b/src/compiler/scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala index 0d47352215..f1f597322e 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala index cce18d436f..d87a242f1b 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Iulian Dragos */ @@ -247,7 +247,7 @@ abstract class Inliners extends SubComponent { debuglog("Analyzing " + cls) this.currentIClazz = cls - val ms = cls.methods filterNot { _.symbol.isConstructor } sorted imethodOrdering + val ms = cls.methods sorted imethodOrdering ms foreach { im => if(hasInline(im.symbol)) { log("Not inlining into " + im.symbol.originalName.decode + " because it is marked @inline.") @@ -405,6 +405,12 @@ abstract class Inliners extends SubComponent { val inc = new IMethodInfo(callee) val pair = new CallerCalleeInfo(caller, inc, fresh, inlinedMethodCount) + if(inc.hasHandlers && (stackLength == -1)) { + // no inlining is done, yet don't warn about it, stackLength == -1 indicates we're trying to inlineWithoutTFA. + // Shortly, a TFA will be computed and an error message reported if indeed inlining not possible. + return false + } + (pair isStampedForInlining stackLength) match { case inlInfo if inlInfo.isSafe => @@ -605,7 +611,7 @@ abstract class Inliners extends SubComponent { def isSmall = (length <= SMALL_METHOD_SIZE) && blocks(0).length < 10 def isLarge = length > MAX_INLINE_SIZE def isRecursive = m.recursive - def hasHandlers = handlers.nonEmpty + def hasHandlers = handlers.nonEmpty || m.bytecodeHasEHs def isSynchronized = sym.hasFlag(Flags.SYNCHRONIZED) def hasNonFinalizerHandler = handlers exists { @@ -941,6 +947,7 @@ abstract class Inliners extends SubComponent { if(inc.isRecursive) { rs ::= "is recursive" } if(isInlineForbidden) { rs ::= "is annotated @noinline" } if(inc.isSynchronized) { rs ::= "is synchronized method" } + if(inc.m.bytecodeHasEHs) { rs ::= "bytecode contains exception handlers / finally clause" } // SI-6188 if(rs.isEmpty) null else rs.mkString("", ", and ", "") } @@ -974,6 +981,10 @@ abstract class Inliners extends SubComponent { return DontInlineHere("too low score (heuristics)") } + if(inc.hasHandlers && (stackLength > inc.minimumStack)) { + return DontInlineHere("callee contains exception handlers / finally clause, and is invoked with non-empty operand stack") // SI-6157 + } + if(isKnownToInlineSafely) { return InlineableAtThisCaller } if(stackLength > inc.minimumStack && inc.hasNonFinalizerHandler) { diff --git a/src/compiler/scala/tools/nsc/doc/DocFactory.scala b/src/compiler/scala/tools/nsc/doc/DocFactory.scala index 27a03d5381..cd0c242f22 100644 --- a/src/compiler/scala/tools/nsc/doc/DocFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/DocFactory.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author David Bernard, Manohar Jonnalagedda */ diff --git a/src/compiler/scala/tools/nsc/doc/DocParser.scala b/src/compiler/scala/tools/nsc/doc/DocParser.scala index 119a2c06e9..4726f1cc2c 100644 --- a/src/compiler/scala/tools/nsc/doc/DocParser.scala +++ b/src/compiler/scala/tools/nsc/doc/DocParser.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/doc/Index.scala b/src/compiler/scala/tools/nsc/doc/Index.scala index b0ca23fea6..7b0bdac2d1 100644 --- a/src/compiler/scala/tools/nsc/doc/Index.scala +++ b/src/compiler/scala/tools/nsc/doc/Index.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/doc/Settings.scala b/src/compiler/scala/tools/nsc/doc/Settings.scala index ad178b8158..720b1347ef 100644 --- a/src/compiler/scala/tools/nsc/doc/Settings.scala +++ b/src/compiler/scala/tools/nsc/doc/Settings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/doc/Uncompilable.scala b/src/compiler/scala/tools/nsc/doc/Uncompilable.scala index fef753b12c..7e57f9fd9f 100644 --- a/src/compiler/scala/tools/nsc/doc/Uncompilable.scala +++ b/src/compiler/scala/tools/nsc/doc/Uncompilable.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/doc/Universe.scala b/src/compiler/scala/tools/nsc/doc/Universe.scala index fe0ef71680..0a91301500 100644 --- a/src/compiler/scala/tools/nsc/doc/Universe.scala +++ b/src/compiler/scala/tools/nsc/doc/Universe.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/doc/html/Doclet.scala b/src/compiler/scala/tools/nsc/doc/html/Doclet.scala index 5b722b5dd1..c18cc521f3 100644 --- a/src/compiler/scala/tools/nsc/doc/html/Doclet.scala +++ b/src/compiler/scala/tools/nsc/doc/html/Doclet.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author David Bernard, Manohar Jonnalagedda */ diff --git a/src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala b/src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala index 436425df83..845de1a23c 100644 --- a/src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author David Bernard, Manohar Jonnalagedda */ diff --git a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala index aa2df57967..7a74c569f3 100644 --- a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala +++ b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author David Bernard, Manohar Jonnalagedda */ diff --git a/src/compiler/scala/tools/nsc/doc/html/Page.scala b/src/compiler/scala/tools/nsc/doc/html/Page.scala index d30ca5dc08..baeb9e40ed 100644 --- a/src/compiler/scala/tools/nsc/doc/html/Page.scala +++ b/src/compiler/scala/tools/nsc/doc/html/Page.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author David Bernard, Manohar Jonnalagedda */ diff --git a/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala b/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala index 629ac84b34..f1eab841f9 100644 --- a/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala +++ b/src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2010-2011 LAMP/EPFL + * Copyright 2010-2012 LAMP/EPFL * @author Stephane Micheloud */ diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Index.scala b/src/compiler/scala/tools/nsc/doc/html/page/Index.scala index b15d602b57..21c5dc1c25 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/Index.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/Index.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author David Bernard, Manohar Jonnalagedda */ diff --git a/src/compiler/scala/tools/nsc/doc/html/page/IndexScript.scala b/src/compiler/scala/tools/nsc/doc/html/page/IndexScript.scala index a37dd3fb8b..3a45b9fbcd 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/IndexScript.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/IndexScript.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author David Bernard, Manohar Jonnalagedda */ diff --git a/src/compiler/scala/tools/nsc/doc/html/page/ReferenceIndex.scala b/src/compiler/scala/tools/nsc/doc/html/page/ReferenceIndex.scala index effaee711d..6d83b4e6a5 100755 --- a/src/compiler/scala/tools/nsc/doc/html/page/ReferenceIndex.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/ReferenceIndex.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Pedro Furlanetto */ diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Source.scala b/src/compiler/scala/tools/nsc/doc/html/page/Source.scala index 7914daa9d5..a51d66c6cc 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/Source.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/Source.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author David Bernard, Manohar Jonnalagedda */ diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala index 422ea5ef1c..5977acc0c2 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author David Bernard, Manohar Jonnalagedda */ @@ -264,7 +264,7 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp { if (Set("epfl", "EPFL").contains(tpl.universe.settings.docfooter.value)) - <div id="footer">Scala programming documentation. Copyright (c) 2003-2011 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> + <div id="footer">Scala programming documentation. Copyright (c) 2003-2012 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> else <div id="footer"> { tpl.universe.settings.docfooter.value } </div> } diff --git a/src/compiler/scala/tools/nsc/doc/model/Entity.scala b/src/compiler/scala/tools/nsc/doc/model/Entity.scala index 16ade0787e..46b2a11d4a 100644 --- a/src/compiler/scala/tools/nsc/doc/model/Entity.scala +++ b/src/compiler/scala/tools/nsc/doc/model/Entity.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Manohar Jonnalagedda * @author Gilles Dubochet */ diff --git a/src/compiler/scala/tools/nsc/doc/model/IndexModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/IndexModelFactory.scala index 9d141efe0a..6ad3ddf438 100755 --- a/src/compiler/scala/tools/nsc/doc/model/IndexModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/IndexModelFactory.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Pedro Furlanetto */ diff --git a/src/compiler/scala/tools/nsc/doc/model/LinkTo.scala b/src/compiler/scala/tools/nsc/doc/model/LinkTo.scala index b76dee0f14..664567872e 100644 --- a/src/compiler/scala/tools/nsc/doc/model/LinkTo.scala +++ b/src/compiler/scala/tools/nsc/doc/model/LinkTo.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala index 00e6f3769e..a962ec4007 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala @@ -1,4 +1,4 @@ -/* NSC -- new Scala compiler -- Copyright 2007-2011 LAMP/EPFL */ +/* NSC -- new Scala compiler -- Copyright 2007-2012 LAMP/EPFL */ package scala.tools.nsc package doc @@ -380,7 +380,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { if (settings.docImplicits.value) makeImplicitConversions(sym, this) else Nil // members as given by the compiler - lazy val memberSyms = sym.info.members.filter(s => membersShouldDocument(s, this)) + lazy val memberSyms = sym.info.members.filter(s => membersShouldDocument(s, this)).toList // the inherited templates (classes, traits or objects) var memberSymsLazy = memberSyms.filter(t => templateShouldDocument(t, this) && !inOriginalOwner(t, this)) @@ -712,7 +712,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { override def inheritedFrom = Nil override def isRootPackage = true override lazy val memberSyms = - (bSym.info.members ++ EmptyPackage.info.members) filter { s => + (bSym.info.members ++ EmptyPackage.info.members).toList filter { s => s != EmptyPackage && s != RootPackage } }) diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala index a12b67c9ed..5a0cc602e5 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala @@ -386,7 +386,7 @@ trait ModelFactoryImplicitSupport { lazy val memberImpls: List[MemberImpl] = { // Obtain the members inherited by the implicit conversion - val memberSyms = toType.members.filter(implicitShouldDocument(_)) + val memberSyms = toType.members.filter(implicitShouldDocument(_)).toList val existingSyms = sym.info.members // Debugging part :) diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala index d2a26d1309..6c80c85efe 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala @@ -1,4 +1,4 @@ -/* NSC -- new Scala compiler -- Copyright 2007-2011 LAMP/EPFL */ +/* NSC -- new Scala compiler -- Copyright 2007-2012 LAMP/EPFL */ package scala.tools.nsc package doc diff --git a/src/compiler/scala/tools/nsc/doc/model/TreeEntity.scala b/src/compiler/scala/tools/nsc/doc/model/TreeEntity.scala index 23a4e17a9a..e12afebbf8 100644 --- a/src/compiler/scala/tools/nsc/doc/model/TreeEntity.scala +++ b/src/compiler/scala/tools/nsc/doc/model/TreeEntity.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Chris James */ diff --git a/src/compiler/scala/tools/nsc/doc/model/TypeEntity.scala b/src/compiler/scala/tools/nsc/doc/model/TypeEntity.scala index 643067cca5..9b23971395 100644 --- a/src/compiler/scala/tools/nsc/doc/model/TypeEntity.scala +++ b/src/compiler/scala/tools/nsc/doc/model/TypeEntity.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Manohar Jonnalagedda */ diff --git a/src/compiler/scala/tools/nsc/doc/model/ValueArgument.scala b/src/compiler/scala/tools/nsc/doc/model/ValueArgument.scala index 781ff113fb..8f26114fbd 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ValueArgument.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ValueArgument.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Gilles Dubochet */ diff --git a/src/compiler/scala/tools/nsc/doc/model/Visibility.scala b/src/compiler/scala/tools/nsc/doc/model/Visibility.scala index 657d34ee54..ffd69ca115 100644 --- a/src/compiler/scala/tools/nsc/doc/model/Visibility.scala +++ b/src/compiler/scala/tools/nsc/doc/model/Visibility.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Gilles Dubochet */ diff --git a/src/compiler/scala/tools/nsc/doc/model/comment/Body.scala b/src/compiler/scala/tools/nsc/doc/model/comment/Body.scala index 3f0024cb68..34928ab398 100644 --- a/src/compiler/scala/tools/nsc/doc/model/comment/Body.scala +++ b/src/compiler/scala/tools/nsc/doc/model/comment/Body.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Manohar Jonnalagedda */ diff --git a/src/compiler/scala/tools/nsc/doc/model/comment/Comment.scala b/src/compiler/scala/tools/nsc/doc/model/comment/Comment.scala index c8f4c2f285..87d73f8c5b 100644 --- a/src/compiler/scala/tools/nsc/doc/model/comment/Comment.scala +++ b/src/compiler/scala/tools/nsc/doc/model/comment/Comment.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Manohar Jonnalagedda */ diff --git a/src/compiler/scala/tools/nsc/doc/model/comment/CommentFactory.scala b/src/compiler/scala/tools/nsc/doc/model/comment/CommentFactory.scala index 85d6a8911e..59cdf05957 100644 --- a/src/compiler/scala/tools/nsc/doc/model/comment/CommentFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/comment/CommentFactory.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Manohar Jonnalagedda */ diff --git a/src/compiler/scala/tools/nsc/interactive/BuildManager.scala b/src/compiler/scala/tools/nsc/interactive/BuildManager.scala index 7d36d17a18..e31c5eda31 100644 --- a/src/compiler/scala/tools/nsc/interactive/BuildManager.scala +++ b/src/compiler/scala/tools/nsc/interactive/BuildManager.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scxala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Iulian Dragos * @author Hubert Plocinicak */ diff --git a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala index aab1c8fb7e..6acd6d2382 100644 --- a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala +++ b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala b/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala index 80d2796801..4a60211254 100644 --- a/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala +++ b/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index 77bc77e966..cb2e7d641b 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interactive/InteractiveReporter.scala b/src/compiler/scala/tools/nsc/interactive/InteractiveReporter.scala index df8fc3b21e..f57786578a 100644 --- a/src/compiler/scala/tools/nsc/interactive/InteractiveReporter.scala +++ b/src/compiler/scala/tools/nsc/interactive/InteractiveReporter.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interactive/Picklers.scala b/src/compiler/scala/tools/nsc/interactive/Picklers.scala index bf920191c8..f4ec03bb47 100644 --- a/src/compiler/scala/tools/nsc/interactive/Picklers.scala +++ b/src/compiler/scala/tools/nsc/interactive/Picklers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interactive/PresentationCompilerThread.scala b/src/compiler/scala/tools/nsc/interactive/PresentationCompilerThread.scala index 70d8a826d0..309508246c 100644 --- a/src/compiler/scala/tools/nsc/interactive/PresentationCompilerThread.scala +++ b/src/compiler/scala/tools/nsc/interactive/PresentationCompilerThread.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky * @author Iulian Dragos */ diff --git a/src/compiler/scala/tools/nsc/interactive/REPL.scala b/src/compiler/scala/tools/nsc/interactive/REPL.scala index 6876ea14e0..2d93c77ca4 100644 --- a/src/compiler/scala/tools/nsc/interactive/REPL.scala +++ b/src/compiler/scala/tools/nsc/interactive/REPL.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc @@ -124,9 +124,9 @@ object REPL { * @param iContents An Array[Char] containing the instrumented source * @return The name of the instrumented source file */ - def writeInstrumented(iFullName: String, iContents: Array[Char]): String = { + def writeInstrumented(iFullName: String, suffix: String, iContents: Array[Char]): String = { val iSimpleName = iFullName drop ((iFullName lastIndexOf '.') + 1) - val iSourceName = iSimpleName + "$instrumented.scala" + val iSourceName = iSimpleName + suffix val ifile = new FileWriter(iSourceName) ifile.write(iContents) ifile.close() @@ -186,18 +186,20 @@ object REPL { * and outputs in the right column, or None if the presentation compiler * does not respond to askInstrumented. */ - def instrument(arguments: List[String], line: Int): Option[String] = { + def instrument(arguments: List[String], line: Int): Option[(String, String)] = { val source = toSourceFile(arguments.head) // strip right hand side comment column and any trailing spaces from all lines - val strippedSource = new BatchSourceFile(source.file, SourceInserter.stripRight(source.content)) + val strippedContents = SourceInserter.stripRight(source.content) + val strippedSource = new BatchSourceFile(source.file, strippedContents) println("stripped source = "+strippedSource) comp.askReload(List(strippedSource), reloadResult) comp.askInstrumented(strippedSource, line, instrumentedResult) using(instrumentedResult) { case (iFullName, iContents) => println(s"instrumented source $iFullName = ${iContents.mkString}") - val iSourceName = writeInstrumented(iFullName, iContents) - iSourceName + val iSourceName = writeInstrumented(iFullName, "$instrumented.scala", iContents) + val sSourceName = writeInstrumented(iFullName, "$stripped.scala", strippedContents) + (iSourceName, sSourceName) /* * val vdirOpt = compileInstrumented(iSourceName, arguments.tail) runInstrumented(vdirOpt, iFullName, strippedSource.content) @@ -227,9 +229,9 @@ object REPL { case List("complete", file, off1) => doComplete(makePos(file, off1, off1)) case "instrument" :: arguments => - println(instrument(arguments, -1).map(_.mkString)) + println(instrument(arguments, -1)) case "instrumentTo" :: line :: arguments => - println(instrument(arguments, line.toInt).map(_.mkString)) + println(instrument(arguments, line.toInt)) case List("quit") => comp.askShutdown() exit(1) // Don't use sys yet as this has to run on 2.8.2 also. diff --git a/src/compiler/scala/tools/nsc/interactive/RangePositions.scala b/src/compiler/scala/tools/nsc/interactive/RangePositions.scala index b702d2787c..c74cd1bbcc 100644 --- a/src/compiler/scala/tools/nsc/interactive/RangePositions.scala +++ b/src/compiler/scala/tools/nsc/interactive/RangePositions.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala index 57f0835edd..de6974cbb2 100644 --- a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala +++ b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Iulian Dragos * @author Hubert Plocinicak */ diff --git a/src/compiler/scala/tools/nsc/interactive/Response.scala b/src/compiler/scala/tools/nsc/interactive/Response.scala index fbb07b15ad..c90793781f 100644 --- a/src/compiler/scala/tools/nsc/interactive/Response.scala +++ b/src/compiler/scala/tools/nsc/interactive/Response.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interactive/RichCompilationUnits.scala b/src/compiler/scala/tools/nsc/interactive/RichCompilationUnits.scala index 9b2fee5f1f..0f52258b7e 100644 --- a/src/compiler/scala/tools/nsc/interactive/RichCompilationUnits.scala +++ b/src/compiler/scala/tools/nsc/interactive/RichCompilationUnits.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interactive/ScratchPadMaker.scala b/src/compiler/scala/tools/nsc/interactive/ScratchPadMaker.scala index bd1869e1a4..efc393c812 100644 --- a/src/compiler/scala/tools/nsc/interactive/ScratchPadMaker.scala +++ b/src/compiler/scala/tools/nsc/interactive/ScratchPadMaker.scala @@ -3,7 +3,7 @@ package interactive import scala.reflect.internal.util.{SourceFile, BatchSourceFile, RangePosition} import collection.mutable.ArrayBuffer -import reflect.internal.Chars.isLineBreakChar +import reflect.internal.Chars.{isLineBreakChar, isWhitespace} trait ScratchPadMaker { self: Global => @@ -40,14 +40,28 @@ trait ScratchPadMaker { self: Global => toPrint.clear() } + /** The position where to insert an instrumentation statement in front of giuven statement. + * This is at the latest `stat.pos.start`. But in order not to mess with column numbers + * in position we try to insert it at the end of the preceding line instead. + * To be safe, this can be done only if there's only whitespace between that position and + * statement's start position. + */ + private def instrumentPos(stat: Tree): Int = { + var start = stat.pos.start + while (start > 0 && isWhitespace(contents(start - 1))) start -= 1 + if (start > 0 && isLineBreakChar(contents(start - 1))) start -= 1 + start + } + private def addSkip(stat: Tree): Unit = { - if (stat.pos.start > skipped) applyPendingPatches(stat.pos.start) + val ipos = instrumentPos(stat) + if (stat.pos.start > skipped) applyPendingPatches(ipos) if (stat.pos.start >= endOffset) - patches += Patch(stat.pos.start, ";$stop()") + patches += Patch(ipos, ";$stop()") var end = stat.pos.end if (end > skipped) { - while (end < contents.length && !(isLineBreakChar(contents(end)))) end += 1 - patches += Patch(stat.pos.start, ";$skip("+(end-skipped)+"); ") + while (end < contents.length && !isLineBreakChar(contents(end))) end += 1 + patches += Patch(ipos, ";$skip("+(end-skipped)+"); ") skipped = end } } diff --git a/src/compiler/scala/tools/nsc/interactive/SimpleBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/SimpleBuildManager.scala index 6c9c7249e8..b98a305cd9 100644 --- a/src/compiler/scala/tools/nsc/interactive/SimpleBuildManager.scala +++ b/src/compiler/scala/tools/nsc/interactive/SimpleBuildManager.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala b/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala index afb8985700..deeb398d39 100644 --- a/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala +++ b/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interactive/tests/Tester.scala b/src/compiler/scala/tools/nsc/interactive/tests/Tester.scala index 55198e3617..5270b1971a 100644 --- a/src/compiler/scala/tools/nsc/interactive/tests/Tester.scala +++ b/src/compiler/scala/tools/nsc/interactive/tests/Tester.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala b/src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala index 0cf32a8d8a..dfd2f23a19 100644 --- a/src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala +++ b/src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala b/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala index 7289a947f4..7047608c8f 100644 --- a/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala +++ b/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/interpreter/AbstractOrMissingHandler.scala b/src/compiler/scala/tools/nsc/interpreter/AbstractOrMissingHandler.scala index 2f47685757..c8468686ca 100644 --- a/src/compiler/scala/tools/nsc/interpreter/AbstractOrMissingHandler.scala +++ b/src/compiler/scala/tools/nsc/interpreter/AbstractOrMissingHandler.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/ByteCode.scala b/src/compiler/scala/tools/nsc/interpreter/ByteCode.scala index 3059a8fb10..5f84b0daf3 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ByteCode.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ByteCode.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/CodeHandlers.scala b/src/compiler/scala/tools/nsc/interpreter/CodeHandlers.scala index fc68998225..a348478f93 100644 --- a/src/compiler/scala/tools/nsc/interpreter/CodeHandlers.scala +++ b/src/compiler/scala/tools/nsc/interpreter/CodeHandlers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/CommandLine.scala b/src/compiler/scala/tools/nsc/interpreter/CommandLine.scala index e96918c90c..afb1927305 100644 --- a/src/compiler/scala/tools/nsc/interpreter/CommandLine.scala +++ b/src/compiler/scala/tools/nsc/interpreter/CommandLine.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Lex Spoon */ diff --git a/src/compiler/scala/tools/nsc/interpreter/Completion.scala b/src/compiler/scala/tools/nsc/interpreter/Completion.scala index 7a3e1913b6..0906e7ad93 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Completion.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Completion.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/CompletionAware.scala b/src/compiler/scala/tools/nsc/interpreter/CompletionAware.scala index b3bbeb3169..abf326e746 100644 --- a/src/compiler/scala/tools/nsc/interpreter/CompletionAware.scala +++ b/src/compiler/scala/tools/nsc/interpreter/CompletionAware.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala b/src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala index 808f549304..f0060b0c6c 100644 --- a/src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala +++ b/src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/ConsoleReaderHelper.scala b/src/compiler/scala/tools/nsc/interpreter/ConsoleReaderHelper.scala index cfe932ad0b..1be2c86faf 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ConsoleReaderHelper.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ConsoleReaderHelper.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/Delimited.scala b/src/compiler/scala/tools/nsc/interpreter/Delimited.scala index 9d30c47820..f29b8032bb 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Delimited.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Delimited.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala b/src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala index f2438dcc20..f49e8d6b59 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/Formatting.scala b/src/compiler/scala/tools/nsc/interpreter/Formatting.scala index 6339dca72f..2bc95e0ca3 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Formatting.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Formatting.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala index b567293a3f..4cc58d3f25 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Alexander Spoon */ @@ -438,7 +438,10 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) } private def warningsCommand(): Result = { - intp.lastWarnings foreach { case (pos, msg) => intp.reporter.warning(pos, msg) } + if (intp.lastWarnings.isEmpty) + "Can't find any cached warnings." + else + intp.lastWarnings foreach { case (pos, msg) => intp.reporter.warning(pos, msg) } } private def javapCommand(line: String): Result = { diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala b/src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala index 7f5e09842a..2c16a754cb 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala index 7bdbff8627..6eadc1e63b 100644 --- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala +++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -108,27 +108,19 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends else new PathResolver(settings).result.asURLs // the compiler's classpath ) def settings = currentSettings - def savingSettings[T](fn: Settings => Unit)(body: => T): T = { - val saved = currentSettings - currentSettings = saved.copy() - fn(currentSettings) - try body - finally currentSettings = saved - } def mostRecentLine = prevRequestList match { case Nil => "" case req :: _ => req.originalLine } - def rerunWith(names: String*) = { - savingSettings((ss: Settings) => { - import ss._ - names flatMap lookupSetting foreach { - case s: BooleanSetting => s.value = true - case _ => () - } - })(interpret(mostRecentLine)) + // Run the code body with the given boolean settings flipped to true. + def withoutWarnings[T](body: => T): T = beQuietDuring { + val saved = settings.nowarn.value + if (!saved) + settings.nowarn.value = true + + try body + finally if (!saved) settings.nowarn.value = false } - def rerunForWarnings = rerunWith("-deprecation", "-unchecked", "-Xlint") /** construct an interpreter that reports to Console */ def this(settings: Settings) = this(settings, new NewLinePrintWriter(new ConsoleWriter, true)) @@ -699,6 +691,10 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends class ReadEvalPrint(lineId: Int) { def this() = this(freshLineId()) + private var lastRun: Run = _ + private var evalCaught: Option[Throwable] = None + private var conditionalWarnings: List[ConditionalWarning] = Nil + val packageName = sessionNames.line + lineId val readName = sessionNames.read val evalName = sessionNames.eval @@ -754,7 +750,6 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends catch { case ex: Throwable => evalError(path, unwrap(ex)) } } - var evalCaught: Option[Throwable] = None lazy val evalClass = load(evalPath) lazy val evalValue = callEither(resultName) match { case Left(ex) => evalCaught = Some(ex) ; None @@ -776,27 +771,25 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends /** We get a bunch of repeated warnings for reasons I haven't * entirely figured out yet. For now, squash. */ - private def removeDupWarnings(xs: List[(Position, String)]): List[(Position, String)] = { - if (xs.isEmpty) - return Nil - - val ((pos, msg)) :: rest = xs - val filtered = rest filter { case (pos0, msg0) => - (msg != msg0) || (pos.lineContent.trim != pos0.lineContent.trim) || { - // same messages and same line content after whitespace removal - // but we want to let through multiple warnings on the same line - // from the same run. The untrimmed line will be the same since - // there's no whitespace indenting blowing it. - (pos.lineContent == pos0.lineContent) - } + private def updateRecentWarnings(run: Run) { + def loop(xs: List[(Position, String)]): List[(Position, String)] = xs match { + case Nil => Nil + case ((pos, msg)) :: rest => + val filtered = rest filter { case (pos0, msg0) => + (msg != msg0) || (pos.lineContent.trim != pos0.lineContent.trim) || { + // same messages and same line content after whitespace removal + // but we want to let through multiple warnings on the same line + // from the same run. The untrimmed line will be the same since + // there's no whitespace indenting blowing it. + (pos.lineContent == pos0.lineContent) + } + } + ((pos, msg)) :: loop(filtered) } - ((pos, msg)) :: removeDupWarnings(filtered) + val warnings = loop(run.allConditionalWarnings flatMap (_.warnings)) + if (warnings.nonEmpty) + mostRecentWarnings = warnings } - def lastWarnings: List[(Position, String)] = ( - if (lastRun == null) Nil - else removeDupWarnings(lastRun.allConditionalWarnings flatMap (_.warnings)) - ) - private var lastRun: Run = _ private def evalMethod(name: String) = evalClass.getMethods filter (_.getName == name) match { case Array(method) => method case xs => sys.error("Internal error: eval object " + evalClass + ", " + xs.mkString("\n", "\n", "")) @@ -804,6 +797,7 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends private def compileAndSaveRun(label: String, code: String) = { showCodeIfDebugging(code) val (success, run) = compileSourcesKeepingRun(new BatchSourceFile(label, packaged(code))) + updateRecentWarnings(run) lastRun = run success } @@ -953,11 +947,7 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends } // compile the result-extraction object - beQuietDuring { - savingSettings(_.nowarn.value = true) { - lineRep compile ResultObjectSourceCode(handlers) - } - } + withoutWarnings(lineRep compile ResultObjectSourceCode(handlers)) } } @@ -1008,12 +998,8 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends case _ => naming.mostRecentVar }) - def lastWarnings: List[(global.Position, String)] = ( - prevRequests.reverseIterator - map (_.lineRep.lastWarnings) - find (_.nonEmpty) - getOrElse Nil - ) + private var mostRecentWarnings: List[(global.Position, String)] = Nil + def lastWarnings = mostRecentWarnings def treesForRequestId(id: Int): List[Tree] = requestForReqId(id).toList flatMap (_.trees) diff --git a/src/compiler/scala/tools/nsc/interpreter/ISettings.scala b/src/compiler/scala/tools/nsc/interpreter/ISettings.scala index d68a2becfb..b65a1ac889 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ISettings.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ISettings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Alexander Spoon */ diff --git a/src/compiler/scala/tools/nsc/interpreter/Imports.scala b/src/compiler/scala/tools/nsc/interpreter/Imports.scala index d579e0369e..5193166889 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Imports.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Imports.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ @@ -191,5 +191,5 @@ trait Imports { prevRequestList flatMap (req => req.handlers map (req -> _)) private def membersAtPickler(sym: Symbol): List[Symbol] = - beforePickler(sym.info.nonPrivateMembers) + beforePickler(sym.info.nonPrivateMembers.toList) }
\ No newline at end of file diff --git a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala index 241ba5fa4a..2c894e5b47 100644 --- a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala +++ b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stepan Koltsov */ diff --git a/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala index c429e3b196..edb95f7526 100644 --- a/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala +++ b/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ @@ -52,10 +52,10 @@ class JLineCompletion(val intp: IMain) extends Completion with CompletionOutput // XXX we'd like to say "filterNot (_.isDeprecated)" but this causes the // compiler to crash for reasons not yet known. - def members = afterTyper((effectiveTp.nonPrivateMembers ++ anyMembers) filter (_.isPublic)) - def methods = members filter (_.isMethod) - def packages = members filter (_.isPackage) - def aliases = members filter (_.isAliasType) + def members = afterTyper((effectiveTp.nonPrivateMembers.toList ++ anyMembers) filter (_.isPublic)) + def methods = members.toList filter (_.isMethod) + def packages = members.toList filter (_.isPackage) + def aliases = members.toList filter (_.isAliasType) def memberNames = members map tos def methodNames = methods map tos diff --git a/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala b/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala index 758f6e2abc..d8454db0ab 100644 --- a/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala +++ b/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stepan Koltsov */ diff --git a/src/compiler/scala/tools/nsc/interpreter/Logger.scala b/src/compiler/scala/tools/nsc/interpreter/Logger.scala index d6cba5da6a..4016e0a6fc 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Logger.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Logger.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala b/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala index 3520a60ee5..2dc394a081 100644 --- a/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala +++ b/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/MemberHandlers.scala b/src/compiler/scala/tools/nsc/interpreter/MemberHandlers.scala index 236f3f23c5..c041f02859 100644 --- a/src/compiler/scala/tools/nsc/interpreter/MemberHandlers.scala +++ b/src/compiler/scala/tools/nsc/interpreter/MemberHandlers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -9,6 +9,7 @@ package interpreter import scala.collection.{ mutable, immutable } import scala.PartialFunction.cond import scala.reflect.internal.Chars +import scala.reflect.internal.Flags._ import language.implicitConversions trait MemberHandlers { @@ -126,7 +127,7 @@ trait MemberHandlers { class DefHandler(member: DefDef) extends MemberDefHandler(member) { private def vparamss = member.vparamss - private def isMacro = member.mods.hasFlag(scala.reflect.internal.Flags.MACRO) + private def isMacro = member.symbol hasFlag MACRO // true if not a macro and 0-arity override def definesValue = !isMacro && flattensToEmpty(vparamss) override def resultExtractionCode(req: Request) = @@ -211,7 +212,7 @@ trait MemberHandlers { beforePickler(individualNames map (targetType nonPrivateMember _)) lazy val wildcardSymbols: List[Symbol] = - if (importsWildcard) beforePickler(targetType.nonPrivateMembers) + if (importsWildcard) beforePickler(targetType.nonPrivateMembers.toList) else Nil /** Complete list of names imported by a wildcard */ diff --git a/src/compiler/scala/tools/nsc/interpreter/NamedParam.scala b/src/compiler/scala/tools/nsc/interpreter/NamedParam.scala index 3a69ea86b5..a2b42aeefc 100644 --- a/src/compiler/scala/tools/nsc/interpreter/NamedParam.scala +++ b/src/compiler/scala/tools/nsc/interpreter/NamedParam.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/Naming.scala b/src/compiler/scala/tools/nsc/interpreter/Naming.scala index c3f51c74ec..35ee51ad10 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Naming.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Naming.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/Parsed.scala b/src/compiler/scala/tools/nsc/interpreter/Parsed.scala index 6eccf1e1c5..7f2492204c 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Parsed.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Parsed.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/Pasted.scala b/src/compiler/scala/tools/nsc/interpreter/Pasted.scala index 83321356a3..8ead419db3 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Pasted.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Pasted.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/Phased.scala b/src/compiler/scala/tools/nsc/interpreter/Phased.scala index f39c025a86..9124eace05 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Phased.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Phased.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/Power.scala b/src/compiler/scala/tools/nsc/interpreter/Power.scala index 57d7cef726..4ba0c59112 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Power.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Power.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ @@ -62,7 +62,7 @@ class Power[ReplValsImpl <: ReplVals : ru.TypeTag: ClassTag](val intp: IMain, re def discarded = seen.size - keep.size def members(x: Symbol): List[Symbol] = - if (x.rawInfo.isComplete) x.info.members + if (x.rawInfo.isComplete) x.info.members.toList else Nil var lastCount = -1 @@ -216,7 +216,7 @@ class Power[ReplValsImpl <: ReplVals : ru.TypeTag: ClassTag](val intp: IMain, re def declsOriginal = membersDeclared filterNot (_.isOverride) def members = membersUnabridged filterNot excludeMember - def membersUnabridged = tpe.members + def membersUnabridged = tpe.members.toList def membersDeclared = members filterNot excludeMember def membersInherited = members filterNot (membersDeclared contains _) def memberTypes = members filter (_.name.isTypeName) diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplConfig.scala b/src/compiler/scala/tools/nsc/interpreter/ReplConfig.scala index adb1a2be04..e96dc63adb 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ReplConfig.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ReplConfig.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplGlobal.scala b/src/compiler/scala/tools/nsc/interpreter/ReplGlobal.scala index 05321dd7e6..6a0978d954 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ReplGlobal.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ReplGlobal.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala b/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala index 218e02193a..1a63430f0e 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplReporter.scala b/src/compiler/scala/tools/nsc/interpreter/ReplReporter.scala index fb61dfb672..8bd3fd67b6 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ReplReporter.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ReplReporter.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplStrings.scala b/src/compiler/scala/tools/nsc/interpreter/ReplStrings.scala index 0c9f4fcd47..c5358179f1 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ReplStrings.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ReplStrings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala b/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala index 588d0647d2..5b8e4c3d92 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/Results.scala b/src/compiler/scala/tools/nsc/interpreter/Results.scala index f582d47485..7c9d803d89 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Results.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Results.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/interpreter/RichClass.scala b/src/compiler/scala/tools/nsc/interpreter/RichClass.scala index 32eb1e95c1..1306afb1a0 100644 --- a/src/compiler/scala/tools/nsc/interpreter/RichClass.scala +++ b/src/compiler/scala/tools/nsc/interpreter/RichClass.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala b/src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala index a57b047bc0..e144ed71be 100644 --- a/src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala +++ b/src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stepan Koltsov */ diff --git a/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala b/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala index 56b9c7011c..d6604499b4 100644 --- a/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala +++ b/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ @@ -212,8 +212,7 @@ trait TypeStrings { } private def tparamString[T: ru.TypeTag] : String = { - // [Eugene++ to Paul] needs review!! - def typeArguments: List[ru.Type] = ru.typeOf[T].typeArguments + def typeArguments: List[ru.Type] = ru.typeOf[T] match { case ru.TypeRef(_, _, args) => args; case _ => Nil } // [Eugene++] todo. need to use not the `rootMirror`, but a mirror with the REPL's classloader // how do I get to it? acquiring context classloader seems unreliable because of multithreading def typeVariables: List[java.lang.Class[_]] = typeArguments map (targ => ru.rootMirror.runtimeClass(targ)) diff --git a/src/compiler/scala/tools/nsc/interpreter/package.scala b/src/compiler/scala/tools/nsc/interpreter/package.scala index 7d2610e3c8..98129aded8 100644 --- a/src/compiler/scala/tools/nsc/interpreter/package.scala +++ b/src/compiler/scala/tools/nsc/interpreter/package.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala b/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala index e238bdf654..c81b24c59b 100644 --- a/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala +++ b/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/session/History.scala b/src/compiler/scala/tools/nsc/interpreter/session/History.scala index 5e1aba20f1..81b8b9efd6 100644 --- a/src/compiler/scala/tools/nsc/interpreter/session/History.scala +++ b/src/compiler/scala/tools/nsc/interpreter/session/History.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/session/JLineHistory.scala b/src/compiler/scala/tools/nsc/interpreter/session/JLineHistory.scala index 795ca79668..86c25748d6 100644 --- a/src/compiler/scala/tools/nsc/interpreter/session/JLineHistory.scala +++ b/src/compiler/scala/tools/nsc/interpreter/session/JLineHistory.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/session/SimpleHistory.scala b/src/compiler/scala/tools/nsc/interpreter/session/SimpleHistory.scala index 28173534e4..aa66311963 100644 --- a/src/compiler/scala/tools/nsc/interpreter/session/SimpleHistory.scala +++ b/src/compiler/scala/tools/nsc/interpreter/session/SimpleHistory.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/interpreter/session/package.scala b/src/compiler/scala/tools/nsc/interpreter/session/package.scala index 4e5b08c8cb..c1cd599941 100644 --- a/src/compiler/scala/tools/nsc/interpreter/session/package.scala +++ b/src/compiler/scala/tools/nsc/interpreter/session/package.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/io/DaemonThreadFactory.scala b/src/compiler/scala/tools/nsc/io/DaemonThreadFactory.scala index fa1218cc82..0e75ac3baa 100644 --- a/src/compiler/scala/tools/nsc/io/DaemonThreadFactory.scala +++ b/src/compiler/scala/tools/nsc/io/DaemonThreadFactory.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/io/Fileish.scala b/src/compiler/scala/tools/nsc/io/Fileish.scala index e12fcedc39..a05d9afe2a 100644 --- a/src/compiler/scala/tools/nsc/io/Fileish.scala +++ b/src/compiler/scala/tools/nsc/io/Fileish.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/io/Jar.scala b/src/compiler/scala/tools/nsc/io/Jar.scala index b322df986c..12ba3e4bd7 100644 --- a/src/compiler/scala/tools/nsc/io/Jar.scala +++ b/src/compiler/scala/tools/nsc/io/Jar.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/io/MsilFile.scala b/src/compiler/scala/tools/nsc/io/MsilFile.scala index d970d0e9c9..1835c8044b 100644 --- a/src/compiler/scala/tools/nsc/io/MsilFile.scala +++ b/src/compiler/scala/tools/nsc/io/MsilFile.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/io/Socket.scala b/src/compiler/scala/tools/nsc/io/Socket.scala index b7920921fa..b268b00dd5 100644 --- a/src/compiler/scala/tools/nsc/io/Socket.scala +++ b/src/compiler/scala/tools/nsc/io/Socket.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/io/SourceReader.scala b/src/compiler/scala/tools/nsc/io/SourceReader.scala index 2e146becdf..f784f751f5 100644 --- a/src/compiler/scala/tools/nsc/io/SourceReader.scala +++ b/src/compiler/scala/tools/nsc/io/SourceReader.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/io/package.scala b/src/compiler/scala/tools/nsc/io/package.scala index d29030603e..3c4f004198 100644 --- a/src/compiler/scala/tools/nsc/io/package.scala +++ b/src/compiler/scala/tools/nsc/io/package.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index 3797d32d8b..d1c404b3e3 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ //todo: allow infix type patterns diff --git a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala index 58c2426602..0367119547 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/javac/JavaTokens.scala b/src/compiler/scala/tools/nsc/javac/JavaTokens.scala index 796f96eccd..ae88a56398 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaTokens.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaTokens.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/matching/MatchSupport.scala b/src/compiler/scala/tools/nsc/matching/MatchSupport.scala index 16761144d7..6d8c80d1d0 100644 --- a/src/compiler/scala/tools/nsc/matching/MatchSupport.scala +++ b/src/compiler/scala/tools/nsc/matching/MatchSupport.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * Author: Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/matching/Matrix.scala b/src/compiler/scala/tools/nsc/matching/Matrix.scala index b29fac225a..1cf4bccb40 100644 --- a/src/compiler/scala/tools/nsc/matching/Matrix.scala +++ b/src/compiler/scala/tools/nsc/matching/Matrix.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * Author: Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/matching/MatrixAdditions.scala b/src/compiler/scala/tools/nsc/matching/MatrixAdditions.scala index ef17367ce0..5a0621ea20 100644 --- a/src/compiler/scala/tools/nsc/matching/MatrixAdditions.scala +++ b/src/compiler/scala/tools/nsc/matching/MatrixAdditions.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * Author: Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index 0d1356a6b0..71deb2d356 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * Copyright 2007 Google Inc. All Rights Reserved. * Author: bqe@google.com (Burak Emir) */ diff --git a/src/compiler/scala/tools/nsc/matching/PatternBindings.scala b/src/compiler/scala/tools/nsc/matching/PatternBindings.scala index b2a721c586..8e043613b8 100644 --- a/src/compiler/scala/tools/nsc/matching/PatternBindings.scala +++ b/src/compiler/scala/tools/nsc/matching/PatternBindings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * Author: Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/matching/Patterns.scala b/src/compiler/scala/tools/nsc/matching/Patterns.scala index 28dfd3fc77..af77d3fe3f 100644 --- a/src/compiler/scala/tools/nsc/matching/Patterns.scala +++ b/src/compiler/scala/tools/nsc/matching/Patterns.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * Author: Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/package.scala b/src/compiler/scala/tools/nsc/package.scala index 88d600c113..9ad0d9ba1f 100644 --- a/src/compiler/scala/tools/nsc/package.scala +++ b/src/compiler/scala/tools/nsc/package.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/plugins/Plugin.scala b/src/compiler/scala/tools/nsc/plugins/Plugin.scala index 7f9df2235a..de47e1b828 100644 --- a/src/compiler/scala/tools/nsc/plugins/Plugin.scala +++ b/src/compiler/scala/tools/nsc/plugins/Plugin.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Lex Spoon */ diff --git a/src/compiler/scala/tools/nsc/plugins/PluginComponent.scala b/src/compiler/scala/tools/nsc/plugins/PluginComponent.scala index 3c683d59ad..d5c0dd287a 100644 --- a/src/compiler/scala/tools/nsc/plugins/PluginComponent.scala +++ b/src/compiler/scala/tools/nsc/plugins/PluginComponent.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Lex Spoon * Updated by Anders Bach Nielsen */ diff --git a/src/compiler/scala/tools/nsc/plugins/PluginDescription.scala b/src/compiler/scala/tools/nsc/plugins/PluginDescription.scala index 0fa925baa7..b5f52e50ea 100644 --- a/src/compiler/scala/tools/nsc/plugins/PluginDescription.scala +++ b/src/compiler/scala/tools/nsc/plugins/PluginDescription.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Lex Spoon */ diff --git a/src/compiler/scala/tools/nsc/plugins/PluginLoadException.scala b/src/compiler/scala/tools/nsc/plugins/PluginLoadException.scala index 77c8d44347..cc7c575e38 100644 --- a/src/compiler/scala/tools/nsc/plugins/PluginLoadException.scala +++ b/src/compiler/scala/tools/nsc/plugins/PluginLoadException.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Lex Spoon */ diff --git a/src/compiler/scala/tools/nsc/plugins/Plugins.scala b/src/compiler/scala/tools/nsc/plugins/Plugins.scala index ba042b7b78..5eba9034d6 100644 --- a/src/compiler/scala/tools/nsc/plugins/Plugins.scala +++ b/src/compiler/scala/tools/nsc/plugins/Plugins.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Lex Spoon * Updated by Anders Bach Nielsen */ diff --git a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala index cb85e49d55..491718bc0d 100644 --- a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala index dff900383e..6fae641487 100644 --- a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/reporters/Reporter.scala b/src/compiler/scala/tools/nsc/reporters/Reporter.scala index 303a477491..d756c1cb2c 100644 --- a/src/compiler/scala/tools/nsc/reporters/Reporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/Reporter.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/reporters/StoreReporter.scala b/src/compiler/scala/tools/nsc/reporters/StoreReporter.scala index 5c3f7b8965..919d2ac377 100644 --- a/src/compiler/scala/tools/nsc/reporters/StoreReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/StoreReporter.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/scratchpad/Mixer.scala b/src/compiler/scala/tools/nsc/scratchpad/Mixer.scala index 46ccc32097..67ff916b11 100644 --- a/src/compiler/scala/tools/nsc/scratchpad/Mixer.scala +++ b/src/compiler/scala/tools/nsc/scratchpad/Mixer.scala @@ -23,7 +23,7 @@ class Mixer { val nextSpace = comments indexOf (' ', idx) var nextNL = comments indexOf ('\n', nextSpace + 1) if (nextNL < 0) nextNL = comments.length - val result = + val result = (new String(comments.slice(idx, nextSpace)).toInt, comments.slice(nextSpace + 1, nextNL)) idx = nextNL + 1 result @@ -46,7 +46,10 @@ class Mixer { mixed += '\n' col = 0 } - mixed ++= (" " * (sepColumn - col)) + while (col < sepColumn) { + mixed += ' ' + col += 1 + } } for ((offset, cs) <- parseComments(comments)) { val sep = diff --git a/src/compiler/scala/tools/nsc/settings/AbsScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/AbsScalaSettings.scala index d4ac490134..a96ddb11a2 100644 --- a/src/compiler/scala/tools/nsc/settings/AbsScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/AbsScalaSettings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/settings/AbsSettings.scala b/src/compiler/scala/tools/nsc/settings/AbsSettings.scala index c1dad2da82..120ada965a 100644 --- a/src/compiler/scala/tools/nsc/settings/AbsSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/AbsSettings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/settings/AdvancedScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/AdvancedScalaSettings.scala index 08b1f7374e..1e5e0bd25c 100644 --- a/src/compiler/scala/tools/nsc/settings/AdvancedScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/AdvancedScalaSettings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/settings/AestheticSettings.scala b/src/compiler/scala/tools/nsc/settings/AestheticSettings.scala index 2baff0bb1c..5d324903e9 100644 --- a/src/compiler/scala/tools/nsc/settings/AestheticSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/AestheticSettings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/settings/FscSettings.scala b/src/compiler/scala/tools/nsc/settings/FscSettings.scala index bb6e2ad920..ae7cacd049 100644 --- a/src/compiler/scala/tools/nsc/settings/FscSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/FscSettings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala index fc833e2c26..116eed0f31 100644 --- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -68,7 +68,7 @@ class MutableSettings(val errorFn: String => Unit) if (isOpt) { val newArgs = parseParams(args) if (args eq newArgs) { - errorFn("bad option: '" + x + "'") + errorFn(s"bad option: '$x'") (false, args) } // discard empties, sometimes they appear because of ant or etc. @@ -536,7 +536,7 @@ class MutableSettings(val errorFn: String => Unit) } override def tryToSetColon(args: List[String]) = tryToSet(args) override def tryToSetFromPropertyValue(s: String) = tryToSet(s.trim.split(',').toList) - def unparse: List[String] = value map { name + ":" + _ } + def unparse: List[String] = name :: value withHelpSyntax(name + ":<" + arg + ">") } diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index aa30a7a45b..19392ec23a 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -205,8 +205,6 @@ trait ScalaSettings extends AbsScalaSettings // Feature extensions val XmacroSettings = MultiStringSetting("-Xmacro-settings", "option", "Custom settings for macros.") - val XmacroPrimaryClasspath = PathSetting("-Xmacro-primary-classpath", "Classpath to load macros implementations from, defaults to compilation classpath (aka \"library classpath\".", "") - val XmacroFallbackClasspath = PathSetting("-Xmacro-fallback-classpath", "Classpath to load macros implementations from if they cannot be loaded from library classpath.", "") /** * IDE-specific settings diff --git a/src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala index 0991577829..ead9fc2d83 100644 --- a/src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ @@ -43,7 +43,7 @@ trait StandardScalaSettings { val target = ChoiceSetting ("-target", "target", "Target platform for object files. All JVM 1.5 targets are deprecated.", List("jvm-1.5", "jvm-1.5-fjbg", "jvm-1.5-asm", "jvm-1.6", "jvm-1.7", "msil"), "jvm-1.6") - val unchecked = BooleanSetting ("-unchecked", "Enable detailed unchecked (erasure) warnings.") + val unchecked = BooleanSetting ("-unchecked", "Enable additional warnings where generated code depends on assumptions.") val uniqid = BooleanSetting ("-uniqid", "Uniquely tag all identifiers in debugging output.") val usejavacp = BooleanSetting ("-usejavacp", "Utilize the java.class.path in classpath resolution.") val verbose = BooleanSetting ("-verbose", "Output messages about what the compiler is doing.") diff --git a/src/compiler/scala/tools/nsc/settings/Warnings.scala b/src/compiler/scala/tools/nsc/settings/Warnings.scala index b2e3d51ad4..16f8685a87 100644 --- a/src/compiler/scala/tools/nsc/settings/Warnings.scala +++ b/src/compiler/scala/tools/nsc/settings/Warnings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/symtab/BrowsingLoaders.scala b/src/compiler/scala/tools/nsc/symtab/BrowsingLoaders.scala index 84d601bfed..e087a93511 100644 --- a/src/compiler/scala/tools/nsc/symtab/BrowsingLoaders.scala +++ b/src/compiler/scala/tools/nsc/symtab/BrowsingLoaders.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala index 46c52e68a2..213a995e96 100644 --- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala +++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolTable.scala b/src/compiler/scala/tools/nsc/symtab/SymbolTable.scala index 75b486ca7d..c6bd236e8a 100644 --- a/src/compiler/scala/tools/nsc/symtab/SymbolTable.scala +++ b/src/compiler/scala/tools/nsc/symtab/SymbolTable.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolTrackers.scala b/src/compiler/scala/tools/nsc/symtab/SymbolTrackers.scala index 3cf5cc2f54..c596eb014a 100644 --- a/src/compiler/scala/tools/nsc/symtab/SymbolTrackers.scala +++ b/src/compiler/scala/tools/nsc/symtab/SymbolTrackers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/AbstractFileReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/AbstractFileReader.scala index a75a03bff9..ac0b5012e7 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/AbstractFileReader.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/AbstractFileReader.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index a035a346e6..32c9bff21b 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala index bb9f9bde98..437a5e1434 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Iulian Dragos */ @@ -594,6 +594,7 @@ abstract class ICodeReader extends ClassfileParser { while (pc < codeLength) parseInstruction val exceptionEntries = in.nextChar.toInt + code.containsEHs = (exceptionEntries != 0) var i = 0 while (i < exceptionEntries) { // skip start end PC @@ -647,6 +648,7 @@ abstract class ICodeReader extends ClassfileParser { var containsDUPX = false var containsNEW = false + var containsEHs = false def emit(i: Instruction) { instrs += ((pc, i)) @@ -664,6 +666,7 @@ abstract class ICodeReader extends ClassfileParser { val code = new Code(method) method.setCode(code) + method.bytecodeHasEHs = containsEHs var bb = code.startBlock def makeBasicBlocks: mutable.Map[Int, BasicBlock] = @@ -725,8 +728,7 @@ abstract class ICodeReader extends ClassfileParser { import analysis.typeFlowLattice.IState /** Abstract interpretation for one instruction. */ - override def interpret(in: typeFlowLattice.Elem, i: Instruction): typeFlowLattice.Elem = { - var out = IState(new VarBinding(in.vars), new TypeStack(in.stack)) + override def mutatingInterpret(out: typeFlowLattice.Elem, i: Instruction): typeFlowLattice.Elem = { val bindings = out.vars val stack = out.stack import stack.push @@ -734,12 +736,10 @@ abstract class ICodeReader extends ClassfileParser { case DUP_X1 => val (one, two) = stack.pop2 push(one); push(two); push(one); - out = IState(bindings, stack) case DUP_X2 => val (one, two, three) = stack.pop3 push(one); push(three); push(two); push(one); - out = IState(bindings, stack) case DUP2_X1 => val (one, two) = stack.pop2 @@ -749,7 +749,6 @@ abstract class ICodeReader extends ClassfileParser { val three = stack.pop push(two); push(one); push(three); push(two); push(one); } - out = IState(bindings, stack) case DUP2_X2 => val (one, two) = stack.pop2 @@ -768,10 +767,9 @@ abstract class ICodeReader extends ClassfileParser { push(two); push(one); push(four); push(one); push(three); push(two); push(one); } } - out = IState(bindings, stack) case _ => - out = super.interpret(in, i) + super.mutatingInterpret(out, i) } out } diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala index cc5ed0f129..3c34cf1c80 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala b/src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala index d3b6c9238d..22bdff61ab 100644 --- a/src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala +++ b/src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2004-2011 LAMP/EPFL + * Copyright 2004-2012 LAMP/EPFL */ diff --git a/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala b/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala index c5092aa057..5e52415ab2 100644 --- a/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2004-2011 LAMP/EPFL + * Copyright 2004-2012 LAMP/EPFL */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala index 822c819e7d..a8cdee7154 100644 --- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala +++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala index 70bd0bd21b..f2f4a44b02 100644 --- a/src/compiler/scala/tools/nsc/transform/Constructors.scala +++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author */ diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 24a74722b0..eb3c965d7f 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index 1f7c34b8ad..6fba6dcc39 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -46,13 +46,13 @@ abstract class ExplicitOuter extends InfoTransform private def haveSameOuter(parent: Type, clazz: Symbol) = parent match { case TypeRef(pre, sym, _) => val owner = clazz.owner - + //println(s"have same outer $parent $clazz $sym ${sym.owner} $owner $pre") sym.isClass && owner.isClass && - (owner isSubClass sym.owner) && + (owner isSubClass sym.owner) && owner.thisType =:= pre - + case _ => false } @@ -416,7 +416,7 @@ abstract class ExplicitOuter extends InfoTransform val (checkExhaustive, requireSwitch) = nselector match { case Typed(nselector1, tpt) => - val unchecked = treeInfo.isUncheckedAnnotation(tpt.tpe) + val unchecked = tpt.tpe hasAnnotation UncheckedClass if (unchecked) nselector = nselector1 @@ -497,8 +497,18 @@ abstract class ExplicitOuter extends InfoTransform else atPos(tree.pos)(outerPath(outerValue, currentClass.outerClass, sym)) // (5) case Select(qual, name) => - if (currentClass != sym.owner) // (3) + /** return closest enclosing method, unless shadowed by an enclosing class; + * no use of closures here in the interest of speed. + */ + def closestEnclMethod(from: Symbol): Symbol = + if (from.isSourceMethod) from + else if (from.isClass) NoSymbol + else closestEnclMethod(from.owner) + + if (currentClass != sym.owner || + (closestEnclMethod(currentOwner) hasAnnotation ScalaInlineClass)) sym.makeNotPrivate(sym.owner) + val qsym = qual.tpe.widen.typeSymbol if (sym.isProtected && //(4) (qsym.isTrait || !(qual.isInstanceOf[Super] || (qsym isSubClass currentClass)))) diff --git a/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala b/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala index e937589f54..574c2c7049 100644 --- a/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala +++ b/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.tools.nsc diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala index c8de25b2ea..94eaba67d7 100644 --- a/src/compiler/scala/tools/nsc/transform/Flatten.scala +++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/transform/InfoTransform.scala b/src/compiler/scala/tools/nsc/transform/InfoTransform.scala index 880f0f0157..ab078421b0 100644 --- a/src/compiler/scala/tools/nsc/transform/InfoTransform.scala +++ b/src/compiler/scala/tools/nsc/transform/InfoTransform.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author */ diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala index bee5aa5f4f..b6d54f114e 100644 --- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala +++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author */ diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index fe5bef5009..3c828db7f3 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala index d8c18c2d50..4401e3bd3e 100644 --- a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala +++ b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/transform/SampleTransform.scala b/src/compiler/scala/tools/nsc/transform/SampleTransform.scala index f7d2c9de28..f0548252e7 100644 --- a/src/compiler/scala/tools/nsc/transform/SampleTransform.scala +++ b/src/compiler/scala/tools/nsc/transform/SampleTransform.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 63f93aa000..10a946c318 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Iulian Dragos */ @@ -69,7 +69,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { import definitions.{ BooleanClass, UnitClass, ArrayClass, ScalaValueClasses, isPrimitiveValueClass, isPrimitiveValueType, - SpecializedClass, UnspecializedClass, AnyRefClass, ObjectClass, AnyRefModule, + SpecializedClass, UnspecializedClass, AnyRefClass, ObjectClass, GroupOfSpecializable, uncheckedVarianceClass, ScalaInlineClass } import rootMirror.RootClass @@ -326,7 +326,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { } } - lazy val specializableTypes = (ScalaValueClasses :+ AnyRefClass) map (_.tpe) sorted + lazy val specializableTypes = ScalaValueClasses map (_.tpe) sorted /** If the symbol is the companion of a value class, the value class. * Otherwise, AnyRef. diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala index 492273dfdc..b1b930ca2d 100644 --- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala +++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Iulian Dragos */ @@ -36,7 +36,7 @@ abstract class TailCalls extends Transform { } } - import gen.hasSynthCaseSymbol + import treeInfo.hasSynthCaseSymbol /** * A Tail Call Transformer diff --git a/src/compiler/scala/tools/nsc/transform/Transform.scala b/src/compiler/scala/tools/nsc/transform/Transform.scala index 0f793fdb2e..8afff8bcb4 100644 --- a/src/compiler/scala/tools/nsc/transform/Transform.scala +++ b/src/compiler/scala/tools/nsc/transform/Transform.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala b/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala index 7a4da41f14..9e681b321c 100644 --- a/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala +++ b/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 5c0207e5c7..e98bf519fe 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author */ diff --git a/src/compiler/scala/tools/nsc/typechecker/Adaptations.scala b/src/compiler/scala/tools/nsc/typechecker/Adaptations.scala index 99d5363d5e..a81ac45c3d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Adaptations.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Adaptations.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala b/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala index 2077ab0997..7f4f61bf80 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala index 021ab34c9f..c21a0c008b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala index ba6c43f9d3..c7728ce389 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 0fc298e886..dd5588e9a6 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -360,7 +360,7 @@ trait Contexts { self: Analyzer => private def unitError(pos: Position, msg: String) = unit.error(pos, if (checking) "\n**** ERROR DURING INTERNAL CHECKING ****\n" + msg else msg) - + @inline private def issueCommon(err: AbsTypeError)(pf: PartialFunction[AbsTypeError, Unit]) { debugwarn("issue error: " + err.errMsg) if (settings.Yissuedebug.value) (new Exception).printStackTrace() @@ -611,8 +611,8 @@ trait Contexts { self: Analyzer => (e ne null) && (e.owner == scope) }) - private def collectImplicits(syms: List[Symbol], pre: Type, imported: Boolean = false): List[ImplicitInfo] = - for (sym <- syms if isQualifyingImplicit(sym.name, sym, pre, imported)) yield + private def collectImplicits(syms: Scope, pre: Type, imported: Boolean = false): List[ImplicitInfo] = + for (sym <- syms.toList if isQualifyingImplicit(sym.name, sym, pre, imported)) yield new ImplicitInfo(sym.name, pre, sym) private def collectImplicitImports(imp: ImportInfo): List[ImplicitInfo] = { @@ -657,7 +657,7 @@ trait Contexts { self: Analyzer => } } else if (scope != nextOuter.scope && !owner.isPackageClass) { debuglog("collect local implicits " + scope.toList)//DEBUG - collectImplicits(scope.toList, NoPrefix) + collectImplicits(scope, NoPrefix) } else if (imports != nextOuter.imports) { assert(imports.tail == nextOuter.imports, (imports, nextOuter.imports)) collectImplicitImports(imports.head) @@ -725,7 +725,7 @@ trait Contexts { self: Analyzer => result } - def allImportedSymbols: List[Symbol] = + def allImportedSymbols: Iterable[Symbol] = qual.tpe.members flatMap (transformImport(tree.selectors, _)) private def transformImport(selectors: List[ImportSelector], sym: Symbol): List[Symbol] = selectors match { diff --git a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala index 63d1bd0e9f..e590e7aa30 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -41,7 +41,7 @@ abstract class Duplicators extends Analyzer { } protected def newBodyDuplicator(context: Context) = new BodyDuplicator(context) - + def retypedMethod(context: Context, tree: Tree, oldThis: Symbol, newThis: Symbol): Tree = (newBodyDuplicator(context)).retypedMethod(tree.asInstanceOf[DefDef], oldThis, newThis) @@ -160,7 +160,7 @@ abstract class Duplicators extends Analyzer { newsym.setInfo(fixType(ldef.symbol.info)) ldef.symbol = newsym debuglog("newsym: " + newsym + " info: " + newsym.info) - + case vdef @ ValDef(mods, name, _, rhs) if mods.hasFlag(Flags.LAZY) => debuglog("ValDef " + name + " sym.info: " + vdef.symbol.info) invalidSyms(vdef.symbol) = vdef @@ -170,7 +170,7 @@ abstract class Duplicators extends Analyzer { vdef.symbol = newsym debuglog("newsym: " + newsym + " info: " + newsym.info + ", owner: " + newsym.owner + ", " + newsym.owner.isClass) if (newsym.owner.isClass) newsym.owner.info.decls enter newsym - + case DefDef(_, name, tparams, vparamss, _, rhs) => // invalidate parameters invalidateAll(tparams ::: vparamss.flatten) @@ -215,7 +215,7 @@ abstract class Duplicators extends Analyzer { * Unless overridden, just returns the tree. */ def castType(tree: Tree, pt: Type): Tree = tree - + /** Special typer method for re-type checking trees. It expects a typed tree. * Returns a typed tree that has fresh symbols for all definitions in the original tree. * @@ -278,12 +278,19 @@ abstract class Duplicators extends Analyzer { invalidate(rhs) ldef.tpe = null - // since typer does not create the symbols for a LabelDef's params, - // we do that manually here -- we should really refactor LabelDef to be a subclass of DefDef - def newParam(p: Tree): Ident = { - val newsym = p.symbol.cloneSymbol //(context.owner) // TODO owner? - Ident(newsym.setInfo(fixType(p.symbol.info))) - } + // is this LabelDef generated by tailcalls? + val isTailLabel = (ldef.params.length >= 1) && (ldef.params.head.name == nme.THIS) + + // the typer does not create the symbols for a LabelDef's params, so unless they were created before we need + // to do it manually here -- but for the tailcalls-generated labels, ValDefs are created before the LabelDef, + // so we just need to plug in the name + def newParam(p: Tree): Ident = + if (isTailLabel) + Ident(p.symbol.name) // let the typer pick up the right symbol + else { + val newsym = p.symbol.cloneSymbol //(context.owner) // TODO owner? + Ident(newsym.setInfo(fixType(p.symbol.info))) + } val params1 = params map newParam val rhs1 = (new TreeSubstituter(params map (_.symbol), params1) transform rhs) // TODO: duplicate? rhs1.tpe = null @@ -365,7 +372,7 @@ abstract class Duplicators extends Analyzer { case EmptyTree => // no need to do anything, in particular, don't set the type to null, EmptyTree.tpe_= asserts tree - + case _ => debuglog("Duplicators default case: " + tree.summaryString) debuglog(" ---> " + tree) @@ -376,7 +383,7 @@ abstract class Duplicators extends Analyzer { super.typed(ntree, mode, pt) } } - + } } diff --git a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala index 69b27045ab..9e175fa516 100644 --- a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala +++ b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index da045e1a48..f9035f26b9 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -957,7 +957,7 @@ trait Implicits { companion.moduleClass match { case mc: ModuleClassSymbol => val infos = - for (im <- mc.implicitMembers) yield new ImplicitInfo(im.name, singleType(pre, companion), im) + for (im <- mc.implicitMembers.toList) yield new ImplicitInfo(im.name, singleType(pre, companion), im) if (infos.nonEmpty) infoMap += (sym -> infos) case _ => @@ -1196,7 +1196,7 @@ trait Implicits { gen.mkAttributedThis(thisSym) case _ => // if ``pre'' is not a PDT, e.g. if someone wrote - // implicitly[scala.reflect.makro.Context#TypeTag[Int]] + // implicitly[scala.reflect.macros.Context#TypeTag[Int]] // then we need to fail, because we don't know the prefix to use during type reification // upd. we also need to fail silently, because this is a very common situation // e.g. quite often we're searching for BaseUniverse#TypeTag, e.g. for a type tag in any universe diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index e096b75d6d..d724164715 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -1366,14 +1366,16 @@ trait Infer { else if (param.isContravariant) >:> else =:= ) - val TypeRef(_, sym, args) = arg - - ( isLocalBinding(sym) - || arg.typeSymbol.isTypeParameterOrSkolem - || (sym.name == tpnme.WILDCARD) // avoid spurious warnings on HK types - || check(arg, param.tpe, conforms) - || warn("non-variable type argument " + arg) - ) + (arg hasAnnotation UncheckedClass) || { + val TypeRef(_, sym, args) = arg.withoutAnnotations + + ( isLocalBinding(sym) + || arg.typeSymbol.isTypeParameterOrSkolem + || (sym.name == tpnme.WILDCARD) // avoid spurious warnings on HK types + || check(arg, param.tpe, conforms) + || warn("non-variable type argument " + arg) + ) + } } // Checking if pt (the expected type of the pattern, and the type @@ -1404,8 +1406,11 @@ trait Infer { case _ => def where = ( if (inPattern) "pattern " else "" ) + typeToTest if (check(typeToTest, typeEnsured, =:=)) () + // Note that this is a regular warning, not an uncheckedWarning, + // which is now the province of such notifications as "pattern matcher + // exceeded its analysis budget." else warningMessages foreach (m => - context.unit.uncheckedWarning(tree.pos, s"$m in type $where is unchecked since it is eliminated by erasure")) + context.unit.warning(tree.pos, s"$m in type $where is unchecked since it is eliminated by erasure")) } } diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala index d33857371d..7c5d458fee 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala @@ -8,7 +8,7 @@ import scala.reflect.runtime.ReflectionUtils import scala.collection.mutable.ListBuffer import scala.compat.Platform.EOL import reflect.internal.util.Statistics -import scala.reflect.makro.util._ +import scala.reflect.macros.util._ import java.lang.{Class => jClass} import java.lang.reflect.{Array => jArray, Method => jMethod} @@ -23,8 +23,8 @@ import java.lang.reflect.{Array => jArray, Method => jMethod} * * Then fooBar needs to point to a static method of the following form: * - * def fooBar[T: c.TypeTag] - * (c: scala.reflect.makro.Context) + * def fooBar[T: c.AbsTypeTag] + * (c: scala.reflect.macros.Context) * (xs: c.Expr[List[T]]) * : c.Expr[T] = { * ... @@ -51,7 +51,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { /** A list of compatible macro implementation signatures. * * In the example above: - * (c: scala.reflect.makro.Context)(xs: c.Expr[List[T]]): c.Expr[T] + * (c: scala.reflect.macros.Context)(xs: c.Expr[List[T]]): c.Expr[T] * * @param macroDef The macro definition symbol * @param tparams The type parameters of the macro definition @@ -156,7 +156,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { case TypeRef(SingleType(NoPrefix, contextParam), sym, List(tparam)) => var wannabe = sym while (wannabe.isAliasType) wannabe = wannabe.info.typeSymbol - if (wannabe != definitions.AbsTypeTagClass && wannabe != definitions.TypeTagClass) + if (wannabe != definitions.AbsTypeTagClass) List(param) else transform(param, tparam.typeSymbol) map (_ :: Nil) getOrElse Nil @@ -202,7 +202,6 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { def abbreviateCoreAliases: String = { // hack! var result = s result = result.replace("c.universe.AbsTypeTag", "c.AbsTypeTag") - result = result.replace("c.universe.TypeTag", "c.TypeTag") result = result.replace("c.universe.Expr", "c.Expr") result } @@ -440,7 +439,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { // we don't have to do this, but it appears to be more clear than allowing them val implicitParams = actparamss.flatten filter (_.isImplicit) if (implicitParams.length > 0) { - reportError(implicitParams.head.pos, "macro implementations cannot have implicit parameters other than TypeTag evidences") + reportError(implicitParams.head.pos, "macro implementations cannot have implicit parameters other than AbsTypeTag evidences") macroTraceVerbose("macro def failed to satisfy trivial preconditions: ")(macroDef) } @@ -591,53 +590,34 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { runtimeType } - /** Primary classloader that is used to resolve and run macro implementations. - * Loads classes from -Xmacro-primary-classpath, or from -cp if the option is not specified. + /** Macro classloader that is used to resolve and run macro implementations. + * Loads classes from from -cp (aka the library classpath). * Is also capable of detecting REPL and reusing its classloader. */ - private lazy val primaryClassloader: ClassLoader = { + private lazy val macroClassloader: ClassLoader = { if (global.forMSIL) throw new UnsupportedOperationException("Scala reflection not available on this platform") - if (settings.XmacroPrimaryClasspath.value != "") { - macroLogVerbose("primary macro classloader: initializing from -Xmacro-primary-classpath: %s".format(settings.XmacroPrimaryClasspath.value)) - val classpath = toURLs(settings.XmacroPrimaryClasspath.value) - ScalaClassLoader.fromURLs(classpath, self.getClass.getClassLoader) - } else { - macroLogVerbose("primary macro classloader: initializing from -cp: %s".format(global.classPath.asURLs)) - val classpath = global.classPath.asURLs - var loader: ClassLoader = ScalaClassLoader.fromURLs(classpath, self.getClass.getClassLoader) - - // [Eugene] a heuristic to detect the REPL - if (global.settings.exposeEmptyPackage.value) { - macroLogVerbose("primary macro classloader: initializing from a REPL classloader".format(global.classPath.asURLs)) - import scala.tools.nsc.interpreter._ - val virtualDirectory = global.settings.outputDirs.getSingleOutput.get - loader = new AbstractFileClassLoader(virtualDirectory, loader) {} - } + val classpath = global.classPath.asURLs + macroLogVerbose("macro classloader: initializing from -cp: %s".format(classpath)) + val loader = ScalaClassLoader.fromURLs(classpath, self.getClass.getClassLoader) + // [Eugene] a heuristic to detect the REPL + if (global.settings.exposeEmptyPackage.value) { + macroLogVerbose("macro classloader: initializing from a REPL classloader".format(global.classPath.asURLs)) + import scala.tools.nsc.interpreter._ + val virtualDirectory = global.settings.outputDirs.getSingleOutput.get + new AbstractFileClassLoader(virtualDirectory, loader) {} + } else { loader } } - /** Fallback classloader that is used to resolve and run macro implementations when `primaryClassloader` fails. - * Loads classes from -Xmacro-fallback-classpath. - */ - private lazy val fallbackClassloader: ClassLoader = { - if (global.forMSIL) - throw new UnsupportedOperationException("Scala reflection not available on this platform") - - macroLogVerbose("fallback macro classloader: initializing from -Xmacro-fallback-classpath: %s".format(settings.XmacroFallbackClasspath.value)) - val classpath = toURLs(settings.XmacroFallbackClasspath.value) - ScalaClassLoader.fromURLs(classpath, self.getClass.getClassLoader) - } - /** Produces a function that can be used to invoke macro implementation for a given macro definition: * 1) Looks up macro implementation symbol in this universe. - * 2) Loads its enclosing class from the primary classloader. - * 3) Loads the companion of that enclosing class from the primary classloader. + * 2) Loads its enclosing class from the macro classloader. + * 3) Loads the companion of that enclosing class from the macro classloader. * 4) Resolves macro implementation within the loaded companion. - * 5) If 2-4 fails, repeats them for the fallback classloader. * * @return Some(runtime) if macro implementation can be loaded successfully from either of the mirrors, * None otherwise. @@ -742,25 +722,10 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { } } - val primary = loadMacroImpl(primaryClassloader) - primary match { - case Some((implObj, implMeth)) => + loadMacroImpl(macroClassloader) map { + case (implObj, implMeth) => def runtime(args: List[Any]) = implMeth.invoke(implObj, (args map (_.asInstanceOf[AnyRef])): _*).asInstanceOf[Any] - Some(runtime _) - case None => - if (settings.XmacroFallbackClasspath.value != "") { - macroLogVerbose("trying to load macro implementation from the fallback mirror: %s".format(settings.XmacroFallbackClasspath.value)) - val fallback = loadMacroImpl(fallbackClassloader) - fallback match { - case Some((implObj, implMeth)) => - def runtime(args: List[Any]) = implMeth.invoke(implObj, (args map (_.asInstanceOf[AnyRef])): _*).asInstanceOf[Any] - Some(runtime _) - case None => - None - } - } else { - None - } + runtime _ } } @@ -888,9 +853,6 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { param.tpe.typeSymbol match { case definitions.AbsTypeTagClass => // do nothing - case definitions.TypeTagClass => - if (!tpe.isConcrete) context.abort(context.enclosingPosition, "cannot create TypeTag from a type %s having unresolved type parameters".format(tpe)) - // otherwise do nothing case _ => throw new Error("unsupported tpe: " + tpe) } @@ -913,7 +875,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { } /** Keeps track of macros in-flight. - * See more informations in comments to ``openMacros'' in ``scala.reflect.makro.Context''. + * See more informations in comments to ``openMacros'' in ``scala.reflect.macros.Context''. */ var openMacros = List[MacroContext]() def enclosingMacroPosition = openMacros map (_.macroApplication.pos) find (_ ne NoPosition) getOrElse NoPosition @@ -1053,7 +1015,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { ) val forgotten = ( if (sym.isTerm) "splice when splicing this variable into a reifee" - else "c.TypeTag annotation for this type parameter" + else "c.AbsTypeTag annotation for this type parameter" ) typer.context.error(expandee.pos, template.replaceAllLiterally("@kind@", sym.name.nameKind).format( @@ -1147,9 +1109,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { val macroDef = expandee.symbol def notFound() = { typer.context.error(expandee.pos, "macro implementation not found: " + macroDef.name + " " + - "(the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)\n" + - "if you do need to define macro implementations along with the rest of your program, consider two-phase compilation with -Xmacro-fallback-classpath " + - "in the second phase pointing to the output of the first phase") + "(the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)") None } def fallBackToOverridden(tree: Tree): Option[Tree] = { @@ -1191,7 +1151,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { // [Eugene] any ideas about how to improve this one? val realex = ReflectionUtils.unwrapThrowable(ex) realex match { - case realex: reflect.makro.runtime.AbortMacroException => + case realex: reflect.macros.runtime.AbortMacroException => macroLogVerbose("macro expansion has failed: %s".format(realex.msg)) fail(typer, expandee) // error has been reported by abort case err: TypeError => diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala index 7bd5f4caeb..dd180e6b76 100644 --- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala +++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ package scala.tools.nsc @@ -70,11 +70,8 @@ trait MethodSynthesis { // [Eugene++->Martin] now this compiles, will soon check it out def newMethodType[F](owner: Symbol)(implicit t: TT[F]): Type = { val fnSymbol = compilerSymbolFromTag(t) - assert(fnSymbol isSubClass FunctionClass(t.tpe.typeArguments.size - 1), (owner, t)) - // [Eugene++ to Paul] needs review!! - // val symbols = m.typeArguments map (m => manifestToSymbol(m)) - // val formals = symbols.init map (_.typeConstructor) val formals = compilerTypeFromTag(t).typeArguments + assert(fnSymbol isSubClass FunctionClass(formals.size - 1), (owner, t)) val params = owner newSyntheticValueParams formals MethodType(params, formals.last) } diff --git a/src/compiler/scala/tools/nsc/typechecker/Modes.scala b/src/compiler/scala/tools/nsc/typechecker/Modes.scala index 3eff5ef024..e9ea99faab 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Modes.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Modes.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index dc9f07cad9..efb96b173c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -983,15 +983,10 @@ trait Namers extends MethodSynthesis { } addDefaultGetters(meth, vparamss, tparams, overriddenSymbol) - // macro defs need to be typechecked in advance - // because @macroImpl annotation only gets assigned during typechecking - // otherwise we might find ourselves in the situation when we specified -Xmacro-fallback-classpath - // but macros still don't expand - // that might happen because macro def doesn't have its link a macro impl yet - if (ddef.symbol.isTermMacro) { - val pt = resultPt.substSym(tparamSyms, tparams map (_.symbol)) - typer.computeMacroDefType(ddef, pt) - } + // fast track macros, i.e. macros defined inside the compiler, are hardcoded + // hence we make use of that and let them have whatever right-hand side they need + // (either "macro ???" as they used to or just "???" to maximally simplify their compilation) + if (fastTrack contains ddef.symbol) ddef.symbol setFlag MACRO thisMethodType({ val rt = ( diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala index a0c1342026..7ba198a9f2 100644 --- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala +++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala index cf5c7265ad..8599db2121 100644 --- a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala +++ b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala @@ -1,6 +1,6 @@ /* NSC -- new Scala compiler * - * Copyright 2012 LAMP/EPFL + * Copyright 2011-2012 LAMP/EPFL * @author Adriaan Moors */ @@ -113,7 +113,6 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL import definitions._ import analyzer._ //Typer - val SYNTH_CASE = Flags.CASE | SYNTHETIC case class DefaultOverrideMatchAttachment(default: Tree) @@ -241,7 +240,8 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL // append the default to the list of cases and suppress the unreachable case error that may arise (once we detect that...) val matchFailGenOverride = match_.attachments.get[DefaultOverrideMatchAttachment].map{case DefaultOverrideMatchAttachment(default) => ((scrut: Tree) => default)} - val selectorSym = freshSym(selector.pos, pureType(selectorTp)) setFlag SYNTH_CASE + val selectorSym = freshSym(selector.pos, pureType(selectorTp)) setFlag treeInfo.SYNTH_CASE_FLAGS + // pt = Any* occurs when compiling test/files/pos/annotDepMethType.scala with -Xexperimental val combined = combineCases(selector, selectorSym, cases map translateCase(selectorSym, pt), pt, matchOwner, matchFailGenOverride) @@ -1043,8 +1043,9 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL def outerTest(testedBinder: Symbol, expectedTp: Type): Tree = { val expectedOuter = expectedTp.prefix match { - case ThisType(clazz) => THIS(clazz) - case pre => REF(pre.prefix, pre.termSymbol) + case ThisType(clazz) => THIS(clazz) + case pre if pre != NoType => REF(pre.prefix, pre.termSymbol) + case _ => TRUE_typed // fallback for SI-6183 } // ExplicitOuter replaces `Select(q, outerSym) OBJ_EQ expectedPrefix` by `Select(q, outerAccessor(outerSym.owner)) OBJ_EQ expectedPrefix` @@ -1228,7 +1229,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL if (settings.XnoPatmatAnalysis.value) (true, false) else scrut match { case Typed(_, tpt) => - (treeInfo.isUncheckedAnnotation(tpt.tpe), + (tpt.tpe hasAnnotation UncheckedClass, // matches with two or fewer cases need not apply for switchiness (if-then-else will do) treeInfo.isSwitchAnnotation(tpt.tpe) && casesNoSubstOnly.lengthCompare(2) > 0) case _ => @@ -1317,6 +1318,9 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL def freshSym(pos: Position, tp: Type = NoType, prefix: String = "x") = NoSymbol.newTermSymbol(freshName(prefix), pos) setInfo tp + def newSynthCaseLabel(name: String) = + NoSymbol.newLabel(freshName(name), NoPosition) setFlag treeInfo.SYNTH_CASE_FLAGS + // codegen relevant to the structure of the translation (how extractors are combined) trait AbsCodegen { def matcher(scrut: Tree, scrutSym: Symbol, restpe: Type)(cases: List[Casegen => Tree], matchFailGen: Option[Tree => Tree]): Tree @@ -1487,7 +1491,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL case object FalseCond extends Cond {override def toString = "F"} case class AndCond(a: Cond, b: Cond) extends Cond {override def toString = a +"/\\"+ b} - case class OrCond(a: Cond, b: Cond) extends Cond {override def toString = "("+a+") \\/ ("+ b +")"} + case class OrCond(a: Cond, b: Cond) extends Cond {override def toString = "("+a+") \\/ ("+ b +")"} object EqualityCond { private val uniques = new collection.mutable.HashMap[(Tree, Tree), EqualityCond] @@ -3109,7 +3113,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL } } - private val defaultLabel: Symbol = NoSymbol.newLabel(freshName("default"), NoPosition) setFlag SYNTH_CASE + private val defaultLabel: Symbol = newSynthCaseLabel("default") /** Collapse guarded cases that switch on the same constant (the last case may be unguarded). * @@ -3477,11 +3481,11 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL * if keepGoing is false, the result Some(x) of the naive translation is encoded as matchRes == x */ def matcher(scrut: Tree, scrutSym: Symbol, restpe: Type)(cases: List[Casegen => Tree], matchFailGen: Option[Tree => Tree]): Tree = { - val matchEnd = NoSymbol.newLabel(freshName("matchEnd"), NoPosition) setFlag SYNTH_CASE + val matchEnd = newSynthCaseLabel("matchEnd") val matchRes = NoSymbol.newValueParameter(newTermName("x"), NoPosition, SYNTHETIC) setInfo restpe.withoutAnnotations // matchEnd setInfo MethodType(List(matchRes), restpe) - def newCaseSym = NoSymbol.newLabel(freshName("case"), NoPosition) setInfo MethodType(Nil, restpe) setFlag SYNTH_CASE + def newCaseSym = newSynthCaseLabel("case") setInfo MethodType(Nil, restpe) var _currCase = newCaseSym val caseDefs = cases map { (mkCase: Casegen => Tree) => diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 3518316fbb..41387b7507 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -122,7 +122,7 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R val defaultGetters = clazz.info.findMembers(0L, DEFAULTPARAM) val defaultMethodNames = defaultGetters map (sym => nme.defaultGetterToMethod(sym.name)) - defaultMethodNames.distinct foreach { name => + defaultMethodNames.toList.distinct foreach { name => val methods = clazz.info.findMember(name, 0L, METHOD, false).alternatives val haveDefaults = methods filter (sym => sym.hasParamWhich(_.hasDefault) && !nme.isProtectedAccessorName(sym.name)) @@ -628,7 +628,7 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R matchingArity match { // So far so good: only one candidate method - case concrete :: Nil => + case Scope(concrete) => val mismatches = abstractParams zip concrete.tpe.paramTypes filterNot { case (x, y) => x =:= y } mismatches match { // Only one mismatched parameter: say something useful. @@ -1541,7 +1541,8 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R transform(qual) case Apply(fn, args) => - checkSensible(tree.pos, fn, args) + // sensicality should be subsumed by the unreachability/exhaustivity/irrefutability analyses in the pattern matcher + if (!inPattern) checkSensible(tree.pos, fn, args) currentApplication = tree tree } @@ -1718,7 +1719,7 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R val pat1 = transform(pat) inPattern = false treeCopy.CaseDef(tree, pat1, transform(guard), transform(body)) - case LabelDef(_, _, _) if gen.hasSynthCaseSymbol(result) => + case LabelDef(_, _, _) if treeInfo.hasSynthCaseSymbol(result) => val old = inPattern inPattern = true val res = deriveLabelDef(result)(transform) diff --git a/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala b/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala index 190b18711c..64c5b41638 100644 --- a/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala +++ b/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala @@ -4,7 +4,7 @@ package typechecker trait StdAttachments { self: Analyzer => - type UnaffiliatedMacroContext = scala.reflect.makro.runtime.Context + type UnaffiliatedMacroContext = scala.reflect.macros.runtime.Context type MacroContext = UnaffiliatedMacroContext { val universe: self.global.type } case class MacroRuntimeAttachment(delayed: Boolean, typerContext: Context, macroContext: Option[MacroContext]) }
\ No newline at end of file diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala index b544407286..92c50a05c2 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala index 5465a3b47f..c7c9d2f4aa 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/typechecker/Tags.scala b/src/compiler/scala/tools/nsc/typechecker/Tags.scala index 052484e8e1..f82e009be8 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Tags.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Tags.scala @@ -61,7 +61,7 @@ trait Tags { */ def resolveTypeTag(pos: Position, pre: Type, tp: Type, concrete: Boolean, allowMaterialization: Boolean = true): Tree = { val tagSym = if (concrete) TypeTagClass else AbsTypeTagClass - val tagTp = if (pre == NoType) TypeRef(BaseUniverseClass.asTypeConstructor, tagSym, List(tp)) else singleType(pre, pre member tagSym.name) + val tagTp = if (pre == NoType) TypeRef(BaseUniverseClass.toTypeConstructor, tagSym, List(tp)) else singleType(pre, pre member tagSym.name) val taggedTp = appliedType(tagTp, List(tp)) resolveTag(pos, taggedTp, allowMaterialization) } diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala index fe82af5b23..07d457b17b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala index 38c2c5f719..4a0977eb90 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ @@ -401,7 +401,11 @@ trait TypeDiagnostics { object checkDead { private var expr: Symbol = NoSymbol - private def exprOK = expr != Object_synchronized + + private def exprOK = + (expr != Object_synchronized) && + !(expr.isLabel && treeInfo.isSynthCaseSymbol(expr)) // it's okay to jump to matchEnd (or another case) with an argument of type nothing + private def treeOK(tree: Tree) = tree.tpe != null && tree.tpe.typeSymbol == NothingClass def updateExpr(fn: Tree) = { diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index e57cae00e0..a6d7424837 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -92,8 +92,8 @@ trait Typers extends Modes with Adaptations with Tags { // when true: // - we may virtualize matches (if -Xexperimental and there's a suitable __match in scope) // - we synthesize PartialFunction implementations for `x => x match {...}` and `match {...}` when the expected type is PartialFunction - // this is disabled by: -Xoldpatmat, scaladoc or interactive compilation - @inline private def newPatternMatching = opt.virtPatmat && !forScaladoc && !forInteractive // && (phase.id < currentRun.uncurryPhase.id) + // this is disabled by: -Xoldpatmat or interactive compilation (we run it for scaladoc due to SI-5933) + @inline private def newPatternMatching = opt.virtPatmat && !forInteractive //&& !forScaladoc && (phase.id < currentRun.uncurryPhase.id) abstract class Typer(context0: Context) extends TyperDiagnostics with Adaptation with Tag with TyperContextErrors { import context0.unit @@ -769,7 +769,7 @@ trait Typers extends Modes with Adaptations with Tags { val featureName = (nestedOwners map (_.name + ".")).mkString + featureTrait.name def action(): Boolean = { def hasImport = inferImplicit(EmptyTree: Tree, featureTrait.tpe, true, false, context) != SearchFailure - def hasOption = settings.language.value contains featureName + def hasOption = settings.language.value exists (s => s == featureName || s == "_") val OK = hasImport || hasOption if (!OK) { val Some(AnnotationInfo(_, List(Literal(Constant(featureDesc: String)), Literal(Constant(required: Boolean))), _)) = @@ -1551,10 +1551,15 @@ trait Typers extends Modes with Adaptations with Tags { */ def validateParentClasses(parents: List[Tree], selfType: Type) { val pending = ListBuffer[AbsTypeError]() - def validateParentClass(parent: Tree, superclazz: Symbol) { + @inline def validateDynamicParent(parent: Symbol) = + if (parent == DynamicClass) checkFeature(parent.pos, DynamicsFeature) + + def validateParentClass(parent: Tree, superclazz: Symbol) = if (!parent.isErrorTyped) { val psym = parent.tpe.typeSymbol.initialize + checkStablePrefixClassType(parent) + if (psym != superclazz) { if (psym.isTrait) { val ps = psym.info.parents @@ -1564,6 +1569,7 @@ trait Typers extends Modes with Adaptations with Tags { pending += ParentNotATraitMixinError(parent, psym) } } + if (psym.isFinal) pending += ParentFinalInheritanceError(parent, psym) @@ -1586,12 +1592,17 @@ trait Typers extends Modes with Adaptations with Tags { pending += ParentSelfTypeConformanceError(parent, selfType) if (settings.explaintypes.value) explainTypes(selfType, parent.tpe.typeOfThis) } + if (parents exists (p => p != parent && p.tpe.typeSymbol == psym && !psym.isError)) pending += ParentInheritedTwiceError(parent, psym) + + validateDynamicParent(psym) } + + if (!parents.isEmpty && parents.forall(!_.isErrorTyped)) { + val superclazz = parents.head.tpe.typeSymbol + for (p <- parents) validateParentClass(p, superclazz) } - if (!parents.isEmpty && parents.forall(!_.isErrorTyped)) - for (p <- parents) validateParentClass(p, parents.head.tpe.typeSymbol) /* if (settings.Xshowcls.value != "" && @@ -2286,7 +2297,7 @@ trait Typers extends Modes with Adaptations with Tags { // but not in real life (i.e., now that's we've reset the method's type skolems' // infos back to their pre-GADT-constraint state) if (isFullyDefined(pt) && !(body1.tpe <:< pt)) - body1 = typedPos(body1.pos)(gen.mkCast(body1, pt)) + body1 = typedPos(body1.pos)(gen.mkCast(body1, pt.normalize)) } @@ -3220,7 +3231,7 @@ trait Typers extends Modes with Adaptations with Tags { // we don't create a new Context for a Match, so find the CaseDef, then go out one level and navigate back to the match that has this case // val thisCase = context.nextEnclosing(_.tree.isInstanceOf[CaseDef]) // val unchecked = thisCase.outer.tree.collect{case Match(selector, cases) if cases contains thisCase => selector} match { - // case List(Typed(_, tpt)) if treeInfo.isUncheckedAnnotation(tpt.tpe) => true + // case List(Typed(_, tpt)) if tpt.tpe hasAnnotation UncheckedClass => true // case t => println("outer tree: "+ (t, thisCase, thisCase.outer.tree)); false // } // println("wrapClassTagUnapply"+ (!isPastTyper && infer.containsUnchecked(pt), pt, uncheckedPattern)) @@ -4522,7 +4533,9 @@ trait Typers extends Modes with Adaptations with Tags { }) setType qual.tpe setPos qual.pos, name) case _ if accessibleError.isDefined => - val qual1 = adaptToMemberWithArgs(tree, qual, name, mode, false, false) + // don't adapt constructor, SI-6074 + val qual1 = if (name == nme.CONSTRUCTOR) qual + else adaptToMemberWithArgs(tree, qual, name, mode, false, false) if (!qual1.isErrorTyped && (qual1 ne qual)) typed(Select(qual1, name) setPos tree.pos, mode, pt) else @@ -5089,7 +5102,7 @@ trait Typers extends Modes with Adaptations with Tags { // convert new Array^N[T](len) for N > 1 to evidence[ClassTag[Array[...Array[T]...]]].newArray(len), where Array HK gets applied (N-1) times // [Eugene] no more MaxArrayDims. ClassTags are flexible enough to allow creation of arrays of arbitrary dimensionality (w.r.t JVM restrictions) val Some((level, componentType)) = erasure.GenericArray.unapply(tpt.tpe) - val tagType = List.iterate(componentType, level)(tpe => appliedType(ArrayClass.asType, List(tpe))).last + val tagType = List.iterate(componentType, level)(tpe => appliedType(ArrayClass.toTypeConstructor, List(tpe))).last val newArrayApp = atPos(tree.pos) { val tag = resolveClassTag(tree.pos, tagType) if (tag.isEmpty) MissingClassTagError(tree, tagType) diff --git a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala index d508e10813..4871ef199c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/typechecker/Variances.scala b/src/compiler/scala/tools/nsc/typechecker/Variances.scala index 1ba0de0192..b9f2b9abd8 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Variances.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Variances.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/util/CharArrayReader.scala b/src/compiler/scala/tools/nsc/util/CharArrayReader.scala index 153334b5e1..d0927ae6f6 100644 --- a/src/compiler/scala/tools/nsc/util/CharArrayReader.scala +++ b/src/compiler/scala/tools/nsc/util/CharArrayReader.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala index 9755fb6c60..1c7a723f7f 100644 --- a/src/compiler/scala/tools/nsc/util/ClassPath.scala +++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2006-2011 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/util/CommandLineParser.scala b/src/compiler/scala/tools/nsc/util/CommandLineParser.scala index 78bfd5e908..de4b3d5d62 100644 --- a/src/compiler/scala/tools/nsc/util/CommandLineParser.scala +++ b/src/compiler/scala/tools/nsc/util/CommandLineParser.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/util/DocStrings.scala b/src/compiler/scala/tools/nsc/util/DocStrings.scala index c88414c423..b096e1bc03 100755 --- a/src/compiler/scala/tools/nsc/util/DocStrings.scala +++ b/src/compiler/scala/tools/nsc/util/DocStrings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2006-2011 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/util/FreshNameCreator.scala b/src/compiler/scala/tools/nsc/util/FreshNameCreator.scala index 16bf748414..554a96d627 100644 --- a/src/compiler/scala/tools/nsc/util/FreshNameCreator.scala +++ b/src/compiler/scala/tools/nsc/util/FreshNameCreator.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/util/JavaCharArrayReader.scala b/src/compiler/scala/tools/nsc/util/JavaCharArrayReader.scala index 0dd1f23570..33a3e7f70f 100644 --- a/src/compiler/scala/tools/nsc/util/JavaCharArrayReader.scala +++ b/src/compiler/scala/tools/nsc/util/JavaCharArrayReader.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/util/MsilClassPath.scala b/src/compiler/scala/tools/nsc/util/MsilClassPath.scala index 6215506141..fb55c7aa1a 100644 --- a/src/compiler/scala/tools/nsc/util/MsilClassPath.scala +++ b/src/compiler/scala/tools/nsc/util/MsilClassPath.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2006-2011 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala b/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala index 5b30d9aacd..25caae9ecb 100644 --- a/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala +++ b/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/nsc/util/ShowPickled.scala b/src/compiler/scala/tools/nsc/util/ShowPickled.scala index 53ed96d0d3..d1f3183f68 100644 --- a/src/compiler/scala/tools/nsc/util/ShowPickled.scala +++ b/src/compiler/scala/tools/nsc/util/ShowPickled.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/util/StatisticsInfo.scala b/src/compiler/scala/tools/nsc/util/StatisticsInfo.scala index f6a1ae1414..8cdb96c586 100644 --- a/src/compiler/scala/tools/nsc/util/StatisticsInfo.scala +++ b/src/compiler/scala/tools/nsc/util/StatisticsInfo.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/util/TreeSet.scala b/src/compiler/scala/tools/nsc/util/TreeSet.scala index c816d1eed4..ab1142211f 100644 --- a/src/compiler/scala/tools/nsc/util/TreeSet.scala +++ b/src/compiler/scala/tools/nsc/util/TreeSet.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/compiler/scala/tools/nsc/util/package.scala b/src/compiler/scala/tools/nsc/util/package.scala index 2229b8d997..876fb18578 100644 --- a/src/compiler/scala/tools/nsc/util/package.scala +++ b/src/compiler/scala/tools/nsc/util/package.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/reflect/FastTrack.scala b/src/compiler/scala/tools/reflect/FastTrack.scala index 237ef813c7..f84877cccb 100644 --- a/src/compiler/scala/tools/reflect/FastTrack.scala +++ b/src/compiler/scala/tools/reflect/FastTrack.scala @@ -28,7 +28,7 @@ trait FastTrack { def run(args: List[Any]): Any = { val c = args(0).asInstanceOf[MacroContext] val result = expander((c, c.expandee)) - c.Expr[Nothing](result)(c.TypeTag.Nothing) + c.Expr[Nothing](result)(c.AbsTypeTag.Nothing) } } @@ -38,7 +38,7 @@ trait FastTrack { MacroInternal_materializeClassTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeClassTag(u, tt.tpe) } MacroInternal_materializeAbsTypeTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeTypeTag(u, EmptyTree, tt.tpe, concrete = false) } MacroInternal_materializeTypeTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeTypeTag(u, EmptyTree, tt.tpe, concrete = true) } - ApiUniverseReify bindTo { case (c, Apply(TypeApply(_, List(tt)), List(expr))) => c.materializeExpr(c.prefix.tree, EmptyTree, expr) } + BaseUniverseReify bindTo { case (c, Apply(TypeApply(_, List(tt)), List(expr))) => c.materializeExpr(c.prefix.tree, EmptyTree, expr) } ReflectRuntimeCurrentMirror bindTo { case (c, _) => scala.reflect.runtime.Macros.currentMirror(c).tree } StringContext_f bindTo { case (c, app@Apply(Select(Apply(_, parts), _), args)) => c.macro_StringInterpolation_f(parts, args, app.pos) } registry diff --git a/src/compiler/scala/tools/reflect/MacroImplementations.scala b/src/compiler/scala/tools/reflect/MacroImplementations.scala index e1b959cefa..40ceefcc70 100644 --- a/src/compiler/scala/tools/reflect/MacroImplementations.scala +++ b/src/compiler/scala/tools/reflect/MacroImplementations.scala @@ -1,7 +1,7 @@ package scala.tools.reflect -import scala.reflect.makro.{ReificationError, UnexpectedReificationError} -import scala.reflect.makro.runtime.Context +import scala.reflect.macros.{ReificationError, UnexpectedReificationError} +import scala.reflect.macros.runtime.Context import scala.collection.mutable.ListBuffer import scala.collection.mutable.Stack @@ -25,9 +25,9 @@ abstract class MacroImplementations { c.abort(args(parts.length-1).pos, "too many arguments for interpolated string") } - val stringParts = parts map { + val stringParts = parts map { case Literal(Constant(s: String)) => s; - case _ => throw new IllegalArgumentException("argument parts must be a list of string literals") + case _ => throw new IllegalArgumentException("argument parts must be a list of string literals") } val pi = stringParts.iterator diff --git a/src/compiler/scala/tools/reflect/StdTags.scala b/src/compiler/scala/tools/reflect/StdTags.scala index 25a42a82cd..0704189ddc 100644 --- a/src/compiler/scala/tools/reflect/StdTags.scala +++ b/src/compiler/scala/tools/reflect/StdTags.scala @@ -20,7 +20,7 @@ trait StdTags { def apply[U <: BaseUniverse with Singleton](m: MirrorOf[U]): U # Type = { val u = m.universe val pre = u.ThisType(m.staticPackage("scala.collection.immutable").moduleClass.asInstanceOf[u.Symbol]) - u.TypeRef(pre, u.definitions.ListClass, List(u.definitions.StringClass.asTypeConstructor)) + u.TypeRef(pre, u.definitions.ListClass, List(u.definitions.StringClass.toTypeConstructor)) } }) @@ -29,7 +29,7 @@ trait StdTags { m, new TypeCreator { def apply[U <: BaseUniverse with Singleton](m: MirrorOf[U]): U # Type = - m.staticClass(classTag[T].runtimeClass.getName).asTypeConstructor.asInstanceOf[U # Type] + m.staticClass(classTag[T].runtimeClass.getName).toTypeConstructor.asInstanceOf[U # Type] }) lazy val tagOfInt = u.TypeTag.Int lazy val tagOfString = tagOfStaticClass[String] @@ -52,7 +52,7 @@ object StdRuntimeTags extends StdTags { } abstract class StdContextTags extends StdTags { - val tc: scala.reflect.makro.Context + val tc: scala.reflect.macros.Context val u: tc.universe.type = tc.universe val m = tc.mirror } diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala index 6c48762200..eeec973299 100644 --- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala +++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala @@ -85,7 +85,7 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf => if (tree.hasSymbol && tree.symbol.isFreeTerm) { tree match { case Ident(_) => - val freeTermRef = Ident(freeTermNames(tree.symbol.asFreeTermSymbol)) + val freeTermRef = Ident(freeTermNames(tree.symbol.asFreeTerm)) if (wrapFreeTermRefs) Apply(freeTermRef, List()) else freeTermRef case _ => throw new Error("internal error: %s (%s, %s) is not supported".format(tree, tree.productPrefix, tree.getClass)) @@ -256,7 +256,8 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf => // } val (singleton, jmeth) = compileExpr(expr) val result = jmeth.invoke(singleton, thunks map (_.asInstanceOf[AnyRef]): _*) - result + if (jmeth.getReturnType == java.lang.Void.TYPE) () + else result } def parseExpr(code: String): Tree = { @@ -350,7 +351,7 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf => } def inferImplicitView(tree: u.Tree, from: u.Type, to: u.Type, silent: Boolean = true, withMacrosDisabled: Boolean = false, pos: u.Position = u.NoPosition): u.Tree = { - val viewTpe = u.appliedType(u.definitions.FunctionClass(1).asTypeConstructor, List(from, to)) + val viewTpe = u.appliedType(u.definitions.FunctionClass(1).toTypeConstructor, List(from, to)) inferImplicit(tree, viewTpe, isView = true, silent = silent, withMacrosDisabled = withMacrosDisabled, pos = pos) } diff --git a/src/compiler/scala/tools/reflect/WrappedProperties.scala b/src/compiler/scala/tools/reflect/WrappedProperties.scala index 45c1b57d71..6610b9476e 100644 --- a/src/compiler/scala/tools/reflect/WrappedProperties.scala +++ b/src/compiler/scala/tools/reflect/WrappedProperties.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2006-2011 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/reflect/package.scala b/src/compiler/scala/tools/reflect/package.scala index a3778a3b69..3008930823 100644 --- a/src/compiler/scala/tools/reflect/package.scala +++ b/src/compiler/scala/tools/reflect/package.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/util/Javap.scala b/src/compiler/scala/tools/util/Javap.scala index f4f218350a..ce149a5aa0 100644 --- a/src/compiler/scala/tools/util/Javap.scala +++ b/src/compiler/scala/tools/util/Javap.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/compiler/scala/tools/util/PathResolver.scala b/src/compiler/scala/tools/util/PathResolver.scala index 5f4e6d58c3..739878c282 100644 --- a/src/compiler/scala/tools/util/PathResolver.scala +++ b/src/compiler/scala/tools/util/PathResolver.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2006-2011 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL * @author Paul Phillips */ @@ -194,7 +194,7 @@ class PathResolver(settings: Settings, context: JavaContext) { def scalaBootClassPath = cmdLineOrElse("bootclasspath", Defaults.scalaBootClassPath) def scalaExtDirs = cmdLineOrElse("extdirs", Defaults.scalaExtDirs) /** Scaladoc doesn't need any bootstrapping, otherwise will create errors such as: - * [scaladoc] ../scala-trunk/src/reflect/scala/reflect/makro/Reifiers.scala:89: error: object api is not a member of package reflect + * [scaladoc] ../scala-trunk/src/reflect/scala/reflect/macros/Reifiers.scala:89: error: object api is not a member of package reflect * [scaladoc] case class ReificationError(val pos: reflect.api.PositionApi, val msg: String) extends Throwable(msg) * [scaladoc] ^ * because the bootstrapping will look at the sourcepath and create package "reflect" in "<root>" diff --git a/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala b/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala index 211560e343..51760d2807 100644 --- a/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala +++ b/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala @@ -99,11 +99,11 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with treeCopy.Block(body, List(transform(selDef)), transformPureMatch(mat, selector, cases)) // virtpatmat - case b@Block(matchStats@((selDef: ValDef) :: cases), matchEnd) if ext.isDefined && pureBody && (matchStats forall gen.hasSynthCaseSymbol) => + case b@Block(matchStats@((selDef: ValDef) :: cases), matchEnd) if ext.isDefined && pureBody && (matchStats forall treeInfo.hasSynthCaseSymbol) => transformPureVirtMatch(b, selDef, cases, matchEnd) // virtpatmat that stores the scrut separately -- TODO: can we eliminate this case?? - case Block(List(selDef0: ValDef), mat@Block(matchStats@((selDef: ValDef) :: cases), matchEnd)) if ext.isDefined && pureBody && (matchStats forall gen.hasSynthCaseSymbol)=> + case Block(List(selDef0: ValDef), mat@Block(matchStats@((selDef: ValDef) :: cases), matchEnd)) if ext.isDefined && pureBody && (matchStats forall treeInfo.hasSynthCaseSymbol)=> treeCopy.Block(body, List(transform(selDef0)), transformPureVirtMatch(mat, selDef, cases, matchEnd)) case _ => @@ -253,7 +253,7 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with // calling each labeldef is wrong, since some labels may be jumped over // we can get away with this for now since the only other labels we emit are for tailcalls/while loops, // which do not have consecutive labeldefs (and thus fall-through is irrelevant) - if (gen.hasSynthCaseSymbol(ldef)) (List(stm1), localTyper.typed{Literal(Constant(()))}, cpsA) + if (treeInfo.hasSynthCaseSymbol(ldef)) (List(stm1), localTyper.typed{Literal(Constant(()))}, cpsA) else { assert(params.isEmpty, "problem in ANF transforming label with non-empty params "+ ldef) (List(stm1), localTyper.typed{Apply(Ident(sym), List())}, cpsA) @@ -469,9 +469,9 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with val (anfStats, anfExpr) = rec(stms, cpsA, List()) // println("\nanf-block:\n"+ ((stms :+ expr) mkString ("{", "\n", "}")) +"\nBECAME\n"+ ((anfStats :+ anfExpr) mkString ("{", "\n", "}"))) - // println("synth case? "+ (anfStats map (t => (t, t.isDef, gen.hasSynthCaseSymbol(t))))) + // println("synth case? "+ (anfStats map (t => (t, t.isDef, treeInfo.hasSynthCaseSymbol(t))))) // SUPER UGLY HACK: handle virtpatmat-style matches, whose labels have already been turned into DefDefs - if (anfStats.nonEmpty && (anfStats forall (t => !t.isDef || gen.hasSynthCaseSymbol(t)))) { + if (anfStats.nonEmpty && (anfStats forall (t => !t.isDef || treeInfo.hasSynthCaseSymbol(t)))) { val (prologue, rest) = (anfStats :+ anfExpr) span (s => !s.isInstanceOf[DefDef]) // find first case // println("rest: "+ rest) // val (defs, calls) = rest partition (_.isInstanceOf[DefDef]) diff --git a/src/detach/plugin/scala/tools/detach/Detach.scala b/src/detach/plugin/scala/tools/detach/Detach.scala index 41a3795a49..376a56beed 100644 --- a/src/detach/plugin/scala/tools/detach/Detach.scala +++ b/src/detach/plugin/scala/tools/detach/Detach.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud */ diff --git a/src/detach/plugin/scala/tools/detach/DetachPlugin.scala b/src/detach/plugin/scala/tools/detach/DetachPlugin.scala index e4e9e6bdfe..d24a96f0ba 100644 --- a/src/detach/plugin/scala/tools/detach/DetachPlugin.scala +++ b/src/detach/plugin/scala/tools/detach/DetachPlugin.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud */ diff --git a/src/eclipse/README.md b/src/eclipse/README.md index 7ef775218b..39a3f457a0 100644 --- a/src/eclipse/README.md +++ b/src/eclipse/README.md @@ -29,7 +29,7 @@ inside `src/library` with the following contents: version.number=2.10.0-20120603-141530-b34313db72 maven.version.number=2.10.0-SNAPSHOT osgi.version.number=2.10.0.v20120603-141530-b34313db72 - copyright.string=Copyright 2002-2011, LAMP/EPFL + copyright.string=Copyright 2002-2012 LAMP/EPFL 4. Project files are tracked by Git, so adding them to `.gitignore` won't prevent them from being shown as dirty in `git status`. You can still ignore them by telling Git to diff --git a/src/fjbg/ch/epfl/lamp/fjbg/FJBGContext.java b/src/fjbg/ch/epfl/lamp/fjbg/FJBGContext.java index 4c5bc27237..6265142a46 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/FJBGContext.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/FJBGContext.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JAccessFlags.java b/src/fjbg/ch/epfl/lamp/fjbg/JAccessFlags.java index 0a48fc1628..1a4406cf5b 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JAccessFlags.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JAccessFlags.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JArrayType.java b/src/fjbg/ch/epfl/lamp/fjbg/JArrayType.java index 85f9408f46..27b7d443a8 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JArrayType.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JArrayType.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JAttribute.java b/src/fjbg/ch/epfl/lamp/fjbg/JAttribute.java index 3b9e5f3a7c..8294cdf783 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JAttribute.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JAttribute.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JAttributeFactory.java b/src/fjbg/ch/epfl/lamp/fjbg/JAttributeFactory.java index b66bbd8bc0..c2736ad76c 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JAttributeFactory.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JAttributeFactory.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JClass.java b/src/fjbg/ch/epfl/lamp/fjbg/JClass.java index 1d0bc0e19b..a588e43440 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JClass.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JClass.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JCode.java b/src/fjbg/ch/epfl/lamp/fjbg/JCode.java index d80f9f5f94..05021c46b3 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JCode.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JCode.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JCodeAttribute.java b/src/fjbg/ch/epfl/lamp/fjbg/JCodeAttribute.java index 153f156c55..76dda2fe76 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JCodeAttribute.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JCodeAttribute.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JCodeIterator.java b/src/fjbg/ch/epfl/lamp/fjbg/JCodeIterator.java index 989c313c3e..452fa8a76e 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JCodeIterator.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JCodeIterator.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JConstantPool.java b/src/fjbg/ch/epfl/lamp/fjbg/JConstantPool.java index ca2985c9e8..7fbe70786e 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JConstantPool.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JConstantPool.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JConstantValueAttribute.java b/src/fjbg/ch/epfl/lamp/fjbg/JConstantValueAttribute.java index 6efd3d7d34..88265c1417 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JConstantValueAttribute.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JConstantValueAttribute.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JEnclosingMethodAttribute.java b/src/fjbg/ch/epfl/lamp/fjbg/JEnclosingMethodAttribute.java index 5536a3bbcd..b8f34bd595 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JEnclosingMethodAttribute.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JEnclosingMethodAttribute.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JExceptionsAttribute.java b/src/fjbg/ch/epfl/lamp/fjbg/JExceptionsAttribute.java index aee34de219..a629947505 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JExceptionsAttribute.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JExceptionsAttribute.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JExtendedCode.java b/src/fjbg/ch/epfl/lamp/fjbg/JExtendedCode.java index d4c5417260..ca859e1042 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JExtendedCode.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JExtendedCode.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JField.java b/src/fjbg/ch/epfl/lamp/fjbg/JField.java index 1456157bc7..314ed70805 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JField.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JField.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JFieldOrMethod.java b/src/fjbg/ch/epfl/lamp/fjbg/JFieldOrMethod.java index 3d2bf87264..dfffc83ed0 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JFieldOrMethod.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JFieldOrMethod.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JInnerClassesAttribute.java b/src/fjbg/ch/epfl/lamp/fjbg/JInnerClassesAttribute.java index 200bf1713b..07dd805166 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JInnerClassesAttribute.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JInnerClassesAttribute.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JLabel.java b/src/fjbg/ch/epfl/lamp/fjbg/JLabel.java index 77148c89aa..5b7c0f9ba7 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JLabel.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JLabel.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JLineNumberTableAttribute.java b/src/fjbg/ch/epfl/lamp/fjbg/JLineNumberTableAttribute.java index af7145939e..05b645dedb 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JLineNumberTableAttribute.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JLineNumberTableAttribute.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JLocalVariable.java b/src/fjbg/ch/epfl/lamp/fjbg/JLocalVariable.java index ab2c8f2c72..d019b6882b 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JLocalVariable.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JLocalVariable.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JLocalVariableTableAttribute.java b/src/fjbg/ch/epfl/lamp/fjbg/JLocalVariableTableAttribute.java index a091898c00..27662f5f68 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JLocalVariableTableAttribute.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JLocalVariableTableAttribute.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JMember.java b/src/fjbg/ch/epfl/lamp/fjbg/JMember.java index 70d6189b4b..5aaf8bbe90 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JMember.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JMember.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JMethod.java b/src/fjbg/ch/epfl/lamp/fjbg/JMethod.java index ad35c76da3..472b9a733a 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JMethod.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JMethod.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JMethodType.java b/src/fjbg/ch/epfl/lamp/fjbg/JMethodType.java index a0197de972..ca9cbb6ba4 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JMethodType.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JMethodType.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JObjectType.java b/src/fjbg/ch/epfl/lamp/fjbg/JObjectType.java index 50ccae79c0..8711588819 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JObjectType.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JObjectType.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JOpcode.java b/src/fjbg/ch/epfl/lamp/fjbg/JOpcode.java index 4c971a1838..8266fd5e6c 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JOpcode.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JOpcode.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JOtherAttribute.java b/src/fjbg/ch/epfl/lamp/fjbg/JOtherAttribute.java index dcee9c2c13..4eb3b48785 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JOtherAttribute.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JOtherAttribute.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JReferenceType.java b/src/fjbg/ch/epfl/lamp/fjbg/JReferenceType.java index 646b0f878d..9cbfe8bddd 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JReferenceType.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JReferenceType.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JSourceFileAttribute.java b/src/fjbg/ch/epfl/lamp/fjbg/JSourceFileAttribute.java index 46090b77e9..037e727837 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JSourceFileAttribute.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JSourceFileAttribute.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JStackMapTableAttribute.java b/src/fjbg/ch/epfl/lamp/fjbg/JStackMapTableAttribute.java index 52881a2502..2034faa3ea 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JStackMapTableAttribute.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JStackMapTableAttribute.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JType.java b/src/fjbg/ch/epfl/lamp/fjbg/JType.java index 2519fc0fe1..25c6b99a52 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JType.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JType.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/fjbg/Main.java b/src/fjbg/ch/epfl/lamp/fjbg/Main.java index d8fcdacd95..cab87c3a3a 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/Main.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/Main.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/fjbg/ch/epfl/lamp/util/ByteArray.java b/src/fjbg/ch/epfl/lamp/util/ByteArray.java index 0605ae7c20..59a3ac9a12 100644 --- a/src/fjbg/ch/epfl/lamp/util/ByteArray.java +++ b/src/fjbg/ch/epfl/lamp/util/ByteArray.java @@ -1,5 +1,5 @@ /* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL + * Copyright 2002-2012 LAMP/EPFL * @author Michel Schinz */ diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala index 6784b630c7..7511b5309d 100644 --- a/src/library/scala/Array.scala +++ b/src/library/scala/Array.scala @@ -439,10 +439,10 @@ object Array extends FallbackArrayBuilding { * example code. * Line 2 is translated into a call to `apply(Int)`, while line 3 is translated into a call to * `update(Int, T)`. - * + * * Two implicit conversions exist in [[scala.Predef]] that are frequently applied to arrays: a conversion * to [[scala.collection.mutable.ArrayOps]] (shown on line 4 of the example above) and a conversion - * to [[scala.collection.mutable.WrappedArray]] (a subtype of [[scala.collections.Seq]]). + * to [[scala.collection.mutable.WrappedArray]] (a subtype of [[scala.collection.Seq]]). * Both types make available many of the standard operations found in the Scala collections API. * The conversion to `ArrayOps` is temporary, as all operations defined on `ArrayOps` return an `Array`, * while the conversion to `WrappedArray` is permanent as all operations return a `WrappedArray`. diff --git a/src/library/scala/Function0.scala b/src/library/scala/Function0.scala index 3690a0e65b..5f87b38057 100644 --- a/src/library/scala/Function0.scala +++ b/src/library/scala/Function0.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ // GENERATED CODE: DO NOT EDIT. -// genprod generated these sources at: Mon Apr 30 07:46:11 PDT 2012 +// genprod generated these sources at: Tue Aug 07 11:54:44 CEST 2012 package scala @@ -33,7 +33,7 @@ package scala * latter can specify inputs which it will not handle. */ -trait Function0[@specialized +R] extends AnyRef { self => +trait Function0[@specialized(Specializable.Primitives) +R] extends AnyRef { self => /** Apply the body of this function to the arguments. * @return the result of function application. */ diff --git a/src/library/scala/Function1.scala b/src/library/scala/Function1.scala index f9b37fc6bd..22393c65dd 100644 --- a/src/library/scala/Function1.scala +++ b/src/library/scala/Function1.scala @@ -32,7 +32,7 @@ package scala */ @annotation.implicitNotFound(msg = "No implicit view available from ${T1} => ${R}.") -trait Function1[@specialized(scala.Int, scala.Long, scala.Float, scala.Double, scala.AnyRef) -T1, @specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double, scala.AnyRef) +R] extends AnyRef { self => +trait Function1[@specialized(scala.Int, scala.Long, scala.Float, scala.Double/*, scala.AnyRef*/) -T1, @specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double/*, scala.AnyRef*/) +R] extends AnyRef { self => /** Apply the body of this function to the argument. * @return the result of function application. */ diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index 44025d5358..f3d36473dd 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -115,8 +115,11 @@ object Predef extends LowPriorityImplicits { @deprecated("This notion doesn't have a corresponding concept in 2.10, because scala.reflect.runtime.universe.TypeTag can capture arbitrary types. Use type tags instead of manifests, and there will be no need in opt manifests.", "2.10.0") val NoManifest = scala.reflect.NoManifest + @deprecated("Use scala.reflect.classTag[T] and scala.reflect.runtime.universe.typeTag[T] instead", "2.10.0") def manifest[T](implicit m: Manifest[T]) = m + @deprecated("Use scala.reflect.classTag[T] instead", "2.10.0") def classManifest[T](implicit m: ClassManifest[T]) = m + @deprecated("This notion doesn't have a corresponding concept in 2.10, because scala.reflect.runtime.universe.TypeTag can capture arbitrary types. Use type tags instead of manifests, and there will be no need in opt manifests.", "2.10.0") def optManifest[T](implicit m: OptManifest[T]) = m // Minor variations on identity functions diff --git a/src/library/scala/StringContext.scala b/src/library/scala/StringContext.scala index 7d37fa4aa1..723d95a499 100644 --- a/src/library/scala/StringContext.scala +++ b/src/library/scala/StringContext.scala @@ -8,8 +8,6 @@ package scala -import language.experimental.macros - /** A class to support string interpolation. * This class supports string interpolation as outlined in Scala SIP-11. * It needs to be fully documented once the SIP is accepted. @@ -99,7 +97,7 @@ case class StringContext(parts: String*) { * format specifier `%%`. */ // The implementation is magically hardwired into `scala.tools.reflect.MacroImplementations.macro_StringInterpolation_f` - def f(args: Any*): String = macro ??? + def f(args: Any*): String = ??? // macro } object StringContext { diff --git a/src/library/scala/Tuple2.scala b/src/library/scala/Tuple2.scala index 5e77127080..35d5a441c8 100644 --- a/src/library/scala/Tuple2.scala +++ b/src/library/scala/Tuple2.scala @@ -16,7 +16,7 @@ package scala * @param _1 Element 1 of this Tuple2 * @param _2 Element 2 of this Tuple2 */ -case class Tuple2[@specialized(Int, Long, Double, Char, Boolean, AnyRef) +T1, @specialized(Int, Long, Double, Char, Boolean, AnyRef) +T2](_1: T1, _2: T2) +case class Tuple2[@specialized(Int, Long, Double, Char, Boolean/*, AnyRef*/) +T1, @specialized(Int, Long, Double, Char, Boolean/*, AnyRef*/) +T2](_1: T1, _2: T2) extends Product2[T1, T2] { override def toString() = "(" + _1 + "," + _2 + ")" diff --git a/src/library/scala/collection/SeqLike.scala b/src/library/scala/collection/SeqLike.scala index c87726ef2c..d7418de9c3 100644 --- a/src/library/scala/collection/SeqLike.scala +++ b/src/library/scala/collection/SeqLike.scala @@ -852,7 +852,7 @@ object SeqLike { /** Finds a particular index at which one sequence occurs in another sequence. * Like `indexOf`, but finds the latest occurrence rather than earliest. * - * @see [[scala.collection.SeqLike], method `indexOf` + * @see [[scala.collection.SeqLike]], method `indexOf` */ def lastIndexOf[B]( source: Seq[B], sourceOffset: Int, sourceCount: Int, diff --git a/src/library/scala/concurrent/ExecutionContext.scala b/src/library/scala/concurrent/ExecutionContext.scala index 8081bb32da..1be6050303 100644 --- a/src/library/scala/concurrent/ExecutionContext.scala +++ b/src/library/scala/concurrent/ExecutionContext.scala @@ -12,6 +12,7 @@ package scala.concurrent import java.util.concurrent.{ ExecutorService, Executor } import scala.concurrent.util.Duration import scala.annotation.implicitNotFound +import scala.util.Try /** * An `ExecutionContext` is an abstraction over an entity that can execute program logic. @@ -27,6 +28,12 @@ trait ExecutionContext { */ def reportFailure(t: Throwable): Unit + /** Prepares for the execution of a task. Returns the prepared + * execution context. A valid implementation of `prepare` is one + * that simply returns `this`. + */ + def prepare(): ExecutionContext = this + } /** diff --git a/src/library/scala/concurrent/Future.scala b/src/library/scala/concurrent/Future.scala index d24fdbf005..bc0b437a33 100644 --- a/src/library/scala/concurrent/Future.scala +++ b/src/library/scala/concurrent/Future.scala @@ -117,7 +117,7 @@ trait Future[+T] extends Awaitable[T] { * $callbackInContext */ def onSuccess[U](pf: PartialFunction[T, U])(implicit executor: ExecutionContext): Unit = onComplete { - case Right(v) if pf isDefinedAt v => pf(v) + case Success(v) if pf isDefinedAt v => pf(v) case _ => }(executor) @@ -135,7 +135,7 @@ trait Future[+T] extends Awaitable[T] { * $callbackInContext */ def onFailure[U](callback: PartialFunction[Throwable, U])(implicit executor: ExecutionContext): Unit = onComplete { - case Left(t) if NonFatal(t) && callback.isDefinedAt(t) => callback(t) + case Failure(t) if NonFatal(t) && callback.isDefinedAt(t) => callback(t) case _ => }(executor) @@ -148,7 +148,7 @@ trait Future[+T] extends Awaitable[T] { * $multipleCallbacks * $callbackInContext */ - def onComplete[U](func: Either[Throwable, T] => U)(implicit executor: ExecutionContext): Unit + def onComplete[U](func: Try[T] => U)(implicit executor: ExecutionContext): Unit /* Miscellaneous */ @@ -169,7 +169,7 @@ trait Future[+T] extends Awaitable[T] { * if it contains a valid result, or `Some(Failure(error))` if it contains * an exception. */ - def value: Option[Either[Throwable, T]] + def value: Option[Try[T]] /* Projections */ @@ -190,8 +190,8 @@ trait Future[+T] extends Awaitable[T] { val p = Promise[Throwable]() onComplete { - case Left(t) => p success t - case Right(v) => p failure (new NoSuchElementException("Future.failed not completed with a throwable.")) + case Failure(t) => p success t + case Success(v) => p failure (new NoSuchElementException("Future.failed not completed with a throwable.")) } p.future @@ -205,7 +205,7 @@ trait Future[+T] extends Awaitable[T] { * Will not be called if the future fails. */ def foreach[U](f: T => U)(implicit executor: ExecutionContext): Unit = onComplete { - case Right(r) => f(r) + case Success(r) => f(r) case _ => // do nothing }(executor) @@ -227,8 +227,8 @@ trait Future[+T] extends Awaitable[T] { case result => try { result match { - case Left(t) => p failure f(t) - case Right(r) => p success s(r) + case Failure(t) => p failure f(t) + case Success(r) => p success s(r) } } catch { case NonFatal(t) => p failure t @@ -251,8 +251,8 @@ trait Future[+T] extends Awaitable[T] { case result => try { result match { - case Right(r) => p success f(r) - case l: Left[_, _] => p complete l.asInstanceOf[Left[Throwable, S]] + case Success(r) => p success f(r) + case f: Failure[_] => p complete f.asInstanceOf[Failure[S]] } } catch { case NonFatal(t) => p failure t @@ -273,12 +273,12 @@ trait Future[+T] extends Awaitable[T] { val p = Promise[S]() onComplete { - case l: Left[_, _] => p complete l.asInstanceOf[Left[Throwable, S]] - case Right(v) => + case f: Failure[_] => p complete f.asInstanceOf[Failure[S]] + case Success(v) => try { f(v).onComplete({ - case l: Left[_, _] => p complete l.asInstanceOf[Left[Throwable, S]] - case Right(v) => p success v + case f: Failure[_] => p complete f.asInstanceOf[Failure[S]] + case Success(v) => p success v })(internalExecutor) } catch { case NonFatal(t) => p failure t @@ -308,11 +308,11 @@ trait Future[+T] extends Awaitable[T] { val p = Promise[T]() onComplete { - case l: Left[_, _] => p complete l.asInstanceOf[Left[Throwable, T]] - case Right(v) => + case f: Failure[_] => p complete f.asInstanceOf[Failure[T]] + case Success(v) => try { if (pred(v)) p success v - else p failure new NoSuchElementException("Future.filter predicate is not satisfied by: " + v) + else p failure new NoSuchElementException("Future.filter predicate is not satisfied") } catch { case NonFatal(t) => p failure t } @@ -357,8 +357,8 @@ trait Future[+T] extends Awaitable[T] { val p = Promise[S]() onComplete { - case l: Left[_, _] => p complete l.asInstanceOf[Left[Throwable, S]] - case Right(v) => + case f: Failure[_] => p complete f.asInstanceOf[Failure[S]] + case Success(v) => try { if (pf.isDefinedAt(v)) p success pf(v) else p failure new NoSuchElementException("Future.collect partial function is not defined at: " + v) @@ -377,22 +377,15 @@ trait Future[+T] extends Awaitable[T] { * Example: * * {{{ - * future (6 / 0) recover { case e: ArithmeticException ⇒ 0 } // result: 0 - * future (6 / 0) recover { case e: NotFoundException ⇒ 0 } // result: exception - * future (6 / 2) recover { case e: ArithmeticException ⇒ 0 } // result: 3 + * future (6 / 0) recover { case e: ArithmeticException => 0 } // result: 0 + * future (6 / 0) recover { case e: NotFoundException => 0 } // result: exception + * future (6 / 2) recover { case e: ArithmeticException => 0 } // result: 3 * }}} */ def recover[U >: T](pf: PartialFunction[Throwable, U])(implicit executor: ExecutionContext): Future[U] = { val p = Promise[U]() - onComplete { - case Left(t) if pf isDefinedAt t => - try { p success pf(t) } - catch { - case NonFatal(t) => p failure t - } - case otherwise => p complete otherwise - }(executor) + onComplete { case tr => p.complete(tr recover pf) }(executor) p.future } @@ -414,7 +407,7 @@ trait Future[+T] extends Awaitable[T] { val p = Promise[U]() onComplete { - case Left(t) if pf isDefinedAt t => + case Failure(t) if pf isDefinedAt t => try { p completeWith pf(t) } catch { @@ -438,8 +431,8 @@ trait Future[+T] extends Awaitable[T] { val p = Promise[(T, U)]() this onComplete { - case l: Left[_, _] => p complete l.asInstanceOf[Left[Throwable, (T, U)]] - case Right(r) => + case f: Failure[_] => p complete f.asInstanceOf[Failure[(T, U)]] + case Success(r) => that onSuccess { case r2 => p success ((r, r2)) } @@ -468,8 +461,8 @@ trait Future[+T] extends Awaitable[T] { def fallbackTo[U >: T](that: Future[U]): Future[U] = { val p = Promise[U]() onComplete { - case r @ Right(_) ⇒ p complete r - case _ ⇒ p completeWith that + case s @ Success(_) => p complete s + case _ => p completeWith that } p.future } @@ -485,12 +478,12 @@ trait Future[+T] extends Awaitable[T] { val p = Promise[S]() onComplete { - case l: Left[_, _] => p complete l.asInstanceOf[Left[Throwable, S]] - case Right(t) => + case f: Failure[_] => p complete f.asInstanceOf[Failure[S]] + case Success(t) => p complete (try { - Right(boxedType(tag.runtimeClass).cast(t).asInstanceOf[S]) + Success(boxedType(tag.runtimeClass).cast(t).asInstanceOf[S]) } catch { - case e: ClassCastException => Left(e) + case e: ClassCastException => Failure(e) }) } @@ -520,7 +513,7 @@ trait Future[+T] extends Awaitable[T] { * } * }}} */ - def andThen[U](pf: PartialFunction[Either[Throwable, T], U])(implicit executor: ExecutionContext): Future[T] = { + def andThen[U](pf: PartialFunction[Try[T], U])(implicit executor: ExecutionContext): Future[T] = { val p = Promise[T]() onComplete { @@ -545,7 +538,7 @@ trait Future[+T] extends Awaitable[T] { */ def either[U >: T](that: Future[U]): Future[U] = { val p = Promise[U]() - val completePromise: PartialFunction[Either[Throwable, U], _] = { case result => p tryComplete result } + val completePromise: PartialFunction[Try[U], _] = { case result => p tryComplete result } this onComplete completePromise that onComplete completePromise @@ -615,7 +608,7 @@ object Future { def firstCompletedOf[T](futures: TraversableOnce[Future[T]])(implicit executor: ExecutionContext): Future[T] = { val p = Promise[T]() - val completeFirst: Either[Throwable, T] => Unit = p tryComplete _ + val completeFirst: Try[T] => Unit = p tryComplete _ futures.foreach(_ onComplete completeFirst) p.future @@ -629,14 +622,14 @@ object Future { else { val result = Promise[Option[T]]() val ref = new AtomicInteger(futures.size) - val search: Either[Throwable, T] => Unit = v => try { + val search: Try[T] => Unit = v => try { v match { - case Right(r) => if (predicate(r)) result tryComplete Right(Some(r)) - case _ => + case Success(r) => if (predicate(r)) result tryComplete Success(Some(r)) + case _ => } } finally { if (ref.decrementAndGet == 0) { - result tryComplete Right(None) + result tryComplete Success(None) } } diff --git a/src/library/scala/concurrent/Promise.scala b/src/library/scala/concurrent/Promise.scala index 5d1b2c00b6..b873939c15 100644 --- a/src/library/scala/concurrent/Promise.scala +++ b/src/library/scala/concurrent/Promise.scala @@ -8,6 +8,8 @@ package scala.concurrent +import scala.util.{ Try, Success, Failure } + /** Promise is an object which can be completed with a value or failed * with an exception. * @@ -49,7 +51,7 @@ trait Promise[T] { * * $promiseCompletion */ - def complete(result: Either[Throwable, T]): this.type = + def complete(result: Try[T]): this.type = if (tryComplete(result)) this else throw new IllegalStateException("Promise already completed.") /** Tries to complete the promise with either a value or the exception. @@ -58,7 +60,7 @@ trait Promise[T] { * * @return If the promise has already been completed returns `false`, or `true` otherwise. */ - def tryComplete(result: Either[Throwable, T]): Boolean + def tryComplete(result: Try[T]): Boolean /** Completes this promise with the specified future, once that future is completed. * @@ -84,7 +86,7 @@ trait Promise[T] { * * $promiseCompletion */ - def success(v: T): this.type = complete(Right(v)) + def success(v: T): this.type = complete(Success(v)) /** Tries to complete the promise with a value. * @@ -92,7 +94,7 @@ trait Promise[T] { * * @return If the promise has already been completed returns `false`, or `true` otherwise. */ - def trySuccess(value: T): Boolean = tryComplete(Right(value)) + def trySuccess(value: T): Boolean = tryComplete(Success(value)) /** Completes the promise with an exception. * @@ -102,7 +104,7 @@ trait Promise[T] { * * $promiseCompletion */ - def failure(t: Throwable): this.type = complete(Left(t)) + def failure(t: Throwable): this.type = complete(Failure(t)) /** Tries to complete the promise with an exception. * @@ -110,7 +112,7 @@ trait Promise[T] { * * @return If the promise has already been completed returns `false`, or `true` otherwise. */ - def tryFailure(t: Throwable): Boolean = tryComplete(Left(t)) + def tryFailure(t: Throwable): Boolean = tryComplete(Failure(t)) } @@ -129,14 +131,14 @@ object Promise { * @tparam T the type of the value in the promise * @return the newly created `Promise` object */ - def failed[T](exception: Throwable): Promise[T] = new impl.Promise.KeptPromise[T](Left(exception)) + def failed[T](exception: Throwable): Promise[T] = new impl.Promise.KeptPromise[T](Failure(exception)) /** Creates an already completed Promise with the specified result. * * @tparam T the type of the value in the promise * @return the newly created `Promise` object */ - def successful[T](result: T): Promise[T] = new impl.Promise.KeptPromise[T](Right(result)) + def successful[T](result: T): Promise[T] = new impl.Promise.KeptPromise[T](Success(result)) } diff --git a/src/library/scala/concurrent/impl/Future.scala b/src/library/scala/concurrent/impl/Future.scala index 098008e958..d92691901f 100644 --- a/src/library/scala/concurrent/impl/Future.scala +++ b/src/library/scala/concurrent/impl/Future.scala @@ -12,7 +12,7 @@ package scala.concurrent.impl import scala.concurrent.ExecutionContext import scala.util.control.NonFatal - +import scala.util.{Try, Success, Failure} private[concurrent] object Future { @@ -21,7 +21,7 @@ private[concurrent] object Future { override def run() = { promise complete { - try Right(body) catch { case NonFatal(e) => Left(e) } + try Success(body) catch { case NonFatal(e) => Failure(e) } } } } diff --git a/src/library/scala/concurrent/impl/Promise.scala b/src/library/scala/concurrent/impl/Promise.scala index c2df9ac296..b19bed004b 100644 --- a/src/library/scala/concurrent/impl/Promise.scala +++ b/src/library/scala/concurrent/impl/Promise.scala @@ -15,42 +15,46 @@ import scala.concurrent.{ ExecutionContext, CanAwait, OnCompleteRunnable, Timeou import scala.concurrent.util.Duration import scala.annotation.tailrec import scala.util.control.NonFatal - +import scala.util.{ Try, Success, Failure } private[concurrent] trait Promise[T] extends scala.concurrent.Promise[T] with scala.concurrent.Future[T] { def future: this.type = this } -private class CallbackRunnable[T](val executor: ExecutionContext, val onComplete: (Either[Throwable, T]) => Any) extends Runnable with OnCompleteRunnable { +/* Precondition: `executor` is prepared, i.e., `executor` has been returned from invocation of `prepare` on some other `ExecutionContext`. + */ +private class CallbackRunnable[T](val executor: ExecutionContext, val onComplete: Try[T] => Any) extends Runnable with OnCompleteRunnable { // must be filled in before running it - var value: Either[Throwable, T] = null + var value: Try[T] = null override def run() = { require(value ne null) // must set value to non-null before running! try onComplete(value) catch { case NonFatal(e) => executor reportFailure e } } - def executeWithValue(v: Either[Throwable, T]): Unit = { + def executeWithValue(v: Try[T]): Unit = { require(value eq null) // can't complete it twice value = v + // Note that we cannot prepare the ExecutionContext at this point, since we might + // already be running on a different thread! executor.execute(this) } } private[concurrent] object Promise { - private def resolveEither[T](source: Either[Throwable, T]): Either[Throwable, T] = source match { - case Left(t) => resolver(t) - case _ => source + private def resolveTry[T](source: Try[T]): Try[T] = source match { + case Failure(t) => resolver(t) + case _ => source } - private def resolver[T](throwable: Throwable): Either[Throwable, T] = throwable match { - case t: scala.runtime.NonLocalReturnControl[_] => Right(t.value.asInstanceOf[T]) - case t: scala.util.control.ControlThrowable => Left(new ExecutionException("Boxed ControlThrowable", t)) - case t: InterruptedException => Left(new ExecutionException("Boxed InterruptedException", t)) - case e: Error => Left(new ExecutionException("Boxed Error", e)) - case t => Left(t) + private def resolver[T](throwable: Throwable): Try[T] = throwable match { + case t: scala.runtime.NonLocalReturnControl[_] => Success(t.value.asInstanceOf[T]) + case t: scala.util.control.ControlThrowable => Failure(new ExecutionException("Boxed ControlThrowable", t)) + case t: InterruptedException => Failure(new ExecutionException("Boxed InterruptedException", t)) + case e: Error => Failure(new ExecutionException("Boxed Error", e)) + case t => Failure(t) } /** Default promise implementation. @@ -88,25 +92,25 @@ private[concurrent] object Promise { @throws(classOf[Exception]) def result(atMost: Duration)(implicit permit: CanAwait): T = ready(atMost).value.get match { - case Left(e) => throw e - case Right(r) => r + case Failure(e) => throw e + case Success(r) => r } - def value: Option[Either[Throwable, T]] = getState match { - case c: Either[_, _] => Some(c.asInstanceOf[Either[Throwable, T]]) - case _ => None + def value: Option[Try[T]] = getState match { + case c: Try[_] => Some(c.asInstanceOf[Try[T]]) + case _ => None } override def isCompleted(): Boolean = getState match { // Cheaper than boxing result into Option due to "def value" - case _: Either[_, _] => true - case _ => false + case _: Try[_] => true + case _ => false } - def tryComplete(value: Either[Throwable, T]): Boolean = { - val resolved = resolveEither(value) + def tryComplete(value: Try[T]): Boolean = { + val resolved = resolveTry(value) (try { @tailrec - def tryComplete(v: Either[Throwable, T]): List[CallbackRunnable[T]] = { + def tryComplete(v: Try[T]): List[CallbackRunnable[T]] = { getState match { case raw: List[_] => val cur = raw.asInstanceOf[List[CallbackRunnable[T]]] @@ -124,13 +128,14 @@ private[concurrent] object Promise { } } - def onComplete[U](func: Either[Throwable, T] => U)(implicit executor: ExecutionContext): Unit = { - val runnable = new CallbackRunnable[T](executor, func) + def onComplete[U](func: Try[T] => U)(implicit executor: ExecutionContext): Unit = { + val preparedEC = executor.prepare + val runnable = new CallbackRunnable[T](preparedEC, func) @tailrec //Tries to add the callback, if already completed, it dispatches the callback to be executed def dispatchOrAddCallback(): Unit = getState match { - case r: Either[_, _] => runnable.executeWithValue(r.asInstanceOf[Either[Throwable, T]]) + case r: Try[_] => runnable.executeWithValue(r.asInstanceOf[Try[T]]) case listeners: List[_] => if (updateState(listeners, runnable :: listeners)) () else dispatchOrAddCallback() } dispatchOrAddCallback() @@ -141,25 +146,23 @@ private[concurrent] object Promise { * * Useful in Future-composition when a value to contribute is already available. */ - final class KeptPromise[T](suppliedValue: Either[Throwable, T]) extends Promise[T] { + final class KeptPromise[T](suppliedValue: Try[T]) extends Promise[T] { - val value = Some(resolveEither(suppliedValue)) + val value = Some(resolveTry(suppliedValue)) override def isCompleted(): Boolean = true - def tryComplete(value: Either[Throwable, T]): Boolean = false + def tryComplete(value: Try[T]): Boolean = false - def onComplete[U](func: Either[Throwable, T] => U)(implicit executor: ExecutionContext): Unit = { + def onComplete[U](func: Try[T] => U)(implicit executor: ExecutionContext): Unit = { val completedAs = value.get - (new CallbackRunnable(executor, func)).executeWithValue(completedAs) + val preparedEC = executor.prepare + (new CallbackRunnable(preparedEC, func)).executeWithValue(completedAs) } def ready(atMost: Duration)(implicit permit: CanAwait): this.type = this - def result(atMost: Duration)(implicit permit: CanAwait): T = value.get match { - case Left(e) => throw e - case Right(r) => r - } + def result(atMost: Duration)(implicit permit: CanAwait): T = value.get.get } } diff --git a/src/library/scala/reflect/base/Base.scala b/src/library/scala/reflect/base/Base.scala index 53854f160d..714fd365ef 100644 --- a/src/library/scala/reflect/base/Base.scala +++ b/src/library/scala/reflect/base/Base.scala @@ -1,7 +1,6 @@ package scala.reflect package base -import language.experimental.macros import java.io.PrintWriter import scala.annotation.switch import scala.ref.WeakReference @@ -62,7 +61,9 @@ class Base extends Universe { self => class TypeSymbol(val owner: Symbol, override val name: TypeName, flags: FlagSet) extends Symbol(name, flags) with TypeSymbolBase { - override val asTypeConstructor = TypeRef(ThisType(owner), this, Nil) + override def toTypeConstructor = TypeRef(ThisType(owner), this, Nil) + override def toType = TypeRef(ThisType(owner), this, Nil) + override def toTypeIn(site: Type) = TypeRef(ThisType(owner), this, Nil) } implicit val TypeSymbolTag = ClassTag[TypeSymbol](classOf[TypeSymbol]) @@ -170,12 +171,17 @@ class Base extends Universe { self => object BoundedWildcardType extends BoundedWildcardTypeExtractor implicit val BoundedWildcardTypeTag = ClassTag[BoundedWildcardType](classOf[BoundedWildcardType]) - type Scope = Iterable[Symbol] + class Scope(elems: Iterable[Symbol]) extends ScopeBase with MemberScopeBase { + def iterator = elems.iterator + def sorted = elems.toList + } + type MemberScope = Scope implicit val ScopeTag = ClassTag[Scope](classOf[Scope]) + implicit val MemberScopeTag = ClassTag[MemberScope](classOf[MemberScope]) - def newScope = newScopeWith() - def newNestedScope(outer: Iterable[Symbol]) = newScope - def newScopeWith(elems: Symbol*): Scope = elems + def newScope: Scope = newScopeWith() + def newNestedScope(outer: Scope): Scope = newScope + def newScopeWith(elems: Symbol*): Scope = new Scope(elems) abstract class Name(str: String) extends NameBase { override def toString = str @@ -229,7 +235,6 @@ class Base extends Universe { self => override val privateWithin: Name, override val annotations: List[Tree]) extends ModifiersBase { def hasFlag(flags: FlagSet) = (this.flags & flags) != 0 - def hasAllFlags(flags: FlagSet) = (flags & ~this.flags) == 0 } implicit val ModifiersTag = ClassTag[Modifiers](classOf[Modifiers]) @@ -291,16 +296,16 @@ class Base extends Universe { self => object build extends BuildBase { def selectType(owner: Symbol, name: String): TypeSymbol = { val clazz = new ClassSymbol(owner, newTypeName(name), NoFlags) - cached(clazz.fullName)(clazz).asTypeSymbol + cached(clazz.fullName)(clazz).asType } def selectTerm(owner: Symbol, name: String): TermSymbol = { val valu = new MethodSymbol(owner, newTermName(name), NoFlags) - cached(valu.fullName)(valu).asTermSymbol + cached(valu.fullName)(valu).asTerm } def selectOverloadedMethod(owner: Symbol, name: String, index: Int): MethodSymbol = - selectTerm(owner, name).asMethodSymbol + selectTerm(owner, name).asMethod def newNestedSymbol(owner: Symbol, name: Name, pos: Position, flags: Long, isClass: Boolean): Symbol = if (name.isTypeName) @@ -380,7 +385,7 @@ class Base extends Universe { self => object definitions extends DefinitionsBase { lazy val ScalaPackage = staticModule("scala") - lazy val ScalaPackageClass = ScalaPackage.moduleClass.asClassSymbol + lazy val ScalaPackageClass = ScalaPackage.moduleClass.asClass lazy val AnyClass = staticClass("scala.Any") lazy val AnyValClass = staticClass("scala.Any") @@ -461,6 +466,8 @@ class Base extends Universe { self => def treeToString(tree: Tree) = s"<tree ${tree.getClass}>" + def treeType(tree: Tree) = NoType + trait TermTree extends Tree trait TypTree extends Tree diff --git a/src/library/scala/reflect/base/Constants.scala b/src/library/scala/reflect/base/Constants.scala index 8f98e85ad0..ba12b02e92 100644 --- a/src/library/scala/reflect/base/Constants.scala +++ b/src/library/scala/reflect/base/Constants.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/api/Exprs.scala b/src/library/scala/reflect/base/Exprs.scala index 8b2a3b4ea8..47af4f3a9d 100644 --- a/src/reflect/scala/reflect/api/Exprs.scala +++ b/src/library/scala/reflect/base/Exprs.scala @@ -1,12 +1,10 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.reflect -package api - -import scala.reflect.base.TreeCreator +package base trait Exprs { self: Universe => @@ -16,8 +14,8 @@ trait Exprs { self: Universe => def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # Expr[T] def tree: Tree - def staticTpe: Type - def actualTpe: Type + def staticType: Type + def actualType: Type def splice: T val value: T @@ -26,7 +24,7 @@ trait Exprs { self: Universe => override def canEqual(x: Any) = x.isInstanceOf[Expr[_]] override def equals(x: Any) = x.isInstanceOf[Expr[_]] && this.mirror == x.asInstanceOf[Expr[_]].mirror && this.tree == x.asInstanceOf[Expr[_]].tree override def hashCode = mirror.hashCode * 31 + tree.hashCode - override def toString = "Expr["+staticTpe+"]("+tree+")" + override def toString = "Expr["+staticType+"]("+tree+")" } object Expr { @@ -45,8 +43,8 @@ trait Exprs { self: Universe => // [Eugene++] this is important // !!! remove when we have improved type inference for singletons // search for .type] to find other instances - lazy val staticTpe: Type = implicitly[AbsTypeTag[T]].tpe - def actualTpe: Type = tree.tpe + lazy val staticType: Type = implicitly[AbsTypeTag[T]].tpe + def actualType: Type = treeType(tree) def splice: T = throw new UnsupportedOperationException(""" |the function you're calling has not been spliced by the compiler. @@ -58,5 +56,24 @@ trait Exprs { self: Universe => |if you want to splice the underlying expression, use `<your expr>.splice`. |if you want to get a value of the underlying expression, add scala-compiler.jar to the classpath, |import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.""".trim.stripMargin) + + private def writeReplace(): AnyRef = new SerializedExpr(treec, implicitly[AbsTypeTag[T]].in(scala.reflect.basis.rootMirror)) + } +} + +private[scala] class SerializedExpr(var treec: TreeCreator, var tag: scala.reflect.basis.AbsTypeTag[_]) extends Serializable { + private def writeObject(out: java.io.ObjectOutputStream): Unit = { + out.writeObject(treec) + out.writeObject(tag) + } + + private def readObject(in: java.io.ObjectInputStream): Unit = { + treec = in.readObject().asInstanceOf[TreeCreator] + tag = in.readObject().asInstanceOf[scala.reflect.basis.AbsTypeTag[_]] + } + + private def readResolve(): AnyRef = { + import scala.reflect.basis._ + Expr(rootMirror, treec)(tag) } }
\ No newline at end of file diff --git a/src/library/scala/reflect/base/FlagSets.scala b/src/library/scala/reflect/base/FlagSets.scala index 57946d0f27..43de9970c0 100644 --- a/src/library/scala/reflect/base/FlagSets.scala +++ b/src/library/scala/reflect/base/FlagSets.scala @@ -13,5 +13,11 @@ trait FlagSets { self: Universe => /** The empty set of flags */ val NoFlags: FlagSet + + /** The base API all flag bearers support */ + trait HasFlagsBase { + def flags: FlagSet + def hasFlag(flags: FlagSet): Boolean + } } diff --git a/src/library/scala/reflect/base/Scopes.scala b/src/library/scala/reflect/base/Scopes.scala index a5db01c0ce..a388fdc392 100644 --- a/src/library/scala/reflect/base/Scopes.scala +++ b/src/library/scala/reflect/base/Scopes.scala @@ -3,13 +3,33 @@ package base trait Scopes { self: Universe => - type Scope >: Null <: Iterable[Symbol] + type Scope >: Null <: ScopeBase + + /** The base API that all scopes support */ + trait ScopeBase extends Iterable[Symbol] /** A tag that preserves the identity of the `Scope` abstract type from erasure. * Can be used for pattern matching, instance tests, serialization and likes. */ implicit val ScopeTag: ClassTag[Scope] + type MemberScope >: Null <: Scope with MemberScopeBase + + /** The base API that all member scopes support */ + trait MemberScopeBase extends ScopeBase { + /** Sorts the symbols included in this scope so that: + * 1) Symbols appear the linearization order of their owners. + * 2) Symbols with the same owner appear in reverse order of their declarations. + * 3) Synthetic members (e.g. getters/setters for vals/vars) might appear in arbitrary order. + */ + def sorted: List[Symbol] + } + + /** A tag that preserves the identity of the `MemberScope` abstract type from erasure. + * Can be used for pattern matching, instance tests, serialization and likes. + */ + implicit val MemberScopeTag: ClassTag[MemberScope] + /** Create a new scope */ def newScope: Scope diff --git a/src/library/scala/reflect/base/StandardDefinitions.scala b/src/library/scala/reflect/base/StandardDefinitions.scala index 2f270a5911..fe32fdb4c2 100644 --- a/src/library/scala/reflect/base/StandardDefinitions.scala +++ b/src/library/scala/reflect/base/StandardDefinitions.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/library/scala/reflect/base/StandardNames.scala b/src/library/scala/reflect/base/StandardNames.scala index 50399a4a1e..3e569cd523 100644 --- a/src/library/scala/reflect/base/StandardNames.scala +++ b/src/library/scala/reflect/base/StandardNames.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler -* Copyright 2005-2011 LAMP/EPFL +* Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/library/scala/reflect/base/Symbols.scala b/src/library/scala/reflect/base/Symbols.scala index ced1f33395..fe857c540f 100644 --- a/src/library/scala/reflect/base/Symbols.scala +++ b/src/library/scala/reflect/base/Symbols.scala @@ -80,10 +80,6 @@ trait Symbols { self: Universe => /** The base API that all symbols support */ trait SymbolBase { this: Symbol => - /** An id number which is unique for all symbols in this universe */ - // [Eugene++ to Martin] do we leave this here? - def id: Int - /** The owner of this symbol. This is the symbol * that directly contains the current symbol's definition. * The `NoSymbol` symbol does not have an owner, and calling this method @@ -112,18 +108,6 @@ trait Symbols { self: Universe => */ def fullName: String - /** If this symbol is a class, this symbol; otherwise the next enclosing - * class, or `NoSymbol` if none exists. - */ - def enclosingClass: Symbol = - if (isClass || this == NoSymbol) this else owner.enclosingClass - - /** If this symbol is a method, this symbol; otherwise the next enclosing - * method, or `NoSymbol` if none exists. - */ - def enclosingMethod: Symbol = - if (isMethod || this == NoSymbol) this else owner.enclosingMethod - /** Does this symbol represent the definition of a type? * Note that every symbol is either a term or a type. * So for every symbol `sym`, either `sym.isTerm` is true @@ -132,9 +116,9 @@ trait Symbols { self: Universe => def isType: Boolean = false /** This symbol cast to a TypeSymbol. - * Returns ClassCastException if `isType` is false. + * @throws ScalaReflectionException if `isType` is false. */ - def asTypeSymbol: TypeSymbol = throw new ClassCastException(toString) + def asType: TypeSymbol = throw new ScalaReflectionException(s"$this is not a type") /** Does this symbol represent the definition of a term? * Note that every symbol is either a term or a term. @@ -144,9 +128,9 @@ trait Symbols { self: Universe => def isTerm: Boolean = false /** This symbol cast to a TermSymbol. - * Returns ClassCastException if `isTerm` is false. + * @throws ScalaReflectionException if `isTerm` is false. */ - def asTermSymbol: TermSymbol = throw new ClassCastException(toString) + def asTerm: TermSymbol = throw new ScalaReflectionException(s"$this is not a term") /** Does this symbol represent the definition of a method? * If yes, `isTerm` is also guaranteed to be true. @@ -154,9 +138,19 @@ trait Symbols { self: Universe => def isMethod: Boolean = false /** This symbol cast to a MethodSymbol. - * Returns ClassCastException if `isMethod` is false. + * @throws ScalaReflectionException if `isMethod` is false. */ - def asMethodSymbol: MethodSymbol = throw new ClassCastException(toString) + def asMethod: MethodSymbol = { + def overloadedMsg = + "encapsulates multiple overloaded alternatives and cannot be treated as a method. "+ + "Consider invoking `<offending symbol>.asTerm.alternatives` and manually picking the required method" + def vanillaMsg = "is not a method" + val msg = if (isOverloadedMethod) overloadedMsg else vanillaMsg + throw new ScalaReflectionException(s"$this $msg") + } + + /** Used to provide a better error message for `asMethod` */ + protected def isOverloadedMethod = false /** Does this symbol represent the definition of a module (i.e. it * results from an object definition?). @@ -165,9 +159,9 @@ trait Symbols { self: Universe => def isModule: Boolean = false /** This symbol cast to a ModuleSymbol defined by an object definition. - * Returns ClassCastException if `isModule` is false. + * @throws ScalaReflectionException if `isModule` is false. */ - def asModuleSymbol: ModuleSymbol = throw new ClassCastException(toString) + def asModule: ModuleSymbol = throw new ScalaReflectionException(s"$this is not a module") /** Does this symbol represent the definition of a class or trait? * If yes, `isType` is also guaranteed to be true. @@ -181,9 +175,9 @@ trait Symbols { self: Universe => def isModuleClass: Boolean = false /** This symbol cast to a ClassSymbol representing a class or trait. - * Returns ClassCastException if `isClass` is false. + * @throws ScalaReflectionException if `isClass` is false. */ - def asClassSymbol: ClassSymbol = throw new ClassCastException(toString) + def asClass: ClassSymbol = throw new ScalaReflectionException(s"$this is not a class") /** Does this symbol represent a free term captured by reification? * If yes, `isTerm` is also guaranteed to be true. @@ -191,9 +185,9 @@ trait Symbols { self: Universe => def isFreeTerm: Boolean = false /** This symbol cast to a free term symbol. - * Returns ClassCastException if `isFreeTerm` is false. + * @throws ScalaReflectionException if `isFreeTerm` is false. */ - def asFreeTermSymbol: FreeTermSymbol = throw new ClassCastException(toString) + def asFreeTerm: FreeTermSymbol = throw new ScalaReflectionException(s"$this is not a free term") /** Does this symbol represent a free type captured by reification? * If yes, `isType` is also guaranteed to be true. @@ -201,9 +195,9 @@ trait Symbols { self: Universe => def isFreeType: Boolean = false /** This symbol cast to a free type symbol. - * Returns ClassCastException if `isFreeType` is false. + * @throws ScalaReflectionException if `isFreeType` is false. */ - def asFreeTypeSymbol: FreeTypeSymbol = throw new ClassCastException(toString) + def asFreeType: FreeTypeSymbol = throw new ScalaReflectionException(s"$this is not a free type") def newTermSymbol(name: TermName, pos: Position = NoPosition, flags: FlagSet = NoFlags): TermSymbol def newModuleAndClassSymbol(name: Name, pos: Position = NoPosition, flags: FlagSet = NoFlags): (ModuleSymbol, ClassSymbol) @@ -219,16 +213,34 @@ trait Symbols { self: Universe => final type NameType = TypeName /** The type constructor corresponding to this type symbol. - * This is different from `asType` in that type parameters - * are part of results of `asType`, but not of `asTypeConstructor`. + * This is different from `toType` in that type parameters + * are part of results of `toType`, but not of `toTypeConstructor`. * * Example: Given a class declaration `class C[T] { ... } `, that generates a symbol - * `C`. Then `C.asType` is the type `C[T]`, but `C.asTypeConstructor` is `C`. + * `C`. Then `C.toType` is the type `C[T]`, but `C.toTypeConstructor` is `C`. + */ + def toTypeConstructor: Type + + /** A type reference that refers to this type symbol seen + * as a member of given type `site`. */ - def asTypeConstructor: Type + def toTypeIn(site: Type): Type + + /** A type reference that refers to this type symbol + * Note if symbol is a member of a class, one almost always is interested + * in `asTypeIn` with a site type instead. + * + * Example: Given a class declaration `class C[T] { ... } `, that generates a symbol + * `C`. Then `C.toType` is the type `C[T]`. + * + * By contrast, `C.typeSignature` would be a type signature of form + * `PolyType(ClassInfoType(...))` that describes type parameters, value + * parameters, parent types, and members of `C`. + */ + def toType: Type override def isType = true - override def asTypeSymbol = this + override def asType = this } /** The base API that all term symbols support */ @@ -238,13 +250,13 @@ trait Symbols { self: Universe => final type NameType = TermName final override def isTerm = true - final override def asTermSymbol = this + final override def asTerm = this } /** The base API that all method symbols support */ trait MethodSymbolBase extends TermSymbolBase { this: MethodSymbol => final override def isMethod = true - final override def asMethodSymbol = this + final override def asMethod = this } /** The base API that all module symbols support */ @@ -257,24 +269,24 @@ trait Symbols { self: Universe => // [Eugene++] when this becomes `moduleClass: ClassSymbol`, it will be the happiest day in my life final override def isModule = true - final override def asModuleSymbol = this + final override def asModule = this } /** The base API that all class symbols support */ trait ClassSymbolBase extends TypeSymbolBase { this: ClassSymbol => final override def isClass = true - final override def asClassSymbol = this + final override def asClass = this } /** The base API that all free type symbols support */ trait FreeTypeSymbolBase extends TypeSymbolBase { this: FreeTypeSymbol => final override def isFreeType = true - final override def asFreeTypeSymbol = this + final override def asFreeType = this } /** The base API that all free term symbols support */ trait FreeTermSymbolBase extends TermSymbolBase { this: FreeTermSymbol => final override def isFreeTerm = true - final override def asFreeTermSymbol = this + final override def asFreeTerm = this } } diff --git a/src/library/scala/reflect/base/Trees.scala b/src/library/scala/reflect/base/Trees.scala index 2814450ae3..7fa3c90e7d 100644 --- a/src/library/scala/reflect/base/Trees.scala +++ b/src/library/scala/reflect/base/Trees.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.reflect @@ -34,6 +34,9 @@ trait Trees { self: Universe => /** Obtains string representation of a tree */ protected def treeToString(tree: Tree): String + /** Obtains the type of the tree (we intentionally don't expose `tree.tpe` in base) */ + protected def treeType(tree: Tree): Type + /** Tree is the basis for scala's abstract syntax. The nodes are * implemented as case classes, and the parameters which initialize * a given tree are immutable: however Trees have several mutable @@ -1356,10 +1359,7 @@ trait Trees { self: Universe => implicit val ModifiersTag: ClassTag[Modifiers] /** ... */ - abstract class ModifiersBase { - def flags: FlagSet - def hasFlag(flags: FlagSet): Boolean - def hasAllFlags(flags: FlagSet): Boolean + abstract class ModifiersBase extends HasFlagsBase { def privateWithin: Name // default: EmptyTypeName def annotations: List[Tree] // default: List() def mapAnnotations(f: List[Tree] => List[Tree]): Modifiers = diff --git a/src/library/scala/reflect/base/TypeTags.scala b/src/library/scala/reflect/base/TypeTags.scala index 05b1a079d7..b673122d00 100644 --- a/src/library/scala/reflect/base/TypeTags.scala +++ b/src/library/scala/reflect/base/TypeTags.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -169,6 +169,7 @@ trait TypeTags { self: Universe => val otherMirror1 = otherMirror.asInstanceOf[MirrorOf[otherMirror.universe.type]] otherMirror.universe.AbsTypeTag[T](otherMirror1, tpec) } + private def writeReplace(): AnyRef = new SerializedTypeTag(tpec, concrete = false) } /** @@ -233,13 +234,18 @@ trait TypeTags { self: Universe => val otherMirror1 = otherMirror.asInstanceOf[MirrorOf[otherMirror.universe.type]] otherMirror.universe.TypeTag[T](otherMirror1, tpec) } + private def writeReplace(): AnyRef = new SerializedTypeTag(tpec, concrete = true) } - private class PredefTypeTag[T](_tpe: Type, copyIn: Universe => Universe # TypeTag[T]) extends TypeTagImpl[T](rootMirror, null) { + private class PredefTypeCreator[T](copyIn: Universe => Universe # TypeTag[T]) extends TypeCreator { + def apply[U <: Universe with Singleton](m: MirrorOf[U]): U # Type = { + copyIn(m.universe).asInstanceOf[U # TypeTag[T]].tpe + } + } + + private class PredefTypeTag[T](_tpe: Type, copyIn: Universe => Universe # TypeTag[T]) extends TypeTagImpl[T](rootMirror, new PredefTypeCreator(copyIn)) { override lazy val tpe: Type = _tpe - override def in[U <: Universe with Singleton](otherMirror: MirrorOf[U]): U # TypeTag[T] = - copyIn(otherMirror.universe).asInstanceOf[U # TypeTag[T]] - private def readResolve() = copyIn(self) + private def writeReplace(): AnyRef = new SerializedTypeTag(tpec, concrete = true) } // incantations @@ -248,3 +254,21 @@ trait TypeTags { self: Universe => // big thanks to Viktor Klang for this brilliant idea! def typeOf[T](implicit ttag: TypeTag[T]): Type = ttag.tpe } + +private[scala] class SerializedTypeTag(var tpec: TypeCreator, var concrete: Boolean) extends Serializable { + private def writeObject(out: java.io.ObjectOutputStream): Unit = { + out.writeObject(tpec) + out.writeBoolean(concrete) + } + + private def readObject(in: java.io.ObjectInputStream): Unit = { + tpec = in.readObject().asInstanceOf[TypeCreator] + concrete = in.readBoolean() + } + + private def readResolve(): AnyRef = { + import scala.reflect.basis._ + if (concrete) TypeTag(rootMirror, tpec) + else AbsTypeTag(rootMirror, tpec) + } +}
\ No newline at end of file diff --git a/src/library/scala/reflect/base/Universe.scala b/src/library/scala/reflect/base/Universe.scala index 93ddcb9f55..f098876c18 100644 --- a/src/library/scala/reflect/base/Universe.scala +++ b/src/library/scala/reflect/base/Universe.scala @@ -10,9 +10,57 @@ abstract class Universe extends Symbols with Constants with AnnotationInfos with Positions + with Exprs with TypeTags with TagInterop with StandardDefinitions with StandardNames with BuildUtils - with Mirrors
\ No newline at end of file + with Mirrors +{ + /** Given an expression, generate a tree that when compiled and executed produces the original tree. + * The produced tree will be bound to the Universe it was called from. + * + * For instance, given the abstract syntax tree representation of the <[ x + 1 ]> expression: + * + * {{{ + * Apply(Select(Ident("x"), "+"), List(Literal(Constant(1)))) + * }}} + * + * The reifier transforms it to the following expression: + * + * {{{ + * <[ + * val $u: u.type = u // where u is a reference to the Universe that calls the reify + * $u.Expr[Int]($u.Apply($u.Select($u.Ident($u.newFreeVar("x", <Int>, x), "+"), List($u.Literal($u.Constant(1)))))) + * ]> + * }}} + * + * Reification performs expression splicing (when processing Expr.splice) + * and type splicing (for every type T that has a TypeTag[T] implicit in scope): + * + * {{{ + * val two = mirror.reify(2) // Literal(Constant(2)) + * val four = mirror.reify(two.splice + two.splice) // Apply(Select(two.tree, newTermName("$plus")), List(two.tree)) + * + * def macroImpl[T](c: Context) = { + * ... + * // T here is just a type parameter, so the tree produced by reify won't be of much use in a macro expansion + * // however, if T were annotated with c.AbsTypeTag (which would declare an implicit parameter for macroImpl) + * // then reification would substitute T with the TypeTree that was used in a TypeApply of this particular macro invocation + * val factory = c.reify{ new Queryable[T] } + * ... + * } + * }}} + * + * The transformation looks mostly straightforward, but it has its tricky parts: + * * Reifier retains symbols and types defined outside the reified tree, however + * locally defined entities get erased and replaced with their original trees + * * Free variables are detected and wrapped in symbols of the type FreeVar + * * Mutable variables that are accessed from a local function are wrapped in refs + * * Since reified trees can be compiled outside of the scope they've been created in, + * special measures are taken to ensure that all members accessed in the reifee remain visible + */ + // implementation is magically hardwired to `scala.reflect.reify.Taggers` + def reify[T](expr: T): Expr[T] = ??? // macro +}
\ No newline at end of file diff --git a/src/library/scala/reflect/makro/internal/macroImpl.scala b/src/library/scala/reflect/macros/internal/macroImpl.scala index 0dfa8d1654..a7b2bf482c 100644 --- a/src/library/scala/reflect/makro/internal/macroImpl.scala +++ b/src/library/scala/reflect/macros/internal/macroImpl.scala @@ -1,4 +1,4 @@ -package scala.reflect.makro +package scala.reflect.macros package internal /** Links macro definitions with their implementation. diff --git a/src/library/scala/reflect/makro/internal/package.scala b/src/library/scala/reflect/macros/internal/package.scala index 78cb0ffb10..912db53ed4 100644 --- a/src/library/scala/reflect/makro/internal/package.scala +++ b/src/library/scala/reflect/macros/internal/package.scala @@ -1,8 +1,7 @@ -package scala.reflect -package makro +package scala.reflect.macros -import language.experimental.macros import scala.reflect.base.{Universe => BaseUniverse} +import scala.reflect.ClassTag // anchors for materialization macros emitted during tag materialization in Implicits.scala // implementation is magically hardwired into `scala.reflect.reify.Taggers` @@ -10,7 +9,7 @@ import scala.reflect.base.{Universe => BaseUniverse} // todo. once we have implicit macros for tag generation, we can remove these anchors // [Eugene++] how do I hide this from scaladoc? package object internal { - private[scala] def materializeClassTag[T](u: BaseUniverse): ClassTag[T] = macro ??? - private[scala] def materializeAbsTypeTag[T](u: BaseUniverse): u.AbsTypeTag[T] = macro ??? - private[scala] def materializeTypeTag[T](u: BaseUniverse): u.TypeTag[T] = macro ??? + private[scala] def materializeClassTag[T](u: BaseUniverse): ClassTag[T] = ??? // macro + private[scala] def materializeAbsTypeTag[T](u: BaseUniverse): u.AbsTypeTag[T] = ??? // macro + private[scala] def materializeTypeTag[T](u: BaseUniverse): u.TypeTag[T] = ??? // macro } diff --git a/src/library/scala/runtime/AbstractFunction0.scala b/src/library/scala/runtime/AbstractFunction0.scala index c4ce0ebcdc..1b351c62ae 100644 --- a/src/library/scala/runtime/AbstractFunction0.scala +++ b/src/library/scala/runtime/AbstractFunction0.scala @@ -9,6 +9,6 @@ package scala.runtime -abstract class AbstractFunction0[@specialized +R] extends Function0[R] { +abstract class AbstractFunction0[@specialized(Specializable.Primitives) +R] extends Function0[R] { } diff --git a/src/library/scala/runtime/AbstractFunction1.scala b/src/library/scala/runtime/AbstractFunction1.scala index b2f336fe52..a68a82e6a2 100644 --- a/src/library/scala/runtime/AbstractFunction1.scala +++ b/src/library/scala/runtime/AbstractFunction1.scala @@ -9,6 +9,6 @@ package scala.runtime -abstract class AbstractFunction1[@specialized(scala.Int, scala.Long, scala.Float, scala.Double, scala.AnyRef) -T1, @specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double, scala.AnyRef) +R] extends Function1[T1, R] { +abstract class AbstractFunction1[@specialized(scala.Int, scala.Long, scala.Float, scala.Double/*, scala.AnyRef*/) -T1, @specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double/*, scala.AnyRef*/) +R] extends Function1[T1, R] { } diff --git a/src/library/scala/runtime/WorksheetSupport.scala b/src/library/scala/runtime/WorksheetSupport.scala index db6d6359a3..6f2a4d382d 100644 --- a/src/library/scala/runtime/WorksheetSupport.scala +++ b/src/library/scala/runtime/WorksheetSupport.scala @@ -14,9 +14,11 @@ object WorksheetSupport { * By default it is 30ms. */ private class FlushedOutputStream(out: OutputStream) extends OutputStream { + protected def flushInterval = 30000000L // interval between flushes, by default 30ms + protected def width = 80 // output width, by default 80 characters + protected def tabInc = 8 // tab increment, by default 8 characters private var lastFlush: Long = 0L - protected val flushInterval = 30000000L // 30ms - private var lastCh: Int = '\n' + private var col = -1 override def write(b: Array[Byte], off: Int, len: Int) = { for (idx <- off until (off + len min b.length)) writeOne(b(idx)) flush() @@ -33,14 +35,18 @@ object WorksheetSupport { } } def writeOne(c: Int) { - if (lastCh == '\n') { - lastCh = 0 + if (col < 0) { + col = 0 write((currentOffset+" ").getBytes) } out.write(c) - lastCh = c + col = + if (c == '\n') -1 + else if (c == '\t') (col / tabInc) * tabInc + tabInc + else col + 1 + if (col >= width) writeOne('\n') } - def ensureNewLine() = if (lastCh != '\n') writeOne('\n') + def ensureNewLine() = if (col > 0) writeOne('\n') } private val flushedOut = new FlushedOutputStream(System.out) @@ -69,7 +75,7 @@ object WorksheetSupport { try op catch { case ex: StopException => ; - case ex => ex.printStackTrace() + case ex: Throwable => ex.printStackTrace() } } diff --git a/src/library/scala/specialized.scala b/src/library/scala/specialized.scala index b876869afb..761c7cb25e 100644 --- a/src/library/scala/specialized.scala +++ b/src/library/scala/specialized.scala @@ -28,5 +28,5 @@ import Specializable._ class specialized(group: SpecializedGroup) extends annotation.StaticAnnotation { def this(types: Specializable*) = this(new Group(types.toList)) - def this() = this(Everything) + def this() = this(Primitives) } diff --git a/src/library/scala/unchecked.scala b/src/library/scala/unchecked.scala index 10d34312cf..5b05792d97 100644 --- a/src/library/scala/unchecked.scala +++ b/src/library/scala/unchecked.scala @@ -6,32 +6,30 @@ ** |/ ** \* */ - - package scala -/** An annotation that gets applied to a selector in a match expression. - * If it is present, exhaustiveness warnings for that expression will be - * suppressed. - * For example, compiling the code: +/** An annotation to designate that the annotated entity + * should not be considered for additional compiler checks. + * Specific applications include annotating the subject of + * a match expression to suppress exhaustiveness warnings, and + * annotating a type argument in a match case to suppress + * unchecked warnings. + * + * Such suppression should be used with caution, without which + * one may encounter [[scala.MatchError]] or [[java.lang.ClassCastException]] + * at runtime. In most cases one can and should address the + * warning instead of suppressing it. + * * {{{ - * object test extends App { - * def f(x: Option[Int]) = x match { - * case Some(y) => y - * } - * f(None) + * object Test extends App { + * // This would normally warn "match is not exhaustive" + * // because `None` is not covered. + * def f(x: Option[String]) = (x: @unchecked) match { case Some(y) => y } + * // This would normally warn "type pattern is unchecked" + * // but here will blindly cast the head element to String. + * def g(xs: Any) = xs match { case x: List[String @unchecked] => x.head } * } - * }}} - * will display the following warning: - * {{{ - * test.scala:2: warning: does not cover case {object None} - * def f(x: Option[int]) = x match { - * ^ - * one warning found - * }}} - * The above message may be suppressed by substituting the expression `x` - * with `(x: @unchecked)`. Then the modified code will compile silently, - * but, in any case, a [[scala.MatchError]] will be raised at runtime. + * }}} * * @since 2.4 */ diff --git a/src/library/scala/util/Try.scala b/src/library/scala/util/Try.scala index f85bac0b84..f381a18b0c 100644 --- a/src/library/scala/util/Try.scala +++ b/src/library/scala/util/Try.scala @@ -54,6 +54,7 @@ import language.implicitConversions * * `Try` comes to the Scala standard library after years of use as an integral part of Twitter's stack. * + * @author based on Twitter's original implementation in com.twitter.util. * @since 2.10 */ sealed abstract class Try[+T] { @@ -102,7 +103,7 @@ sealed abstract class Try[+T] { * Applies the given function `f` if this is a `Failure`, otherwise returns this if this is a `Success`. * This is like `flatMap` for the exception. */ - def rescue[U >: T](f: PartialFunction[Throwable, Try[U]]): Try[U] + def recoverWith[U >: T](f: PartialFunction[Throwable, Try[U]]): Try[U] /** * Applies the given function `f` if this is a `Failure`, otherwise returns this if this is a `Success`. @@ -116,17 +117,6 @@ sealed abstract class Try[+T] { def toOption = if (isSuccess) Some(get) else None /** - * Returns an empty `Seq` (usually a `List`) if this is a `Failure` or a `Seq` containing the value if this is a `Success`. - */ - def toSeq = if (isSuccess) Seq(get) else Seq() - - /** - * Returns the given function applied to the value from this `Success` or returns this if this is a `Failure`. - * Alias for `flatMap`. - */ - def andThen[U](f: T => Try[U]): Try[U] = flatMap(f) - - /** * Transforms a nested `Try`, ie, a `Try` of type `Try[Try[T]]`, * into an un-nested `Try`, ie, a `Try` of type `Try[T]`. */ @@ -141,7 +131,7 @@ sealed abstract class Try[+T] { /** Completes this `Try` by applying the function `f` to this if this is of type `Failure`, or conversely, by applying * `s` if this is a `Success`. */ - def transform[U](f: Throwable => Try[U], s: T => Try[U]): Try[U] = this match { + def transform[U](s: T => Try[U], f: Throwable => Try[U]): Try[U] = this match { case Success(v) => s(v) case Failure(e) => f(e) } @@ -150,20 +140,6 @@ sealed abstract class Try[+T] { object Try { - implicit def try2either[T](tr: Try[T]): Either[Throwable, T] = { - tr match { - case Success(v) => Right(v) - case Failure(t) => Left(t) - } - } - - implicit def either2try[T](ei: Either[Throwable, T]): Try[T] = { - ei match { - case Right(v) => Success(v) - case Left(t) => Failure(t) - } - } - def apply[T](r: => T): Try[T] = { try { Success(r) } catch { case NonFatal(e) => Failure(e) @@ -175,7 +151,7 @@ object Try { final case class Failure[+T](val exception: Throwable) extends Try[T] { def isFailure: Boolean = true def isSuccess: Boolean = false - def rescue[U >: T](f: PartialFunction[Throwable, Try[U]]): Try[U] = + def recoverWith[U >: T](f: PartialFunction[Throwable, Try[U]]): Try[U] = if (f.isDefinedAt(exception)) f(exception) else this def get: T = throw exception def flatMap[U](f: T => Try[U]): Try[U] = Failure[U](exception) @@ -201,12 +177,12 @@ final case class Failure[+T](val exception: Throwable) extends Try[T] { final case class Success[+T](value: T) extends Try[T] { def isFailure: Boolean = false def isSuccess: Boolean = true - def rescue[U >: T](f: PartialFunction[Throwable, Try[U]]): Try[U] = Success(value) + def recoverWith[U >: T](f: PartialFunction[Throwable, Try[U]]): Try[U] = Success(value) def get = value def flatMap[U](f: T => Try[U]): Try[U] = try f(value) catch { - case e: Throwable => Failure(e) + case NonFatal(e) => Failure(e) } def flatten[U](implicit ev: T <:< Try[U]): Try[U] = value def foreach[U](f: T => U): Unit = f(value) diff --git a/src/library/scala/util/automata/WordBerrySethi.scala b/src/library/scala/util/automata/WordBerrySethi.scala index 1d4d1f971f..235a74dd7a 100644 --- a/src/library/scala/util/automata/WordBerrySethi.scala +++ b/src/library/scala/util/automata/WordBerrySethi.scala @@ -11,7 +11,7 @@ package scala.util.automata import scala.collection.{ immutable, mutable } import scala.util.regexp.WordExp -/** This class turns a regular expression into a [[scala.util.automata.NondetWorkAutom]] +/** This class turns a regular expression into a [[scala.util.automata.NondetWordAutom]] * celebrated position automata construction (also called ''Berry-Sethi'' or ''Glushkov''). * * @author Burak Emir diff --git a/src/library/scala/xml/parsing/XhtmlParser.scala b/src/library/scala/xml/parsing/XhtmlParser.scala index de9a3f2243..e7e3cc38c9 100644 --- a/src/library/scala/xml/parsing/XhtmlParser.scala +++ b/src/library/scala/xml/parsing/XhtmlParser.scala @@ -12,7 +12,7 @@ package parsing import scala.io.Source /** An XML Parser that preserves `CDATA` blocks and knows about - * [[scala.xml.parsing.HtmlEntities]]. + * [[scala.xml.parsing.XhtmlEntities]]. * * @author (c) David Pollak, 2007 WorldWide Conferencing, LLC. */ diff --git a/src/manual/scala/man1/Command.scala b/src/manual/scala/man1/Command.scala index 16c4307140..d8f2b22dea 100644 --- a/src/manual/scala/man1/Command.scala +++ b/src/manual/scala/man1/Command.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud */ diff --git a/src/manual/scala/man1/fsc.scala b/src/manual/scala/man1/fsc.scala index 2aafe7d82c..ed5da09828 100644 --- a/src/manual/scala/man1/fsc.scala +++ b/src/manual/scala/man1/fsc.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud */ diff --git a/src/manual/scala/man1/scala.scala b/src/manual/scala/man1/scala.scala index 8daab84d3e..c2a0a2ad01 100644 --- a/src/manual/scala/man1/scala.scala +++ b/src/manual/scala/man1/scala.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud */ diff --git a/src/manual/scala/man1/scalac.scala b/src/manual/scala/man1/scalac.scala index 49324ffa83..9e4df51819 100644 --- a/src/manual/scala/man1/scalac.scala +++ b/src/manual/scala/man1/scalac.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud */ diff --git a/src/manual/scala/man1/scaladoc.scala b/src/manual/scala/man1/scaladoc.scala index 193c77fc51..ac2a16ccb3 100644 --- a/src/manual/scala/man1/scaladoc.scala +++ b/src/manual/scala/man1/scaladoc.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud */ diff --git a/src/manual/scala/man1/scalap.scala b/src/manual/scala/man1/scalap.scala index 88fc91957f..15fd47fb56 100644 --- a/src/manual/scala/man1/scalap.scala +++ b/src/manual/scala/man1/scalap.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud */ diff --git a/src/manual/scala/tools/docutil/EmitHtml.scala b/src/manual/scala/tools/docutil/EmitHtml.scala index 43d097a137..076626aa1c 100644 --- a/src/manual/scala/tools/docutil/EmitHtml.scala +++ b/src/manual/scala/tools/docutil/EmitHtml.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud * Adapted from Lex Spoon's sbaz manual */ diff --git a/src/manual/scala/tools/docutil/EmitManPage.scala b/src/manual/scala/tools/docutil/EmitManPage.scala index 39d68dbc18..6b54b316ea 100644 --- a/src/manual/scala/tools/docutil/EmitManPage.scala +++ b/src/manual/scala/tools/docutil/EmitManPage.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud * Adapted from Lex Spoon's sbaz manual */ diff --git a/src/manual/scala/tools/docutil/ManMaker.scala b/src/manual/scala/tools/docutil/ManMaker.scala index fa35e658dd..b0781127bb 100644 --- a/src/manual/scala/tools/docutil/ManMaker.scala +++ b/src/manual/scala/tools/docutil/ManMaker.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud * Adapted from Lex Spoon's sbaz manual */ diff --git a/src/manual/scala/tools/docutil/ManPage.scala b/src/manual/scala/tools/docutil/ManPage.scala index ff7ac1bb4c..6ecf422cc4 100644 --- a/src/manual/scala/tools/docutil/ManPage.scala +++ b/src/manual/scala/tools/docutil/ManPage.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Stephane Micheloud * Adapted from Lex Spoon's sbaz manual */ diff --git a/src/manual/scala/tools/docutil/resources/index.html b/src/manual/scala/tools/docutil/resources/index.html index d1f3bd81f4..aaef94d400 100644 --- a/src/manual/scala/tools/docutil/resources/index.html +++ b/src/manual/scala/tools/docutil/resources/index.html @@ -8,7 +8,7 @@ <meta http-equiv="Content-Style-Type" content="text/css"/> <meta http-equiv="Content-Language" content="en"/> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> - <meta name="Copyright" content="(C) 2002-2011 LAMP/EPFL"/> + <meta name="Copyright" content="(C) 2002-2012 LAMP/EPFL"/> <meta name="Language" content="en"/> <meta name="Description" content="The Scala Programming Language"/> <meta name="Author" content="Stephane Micheloud"/> diff --git a/src/partest/scala/tools/partest/CompilerTest.scala b/src/partest/scala/tools/partest/CompilerTest.scala index fec9893099..a1450ee876 100644 --- a/src/partest/scala/tools/partest/CompilerTest.scala +++ b/src/partest/scala/tools/partest/CompilerTest.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/partest/scala/tools/partest/DirectTest.scala b/src/partest/scala/tools/partest/DirectTest.scala index 323705b695..ff047daf9e 100644 --- a/src/partest/scala/tools/partest/DirectTest.scala +++ b/src/partest/scala/tools/partest/DirectTest.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/partest/scala/tools/partest/IcodeTest.scala b/src/partest/scala/tools/partest/IcodeTest.scala index 28891f9bbf..ebb194b14f 100644 --- a/src/partest/scala/tools/partest/IcodeTest.scala +++ b/src/partest/scala/tools/partest/IcodeTest.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/partest/scala/tools/partest/ReplTest.scala b/src/partest/scala/tools/partest/ReplTest.scala index c7f17ad2a3..840739089b 100644 --- a/src/partest/scala/tools/partest/ReplTest.scala +++ b/src/partest/scala/tools/partest/ReplTest.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/partest/scala/tools/partest/ScaladocModelTest.scala b/src/partest/scala/tools/partest/ScaladocModelTest.scala index 7117d7c715..b8a41aabe4 100644 --- a/src/partest/scala/tools/partest/ScaladocModelTest.scala +++ b/src/partest/scala/tools/partest/ScaladocModelTest.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Vlad Ureche */ diff --git a/src/partest/scala/tools/partest/SecurityTest.scala b/src/partest/scala/tools/partest/SecurityTest.scala index 54aad5a625..462db025b5 100644 --- a/src/partest/scala/tools/partest/SecurityTest.scala +++ b/src/partest/scala/tools/partest/SecurityTest.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/partest/scala/tools/partest/SigTest.scala b/src/partest/scala/tools/partest/SigTest.scala index 1d8728294b..d9666f331e 100644 --- a/src/partest/scala/tools/partest/SigTest.scala +++ b/src/partest/scala/tools/partest/SigTest.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/partest/scala/tools/partest/nest/CompileManager.scala b/src/partest/scala/tools/partest/nest/CompileManager.scala index 6e6c767117..604e53e64c 100644 --- a/src/partest/scala/tools/partest/nest/CompileManager.scala +++ b/src/partest/scala/tools/partest/nest/CompileManager.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Philipp Haller */ diff --git a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala index 68e9753575..32f14872ec 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Philipp Haller */ diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala index 20e6f47802..ccc756c158 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Philipp Haller */ diff --git a/src/partest/scala/tools/partest/nest/DirectRunner.scala b/src/partest/scala/tools/partest/nest/DirectRunner.scala index c254472342..a07705322d 100644 --- a/src/partest/scala/tools/partest/nest/DirectRunner.scala +++ b/src/partest/scala/tools/partest/nest/DirectRunner.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Philipp Haller */ diff --git a/src/partest/scala/tools/partest/nest/FileManager.scala b/src/partest/scala/tools/partest/nest/FileManager.scala index 40bfa36b04..064b82da85 100644 --- a/src/partest/scala/tools/partest/nest/FileManager.scala +++ b/src/partest/scala/tools/partest/nest/FileManager.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Philipp Haller */ diff --git a/src/partest/scala/tools/partest/nest/NestRunner.scala b/src/partest/scala/tools/partest/nest/NestRunner.scala index 27c1ef64f0..10fe2e8fb3 100644 --- a/src/partest/scala/tools/partest/nest/NestRunner.scala +++ b/src/partest/scala/tools/partest/nest/NestRunner.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Philipp Haller */ diff --git a/src/partest/scala/tools/partest/nest/NestUI.scala b/src/partest/scala/tools/partest/nest/NestUI.scala index 54e99a7ddf..29845e2fbf 100644 --- a/src/partest/scala/tools/partest/nest/NestUI.scala +++ b/src/partest/scala/tools/partest/nest/NestUI.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Philipp Haller */ diff --git a/src/partest/scala/tools/partest/nest/PathSettings.scala b/src/partest/scala/tools/partest/nest/PathSettings.scala index b409a29165..93a34bb66f 100644 --- a/src/partest/scala/tools/partest/nest/PathSettings.scala +++ b/src/partest/scala/tools/partest/nest/PathSettings.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL */ package scala.tools.partest diff --git a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala index fa75d96b34..838bf56d73 100644 --- a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala +++ b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Philipp Haller */ diff --git a/src/partest/scala/tools/partest/nest/RunnerManager.scala b/src/partest/scala/tools/partest/nest/RunnerManager.scala index 5a7684dc61..20d61d0831 100644 --- a/src/partest/scala/tools/partest/nest/RunnerManager.scala +++ b/src/partest/scala/tools/partest/nest/RunnerManager.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Philipp Haller */ diff --git a/src/partest/scala/tools/partest/nest/RunnerUtils.scala b/src/partest/scala/tools/partest/nest/RunnerUtils.scala index 93fff0e146..ce2d6b5008 100644 --- a/src/partest/scala/tools/partest/nest/RunnerUtils.scala +++ b/src/partest/scala/tools/partest/nest/RunnerUtils.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Philipp Haller */ diff --git a/src/partest/scala/tools/partest/nest/TestFile.scala b/src/partest/scala/tools/partest/nest/TestFile.scala index 52af16274e..c203c000d1 100644 --- a/src/partest/scala/tools/partest/nest/TestFile.scala +++ b/src/partest/scala/tools/partest/nest/TestFile.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Philipp Haller */ diff --git a/src/partest/scala/tools/partest/package.scala b/src/partest/scala/tools/partest/package.scala index 9f45b380eb..08934ef143 100644 --- a/src/partest/scala/tools/partest/package.scala +++ b/src/partest/scala/tools/partest/package.scala @@ -1,5 +1,5 @@ /* NEST (New Scala Test) - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL */ package scala.tools diff --git a/src/reflect/scala/reflect/api/Constants.scala b/src/reflect/scala/reflect/api/Constants.scala index 7862ab0d25..6657245003 100644 --- a/src/reflect/scala/reflect/api/Constants.scala +++ b/src/reflect/scala/reflect/api/Constants.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/api/FlagSets.scala b/src/reflect/scala/reflect/api/FlagSets.scala index 969176d641..6d105c9d20 100644 --- a/src/reflect/scala/reflect/api/FlagSets.scala +++ b/src/reflect/scala/reflect/api/FlagSets.scala @@ -9,8 +9,7 @@ trait FlagSets { self: Universe => trait FlagOps extends Any { def | (right: FlagSet): FlagSet - def & (right: FlagSet): FlagSet - def containsAll (right: FlagSet): Boolean + def hasFlag(flags: FlagSet): Boolean } implicit def addFlagOps(left: FlagSet): FlagOps @@ -19,8 +18,6 @@ trait FlagSets { self: Universe => type FlagValues >: Null <: FlagValuesApi - // [Eugene++] any other flags we would like to expose? - trait FlagValuesApi { /** Flag indicating that symbol or tree represents a trait */ @@ -100,13 +97,5 @@ trait FlagSets { self: Universe => /** Flag indicating that parameter has a default value */ val DEFAULTPARAM: FlagSet - - /** Flag indicating that trait has neither method implementations nor fields. - * This means the trait can be represented as a Java interface. */ - val INTERFACE: FlagSet - - def union(flags: FlagSet*): FlagSet - def intersection(flag: FlagSet*): FlagSet - def containsAll(superset: FlagSet, subset: FlagSet): Boolean } } diff --git a/src/reflect/scala/reflect/api/Mirrors.scala b/src/reflect/scala/reflect/api/Mirrors.scala index 27176a2a2d..f2f96645e3 100644 --- a/src/reflect/scala/reflect/api/Mirrors.scala +++ b/src/reflect/scala/reflect/api/Mirrors.scala @@ -33,8 +33,16 @@ trait Mirrors { self: Universe => /** Reflects against a field symbol and returns a mirror * that can be used to get and, if appropriate, set the value of the field. * + * FieldMirrors are the only way to get at private[this] vals and vars and + * might be useful to inspect the data of underlying Java fields. + * For all other uses, it's better to go through the fields accessor. + * + * In particular, there should be no need to ever access a field mirror + * when reflecting on just the public members of a class or trait. + * Note also that only accessor MethodMirrors, but not FieldMirrors will accurately reflect overriding behavior. + * * To get a field symbol by the name of the field you would like to reflect, - * use `<this mirror>.symbol.typeSignature.member(newTermName(<name of the field>)).asTermSymbol`. + * use `<this mirror>.symbol.typeSignature.member(newTermName(<name of the field>)).asTerm.accessed`. * For further information about member lookup refer to `Symbol.typeSignature`. * * The input symbol can be either private or non-private (Scala reflection transparently deals with visibility). @@ -54,7 +62,7 @@ trait Mirrors { self: Universe => * that can be used to invoke the method provided. * * To get a method symbol by the name of the method you would like to reflect, - * use `<this mirror>.symbol.typeSignature.member(newTermName(<name of the method>)).asMethodSymbol`. + * use `<this mirror>.symbol.typeSignature.member(newTermName(<name of the method>)).asMethod`. * For further information about member lookup refer to `Symbol.typeSignature`. * * The input symbol can be either private or non-private (Scala reflection transparently deals with visibility). @@ -66,7 +74,7 @@ trait Mirrors { self: Universe => * that can be used to create instances of the class, inspect its companion object or perform further reflections. * * To get a class symbol by the name of the class you would like to reflect, - * use `<this mirror>.symbol.typeSignature.member(newTypeName(<name of the class>)).asClassSymbol`. + * use `<this mirror>.symbol.typeSignature.member(newTypeName(<name of the class>)).asClass`. * For further information about member lookup refer to `Symbol.typeSignature`. * * The input symbol can be either private or non-private (Scala reflection transparently deals with visibility). @@ -78,7 +86,7 @@ trait Mirrors { self: Universe => * that can be used to get the instance of the object or inspect its companion class. * * To get a module symbol by the name of the object you would like to reflect, - * use `<this mirror>.symbol.typeSignature.member(newTermName(<name of the object>)).asModuleSymbol`. + * use `<this mirror>.symbol.typeSignature.member(newTermName(<name of the object>)).asModule`. * For further information about member lookup refer to `Symbol.typeSignature`. * * The input symbol can be either private or non-private (Scala reflection transparently deals with visibility). @@ -91,7 +99,7 @@ trait Mirrors { self: Universe => trait FieldMirror { /** The object containing the field */ - def receiver: AnyRef + def receiver: Any /** The field symbol representing the field. * @@ -107,6 +115,10 @@ trait Mirrors { self: Universe => * Scala reflection uses reflection capabilities of the underlying platform, * so `FieldMirror.get` might throw platform-specific exceptions associated * with getting a field or invoking a getter method of the field. + * + * If `symbol` represents a field of a base class with respect to the class of the receiver, + * and this base field is overriden in the class of the receiver, then this method will retrieve + * the value of the base field. To achieve overriding behavior, use reflectMethod on an accessor. */ def get: Any @@ -117,6 +129,10 @@ trait Mirrors { self: Universe => * Scala reflection uses reflection capabilities of the underlying platform, * so `FieldMirror.get` might throw platform-specific exceptions associated * with setting a field or invoking a setter method of the field. + * + * If `symbol` represents a field of a base class with respect to the class of the receiver, + * and this base field is overriden in the class of the receiver, then this method will set + * the value of the base field. To achieve overriding behavior, use reflectMethod on an accessor. */ def set(value: Any): Unit } @@ -125,7 +141,7 @@ trait Mirrors { self: Universe => trait MethodMirror { /** The receiver object of the method */ - def receiver: AnyRef + def receiver: Any /** The method symbol representing the method */ def symbol: MethodSymbol @@ -201,7 +217,7 @@ trait Mirrors { self: Universe => * that can be used to invoke it and construct instances of this mirror's symbols. * * To get a constructor symbol you would like to reflect, - * use `<this mirror>.symbol.typeSignature.member(nme.CONSTRUCTOR).asMethodSymbol`. + * use `<this mirror>.symbol.typeSignature.member(nme.CONSTRUCTOR).asMethod`. * For further information about member lookup refer to `Symbol.typeSignature`. * * The input symbol can be either private or non-private (Scala reflection transparently deals with visibility). @@ -226,7 +242,9 @@ trait Mirrors { self: Universe => * Such a mirror can be used to further reflect against the members of the object * to get/set fields, invoke methods and inspect inner classes and objects. */ - def reflect(obj: Any): InstanceMirror + // we need a ClassTag here to preserve boxity of primitives + // the class tag lets us tell apart `mirror.reflect(2)` and `mirror.reflect(new Integer(2))` + def reflect[T: ClassTag](obj: T): InstanceMirror /** Reflects against a static class symbol and returns a mirror * that can be used to create instances of the class, inspect its companion object or perform further reflections. diff --git a/src/reflect/scala/reflect/api/StandardDefinitions.scala b/src/reflect/scala/reflect/api/StandardDefinitions.scala index c2a89f92dd..c6f02f1a33 100644 --- a/src/reflect/scala/reflect/api/StandardDefinitions.scala +++ b/src/reflect/scala/reflect/api/StandardDefinitions.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.reflect diff --git a/src/reflect/scala/reflect/api/StandardNames.scala b/src/reflect/scala/reflect/api/StandardNames.scala index 24d803a24a..65d87ad7f0 100644 --- a/src/reflect/scala/reflect/api/StandardNames.scala +++ b/src/reflect/scala/reflect/api/StandardNames.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler -* Copyright 2005-2011 LAMP/EPFL +* Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.reflect diff --git a/src/reflect/scala/reflect/api/Symbols.scala b/src/reflect/scala/reflect/api/Symbols.scala index c94c796279..448382973a 100644 --- a/src/reflect/scala/reflect/api/Symbols.scala +++ b/src/reflect/scala/reflect/api/Symbols.scala @@ -12,15 +12,8 @@ trait Symbols extends base.Symbols { self: Universe => override type FreeTermSymbol >: Null <: TermSymbol with FreeTermSymbolApi override type FreeTypeSymbol >: Null <: TypeSymbol with FreeTypeSymbolApi - trait HasFlagsApi { - def flags: FlagSet - def hasFlag(fs: FlagSet): Boolean - def hasAllFlags(fs: FlagSet): Boolean - def flagString: String - } - /** The API of symbols */ - trait SymbolApi extends SymbolBase with HasFlagsApi { this: Symbol => + trait SymbolApi extends SymbolBase with HasFlagsBase { this: Symbol => /** The position of this symbol */ @@ -50,22 +43,52 @@ trait Symbols extends base.Symbols { self: Universe => */ def hasAnnotation(sym: Symbol): Boolean - /** ... + /** For a class: the module or case class factory with the same name in the same package. + * For a module: the class with the same name in the same package. + * For all others: NoSymbol */ - def orElse(alt: => Symbol): Symbol + def companionSymbol: Symbol - /** ... + /** The type signature of this symbol seen as a member of given type `site`. */ - def filter(cond: Symbol => Boolean): Symbol + def typeSignatureIn(site: Type): Type - /** If this is a NoSymbol, returns NoSymbol, otherwise - * returns the result of applying `f` to this symbol. + /** The type signature of this symbol. + * Note if the symbol is a member of a class, one almost always is interested + * in `typeSignatureIn` with a site type instead. */ - def map(f: Symbol => Symbol): Symbol + def typeSignature: Type - /** ... + /******************* tests *******************/ + + /** Does this symbol represent a synthetic (i.e. a compiler-generated) entity? + * Examples of synthetic entities are accessors for vals and vars + * or mixin constructors in trait implementation classes. */ - def suchThat(cond: Symbol => Boolean): Symbol + def isSynthetic: Boolean + + /** Does this symbol represent a local declaration or definition? + * + * If yes, either `isPrivate` or `isProtected` are guaranteed to be true. + * Local symbols can only be accessed from the same object instance. + * + * If yes, `privateWithin` might tell more about this symbol's visibility scope. + */ + def isLocal: Boolean + + /** Does this symbol represent a private declaration or definition? + * If yes, `privateWithin` might tell more about this symbol's visibility scope. + */ + def isPrivate: Boolean + + /** Does this symbol represent a protected declaration or definition? + * If yes, `privateWithin` might tell more about this symbol's visibility scope. + */ + def isProtected: Boolean + + /** Does this symbol represent a public declaration or definition? + */ + def isPublic: Boolean /** * Set when symbol has a modifier of the form private[X], NoSymbol otherwise. @@ -94,24 +117,89 @@ trait Symbols extends base.Symbols { self: Universe => */ def privateWithin: Symbol - /** For a class: the module or case class factory with the same name in the same package. - * For a module: the class with the same name in the same package. - * For all others: NoSymbol + /** Does this symbol represent the definition of a package? + * If yes, `isTerm` is also guaranteed to be true. */ - def companionSymbol: Symbol + def isPackage: Boolean + + /** Does this symbol represent a package class? + * If yes, `isClass` is also guaranteed to be true. + */ + def isPackageClass: Boolean + + /** Does this symbol or its underlying type represent a typechecking error? + */ + def isErroneous : Boolean + + /** Can this symbol be loaded by a reflective mirror? + * + * Scalac relies on `ScalaSignature' annotation to retain symbols across compilation runs. + * Such annotations (also called "pickles") are applied on top-level classes and include information + * about all symbols reachable from the annotee. However, local symbols (e.g. classes or definitions local to a block) + * are typically unreachable and information about them gets lost. + * + * This method is useful for macro writers who wish to save certain ASTs to be used at runtime. + * With `isLocatable' it's possible to check whether a tree can be retained as is, or it needs special treatment. + */ + def isLocatable: Boolean + + /** Is this symbol static (i.e. with no outer instance)? + * Q: When exactly is a sym marked as STATIC? + * A: If it's a member of a toplevel object, or of an object contained in a toplevel object, or any number of levels deep. + * http://groups.google.com/group/scala-internals/browse_thread/thread/d385bcd60b08faf6 + */ + def isStatic: Boolean + + /** Is this symbol final? + */ + def isFinal: Boolean + + /** Is this symbol overriding something? + */ + def isOverride: Boolean + + /** Is this symbol labelled as "abstract override"? + */ + def isAbstractOverride: Boolean + + /** Is this symbol a macro? + */ + def isMacro: Boolean + + /** Is this symbol a parameter (either a method parameter or a type parameter)? + */ + def isParameter: Boolean + + /** Is this symbol a specialized type parameter or a generated specialized member? + */ + def isSpecialized: Boolean - /** If this symbol is a package class, this symbol; otherwise the next enclosing - * package class, or `NoSymbol` if none exists. + /******************* helpers *******************/ + + /** ... */ - def enclosingPackageClass: Symbol + def orElse(alt: => Symbol): Symbol + + /** ... + */ + def filter(cond: Symbol => Boolean): Symbol - /** If this symbol is a top-level class, this symbol; otherwise the next enclosing - * top-level class, or `NoSymbol` if none exists. + /** If this is a NoSymbol, returns NoSymbol, otherwise + * returns the result of applying `f` to this symbol. + */ + def map(f: Symbol => Symbol): Symbol + + /** ... */ - def enclosingTopLevelClass: Symbol + def suchThat(cond: Symbol => Boolean): Symbol + /** The string discriminator of this symbol; useful for debugging */ + def kind: String + } + + /** The API of term symbols */ + trait TermSymbolApi extends SymbolApi with TermSymbolBase { this: TermSymbol => /** Does this symbol represent a value, i.e. not a module and not a method? - * If yes, `isTerm` is also guaranteed to be true. * [Eugene++] I need a review of the implementation */ def isValue: Boolean @@ -120,7 +208,6 @@ trait Symbols extends base.Symbols { self: Universe => def isStable: Boolean /** Does this symbol represent a mutable value? - * If yes, `isTerm` and `isValue` are also guaranteed to be true. */ def isVariable: Boolean @@ -129,113 +216,68 @@ trait Symbols extends base.Symbols { self: Universe => def isAccessor: Boolean /** Does this symbol represent a getter of a field? - * If yes, `isTerm` and `isMethod` are also guaranteed to be true. + * If yes, `isMethod` is also guaranteed to be true. */ def isGetter: Boolean /** Does this symbol represent a setter of a field? - * If yes, `isTerm` and `isMethod` are also guaranteed to be true. + * If yes, `isMethod` is also guaranteed to be true. */ def isSetter: Boolean - /** Does this symbol represent the definition of a package? - * If yes, `isTerm` is also guaranteed to be true. - */ - def isPackage: Boolean - - /** Does this symbol represent a package class? - * If yes, `isClass` is also guaranteed to be true. - */ - def isPackageClass: Boolean - - /** Is this symbol an overloaded method? + /** Does this symbol represent an overloaded method? + * If yes, `isMethod` is false, and the list of the enclosed alternatives can be found out via `alternatives`. */ def isOverloaded : Boolean - /** Does this symbol represent the definition of a primitive class? - * Namely, is it one of [[scala.Double]], [[scala.Float]], [[scala.Long]], [[scala.Int]], [[scala.Char]], - * [[scala.Short]], [[scala.Byte]], [[scala.Unit]] or [[scala.Boolean]]? + /** Does this symbol represent an implicit value, definition or parameter? */ - def isPrimitiveValueClass: Boolean + def isImplicit: Boolean - /** Does this symbol represent the definition of a numeric value class? - * Namely, is it one of [[scala.Double]], [[scala.Float]], [[scala.Long]], [[scala.Int]], [[scala.Char]], - * [[scala.Short]], [[scala.Byte]], [[scala.Unit]] or [[scala.Boolean]]? - */ - def isNumericValueClass: Boolean - - /** Does this symbol represent the definition of a custom value class? - * Namely, is AnyVal among its parent classes? - * TODO: Why not just have in reflect.internal? - * [Eugene++] because it's useful for macros + /** Does this symbol represent a lazy value? */ - def isDerivedValueClass: Boolean + def isLazy: Boolean - /** Does this symbol represent the definition of a type alias? - * If yes, `isType` is also guaranteed to be true. - */ - def isAliasType : Boolean + /** The overloaded alternatives of this symbol */ + def alternatives: List[Symbol] - /** Does this symbol represent the definition of an abstract type? - * If yes, `isType` is also guaranteed to be true. - */ - def isAbstractType : Boolean + /** Used to provide a better error message for `asMethod` */ + override protected def isOverloadedMethod = alternatives exists (_.isMethod) - /** Does this symbol represent an existentially bound type? - * If yes, `isType` is also guaranteed to be true. + /** Backing field for an accessor method, NoSymbol for all other term symbols. */ - def isExistential : Boolean + def accessed: Symbol - /** Does this symbol represent a free type captured by reification? + /** Getter method for a backing field of a val or a val, NoSymbol for all other term symbols. */ - def isFreeType : Boolean + def getter: Symbol - /** Does this symbol or its underlying type represent a typechecking error? + /** Setter method for a backing field of a val or a val, NoSymbol for all other term symbols. */ - def isErroneous : Boolean + def setter: Symbol - /** Can this symbol be loaded by a reflective mirror? - * - * Scalac relies on `ScalaSignature' annotation to retain symbols across compilation runs. - * Such annotations (also called "pickles") are applied on top-level classes and include information - * about all symbols reachable from the annotee. However, local symbols (e.g. classes or definitions local to a block) - * are typically unreachable and information about them gets lost. - * - * This method is useful for macro writers who wish to save certain ASTs to be used at runtime. - * With `isLocatable' it's possible to check whether a tree can be retained as is, or it needs special treatment. + /** Does this symbol represent a field of a class + * that was generated from a parameter of that class? */ - def isLocatable: Boolean + def isParamAccessor: Boolean - /** Is this symbol static (i.e. with no outer instance)? - * Q: When exactly is a sym marked as STATIC? - * A: If it's a member of a toplevel object, or of an object contained in a toplevel object, or any number of levels deep. - * http://groups.google.com/group/scala-internals/browse_thread/thread/d385bcd60b08faf6 + /** Does this symbol represent a field of a case class + * that corresponds to a parameter in the first parameter list of the + * primary constructor of that class? */ - def isStatic: Boolean + def isCaseAccessor: Boolean - /** The type signature of this symbol seen as a member of given type `site`. + /** Does this symbol represent a parameter with a default value? */ - def typeSignatureIn(site: Type): Type + def isParamWithDefault: Boolean - /** The type signature of this symbol. - * Note if the symbol is a member of a class, one almost always is interested - * in `typeSignatureIn` with a site type instead. + /** Does this symbol represent a by-name parameter? */ - def typeSignature: Type - - /** The string discriminator of this symbol; useful for debugging */ - def kind: String - } - - /** The API of term symbols */ - trait TermSymbolApi extends SymbolApi with HasFlagsApi with TermSymbolBase { this: TermSymbol => - /** The overloaded alternatives of this symbol */ - def alternatives: List[Symbol] - + def isByNameParam: Boolean } /** The API of type symbols */ - trait TypeSymbolApi extends SymbolApi with HasFlagsApi with TypeSymbolBase { this: TypeSymbol => + trait TypeSymbolApi extends SymbolApi with TypeSymbolBase { this: TypeSymbol => /** Is the type parameter represented by this symbol contravariant? */ def isContravariant : Boolean @@ -246,37 +288,92 @@ trait Symbols extends base.Symbols { self: Universe => /** Does this symbol represent the definition of a skolem? * Skolems are used during typechecking to represent type parameters viewed from inside their scopes. - * If yes, `isType` is also guaranteed to be true. */ def isSkolem : Boolean - /** A type reference that refers to this type symbol seen - * as a member of given type `site`. - */ - def asTypeIn(site: Type): Type - - /** A type reference that refers to this type symbol - * Note if symbol is a member of a class, one almost always is interested - * in `asTypeIn` with a site type instead. - * - * Example: Given a class declaration `class C[T] { ... } `, that generates a symbol - * `C`. Then `C.asType` is the type `C[T]`. - * - * By contrast, `C.typeSignature` would be a type signature of form - * `PolyType(ClassInfoType(...))` that describes type parameters, value - * parameters, parent types, and members of `C`. - */ - def asType: Type // !!! Same as typeSignature. + /** Does this symbol represent the definition of a type alias? + */ + def isAliasType : Boolean + + /** Does this symbol represent the definition of an abstract type? + */ + def isAbstractType : Boolean + + /** Does this symbol represent an existentially bound type? + */ + def isExistential : Boolean + + /** For a polymorphic type, its type parameters, the empty list for all other types */ + def typeParams: List[Symbol] } /** The API of method symbols */ - type MethodSymbolApi = MethodSymbolBase + trait MethodSymbolApi extends TermSymbolApi with MethodSymbolBase { this: MethodSymbol => + /** Does this method represent a constructor? + * + * If `owner` is a class, then this is a vanilla JVM constructor. + * If `owner` is a trait, then this is a mixin constructor. + */ + def isConstructor: Boolean + + /** For a polymorphic method, its type parameters, the empty list for all other methods */ + def typeParams: List[Symbol] + + /** All parameter lists of the method. + * + * Can be used to distinguish nullary methods and methods with empty parameter lists. + * For a nullary method, returns the empty list (i.e. `List()`). + * For a method with an empty parameter list, returns a list that contains the empty list (i.e. `List(List())`). + */ + def params: List[List[Symbol]] + + /** Does this method support variable length argument lists? + */ + def isVarargs: Boolean + + /** The return type of the method */ + def returnType: Type + } /** The API of module symbols */ - type ModuleSymbolApi = ModuleSymbolBase + trait ModuleSymbolApi extends TermSymbolApi with ModuleSymbolBase { this: ModuleSymbol => + } /** The API of class symbols */ trait ClassSymbolApi extends TypeSymbolApi with ClassSymbolBase { this: ClassSymbol => + /** Does this symbol represent the definition of a primitive class? + * Namely, is it one of [[scala.Double]], [[scala.Float]], [[scala.Long]], [[scala.Int]], [[scala.Char]], + * [[scala.Short]], [[scala.Byte]], [[scala.Unit]] or [[scala.Boolean]]? + */ + def isPrimitive: Boolean + + /** Does this symbol represent the definition of a numeric value class? + * Namely, is it one of [[scala.Double]], [[scala.Float]], [[scala.Long]], [[scala.Int]], [[scala.Char]], + * [[scala.Short]], [[scala.Byte]], [[scala.Unit]] or [[scala.Boolean]]? + */ + def isNumeric: Boolean + + /** Does this symbol represent the definition of a custom value class? + * Namely, is AnyVal among its parent classes? + */ + def isDerivedValueClass: Boolean + + /** Does this symbol represent a trait? + */ + def isTrait: Boolean + + /** Does this symbol represent an abstract class? + */ + def isAbstractClass: Boolean + + /** Does this symbol represent a case class? + */ + def isCaseClass: Boolean + + /** Does this symbol represent a sealed class? + */ + def isSealed: Boolean + /** If this symbol is a class or trait, its self type, otherwise the type * of the symbol itself. */ @@ -284,6 +381,9 @@ trait Symbols extends base.Symbols { self: Universe => /** The type `C.this`, where `C` is the current class */ def thisPrefix: Type + + /** For a polymorphic class/trait, its type parameters, the empty list for all other classes/trait */ + def typeParams: List[Symbol] } /** The API of free term symbols */ diff --git a/src/reflect/scala/reflect/api/TagInterop.scala b/src/reflect/scala/reflect/api/TagInterop.scala index f1938083b5..4d2254cb9f 100644 --- a/src/reflect/scala/reflect/api/TagInterop.scala +++ b/src/reflect/scala/reflect/api/TagInterop.scala @@ -27,8 +27,8 @@ trait TagInterop { self: JavaUniverse => val jm = mirror.asInstanceOf[ju.Mirror] val sym = jm.classSymbol(manifest.erasure) val tpe = - if (manifest.typeArguments.isEmpty) sym.asType - else ju.appliedType(sym.asTypeConstructor, manifest.typeArguments map (targ => ju.manifestToTypeTag(jm, targ)) map (_.in(jm).tpe)) + if (manifest.typeArguments.isEmpty) sym.toType + else ju.appliedType(sym.toTypeConstructor, manifest.typeArguments map (targ => ju.manifestToTypeTag(jm, targ)) map (_.in(jm).tpe)) tpe.asInstanceOf[U # Type] case u => u.manifestToTypeTag(mirror.asInstanceOf[u.Mirror], manifest).in(mirror).tpe diff --git a/src/reflect/scala/reflect/api/Trees.scala b/src/reflect/scala/reflect/api/Trees.scala index 2d130daa4e..5522693b29 100644 --- a/src/reflect/scala/reflect/api/Trees.scala +++ b/src/reflect/scala/reflect/api/Trees.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.reflect @@ -109,6 +109,8 @@ trait Trees extends base.Trees { self: Universe => def duplicate: this.type } + override protected def treeType(tree: Tree) = tree.tpe + override type TermTree >: Null <: Tree with TermTreeApi /** The API that all term trees support */ @@ -640,8 +642,16 @@ trait Trees extends base.Trees { self: Universe => abstract class Transformer { val treeCopy: TreeCopier = newLazyTreeCopier protected[scala] var currentOwner: Symbol = rootMirror.RootClass - protected def currentMethod = currentOwner.enclosingMethod - protected def currentClass = currentOwner.enclosingClass + protected def currentMethod = { + def enclosingMethod(sym: Symbol): Symbol = + if (sym.isMethod || sym == NoSymbol) sym else enclosingMethod(sym.owner) + enclosingMethod(currentOwner) + } + protected def currentClass = { + def enclosingClass(sym: Symbol): Symbol = + if (sym.isClass || sym == NoSymbol) sym else enclosingClass(sym.owner) + enclosingClass(currentOwner) + } // protected def currentPackage = currentOwner.enclosingTopLevelClass.owner def transform(tree: Tree): Tree = itransform(this, tree) @@ -683,7 +693,7 @@ trait Trees extends base.Trees { self: Universe => type Modifiers >: Null <: ModifiersApi - abstract class ModifiersApi extends ModifiersBase with HasFlagsApi + abstract class ModifiersApi extends ModifiersBase } diff --git a/src/reflect/scala/reflect/api/Types.scala b/src/reflect/scala/reflect/api/Types.scala index 01de5fa9a7..199cf9b9e5 100644 --- a/src/reflect/scala/reflect/api/Types.scala +++ b/src/reflect/scala/reflect/api/Types.scala @@ -24,73 +24,35 @@ trait Types extends base.Types { self: Universe => */ def declaration(name: Name): Symbol - /** The collection of declarations in this type - * [Eugene++] why not List? + /** A `Scope` containing directly declared members of this type. + * Unlike `members` this method doesn't returns inherited members. + * + * Members in the returned scope might appear in arbitrary order. + * Use `declarations.sorted` to get an ordered list of members. */ - def declarations: Iterable[Symbol] + def declarations: MemberScope /** The member with given name, either directly declared or inherited, * an OverloadedSymbol if several exist, NoSymbol if none exist. */ def member(name: Name): Symbol - /** The non-private member with given name, either directly declared or inherited, - * an OverloadedSymbol if several exist, NoSymbol if none exist. - */ - def nonPrivateMember(name: Name): Symbol - - /** An iterable containing all members of this type (directly declared or inherited) - * Members appear in the linearization order of their owners. - * Members with the same owner appear in reverse order of their declarations. - * [Eugene++] the order needs to be reversed back, at least in the public API - */ - def members: Iterable[Symbol] - - /** An iterable containing all non-private members of this type (directly declared or inherited) - * Members appear in the linearization order of their owners. - * Members with the same owner appear in reverse order of their declarations. - */ - def nonPrivateMembers: Iterable[Symbol] - - /** Substitute symbols in `to` for corresponding occurrences of references to - * symbols `from` in this type. - */ - def substituteSymbols(from: List[Symbol], to: List[Symbol]): Type - - /** Substitute types in `to` for corresponding occurrences of references to - * symbols `from` in this type. - */ - def substituteTypes(from: List[Symbol], to: List[Type]): Type - - /** If this is a parameterized types, the type arguments. - * Otherwise the empty list + /** A `Scope` containing all members of this type (directly declared or inherited). + * Unlike `declarations` this method also returns inherited members. + * + * Members in the returned scope might appear in arbitrary order. + * Use `declarations.sorted` to get an ordered list of members. */ - def typeArguments: List[Type] - - /** For a (potentially wrapped) poly type, its type parameters, - * the empty list for all other types */ - def typeParams: List[Symbol] - - /** For a (nullary) method or poly type, its direct result type, - * the type itself for all other types. */ - def resultType: Type + def members: MemberScope /** Is this type a type constructor that is missing its type arguments? */ - def isHigherKinded: Boolean // !!! This should be called "isTypeConstructor", no? + def takesTypeArgs: Boolean /** Returns the corresponding type constructor (e.g. List for List[T] or List[String]) */ def typeConstructor: Type - /** Does this type refer to spliceable types or is a spliceable type? - */ - def isConcrete: Boolean - - /** Is this type an abstract type that needs to be resolved? - */ - def isSpliceable: Boolean - /** * Expands type aliases and converts higher-kinded TypeRefs to PolyTypes. * Functions on types are also implemented as PolyTypes. @@ -99,7 +61,7 @@ trait Types extends base.Types { self: Universe => * TypeRef(pre, <List>, List()) is replaced by * PolyType(X, TypeRef(pre, <List>, List(X))) */ - def normalize: Type // !!! Alternative name? "normalize" is used to mean too many things. + def normalize: Type /** Does this type conform to given type argument `that`? */ def <:< (that: Type): Boolean @@ -111,7 +73,7 @@ trait Types extends base.Types { self: Universe => * in reverse linearization order, starting with the class itself and ending * in class Any. */ - def baseClasses: List[Symbol] // !!! Alternative name, perhaps linearization? + def baseClasses: List[Symbol] /** The least type instance of given class which is a supertype * of this type. Example: @@ -141,36 +103,7 @@ trait Types extends base.Types { self: Universe => /** The erased type corresponding to this type after * all transformations from Scala to Java have been performed. */ - def erasure: Type // !!! "erasedType", compare with "widen" (so "erase") or "underlying" (so "erased") - // why not name it "erasure"? - - /** Apply `f` to each part of this type, returning - * a new type. children get mapped before their parents */ - def map(f: Type => Type): Type - - /** Apply `f` to each part of this type, for side effects only */ - def foreach(f: Type => Unit) - - /** Returns optionally first type (in a preorder traversal) which satisfies predicate `p`, - * or None if none exists. - */ - def find(p: Type => Boolean): Option[Type] - - /** Is there part of this type which satisfies predicate `p`? */ - def exists(p: Type => Boolean): Boolean - - /** Does this type contain a reference to given symbol? */ - def contains(sym: Symbol): Boolean - - /** If this is a compound type, the list of its parent types; - * otherwise the empty list - */ - def parents: List[Type] - - /** If this is a singleton type, returns the type underlying it; - * otherwise returns this type itself. - */ - def underlying: Type + def erasure: Type /** If this is a singleton type, widen it to its nearest underlying non-singleton * base type by applying one or more `underlying` dereferences. @@ -193,6 +126,36 @@ trait Types extends base.Types { self: Universe => */ def narrow: Type + /******************* helpers *******************/ + + /** Substitute symbols in `to` for corresponding occurrences of references to + * symbols `from` in this type. + */ + def substituteSymbols(from: List[Symbol], to: List[Symbol]): Type + + /** Substitute types in `to` for corresponding occurrences of references to + * symbols `from` in this type. + */ + def substituteTypes(from: List[Symbol], to: List[Type]): Type + + /** Apply `f` to each part of this type, returning + * a new type. children get mapped before their parents */ + def map(f: Type => Type): Type + + /** Apply `f` to each part of this type, for side effects only */ + def foreach(f: Type => Unit) + + /** Returns optionally first type (in a preorder traversal) which satisfies predicate `p`, + * or None if none exists. + */ + def find(p: Type => Boolean): Option[Type] + + /** Is there part of this type which satisfies predicate `p`? */ + def exists(p: Type => Boolean): Boolean + + /** Does this type contain a reference to given symbol? */ + def contains(sym: Symbol): Boolean + /** The string discriminator of this type; useful for debugging */ def kind: String } diff --git a/src/reflect/scala/reflect/api/Universe.scala b/src/reflect/scala/reflect/api/Universe.scala index 85d8adc44f..3dce0f218e 100644 --- a/src/reflect/scala/reflect/api/Universe.scala +++ b/src/reflect/scala/reflect/api/Universe.scala @@ -1,8 +1,6 @@ package scala.reflect package api -import language.experimental.macros - abstract class Universe extends base.Universe with Symbols with Types @@ -16,53 +14,4 @@ abstract class Universe extends base.Universe with StandardDefinitions with StandardNames with Importers - with Exprs with AnnotationInfos -{ - - /** Given an expression, generate a tree that when compiled and executed produces the original tree. - * The produced tree will be bound to the Universe it was called from. - * - * For instance, given the abstract syntax tree representation of the <[ x + 1 ]> expression: - * - * {{{ - * Apply(Select(Ident("x"), "+"), List(Literal(Constant(1)))) - * }}} - * - * The reifier transforms it to the following expression: - * - * {{{ - * <[ - * val $u: u.type = u // where u is a reference to the Universe that calls the reify - * $u.Expr[Int]($u.Apply($u.Select($u.Ident($u.newFreeVar("x", <Int>, x), "+"), List($u.Literal($u.Constant(1)))))) - * ]> - * }}} - * - * Reification performs expression splicing (when processing Expr.splice) - * and type splicing (for every type T that has a TypeTag[T] implicit in scope): - * - * {{{ - * val two = mirror.reify(2) // Literal(Constant(2)) - * val four = mirror.reify(two.splice + two.splice) // Apply(Select(two.tree, newTermName("$plus")), List(two.tree)) - * - * def macroImpl[T](c: Context) = { - * ... - * // T here is just a type parameter, so the tree produced by reify won't be of much use in a macro expansion - * // however, if T were annotated with c.TypeTag (which would declare an implicit parameter for macroImpl) - * // then reification would subtitute T with the TypeTree that was used in a TypeApply of this particular macro invocation - * val factory = c.reify{ new Queryable[T] } - * ... - * } - * }}} - * - * The transformation looks mostly straightforward, but it has its tricky parts: - * * Reifier retains symbols and types defined outside the reified tree, however - * locally defined entities get erased and replaced with their original trees - * * Free variables are detected and wrapped in symbols of the type FreeVar - * * Mutable variables that are accessed from a local function are wrapped in refs - * * Since reified trees can be compiled outside of the scope they've been created in, - * special measures are taken to ensure that all members accessed in the reifee remain visible - */ - // implementation is magically hardwired to `scala.reflect.reify.Taggers` - def reify[T](expr: T): Expr[T] = macro ??? -}
\ No newline at end of file diff --git a/src/reflect/scala/reflect/internal/AnnotationCheckers.scala b/src/reflect/scala/reflect/internal/AnnotationCheckers.scala index 449b0ca0bc..9f102c5712 100644 --- a/src/reflect/scala/reflect/internal/AnnotationCheckers.scala +++ b/src/reflect/scala/reflect/internal/AnnotationCheckers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/AnnotationInfos.scala b/src/reflect/scala/reflect/internal/AnnotationInfos.scala index 2bcc95b9a8..229570dafd 100644 --- a/src/reflect/scala/reflect/internal/AnnotationInfos.scala +++ b/src/reflect/scala/reflect/internal/AnnotationInfos.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2007-2011 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala b/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala index 19f70ba785..fbee906b7b 100644 --- a/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala +++ b/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.reflect diff --git a/src/reflect/scala/reflect/internal/BuildUtils.scala b/src/reflect/scala/reflect/internal/BuildUtils.scala index ad59605760..74b9442076 100644 --- a/src/reflect/scala/reflect/internal/BuildUtils.scala +++ b/src/reflect/scala/reflect/internal/BuildUtils.scala @@ -8,11 +8,11 @@ trait BuildUtils extends base.BuildUtils { self: SymbolTable => class BuildImpl extends BuildBase { def selectType(owner: Symbol, name: String): TypeSymbol = - select(owner, newTypeName(name)).asTypeSymbol + select(owner, newTypeName(name)).asType def selectTerm(owner: Symbol, name: String): TermSymbol = { - val result = select(owner, newTermName(name)).asTermSymbol - if (result.isOverloaded) result.suchThat(!_.isMethod).asTermSymbol + val result = select(owner, newTermName(name)).asTerm + if (result.isOverloaded) result.suchThat(!_.isMethod).asTerm else result } @@ -26,7 +26,7 @@ trait BuildUtils extends base.BuildUtils { self: SymbolTable => def selectOverloadedMethod(owner: Symbol, name: String, index: Int): MethodSymbol = { val result = owner.info.decl(newTermName(name)).alternatives(index) - if (result ne NoSymbol) result.asMethodSymbol + if (result ne NoSymbol) result.asMethod else MissingRequirementError.notFound("overloaded method %s #%d in %s".format(name, index, owner.fullName)) } diff --git a/src/reflect/scala/reflect/internal/Chars.scala b/src/reflect/scala/reflect/internal/Chars.scala index 50ec71094a..6ece733b06 100644 --- a/src/reflect/scala/reflect/internal/Chars.scala +++ b/src/reflect/scala/reflect/internal/Chars.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2006-2011 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL * @author Martin Odersky */ package scala.reflect diff --git a/src/reflect/scala/reflect/internal/ClassfileConstants.scala b/src/reflect/scala/reflect/internal/ClassfileConstants.scala index 3346e9cccb..124f1f881d 100644 --- a/src/reflect/scala/reflect/internal/ClassfileConstants.scala +++ b/src/reflect/scala/reflect/internal/ClassfileConstants.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/Constants.scala b/src/reflect/scala/reflect/internal/Constants.scala index d6a168ee11..e5a543da46 100644 --- a/src/reflect/scala/reflect/internal/Constants.scala +++ b/src/reflect/scala/reflect/internal/Constants.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index 90aa0b732c..c6815d10c3 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -20,21 +20,21 @@ trait Definitions extends api.StandardDefinitions { object definitions extends DefinitionsClass // [Eugene] find a way to make these non-lazy - lazy val ByteTpe = definitions.ByteClass.asType - lazy val ShortTpe = definitions.ShortClass.asType - lazy val CharTpe = definitions.CharClass.asType - lazy val IntTpe = definitions.IntClass.asType - lazy val LongTpe = definitions.LongClass.asType - lazy val FloatTpe = definitions.FloatClass.asType - lazy val DoubleTpe = definitions.DoubleClass.asType - lazy val BooleanTpe = definitions.BooleanClass.asType - lazy val UnitTpe = definitions.UnitClass.asType - lazy val AnyTpe = definitions.AnyClass.asType - lazy val ObjectTpe = definitions.ObjectClass.asType - lazy val AnyValTpe = definitions.AnyValClass.asType - lazy val AnyRefTpe = definitions.AnyRefClass.asType - lazy val NothingTpe = definitions.NothingClass.asType - lazy val NullTpe = definitions.NullClass.asType + lazy val ByteTpe = definitions.ByteClass.toTypeConstructor + lazy val ShortTpe = definitions.ShortClass.toTypeConstructor + lazy val CharTpe = definitions.CharClass.toTypeConstructor + lazy val IntTpe = definitions.IntClass.toTypeConstructor + lazy val LongTpe = definitions.LongClass.toTypeConstructor + lazy val FloatTpe = definitions.FloatClass.toTypeConstructor + lazy val DoubleTpe = definitions.DoubleClass.toTypeConstructor + lazy val BooleanTpe = definitions.BooleanClass.toTypeConstructor + lazy val UnitTpe = definitions.UnitClass.toTypeConstructor + lazy val AnyTpe = definitions.AnyClass.toTypeConstructor + lazy val ObjectTpe = definitions.ObjectClass.toTypeConstructor + lazy val AnyValTpe = definitions.AnyValClass.toTypeConstructor + lazy val AnyRefTpe = definitions.AnyRefClass.toTypeConstructor + lazy val NothingTpe = definitions.NothingClass.toTypeConstructor + lazy val NullTpe = definitions.NullClass.toTypeConstructor /** Since both the value parameter types and the result type may * require access to the type parameter symbols, we model polymorphic @@ -183,11 +183,11 @@ trait Definitions extends api.StandardDefinitions { // It becomes tricky to create dedicated objects for other symbols because // of initialization order issues. lazy val JavaLangPackage = getRequiredPackage(sn.JavaLang) - lazy val JavaLangPackageClass = JavaLangPackage.moduleClass.asClassSymbol + lazy val JavaLangPackageClass = JavaLangPackage.moduleClass.asClass lazy val ScalaPackage = getRequiredPackage(nme.scala_) - lazy val ScalaPackageClass = ScalaPackage.moduleClass.asClassSymbol + lazy val ScalaPackageClass = ScalaPackage.moduleClass.asClass lazy val RuntimePackage = getRequiredPackage("scala.runtime") - lazy val RuntimePackageClass = RuntimePackage.moduleClass.asClassSymbol + lazy val RuntimePackageClass = RuntimePackage.moduleClass.asClass lazy val JavaLangEnumClass = requiredClass[java.lang.Enum[_]] @@ -471,11 +471,11 @@ trait Definitions extends api.StandardDefinitions { lazy val OptManifestClass = requiredClass[scala.reflect.OptManifest[_]] lazy val NoManifest = requiredModule[scala.reflect.NoManifest.type] - lazy val ExprsClass = getClassIfDefined("scala.reflect.api.Exprs") // defined in scala-reflect.jar, so we need to be careful - lazy val ExprClass = if (ExprsClass != NoSymbol) getMemberClass(ExprsClass, tpnme.Expr) else NoSymbol - def ExprSplice = if (ExprsClass != NoSymbol) getMemberMethod(ExprClass, nme.splice) else NoSymbol - def ExprValue = if (ExprsClass != NoSymbol) getMemberMethod(ExprClass, nme.value) else NoSymbol - lazy val ExprModule = if (ExprsClass != NoSymbol) getMemberModule(ExprsClass, nme.Expr) else NoSymbol + lazy val ExprsClass = requiredClass[scala.reflect.base.Exprs] + lazy val ExprClass = getMemberClass(ExprsClass, tpnme.Expr) + def ExprSplice = getMemberMethod(ExprClass, nme.splice) + def ExprValue = getMemberMethod(ExprClass, nme.value) + lazy val ExprModule = getMemberModule(ExprsClass, nme.Expr) lazy val ClassTagModule = requiredModule[scala.reflect.ClassTag[_]] lazy val ClassTagClass = requiredClass[scala.reflect.ClassTag[_]] @@ -486,8 +486,7 @@ trait Definitions extends api.StandardDefinitions { lazy val TypeTagModule = getMemberModule(TypeTagsClass, nme.TypeTag) lazy val BaseUniverseClass = requiredClass[scala.reflect.base.Universe] - lazy val ApiUniverseClass = getClassIfDefined("scala.reflect.api.Universe") // defined in scala-reflect.jar, so we need to be careful - def ApiUniverseReify = if (ApiUniverseClass != NoSymbol) getMemberMethod(ApiUniverseClass, nme.reify) else NoSymbol + def BaseUniverseReify = getMemberMethod(BaseUniverseClass, nme.reify) lazy val JavaUniverseClass = getClassIfDefined("scala.reflect.api.JavaUniverse") // defined in scala-reflect.jar, so we need to be careful lazy val MirrorOfClass = requiredClass[scala.reflect.base.MirrorOf[_]] @@ -495,13 +494,13 @@ trait Definitions extends api.StandardDefinitions { lazy val TypeCreatorClass = requiredClass[scala.reflect.base.TypeCreator] lazy val TreeCreatorClass = requiredClass[scala.reflect.base.TreeCreator] - lazy val MacroContextClass = getClassIfDefined("scala.reflect.makro.Context") // defined in scala-reflect.jar, so we need to be careful + lazy val MacroContextClass = getClassIfDefined("scala.reflect.macros.Context") // defined in scala-reflect.jar, so we need to be careful def MacroContextPrefix = if (MacroContextClass != NoSymbol) getMemberMethod(MacroContextClass, nme.prefix) else NoSymbol def MacroContextPrefixType = if (MacroContextClass != NoSymbol) getMemberType(MacroContextClass, tpnme.PrefixType) else NoSymbol def MacroContextUniverse = if (MacroContextClass != NoSymbol) getMemberMethod(MacroContextClass, nme.universe) else NoSymbol def MacroContextMirror = if (MacroContextClass != NoSymbol) getMemberMethod(MacroContextClass, nme.mirror) else NoSymbol - lazy val MacroImplAnnotation = requiredClass[scala.reflect.makro.internal.macroImpl] - lazy val MacroInternalPackage = getPackageObject("scala.reflect.makro.internal") + lazy val MacroImplAnnotation = requiredClass[scala.reflect.macros.internal.macroImpl] + lazy val MacroInternalPackage = getPackageObject("scala.reflect.macros.internal") def MacroInternal_materializeClassTag = getMemberMethod(MacroInternalPackage, nme.materializeClassTag) def MacroInternal_materializeAbsTypeTag = getMemberMethod(MacroInternalPackage, nme.materializeAbsTypeTag) def MacroInternal_materializeTypeTag = getMemberMethod(MacroInternalPackage, nme.materializeTypeTag) @@ -1045,7 +1044,7 @@ trait Definitions extends api.StandardDefinitions { // System.err.println("isMethod = " + result.isMethod) // System.err.println("isTerm = " + result.isTerm) // System.err.println("isValue = " + result.isValue) - // result.asMethodSymbol + // result.asMethod // // prints this: // @@ -1074,8 +1073,8 @@ trait Definitions extends api.StandardDefinitions { // [scalacfork] // [scalacfork] uncaught exception during compilation: java.lang.ClassCastException // [scalacfork] error: java.lang.ClassCastException: value apply - // [scalacfork] at scala.reflect.base.Symbols$SymbolBase$class.asMethodSymbol(Symbols.scala:118) - // [scalacfork] at scala.reflect.internal.Symbols$SymbolContextApiImpl.asMethodSymbol(Symbols.scala:63) + // [scalacfork] at scala.reflect.base.Symbols$SymbolBase$class.asMethod(Symbols.scala:118) + // [scalacfork] at scala.reflect.internal.Symbols$SymbolContextApiImpl.asMethod(Symbols.scala:63) // [scalacfork] at scala.reflect.internal.Definitions$DefinitionsClass.Symbol_apply(Definitions.scala:381) // [Eugene++] should be a ClassCastException instead? diff --git a/src/reflect/scala/reflect/internal/ExistentialsAndSkolems.scala b/src/reflect/scala/reflect/internal/ExistentialsAndSkolems.scala index f1fe4fc118..833ab81b9f 100644 --- a/src/reflect/scala/reflect/internal/ExistentialsAndSkolems.scala +++ b/src/reflect/scala/reflect/internal/ExistentialsAndSkolems.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/FatalError.scala b/src/reflect/scala/reflect/internal/FatalError.scala index c843308480..428803994b 100644 --- a/src/reflect/scala/reflect/internal/FatalError.scala +++ b/src/reflect/scala/reflect/internal/FatalError.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.reflect.internal diff --git a/src/reflect/scala/reflect/internal/FlagSets.scala b/src/reflect/scala/reflect/internal/FlagSets.scala index 0354d2513c..6e77741355 100644 --- a/src/reflect/scala/reflect/internal/FlagSets.scala +++ b/src/reflect/scala/reflect/internal/FlagSets.scala @@ -13,8 +13,7 @@ trait FlagSets extends api.FlagSets { self: SymbolTable => private class FlagOpsImpl(left: Long) extends FlagOps { def | (right: Long): Long = left | right - def & (right: Long): Long = left & right - def containsAll (right: Long): Boolean = (right & ~left) == 0 + def hasFlag(right: Long): Boolean = (left & right) != 0 } val NoFlags: FlagSet = 0L @@ -47,20 +46,5 @@ trait FlagSets extends api.FlagSets { self: SymbolTable => val CONTRAVARIANT : FlagSet = Flags.CONTRAVARIANT val DEFAULTPARAM : FlagSet = Flags.DEFAULTPARAM val INTERFACE : FlagSet = Flags.INTERFACE - - def union(flags: FlagSet*): FlagSet = { - var acc = 0L - for (flag <- flags) acc |= flag - acc - } - - def intersection(flags: FlagSet*): FlagSet = { - var acc = -1L - for (flag <- flags) acc &= flag - acc - } - - def containsAll(superset: FlagSet, subset: FlagSet): Boolean = - (subset & ~superset) == 0 } } diff --git a/src/reflect/scala/reflect/internal/Flags.scala b/src/reflect/scala/reflect/internal/Flags.scala index 55fa00dd4d..f3f3bf5ce8 100644 --- a/src/reflect/scala/reflect/internal/Flags.scala +++ b/src/reflect/scala/reflect/internal/Flags.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/InfoTransformers.scala b/src/reflect/scala/reflect/internal/InfoTransformers.scala index e53f714c0c..e25ebc0076 100644 --- a/src/reflect/scala/reflect/internal/InfoTransformers.scala +++ b/src/reflect/scala/reflect/internal/InfoTransformers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/Kinds.scala b/src/reflect/scala/reflect/internal/Kinds.scala index b736a9192f..eb94f0e11c 100644 --- a/src/reflect/scala/reflect/internal/Kinds.scala +++ b/src/reflect/scala/reflect/internal/Kinds.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/Mirrors.scala b/src/reflect/scala/reflect/internal/Mirrors.scala index f7561ae274..2e2e63a4b4 100644 --- a/src/reflect/scala/reflect/internal/Mirrors.scala +++ b/src/reflect/scala/reflect/internal/Mirrors.scala @@ -1,6 +1,6 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/MissingRequirementError.scala b/src/reflect/scala/reflect/internal/MissingRequirementError.scala index fbbbcc1928..5ede51d5f3 100644 --- a/src/reflect/scala/reflect/internal/MissingRequirementError.scala +++ b/src/reflect/scala/reflect/internal/MissingRequirementError.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/Names.scala b/src/reflect/scala/reflect/internal/Names.scala index 72e6707f57..835a46f05d 100644 --- a/src/reflect/scala/reflect/internal/Names.scala +++ b/src/reflect/scala/reflect/internal/Names.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/Phase.scala b/src/reflect/scala/reflect/internal/Phase.scala index 68dc5ce783..ac30d49b8c 100644 --- a/src/reflect/scala/reflect/internal/Phase.scala +++ b/src/reflect/scala/reflect/internal/Phase.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/Printers.scala b/src/reflect/scala/reflect/internal/Printers.scala index 18f9928124..e3e2063b05 100644 --- a/src/reflect/scala/reflect/internal/Printers.scala +++ b/src/reflect/scala/reflect/internal/Printers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -670,7 +670,7 @@ trait Printers extends api.Printers { self: SymbolTable => if (flags == NoFlags) nme.NoFlags.toString else { val s_flags = new collection.mutable.ListBuffer[String] - for (i <- 0 to 63 if (flags containsAll (1L << i))) + for (i <- 0 to 63 if (flags hasFlag (1L << i))) s_flags += flagToString(1L << i).replace("<", "").replace(">", "").toUpperCase s_flags mkString " | " } diff --git a/src/reflect/scala/reflect/internal/Scopes.scala b/src/reflect/scala/reflect/internal/Scopes.scala index 89e3c52de6..ed75b5d855 100644 --- a/src/reflect/scala/reflect/internal/Scopes.scala +++ b/src/reflect/scala/reflect/internal/Scopes.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -41,9 +41,9 @@ trait Scopes extends api.Scopes { self: SymbolTable => * This is necessary because when run from reflection every scope needs to have a * SynchronizedScope as mixin. */ - class Scope protected[Scopes] (initElems: ScopeEntry = null, initFingerPrints: Long = 0L) extends Iterable[Symbol] { - - /** A bitset containing the last 6 bits of the start value of every name + class Scope protected[Scopes] (initElems: ScopeEntry = null, initFingerPrints: Long = 0L) extends ScopeBase with MemberScopeBase { + + /** A bitset containing the last 6 bits of the start value of every name * stored in this scope. */ var fingerPrints: Long = initFingerPrints @@ -118,10 +118,10 @@ trait Scopes extends api.Scopes { self: SymbolTable => * * @param sym ... */ - def enter[T <: Symbol](sym: T): T = { + def enter[T <: Symbol](sym: T): T = { fingerPrints |= sym.name.fingerPrint - enterEntry(newScopeEntry(sym, this)) - sym + enterEntry(newScopeEntry(sym, this)) + sym } /** enter a symbol, asserting that no symbol with same name exists in scope @@ -282,6 +282,10 @@ trait Scopes extends api.Scopes { self: SymbolTable => elemsCache } + /** Vanilla scope - symbols are stored in declaration order. + */ + def sorted: List[Symbol] = toList + /** Return the nesting level of this scope, i.e. the number of times this scope * was nested in another */ def nestingLevel = nestinglevel @@ -320,18 +324,53 @@ trait Scopes extends api.Scopes { self: SymbolTable => override def filter(p: Symbol => Boolean): Scope = if (!(toList forall p)) newScopeWith(toList filter p: _*) else this + @deprecated("Use `toList.reverse` instead", "2.10.0") + def reverse: List[Symbol] = toList.reverse + override def mkString(start: String, sep: String, end: String) = toList.map(_.defString).mkString(start, sep, end) override def toString(): String = mkString("Scope{\n ", ";\n ", "\n}") - } implicit val ScopeTag = ClassTag[Scope](classOf[Scope]) + type MemberScope = Scope + + implicit val MemberScopeTag = ClassTag[MemberScope](classOf[MemberScope]) + /** Create a new scope */ def newScope: Scope = new Scope() + /** Create a new scope to be used in `findMembers`. + * + * But why do we need a special scope for `findMembers`? + * Let me tell you a story. + * + * `findMembers` creates a synthetic scope and then iterates over + * base classes in linearization order, and for every scrutinized class + * iterates over `decls`, the collection of symbols declared in that class. + * Declarations that fit the filter get appended to the created scope. + * + * The problem is that `decls` returns a Scope, and to iterate a scope performantly + * one needs to go from its end to its beginning. + * + * Hence the `findMembers` scope is populated in a wicked order: + * symbols that belong to the same declaring class come in reverse order of their declaration, + * however, the scope itself is ordered w.r.t the linearization of the target type. + * + * Once `members` became a public API, this has been confusing countless numbers of users. + * Therefore we introduce a special flavor of scopes to accommodate this quirk of `findMembers` + */ + private[scala] def newFindMemberScope: Scope = new Scope() { + override def sorted = { + val members = toList + val owners = members.map(_.owner).distinct + val grouped = members groupBy (_.owner) + owners.flatMap(owner => grouped(owner).reverse) + } + } + /** Create a new scope nested in another one with which it shares its elements */ def newNestedScope(outer: Scope): Scope = new Scope(outer) diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala index 75962ff9d0..c1e5f78d50 100644 --- a/src/reflect/scala/reflect/internal/StdNames.scala +++ b/src/reflect/scala/reflect/internal/StdNames.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -616,7 +616,6 @@ trait StdNames { val apply: NameType = "apply" val applyDynamic: NameType = "applyDynamic" val applyDynamicNamed: NameType = "applyDynamicNamed" - val applyImpl: NameType = "applyImpl" val applyOrElse: NameType = "applyOrElse" val args : NameType = "args" val argv : NameType = "argv" @@ -628,14 +627,13 @@ trait StdNames { val array_length : NameType = "array_length" val array_update : NameType = "array_update" val arraycopy: NameType = "arraycopy" - val asTermSymbol: NameType = "asTermSymbol" - val asModuleSymbol: NameType = "asModuleSymbol" - val asMethodSymbol: NameType = "asMethodSymbol" - val asTypeSymbol: NameType = "asTypeSymbol" - val asClassSymbol: NameType = "asClassSymbol" + val asTerm: NameType = "asTerm" + val asModule: NameType = "asModule" + val asMethod: NameType = "asMethod" + val asType: NameType = "asType" + val asClass: NameType = "asClass" val asInstanceOf_ : NameType = "asInstanceOf" val asInstanceOf_Ob : NameType = "$asInstanceOf" - val asTypeConstructor: NameType = "asTypeConstructor" val assert_ : NameType = "assert" val assume_ : NameType = "assume" val basis : NameType = "basis" @@ -767,6 +765,7 @@ trait StdNames { val toObjectArray : NameType = "toObjectArray" val toSeq: NameType = "toSeq" val toString_ : NameType = if (forMSIL) "ToString" else "toString" + val toTypeConstructor: NameType = "toTypeConstructor" val tpe : NameType = "tpe" val tree : NameType = "tree" val true_ : NameType = "true" @@ -938,6 +937,12 @@ trait StdNames { case _ => NO_NAME } + def primitiveMethodName(name: Name): TermName = + primitiveInfixMethodName(name) match { + case NO_NAME => primitivePostfixMethodName(name) + case name => name + } + /** Translate a String into a list of simple TypeNames and TermNames. * In all segments before the last, type/term is determined by whether * the following separator char is '.' or '#'. In the last segment, diff --git a/src/reflect/scala/reflect/internal/SymbolTable.scala b/src/reflect/scala/reflect/internal/SymbolTable.scala index 5ae8f22c64..c564a93b62 100644 --- a/src/reflect/scala/reflect/internal/SymbolTable.scala +++ b/src/reflect/scala/reflect/internal/SymbolTable.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -9,7 +9,7 @@ package internal import scala.collection.{ mutable, immutable } import util._ -abstract class SymbolTable extends makro.Universe +abstract class SymbolTable extends macros.Universe with Collections with Names with Symbols diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index e6a9cb46c6..2a306d7c6e 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -64,6 +64,8 @@ trait Symbols extends api.Symbols { self: SymbolTable => def kind: String = kindString def isExistential: Boolean = this.isExistentiallyBound + def isParamWithDefault: Boolean = this.hasDefault + def isByNameParam: Boolean = this.isValueParameter && (this hasFlag BYNAMEPARAM) def newNestedSymbol(name: Name, pos: Position, newFlags: Long, isClass: Boolean): Symbol = name match { case n: TermName => newTermSymbol(n, pos, newFlags) @@ -75,15 +77,17 @@ trait Symbols extends api.Symbols { self: SymbolTable => def typeSignature: Type = info def typeSignatureIn(site: Type): Type = site memberInfo this - def asType: Type = tpe - def asTypeIn(site: Type): Type = site.memberType(this) - def asTypeConstructor: Type = typeConstructor + def toType: Type = tpe + def toTypeIn(site: Type): Type = site.memberType(this) + def toTypeConstructor: Type = typeConstructor def setFlags(flags: FlagSet): this.type = setInternalFlags(flags) def setInternalFlags(flag: Long): this.type = { setFlag(flag); this } def setTypeSignature(tpe: Type): this.type = { setInfo(tpe); this } def getAnnotations: List[AnnotationInfo] = { initialize; annotations } def setAnnotations(annots: AnnotationInfo*): this.type = { setAnnotations(annots.toList); this } + def getter: Symbol = getter(owner) + def setter: Symbol = setter(owner) } /** The class for all symbols */ @@ -311,10 +315,16 @@ trait Symbols extends api.Symbols { self: SymbolTable => skolem setInfo (basis.info cloneInfo skolem) } + // don't test directly -- use isGADTSkolem + // used to single out a gadt skolem symbol in deskolemizeGADT + // gadtskolems are created in adaptConstrPattern and removed at the end of typedCase + @inline final protected[Symbols] def GADT_SKOLEM_FLAGS = CASEACCESSOR | SYNTHETIC + // flags set up to maintain TypeSkolem's invariant: origin.isInstanceOf[Symbol] == !hasFlag(EXISTENTIAL) - // CASEACCESSOR | SYNTHETIC used to single this symbol out in deskolemizeGADT + // GADT_SKOLEM_FLAGS (== CASEACCESSOR | SYNTHETIC) used to single this symbol out in deskolemizeGADT + // TODO: it would be better to allocate a new bit in the flag long for GADTSkolem rather than OR'ing together CASEACCESSOR | SYNTHETIC def newGADTSkolem(name: TypeName, origin: Symbol, info: Type): TypeSkolem = - newTypeSkolemSymbol(name, origin, origin.pos, origin.flags & ~(EXISTENTIAL | PARAM) | CASEACCESSOR | SYNTHETIC) setInfo info + newTypeSkolemSymbol(name, origin, origin.pos, origin.flags & ~(EXISTENTIAL | PARAM) | GADT_SKOLEM_FLAGS) setInfo info final def freshExistential(suffix: String): TypeSymbol = newExistential(freshExistentialName(suffix), pos) @@ -454,6 +464,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => def isAliasType = false def isAbstractType = false def isSkolem = false + def isMacro = this hasFlag MACRO /** A Type, but not a Class. */ def isNonClassType = false @@ -2484,6 +2495,21 @@ trait Symbols extends api.Symbols { self: SymbolTable => mtpeResult = res res } + + override def params: List[List[Symbol]] = paramss + + override def isVarargs: Boolean = definitions.isVarArgsList(paramss.flatten) + + override def returnType: Type = { + def loop(tpe: Type): Type = + tpe match { + case NullaryMethodType(ret) => loop(ret) + case MethodType(_, ret) => loop(ret) + case PolyType(_, tpe) => loop(tpe) + case tpe => tpe + } + loop(info) + } } implicit val MethodSymbolTag = ClassTag[MethodSymbol](classOf[MethodSymbol]) @@ -2683,7 +2709,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => // a type symbol bound by an existential type, for instance the T in // List[T] forSome { type T } override def isExistentialSkolem = this hasFlag EXISTENTIAL - override def isGADTSkolem = this hasFlag CASEACCESSOR | SYNTHETIC + override def isGADTSkolem = this hasAllFlags GADT_SKOLEM_FLAGS override def isTypeSkolem = this hasFlag PARAM override def isAbstractType = this hasFlag DEFERRED @@ -2747,8 +2773,10 @@ trait Symbols extends api.Symbols { self: SymbolTable => override def isJavaInterface = hasAllFlags(JAVA | TRAIT) override def isNestedClass = !owner.isPackageClass override def isNumericValueClass = definitions.isNumericValueClass(this) + override def isNumeric = isNumericValueClass override def isPackageObjectClass = isModuleClass && (name == tpnme.PACKAGE) override def isPrimitiveValueClass = definitions.isPrimitiveValueClass(this) + override def isPrimitive = isPrimitiveValueClass // The corresponding interface is the last parent by convention. private def lastParent = if (tpe.parents.isEmpty) NoSymbol else tpe.parents.last.typeSymbol @@ -2890,7 +2918,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => private[this] var typeOfThisCache: Type = _ private[this] var typeOfThisPeriod = NoPeriod - private var implicitMembersCacheValue: List[Symbol] = Nil + private var implicitMembersCacheValue: Scope = EmptyScope private var implicitMembersCacheKey1: Type = NoType private var implicitMembersCacheKey2: ScopeEntry = null @@ -2909,7 +2937,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => typeOfThisCache } - def implicitMembers: List[Symbol] = { + def implicitMembers: Scope = { val tp = info if ((implicitMembersCacheKey1 ne tp) || (implicitMembersCacheKey2 ne tp.decls.elems)) { // Skip a package object class, because the members are also in diff --git a/src/reflect/scala/reflect/internal/TreeGen.scala b/src/reflect/scala/reflect/internal/TreeGen.scala index 285700f9ff..d160695e67 100644 --- a/src/reflect/scala/reflect/internal/TreeGen.scala +++ b/src/reflect/scala/reflect/internal/TreeGen.scala @@ -1,7 +1,7 @@ package scala.reflect package internal -abstract class TreeGen extends makro.TreeBuilder { +abstract class TreeGen extends macros.TreeBuilder { val global: SymbolTable import global._ diff --git a/src/reflect/scala/reflect/internal/TreeInfo.scala b/src/reflect/scala/reflect/internal/TreeInfo.scala index 7ba749ed2c..1b4c1b2877 100644 --- a/src/reflect/scala/reflect/internal/TreeInfo.scala +++ b/src/reflect/scala/reflect/internal/TreeInfo.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -326,9 +326,6 @@ abstract class TreeInfo { case _ => false } - /** a Match(Typed(_, tpt), _) is unchecked if isUncheckedAnnotation(tpt.tpe) */ - def isUncheckedAnnotation(tpe: Type) = tpe hasAnnotation definitions.UncheckedClass - /** a Match(Typed(_, tpt), _) must be translated into a switch if isSwitchAnnotation(tpt.tpe) */ def isSwitchAnnotation(tpe: Type) = tpe hasAnnotation definitions.SwitchClass @@ -464,6 +461,16 @@ abstract class TreeInfo { case _ => false } + + // used in the symbols for labeldefs and valdefs emitted by the pattern matcher + // tailcalls, cps,... use this flag combination to detect translated matches + // TODO: move to Flags + final val SYNTH_CASE_FLAGS = CASE | SYNTHETIC + + def isSynthCaseSymbol(sym: Symbol) = sym hasAllFlags SYNTH_CASE_FLAGS + def hasSynthCaseSymbol(t: Tree) = t.symbol != null && isSynthCaseSymbol(t.symbol) + + /** The method part of an application node */ def methPart(tree: Tree): Tree = tree match { diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala index 619e3bc170..220869e4d2 100644 --- a/src/reflect/scala/reflect/internal/Trees.scala +++ b/src/reflect/scala/reflect/internal/Trees.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -1024,14 +1024,14 @@ trait Trees extends api.Trees { self: SymbolTable => } } - + /** Delegate for a TypeTree symbol. This operation is unsafe because * it may trigger type checking when forcing the type symbol of the * underlying type. */ protected def typeTreeSymbol(tree: TypeTree): Symbol = if (tree.tpe == null) null else tree.tpe.typeSymbol - + // --- generic traversers and transformers override protected def itraverse(traverser: Traverser, tree: Tree): Unit = { @@ -1266,7 +1266,7 @@ trait Trees extends api.Trees { self: SymbolTable => } } - private def mclass(sym: Symbol) = sym map (_.asModuleSymbol.moduleClass) + private def mclass(sym: Symbol) = sym map (_.asModule.moduleClass) // --- specific traversers and transformers diff --git a/src/reflect/scala/reflect/internal/TypeDebugging.scala b/src/reflect/scala/reflect/internal/TypeDebugging.scala index 33f6a645e8..a4d426171d 100644 --- a/src/reflect/scala/reflect/internal/TypeDebugging.scala +++ b/src/reflect/scala/reflect/internal/TypeDebugging.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index d4f36e3c6d..b6305e773a 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -323,6 +323,7 @@ trait Types extends api.Types { self: SymbolTable => /** Is this type higher-kinded, i.e., is it a type constructor @M */ def isHigherKinded: Boolean = false + def takesTypeArgs: Boolean = this.isHigherKinded /** Does this type denote a stable reference (i.e. singleton type)? */ def isStable: Boolean = false @@ -612,21 +613,21 @@ trait Types extends api.Types { self: SymbolTable => * Members appear in linearization order of their owners. * Members with the same owner appear in reverse order of their declarations. */ - def members: List[Symbol] = membersBasedOnFlags(0, 0) + def members: Scope = membersBasedOnFlags(0, 0) /** A list of all non-private members of this type (defined or inherited) */ - def nonPrivateMembers: List[Symbol] = membersBasedOnFlags(BridgeAndPrivateFlags, 0) + def nonPrivateMembers: Scope = membersBasedOnFlags(BridgeAndPrivateFlags, 0) /** A list of all non-private members of this type (defined or inherited), * admitting members with given flags `admit` */ - def nonPrivateMembersAdmitting(admit: Long): List[Symbol] = membersBasedOnFlags(BridgeAndPrivateFlags & ~admit, 0) + def nonPrivateMembersAdmitting(admit: Long): Scope = membersBasedOnFlags(BridgeAndPrivateFlags & ~admit, 0) /** A list of all implicit symbols of this type (defined or inherited) */ - def implicitMembers: List[Symbol] = membersBasedOnFlags(BridgeFlags, IMPLICIT) + def implicitMembers: Scope = membersBasedOnFlags(BridgeFlags, IMPLICIT) /** A list of all deferred symbols of this type (defined or inherited) */ - def deferredMembers: List[Symbol] = membersBasedOnFlags(BridgeFlags, DEFERRED) + def deferredMembers: Scope = membersBasedOnFlags(BridgeFlags, DEFERRED) /** The member with given name, * an OverloadedSymbol if several exist, NoSymbol if none exist */ @@ -642,12 +643,12 @@ trait Types extends api.Types { self: SymbolTable => /** All members with the given flags, excluding bridges. */ - def membersWithFlags(requiredFlags: Long): List[Symbol] = + def membersWithFlags(requiredFlags: Long): Scope = membersBasedOnFlags(BridgeFlags, requiredFlags) /** All non-private members with the given flags, excluding bridges. */ - def nonPrivateMembersWithFlags(requiredFlags: Long): List[Symbol] = + def nonPrivateMembersWithFlags(requiredFlags: Long): Scope = membersBasedOnFlags(BridgeAndPrivateFlags, requiredFlags) /** The non-private member with given name, admitting members with given flags `admit`. @@ -668,7 +669,7 @@ trait Types extends api.Types { self: SymbolTable => /** Members excluding and requiring the given flags. * Note: unfortunately it doesn't work to exclude DEFERRED this way. */ - def membersBasedOnFlags(excludedFlags: Long, requiredFlags: Long): List[Symbol] = + def membersBasedOnFlags(excludedFlags: Long, requiredFlags: Long): Scope = findMembers(excludedFlags, requiredFlags) // findMember(nme.ANYNAME, excludedFlags, requiredFlags, false).alternatives @@ -1020,7 +1021,7 @@ trait Types extends api.Types { self: SymbolTable => else (baseClasses.head.newOverloaded(this, alts)) } - def findMembers(excludedFlags: Long, requiredFlags: Long): List[Symbol] = { + def findMembers(excludedFlags: Long, requiredFlags: Long): Scope = { // if this type contains type variables, put them to sleep for a while -- don't just wipe them out by // replacing them by the corresponding type parameter, as that messes up (e.g.) type variables in type refinements // without this, the matchesType call would lead to type variables on both sides @@ -1054,7 +1055,7 @@ trait Types extends api.Types { self: SymbolTable => (bcs eq bcs0) || (flags & PrivateLocal) != PrivateLocal || (bcs0.head.hasTransOwner(bcs.head)))) { - if (members eq null) members = newScope + if (members eq null) members = newFindMemberScope var others: ScopeEntry = members.lookupEntry(sym.name) var symtpe: Type = null while ((others ne null) && { @@ -1083,7 +1084,7 @@ trait Types extends api.Types { self: SymbolTable => } // while (continue) Statistics.popTimer(typeOpsStack, start) if (suspension ne null) suspension foreach (_.suspended = false) - if (members eq null) Nil else members.toList + if (members eq null) EmptyScope else members } /** @@ -3829,6 +3830,7 @@ trait Types extends api.Types { self: SymbolTable => Statistics.incCounter(rawTypeCount) if (uniqueRunId != currentRunId) { uniques = util.HashSet[Type]("uniques", initialUniquesCapacity) + perRunCaches.recordCache(uniques) uniqueRunId = currentRunId } (uniques findEntryOrUpdate tp).asInstanceOf[T] diff --git a/src/reflect/scala/reflect/internal/pickling/PickleBuffer.scala b/src/reflect/scala/reflect/internal/pickling/PickleBuffer.scala index 7f0895ce64..5d3cb92dc0 100644 --- a/src/reflect/scala/reflect/internal/pickling/PickleBuffer.scala +++ b/src/reflect/scala/reflect/internal/pickling/PickleBuffer.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala index 4411b79b97..55746f414b 100644 --- a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala +++ b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/internal/settings/AbsSettings.scala b/src/reflect/scala/reflect/internal/settings/AbsSettings.scala index 9bbba3f079..89281e9835 100644 --- a/src/reflect/scala/reflect/internal/settings/AbsSettings.scala +++ b/src/reflect/scala/reflect/internal/settings/AbsSettings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/reflect/scala/reflect/internal/settings/MutableSettings.scala b/src/reflect/scala/reflect/internal/settings/MutableSettings.scala index e9899f690d..459326e96f 100644 --- a/src/reflect/scala/reflect/internal/settings/MutableSettings.scala +++ b/src/reflect/scala/reflect/internal/settings/MutableSettings.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -14,6 +14,7 @@ abstract class MutableSettings extends AbsSettings { type Setting <: SettingValue type BooleanSetting <: Setting { type T = Boolean } type IntSetting <: Setting { type T = Int } + type MultiStringSetting <: Setting { type T = List[String] } // basically this is a value which remembers if it's been modified trait SettingValue extends AbsSettingValue { @@ -46,4 +47,4 @@ abstract class MutableSettings extends AbsSettings { def XoldPatmat: BooleanSetting def XnoPatmatAnalysis: BooleanSetting def XfullLubs: BooleanSetting -}
\ No newline at end of file +} diff --git a/src/reflect/scala/reflect/internal/util/Collections.scala b/src/reflect/scala/reflect/internal/util/Collections.scala index 1f8eb15c90..2ac0e64edd 100644 --- a/src/reflect/scala/reflect/internal/util/Collections.scala +++ b/src/reflect/scala/reflect/internal/util/Collections.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/reflect/scala/reflect/internal/util/HashSet.scala b/src/reflect/scala/reflect/internal/util/HashSet.scala index a771dad2b0..51e540e235 100644 --- a/src/reflect/scala/reflect/internal/util/HashSet.scala +++ b/src/reflect/scala/reflect/internal/util/HashSet.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ @@ -13,7 +13,7 @@ object HashSet { new HashSet[T](label, initialCapacity) } -class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) extends Set[T] { +class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) extends Set[T] with collection.generic.Clearable { private var used = 0 private var table = new Array[AnyRef](initialCapacity) private def index(x: Int): Int = math.abs(x % table.length) diff --git a/src/reflect/scala/reflect/internal/util/Origins.scala b/src/reflect/scala/reflect/internal/util/Origins.scala index 3111730f76..e7a0c5b8f6 100644 --- a/src/reflect/scala/reflect/internal/util/Origins.scala +++ b/src/reflect/scala/reflect/internal/util/Origins.scala @@ -1,5 +1,5 @@ /* NSC -- new scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/reflect/scala/reflect/internal/util/Position.scala b/src/reflect/scala/reflect/internal/util/Position.scala index 3c251b3b31..e4c6e4aca1 100644 --- a/src/reflect/scala/reflect/internal/util/Position.scala +++ b/src/reflect/scala/reflect/internal/util/Position.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky * */ diff --git a/src/reflect/scala/reflect/internal/util/Set.scala b/src/reflect/scala/reflect/internal/util/Set.scala index cfc3e7eada..d708a09de7 100644 --- a/src/reflect/scala/reflect/internal/util/Set.scala +++ b/src/reflect/scala/reflect/internal/util/Set.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ package scala.reflect.internal.util diff --git a/src/reflect/scala/reflect/internal/util/SourceFile.scala b/src/reflect/scala/reflect/internal/util/SourceFile.scala index 793ef0ac22..747c1ad298 100644 --- a/src/reflect/scala/reflect/internal/util/SourceFile.scala +++ b/src/reflect/scala/reflect/internal/util/SourceFile.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/reflect/makro/Aliases.scala b/src/reflect/scala/reflect/macros/Aliases.scala index 4bd246572f..46b7066902 100644 --- a/src/reflect/scala/reflect/makro/Aliases.scala +++ b/src/reflect/scala/reflect/macros/Aliases.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait Aliases { self: Context => diff --git a/src/reflect/scala/reflect/makro/CapturedVariables.scala b/src/reflect/scala/reflect/macros/CapturedVariables.scala index 592e28b3b2..60ed6f5e7b 100644 --- a/src/reflect/scala/reflect/makro/CapturedVariables.scala +++ b/src/reflect/scala/reflect/macros/CapturedVariables.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait CapturedVariables { self: Context => diff --git a/src/reflect/scala/reflect/makro/Context.scala b/src/reflect/scala/reflect/macros/Context.scala index f093016a38..37c8f9057e 100644 --- a/src/reflect/scala/reflect/makro/Context.scala +++ b/src/reflect/scala/reflect/macros/Context.scala @@ -1,11 +1,9 @@ package scala.reflect -package makro - -import language.experimental.macros +package macros // todo. introduce context hierarchy // the most lightweight context should just expose the stuff from the SIP -// the full context should include all traits from scala.reflect.makro (and probably reside in scala-compiler.jar) +// the full context should include all traits from scala.reflect.macros (and probably reside in scala-compiler.jar) trait Context extends Aliases with CapturedVariables diff --git a/src/reflect/scala/reflect/makro/Enclosures.scala b/src/reflect/scala/reflect/macros/Enclosures.scala index ff5c13a785..a07ff85a08 100644 --- a/src/reflect/scala/reflect/makro/Enclosures.scala +++ b/src/reflect/scala/reflect/macros/Enclosures.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait Enclosures { self: Context => diff --git a/src/reflect/scala/reflect/makro/Evals.scala b/src/reflect/scala/reflect/macros/Evals.scala index 4e5fc2f97f..3837d749da 100644 --- a/src/reflect/scala/reflect/makro/Evals.scala +++ b/src/reflect/scala/reflect/macros/Evals.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait Evals { self: Context => diff --git a/src/reflect/scala/reflect/makro/ExprUtils.scala b/src/reflect/scala/reflect/macros/ExprUtils.scala index c3e5cc6bc1..adcdc78c78 100644 --- a/src/reflect/scala/reflect/makro/ExprUtils.scala +++ b/src/reflect/scala/reflect/macros/ExprUtils.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait ExprUtils { self: Context => diff --git a/src/reflect/scala/reflect/makro/Exprs.scala b/src/reflect/scala/reflect/macros/Exprs.scala index 91d3dafbf2..ceaab06d12 100644 --- a/src/reflect/scala/reflect/makro/Exprs.scala +++ b/src/reflect/scala/reflect/macros/Exprs.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait Exprs { self: Context => diff --git a/src/reflect/scala/reflect/makro/FrontEnds.scala b/src/reflect/scala/reflect/macros/FrontEnds.scala index 5087f90174..d15db0725f 100644 --- a/src/reflect/scala/reflect/makro/FrontEnds.scala +++ b/src/reflect/scala/reflect/macros/FrontEnds.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait FrontEnds extends scala.reflect.api.FrontEnds { self: Context => diff --git a/src/reflect/scala/reflect/makro/Infrastructure.scala b/src/reflect/scala/reflect/macros/Infrastructure.scala index e6bfe33366..5ae2c08265 100644 --- a/src/reflect/scala/reflect/makro/Infrastructure.scala +++ b/src/reflect/scala/reflect/macros/Infrastructure.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait Infrastructure { self: Context => @@ -35,7 +35,7 @@ trait Infrastructure { * * def staticEval[T](x: T) = macro staticEval[T] * - * def staticEval[T: c.TypeTag](c: Context)(x: c.Expr[T]) = { + * def staticEval[T](c: Context)(x: c.Expr[T]) = { * import scala.reflect.runtime.{universe => ru} * val mirror = ru.runtimeMirror(c.libraryClassLoader) * import scala.tools.reflect.ToolBox diff --git a/src/reflect/scala/reflect/makro/Names.scala b/src/reflect/scala/reflect/macros/Names.scala index 909976d83c..fab9bbbca5 100644 --- a/src/reflect/scala/reflect/makro/Names.scala +++ b/src/reflect/scala/reflect/macros/Names.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait Names { self: Context => diff --git a/src/reflect/scala/reflect/makro/Parsers.scala b/src/reflect/scala/reflect/macros/Parsers.scala index 9866b7e491..ea87c5842e 100644 --- a/src/reflect/scala/reflect/makro/Parsers.scala +++ b/src/reflect/scala/reflect/macros/Parsers.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait Parsers { self: Context => diff --git a/src/reflect/scala/reflect/makro/Reifiers.scala b/src/reflect/scala/reflect/macros/Reifiers.scala index f39f56f935..1bee17d548 100644 --- a/src/reflect/scala/reflect/makro/Reifiers.scala +++ b/src/reflect/scala/reflect/macros/Reifiers.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait Reifiers { self: Context => diff --git a/src/reflect/scala/reflect/makro/Settings.scala b/src/reflect/scala/reflect/macros/Settings.scala index c6c7e5870b..8d166056c3 100644 --- a/src/reflect/scala/reflect/makro/Settings.scala +++ b/src/reflect/scala/reflect/macros/Settings.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait Settings { self: Context => diff --git a/src/reflect/scala/reflect/makro/TreeBuilder.scala b/src/reflect/scala/reflect/macros/TreeBuilder.scala index c4179b9c80..06f5caf68b 100644 --- a/src/reflect/scala/reflect/makro/TreeBuilder.scala +++ b/src/reflect/scala/reflect/macros/TreeBuilder.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros // [Eugene] I added some stuff that was necessary for typetag materialization macros // but we should think it over and pick other generally useful stuff diff --git a/src/reflect/scala/reflect/makro/TypeTags.scala b/src/reflect/scala/reflect/macros/TypeTags.scala index 53a9b116e3..8f590d1de4 100644 --- a/src/reflect/scala/reflect/makro/TypeTags.scala +++ b/src/reflect/scala/reflect/macros/TypeTags.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait TypeTags { self: Context => diff --git a/src/reflect/scala/reflect/makro/Typers.scala b/src/reflect/scala/reflect/macros/Typers.scala index 4176c184d0..eef6507418 100644 --- a/src/reflect/scala/reflect/makro/Typers.scala +++ b/src/reflect/scala/reflect/macros/Typers.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros trait Typers { self: Context => diff --git a/src/reflect/scala/reflect/makro/Universe.scala b/src/reflect/scala/reflect/macros/Universe.scala index d88e7e0bb8..4074dd9e93 100644 --- a/src/reflect/scala/reflect/makro/Universe.scala +++ b/src/reflect/scala/reflect/macros/Universe.scala @@ -1,5 +1,5 @@ package scala.reflect -package makro +package macros abstract class Universe extends scala.reflect.api.Universe { diff --git a/src/reflect/scala/reflect/makro/package.scala b/src/reflect/scala/reflect/macros/package.scala index 3c0e51030e..06ce0b3244 100644 --- a/src/reflect/scala/reflect/makro/package.scala +++ b/src/reflect/scala/reflect/macros/package.scala @@ -1,6 +1,6 @@ package scala.reflect -package object makro { +package object macros { type MirrorOf[U <: base.Universe with Singleton] = base.MirrorOf[U] } diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala index 0878801715..4ce2cda04a 100644 --- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala +++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala @@ -18,8 +18,10 @@ import collection.mutable.{ HashMap, ListBuffer } import internal.Flags._ //import scala.tools.nsc.util.ScalaClassLoader //import scala.tools.nsc.util.ScalaClassLoader._ -import ReflectionUtils.{singletonInstance} +import ReflectionUtils.{staticSingletonInstance, innerSingletonInstance} import language.existentials +import scala.runtime.{ScalaRunTime, BoxesRunTime} +import scala.reflect.internal.util.Collections._ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: SymbolTable => @@ -124,15 +126,16 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym private def ErrorStaticClass(wannabe: Symbol) = throw new ScalaReflectionException(s"$wannabe is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror") private def ErrorStaticModule(wannabe: Symbol) = throw new ScalaReflectionException(s"$wannabe is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror") private def ErrorNotMember(wannabe: Symbol, owner: Symbol) = throw new ScalaReflectionException(s"expected a member of $owner, you provided ${wannabe.kind} ${wannabe.fullName}") - private def ErrorNotField(wannabe: Symbol) = throw new ScalaReflectionException(s"expected a field or an accessor method symbol, you provided $wannabe}") + private def ErrorNotField(wannabe: Symbol) = throw new ScalaReflectionException(s"expected a field or an accessor method symbol, you provided $wannabe") private def ErrorNonExistentField(wannabe: Symbol) = throw new ScalaReflectionException(s""" |Scala field ${wannabe.name} isn't represented as a Java field, neither it has a Java accessor method |note that private parameters of class constructors don't get mapped onto fields and/or accessors, |unless they are used outside of their declaring constructors. """.trim.stripMargin) private def ErrorSetImmutableField(wannabe: Symbol) = throw new ScalaReflectionException(s"cannot set an immutable field ${wannabe.name}") + private def ErrorNotConstructor(wannabe: Symbol, owner: Symbol) = throw new ScalaReflectionException(s"expected a constructor of $owner, you provided $wannabe") - def reflect(obj: Any): InstanceMirror = new JavaInstanceMirror(obj.asInstanceOf[AnyRef]) + def reflect[T: ClassTag](obj: T): InstanceMirror = new JavaInstanceMirror(obj) def reflectClass(cls: ClassSymbol): ClassMirror = { if (!cls.isStatic) ErrorInnerClass(cls) @@ -150,15 +153,27 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym def classSymbol(rtcls: RuntimeClass): ClassSymbol = classToScala(rtcls) - def moduleSymbol(rtcls: RuntimeClass): ModuleSymbol = classToScala(rtcls).companionModule.asModuleSymbol + def moduleSymbol(rtcls: RuntimeClass): ModuleSymbol = classToScala(rtcls).companionModule.asModule - private def checkMemberOf(wannabe: Symbol, owner: Symbol) = - if (!owner.info.member(wannabe.name).alternatives.contains(wannabe)) ErrorNotMember(wannabe, owner) + private def checkMemberOf(wannabe: Symbol, owner: ClassSymbol) { + if (wannabe.owner == AnyClass || wannabe.owner == AnyRefClass || wannabe.owner == ObjectClass) { + // do nothing + } else if (wannabe.owner == AnyValClass) { + if (!owner.isPrimitiveValueClass && !owner.isDerivedValueClass) ErrorNotMember(wannabe, owner) + } else { + if (!(owner.info.baseClasses contains wannabe.owner)) ErrorNotMember(wannabe, owner) + } + } - private class JavaInstanceMirror(obj: AnyRef) + private def preciseClass[T: ClassTag](instance: T) = { + val staticClazz = classTag[T].runtimeClass + val dynamicClazz = instance.getClass + if (staticClazz.isPrimitive) staticClazz else dynamicClazz + } + + private class JavaInstanceMirror[T: ClassTag](val instance: T) extends InstanceMirror { - def instance = obj - def symbol = wholemirror.classSymbol(obj.getClass) + def symbol = wholemirror.classSymbol(preciseClass(instance)) def reflectField(field: TermSymbol): FieldMirror = { checkMemberOf(field, symbol) if ((field.isMethod && !field.isAccessor) || field.isModule) ErrorNotField(field) @@ -166,30 +181,31 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym if (field.isGetter) nme.getterToLocal(field.name) else if (field.isSetter) nme.getterToLocal(nme.setterToGetter(field.name)) else field.name - val field1 = (field.owner.info decl name).asTermSymbol + val field1 = (field.owner.info decl name).asTerm try fieldToJava(field1) catch { case _: NoSuchFieldException => ErrorNonExistentField(field1) } - new JavaFieldMirror(obj, field1) + new JavaFieldMirror(instance, field1) } def reflectMethod(method: MethodSymbol): MethodMirror = { checkMemberOf(method, symbol) - new JavaMethodMirror(obj, method) + mkJavaMethodMirror(instance, method) } def reflectClass(cls: ClassSymbol): ClassMirror = { if (cls.isStatic) ErrorStaticClass(cls) checkMemberOf(cls, symbol) - new JavaClassMirror(instance, cls) + new JavaClassMirror(instance.asInstanceOf[AnyRef], cls) } def reflectModule(mod: ModuleSymbol): ModuleMirror = { if (mod.isStatic) ErrorStaticModule(mod) checkMemberOf(mod, symbol) - new JavaModuleMirror(instance, mod) + new JavaModuleMirror(instance.asInstanceOf[AnyRef], mod) } + override def toString = s"instance mirror for $instance" } - private class JavaFieldMirror(val receiver: AnyRef, val symbol: TermSymbol) + private class JavaFieldMirror(val receiver: Any, val symbol: TermSymbol) extends FieldMirror { lazy val jfield = { val jfield = fieldToJava(symbol) @@ -201,25 +217,141 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym if (!symbol.isMutable) ErrorSetImmutableField(symbol) jfield.set(receiver, value) } + override def toString = s"field mirror for ${symbol.fullName} (bound to $receiver)" + } + + private def showMethodSig(symbol: MethodSymbol): String = { + var sig = s"${symbol.fullName}" + if (symbol.typeParams.nonEmpty) { + def showTparam(tparam: Symbol) = + tparam.typeSignature match { + case tpe @ TypeBounds(_, _) => s"${tparam.name}$tpe" + case _ => tparam.name + } + def showTparams(tparams: List[Symbol]) = "[" + (tparams map showTparam mkString ", ") + "]" + sig += showTparams(symbol.typeParams) + } + if (symbol.params.nonEmpty) { + def showParam(param: Symbol) = s"${param.name}: ${param.typeSignature}" + def showParams(params: List[Symbol]) = { + val s_mods = if (params.nonEmpty && params(0).hasFlag(IMPLICIT)) "implicit " else "" + val s_params = params map showParam mkString ", " + "(" + s_mods + s_params + ")" + } + def showParamss(paramss: List[List[Symbol]]) = paramss map showParams mkString "" + sig += showParamss(symbol.params) + } + sig += s": ${symbol.returnType}" + sig } - private class JavaMethodMirror(val receiver: AnyRef, val symbol: MethodSymbol) + // the "symbol == Any_getClass || symbol == Object_getClass" test doesn't cut it + // because both AnyVal and its primitive descendants define their own getClass methods + private def isGetClass(meth: MethodSymbol) = meth.name.toString == "getClass" && meth.params.flatten.isEmpty + private def isMagicPrimitiveMethod(meth: MethodSymbol) = meth.owner.isPrimitiveValueClass + private def isStringConcat(meth: MethodSymbol) = meth == String_+ || (isMagicPrimitiveMethod(meth) && meth.returnType =:= StringClass.toType) + lazy val magicMethodOwners = Set[Symbol](AnyClass, AnyValClass, AnyRefClass, ObjectClass, ArrayClass) ++ ScalaPrimitiveValueClasses + lazy val nonMagicObjectMethods = Set[Symbol](Object_clone, Object_equals, Object_finalize, Object_hashCode, Object_toString, + Object_notify, Object_notifyAll) ++ ObjectClass.info.member(nme.wait_).asTerm.alternatives.map(_.asMethod) + private def isMagicMethod(meth: MethodSymbol): Boolean = { + if (isGetClass(meth) || isStringConcat(meth) || isMagicPrimitiveMethod(meth) || meth == Predef_classOf || meth.isTermMacro) return true + magicMethodOwners(meth.owner) && !nonMagicObjectMethods(meth) + } + + // unlike other mirrors, method mirrors are created by a factory + // that's because we want to have decent performance + // therefore we move special cases into separate subclasses + // rather than have them on a hot path them in a unified implementation of the `apply` method + private def mkJavaMethodMirror[T: ClassTag](receiver: T, symbol: MethodSymbol): JavaMethodMirror = { + if (isMagicMethod(symbol)) new JavaMagicMethodMirror(receiver, symbol) + else if (symbol.params.flatten exists (p => isByNameParamType(p.info))) new JavaByNameMethodMirror(receiver, symbol) + else new JavaVanillaMethodMirror(receiver, symbol) + } + + private abstract class JavaMethodMirror(val symbol: MethodSymbol) extends MethodMirror { lazy val jmeth = { val jmeth = methodToJava(symbol) if (!jmeth.isAccessible) jmeth.setAccessible(true) jmeth } - def apply(args: Any*): Any = - if (symbol.owner == ArrayClass) - symbol.name match { - case nme.length => jArray.getLength(receiver) - case nme.apply => jArray.get(receiver, args(0).asInstanceOf[Int]) - case nme.update => jArray.set(receiver, args(0).asInstanceOf[Int], args(1)) - case _ => assert(false, s"unexpected array method: $symbol") - } - else - jmeth.invoke(receiver, args.asInstanceOf[Seq[AnyRef]]: _*) + + def jinvoke(jmeth: jMethod, receiver: Any, args: Seq[Any]): Any = { + val result = jmeth.invoke(receiver, args.asInstanceOf[Seq[AnyRef]]: _*) + if (jmeth.getReturnType == java.lang.Void.TYPE) () + else result + } + + override def toString = s"method mirror for ${showMethodSig(symbol)} (bound to $receiver)" + } + + private class JavaVanillaMethodMirror(val receiver: Any, symbol: MethodSymbol) + extends JavaMethodMirror(symbol) { + def apply(args: Any*): Any = jinvoke(jmeth, receiver, args) + } + + private class JavaByNameMethodMirror(val receiver: Any, symbol: MethodSymbol) + extends JavaMethodMirror(symbol) { + def apply(args: Any*): Any = { + val transformed = map2(args.toList, symbol.params.flatten)((arg, param) => if (isByNameParamType(param.info)) () => arg else arg) + jinvoke(jmeth, receiver, transformed) + } + } + + private class JavaMagicMethodMirror[T: ClassTag](val receiver: T, symbol: MethodSymbol) + extends JavaMethodMirror(symbol) { + def apply(args: Any*): Any = { + // checking type conformance is too much of a hassle, so we don't do it here + // actually it's not even necessary, because we manually dispatch arguments to magic methods below + val params = symbol.paramss.flatten + val perfectMatch = args.length == params.length + // todo. this doesn't account for multiple vararg parameter lists + // however those aren't supported by the mirror API: https://issues.scala-lang.org/browse/SI-6182 + // hence I leave this code as is, to be fixed when the corresponding bug is fixed + val varargMatch = args.length >= params.length - 1 && isVarArgsList(params) + if (!perfectMatch && !varargMatch) { + val n_arguments = if (isVarArgsList(params)) s"${params.length - 1} or more" else s"${params.length}" + var s_arguments = if (params.length == 1 && !isVarArgsList(params)) "argument" else "arguments" + throw new ScalaReflectionException(s"${showMethodSig(symbol)} takes $n_arguments $s_arguments") + } + + def objReceiver = receiver.asInstanceOf[AnyRef] + def objArg0 = args(0).asInstanceOf[AnyRef] + def objArgs = args.asInstanceOf[Seq[AnyRef]] + def fail(msg: String) = throw new ScalaReflectionException(msg + ", it cannot be invoked with mirrors") + + def invokeMagicPrimitiveMethod = { + val jmeths = classOf[BoxesRunTime].getDeclaredMethods.filter(_.getName == nme.primitiveMethodName(symbol.name).toString) + assert(jmeths.length == 1, jmeths.toList) + jinvoke(jmeths.head, null, objReceiver +: objArgs) + } + + symbol match { + case Any_== | Object_== => ScalaRunTime.inlinedEquals(objReceiver, objArg0) + case Any_!= | Object_!= => !ScalaRunTime.inlinedEquals(objReceiver, objArg0) + case Any_## | Object_## => ScalaRunTime.hash(objReceiver) + case Any_equals => receiver.equals(objArg0) + case Any_hashCode => receiver.hashCode + case Any_toString => receiver.toString + case Object_eq => objReceiver eq objArg0 + case Object_ne => objReceiver ne objArg0 + case Object_synchronized => objReceiver.synchronized(objArg0) + case sym if isGetClass(sym) => preciseClass(receiver) + case Any_asInstanceOf => fail("Any.asInstanceOf requires a type argument") + case Any_isInstanceOf => fail("Any.isInstanceOf requires a type argument") + case Object_asInstanceOf => fail("AnyRef.$asInstanceOf is an internal method") + case Object_isInstanceOf => fail("AnyRef.$isInstanceOf is an internal method") + case Array_length => ScalaRunTime.array_length(objReceiver) + case Array_apply => ScalaRunTime.array_apply(objReceiver, args(0).asInstanceOf[Int]) + case Array_update => ScalaRunTime.array_update(objReceiver, args(0).asInstanceOf[Int], args(1)) + case Array_clone => ScalaRunTime.array_clone(objReceiver) + case sym if isStringConcat(sym) => receiver.toString + objArg0 + case sym if isMagicPrimitiveMethod(sym) => invokeMagicPrimitiveMethod + case sym if sym == Predef_classOf => fail("Predef.classOf is a compile-time function") + case sym if sym.isTermMacro => fail(s"${symbol.fullName} is a macro, i.e. a compile-time function") + case _ => assert(false, this) + } + } } private class JavaConstructorMirror(val outer: AnyRef, val symbol: MethodSymbol) @@ -231,14 +363,17 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym jconstr } def apply(args: Any*): Any = { + if (symbol.owner == ArrayClass) + throw new ScalaReflectionException("Cannot instantiate arrays with mirrors. Consider using `scala.reflect.ClassTag(<class of element>).newArray(<length>)` instead") + val effectiveArgs = if (outer == null) args.asInstanceOf[Seq[AnyRef]] else outer +: args.asInstanceOf[Seq[AnyRef]] jconstr.newInstance(effectiveArgs: _*) } + override def toString = s"constructor mirror for ${showMethodSig(symbol)} (bound to $outer)" } - private abstract class JavaTemplateMirror extends TemplateMirror { def outer: AnyRef @@ -251,25 +386,34 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym extends JavaTemplateMirror with ClassMirror { def erasure = symbol def isStatic = false - def reflectConstructor(constructor: MethodSymbol) = new JavaConstructorMirror(outer, constructor) + def reflectConstructor(constructor: MethodSymbol) = { + if (!constructor.isClassConstructor) ErrorNotConstructor(constructor, symbol) + if (!symbol.info.decls.toList.contains(constructor)) ErrorNotConstructor(constructor, symbol) + new JavaConstructorMirror(outer, constructor) + } def companion: Option[ModuleMirror] = symbol.companionModule match { case module: ModuleSymbol => Some(new JavaModuleMirror(outer, module)) case _ => None } + override def toString = s"class mirror for ${symbol.fullName} (bound to $outer)" } private class JavaModuleMirror(val outer: AnyRef, val symbol: ModuleSymbol) extends JavaTemplateMirror with ModuleMirror { - def erasure = symbol.moduleClass.asClassSymbol + def erasure = symbol.moduleClass.asClass def isStatic = true def instance = { - if (!symbol.owner.isPackageClass) throw new Error("inner and nested modules are not supported yet") - singletonInstance(classLoader, symbol.fullName) + if (symbol.owner.isPackageClass) + staticSingletonInstance(classLoader, symbol.fullName) + else + if (outer == null) staticSingletonInstance(classToJava(symbol.moduleClass.asClass)) + else innerSingletonInstance(outer, symbol.name) } def companion: Option[ClassMirror] = symbol.companionClass match { case cls: ClassSymbol => Some(new JavaClassMirror(outer, cls)) case _ => None } + override def toString = s"module mirror for ${symbol.fullName} (bound to $outer)" } // -------------------- Java to Scala ----------------------------------- @@ -629,7 +773,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym val preOwner = classToScala(jOwner) val owner = followStatic(preOwner, jmeth.getModifiers) (lookup(owner, jmeth.getName) suchThat (erasesTo(_, jmeth)) orElse jmethodAsScala(jmeth)) - .asMethodSymbol + .asMethod } /** @@ -643,7 +787,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym private def constructorToScala1(jconstr: jConstructor[_]): MethodSymbol = { val owner = followStatic(classToScala(jconstr.getDeclaringClass), jconstr.getModifiers) (lookup(owner, jconstr.getName) suchThat (erasesTo(_, jconstr)) orElse jconstrAsScala(jconstr)) - .asMethodSymbol + .asMethod } /** @@ -657,8 +801,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym private def fieldToScala1(jfield: jField): TermSymbol = { val owner = followStatic(classToScala(jfield.getDeclaringClass), jfield.getModifiers) - (lookup(owner, jfield.getName) suchThat (!_.isMethod) orElse jfieldAsScala(jfield)) - .asTermSymbol + (lookup(owner, jfield.getName) suchThat (!_.isMethod) orElse jfieldAsScala(jfield)).asTerm } /** @@ -691,7 +834,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym val name = (fullname: TermName) drop split + 1 val opkg = owner.info decl name if (opkg.isPackage) - opkg.asModuleSymbol + opkg.asModule else if (opkg == NoSymbol) { val pkg = owner.newPackage(name) pkg.moduleClass setInfo new LazyPackageType @@ -748,7 +891,16 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym lookupClass else if (jclazz.isLocalClass0 || isInvalidClassName(jname)) // local classes and implementation classes not preserved by unpickling - treat as Java - jclassAsScala(jclazz) + // + // upd. but only if they cannot be loaded as top-level classes + // otherwise we may mistake mangled symbolic names for mangled nested names + // + // in case when a Java binary name can be treated both as a top-level class and as a nested class + // (as described in http://groups.google.com/group/scala-internals/browse_thread/thread/10855403bbf04298) + // we check for a top-level class first + // this is totally correct, because a top-level class and a nested class with the same name cannot coexist + // so it's either one or another, but not both - therefore we always load $-bearing classes correctly + lookupClass orElse jclassAsScala(jclazz) else if (jclazz.isArray) ArrayClass else @@ -758,7 +910,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym s"""${if (cls == NoSymbol) "not a type: symbol" else "no symbol could be"} | loaded from $jclazz in $owner with name $simpleName and classloader $classLoader""".stripMargin) - cls.asClassSymbol + cls.asClass } } @@ -773,7 +925,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym private def typeParamToScala1(jparam: jTypeVariable[_ <: GenericDeclaration]): TypeSymbol = { val owner = genericDeclarationToScala(jparam.getGenericDeclaration) owner.info match { - case PolyType(tparams, _) => tparams.find(_.name.toString == jparam.getName).get.asTypeSymbol + case PolyType(tparams, _) => tparams.find(_.name.toString == jparam.getName).get.asType } } @@ -940,12 +1092,25 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym noClass else if (clazz.owner.isPackageClass) javaClass(clazz.javaClassName) - else if (clazz.owner.isClass) - classToJava(clazz.owner.asClassSymbol) - .getDeclaredClasses - .find(_.getSimpleName == clazz.name.toString) - .getOrElse(noClass) - else + else if (clazz.owner.isClass) { + val childOfClass = !clazz.owner.isModuleClass + val childOfTopLevel = clazz.owner.owner.isPackageClass + val childOfTopLevelObject = clazz.owner.isModuleClass && childOfTopLevel + + // suggested in https://issues.scala-lang.org/browse/SI-4023?focusedCommentId=54759#comment-54759 + var ownerClazz = classToJava(clazz.owner.asClass) + if (childOfTopLevelObject) ownerClazz = Class.forName(ownerClazz.getName stripSuffix "$", true, ownerClazz.getClassLoader) + val ownerChildren = ownerClazz.getDeclaredClasses + + var fullNameOfJavaClass = ownerClazz.getName + if (childOfClass || childOfTopLevel) fullNameOfJavaClass += "$" + fullNameOfJavaClass += clazz.name + if (clazz.isModuleClass) fullNameOfJavaClass += "$" + + // println(s"ownerChildren = ${ownerChildren.toList}") + // println(s"fullNameOfJavaClass = $fullNameOfJavaClass") + ownerChildren.find(_.getName == fullNameOfJavaClass).getOrElse(noClass) + } else noClass } @@ -957,7 +1122,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym * @param meth The Scala field. */ def fieldToJava(fld: TermSymbol): jField = fieldCache.toJava(fld) { - val jclazz = classToJava(fld.owner.asClassSymbol) + val jclazz = classToJava(fld.owner.asClass) val jname = nme.dropLocalSuffix(fld.name).toString try jclazz getDeclaredField jname catch { @@ -969,7 +1134,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym * @param meth The Scala method */ def methodToJava(meth: MethodSymbol): jMethod = methodCache.toJava(meth) { - val jclazz = classToJava(meth.owner.asClassSymbol) + val jclazz = classToJava(meth.owner.asClass) val paramClasses = transformedType(meth).paramTypes map typeToJavaClass val jname = nme.dropLocalSuffix(meth.name).toString try jclazz getDeclaredMethod (jname, paramClasses: _*) @@ -983,7 +1148,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym * @param constr The Scala constructor */ def constructorToJava(constr: MethodSymbol): jConstructor[_] = constructorCache.toJava(constr) { - val jclazz = classToJava(constr.owner.asClassSymbol) + val jclazz = classToJava(constr.owner.asClass) val paramClasses = transformedType(constr).paramTypes map typeToJavaClass val effectiveParamClasses = if (!constr.owner.owner.isStaticOwner) jclazz.getEnclosingClass +: paramClasses @@ -1001,7 +1166,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym def typeToJavaClass(tpe: Type): jClass[_] = tpe match { case ExistentialType(_, rtpe) => typeToJavaClass(rtpe) case TypeRef(_, ArrayClass, List(elemtpe)) => jArrayClass(typeToJavaClass(elemtpe)) - case TypeRef(_, sym: ClassSymbol, _) => classToJava(sym.asClassSymbol) + case TypeRef(_, sym: ClassSymbol, _) => classToJava(sym.asClass) case tpe @ TypeRef(_, sym: AliasTypeSymbol, _) => typeToJavaClass(tpe.dealias) case _ => throw new NoClassDefFoundError("no Java class corresponding to "+tpe+" found") } @@ -1029,7 +1194,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym mirrors(rootToLoader getOrElseUpdate(root, findLoader)).get.get } - private lazy val magicSymbols: Map[(String, Name), Symbol] = { + private lazy val magicClasses: Map[(String, Name), Symbol] = { def mapEntry(sym: Symbol): ((String, Name), Symbol) = (sym.owner.fullName, sym.name) -> sym Map() ++ (definitions.magicSymbols filter (_.isType) map mapEntry) } @@ -1050,7 +1215,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym if (name.isTermName && !owner.isEmptyPackageClass) return mirror.makeScalaPackage( if (owner.isRootSymbol) name.toString else owner.fullName+"."+name) - magicSymbols get (owner.fullName, name) match { + magicClasses get (owner.fullName, name) match { case Some(tsym) => owner.info.decls enter tsym return tsym diff --git a/src/reflect/scala/reflect/runtime/ReflectionUtils.scala b/src/reflect/scala/reflect/runtime/ReflectionUtils.scala index f696aceb93..e87c6b339b 100644 --- a/src/reflect/scala/reflect/runtime/ReflectionUtils.scala +++ b/src/reflect/scala/reflect/runtime/ReflectionUtils.scala @@ -1,12 +1,12 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ package scala.reflect.runtime import java.lang.{Class => jClass} -import java.lang.reflect.{ InvocationTargetException, UndeclaredThrowableException } +import java.lang.reflect.{ Method, InvocationTargetException, UndeclaredThrowableException } /** A few java-reflection oriented utility functions useful during reflection bootstrapping. */ @@ -63,25 +63,25 @@ object ReflectionUtils { } } - def singletonInstance(cl: ClassLoader, className: String): AnyRef = { + def staticSingletonInstance(cl: ClassLoader, className: String): AnyRef = { val name = if (className endsWith "$") className else className + "$" val clazz = java.lang.Class.forName(name, true, cl) - val singleton = clazz getField "MODULE$" get null - singleton + staticSingletonInstance(clazz) } - // Retrieves the MODULE$ field for the given class name. - def singletonInstanceOpt(cl: ClassLoader, className: String): Option[AnyRef] = - try Some(singletonInstance(cl, className)) - catch { case _: ClassNotFoundException => None } + def staticSingletonInstance(clazz: Class[_]): AnyRef = clazz getField "MODULE$" get null - def invokeFactory(cl: ClassLoader, className: String, methodName: String, args: AnyRef*): AnyRef = { - val singleton = singletonInstance(cl, className) - val method = singleton.getClass.getMethod(methodName, classOf[ClassLoader]) - method.invoke(singleton, args: _*) - } + def innerSingletonInstance(outer: AnyRef, className: String): AnyRef = { + val accessorName = if (className endsWith "$") className.substring(0, className.length - 1) else className + def singletonAccessor(clazz: Class[_]): Option[Method] = + if (clazz == null) None + else { + val declaredAccessor = clazz.getDeclaredMethods.filter(_.getName == accessorName).headOption + declaredAccessor orElse singletonAccessor(clazz.getSuperclass) + } - def invokeFactoryOpt(cl: ClassLoader, className: String, methodName: String, args: AnyRef*): Option[AnyRef] = - try Some(invokeFactory(cl, className, methodName, args: _*)) - catch { case _: ClassNotFoundException => None } + val accessor = singletonAccessor(outer.getClass) getOrElse { throw new NoSuchMethodException(s"${outer.getClass.getName}.$accessorName") } + accessor setAccessible true + accessor invoke outer + } } diff --git a/src/reflect/scala/reflect/runtime/Settings.scala b/src/reflect/scala/reflect/runtime/Settings.scala index eedb88320b..da4f4fbda1 100644 --- a/src/reflect/scala/reflect/runtime/Settings.scala +++ b/src/reflect/scala/reflect/runtime/Settings.scala @@ -1,11 +1,13 @@ package scala.reflect package runtime +import scala.reflect.internal.settings.MutableSettings + /** The Settings class for runtime reflection. * This should be refined, so that settings are settable via command * line options or properties. */ -class Settings extends internal.settings.MutableSettings { +class Settings extends MutableSettings { trait Setting extends SettingValue { } @@ -21,20 +23,27 @@ class Settings extends internal.settings.MutableSettings { override def value: Int = v } - val overrideObjects = new BooleanSetting(false) - val debug = new BooleanSetting(false) - val Ynotnull = new BooleanSetting(false) - val explaintypes = new BooleanSetting(false) - val verbose = new BooleanSetting(false) - val uniqid = new BooleanSetting(false) - val Yshowsymkinds = new BooleanSetting(false) - val Xprintpos = new BooleanSetting(false) - val printtypes = new BooleanSetting(false) - val Yrecursion = new IntSetting(0) - val maxClassfileName = new IntSetting(255) - val Xexperimental = new BooleanSetting(false) - val deepCloning = new BooleanSetting (false) - val XoldPatmat = new BooleanSetting(false) + class MultiStringSetting(xs: List[String]) extends Setting { + type T = List[String] + protected var v: List[String] = xs + override def value: List[String] = v + } + + val Xexperimental = new BooleanSetting(false) + val XfullLubs = new BooleanSetting(false) val XnoPatmatAnalysis = new BooleanSetting(false) - val XfullLubs = new BooleanSetting(false) + val XoldPatmat = new BooleanSetting(false) + val Xprintpos = new BooleanSetting(false) + val Ynotnull = new BooleanSetting(false) + val Yshowsymkinds = new BooleanSetting(false) + val debug = new BooleanSetting(false) + val deepCloning = new BooleanSetting(false) + val explaintypes = new BooleanSetting(false) + val overrideObjects = new BooleanSetting(false) + val printtypes = new BooleanSetting(false) + val uniqid = new BooleanSetting(false) + val verbose = new BooleanSetting(false) + + val Yrecursion = new IntSetting(0) + val maxClassfileName = new IntSetting(255) } diff --git a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala index 3b28ddf42c..c65357b652 100644 --- a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala +++ b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala @@ -110,6 +110,8 @@ trait SynchronizedSymbols extends internal.Symbols { self: SymbolTable => trait SynchronizedMethodSymbol extends MethodSymbol with SynchronizedTermSymbol { override def typeAsMemberOf(pre: Type): Type = synchronized { super.typeAsMemberOf(pre) } + override def params: List[List[Symbol]] = synchronized { super.params } + override def returnType: Type = synchronized { super.returnType } } trait SynchronizedTypeSymbol extends TypeSymbol with SynchronizedSymbol { @@ -134,7 +136,7 @@ trait SynchronizedSymbols extends internal.Symbols { self: SymbolTable => override def sourceModule = synchronized { super.sourceModule } // [Eugene++ to Martin] doesn't override anything. no longer necessary? // def sourceModule_=(module: ModuleSymbol) = synchronized { super.sourceModule_=(module) } - override def implicitMembers: List[Symbol] = synchronized { super.implicitMembers } + override def implicitMembers: Scope = synchronized { super.implicitMembers } } } diff --git a/src/reflect/scala/reflect/runtime/package.scala b/src/reflect/scala/reflect/runtime/package.scala index a5809a2629..d00094c0c1 100644 --- a/src/reflect/scala/reflect/runtime/package.scala +++ b/src/reflect/scala/reflect/runtime/package.scala @@ -1,7 +1,5 @@ package scala.reflect -import language.experimental.macros - package object runtime { // type is api.JavaUniverse because we only want to expose the `scala.reflect.api.*` subset of reflection @@ -9,18 +7,19 @@ package object runtime { // [Eugene++ to Martin] removed `mirrorOfLoader`, because one can use `universe.runtimeMirror` instead - def currentMirror: universe.Mirror = macro Macros.currentMirror + // implementation magically hardwired to the `currentMirror` method below + def currentMirror: universe.Mirror = ??? // macro } package runtime { object Macros { - def currentMirror(c: scala.reflect.makro.Context): c.Expr[universe.Mirror] = { + def currentMirror(c: scala.reflect.macros.Context): c.Expr[universe.Mirror] = { import c.universe._ val runtimeClass = c.reifyEnclosingRuntimeClass if (runtimeClass.isEmpty) c.abort(c.enclosingPosition, "call site does not have an enclosing class") val runtimeUniverse = Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("runtime")), newTermName("universe")) val currentMirror = Apply(Select(runtimeUniverse, newTermName("runtimeMirror")), List(Select(runtimeClass, newTermName("getClassLoader")))) - c.Expr[Nothing](currentMirror)(c.TypeTag.Nothing) + c.Expr[Nothing](currentMirror)(c.AbsTypeTag.Nothing) } } } diff --git a/src/reflect/scala/tools/nsc/io/AbstractFile.scala b/src/reflect/scala/tools/nsc/io/AbstractFile.scala index fd56608fab..8d55b708b1 100644 --- a/src/reflect/scala/tools/nsc/io/AbstractFile.scala +++ b/src/reflect/scala/tools/nsc/io/AbstractFile.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/tools/nsc/io/NoAbstractFile.scala b/src/reflect/scala/tools/nsc/io/NoAbstractFile.scala index 04568b0e2e..2af933c27b 100644 --- a/src/reflect/scala/tools/nsc/io/NoAbstractFile.scala +++ b/src/reflect/scala/tools/nsc/io/NoAbstractFile.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/reflect/scala/tools/nsc/io/Path.scala b/src/reflect/scala/tools/nsc/io/Path.scala index 74bd6cf16b..bfad4b93c5 100644 --- a/src/reflect/scala/tools/nsc/io/Path.scala +++ b/src/reflect/scala/tools/nsc/io/Path.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/reflect/scala/tools/nsc/io/PlainFile.scala b/src/reflect/scala/tools/nsc/io/PlainFile.scala index 21276e8740..a4f378ad5e 100644 --- a/src/reflect/scala/tools/nsc/io/PlainFile.scala +++ b/src/reflect/scala/tools/nsc/io/PlainFile.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/tools/nsc/io/Streamable.scala b/src/reflect/scala/tools/nsc/io/Streamable.scala index 4d872c0221..ff770bd396 100644 --- a/src/reflect/scala/tools/nsc/io/Streamable.scala +++ b/src/reflect/scala/tools/nsc/io/Streamable.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/src/reflect/scala/tools/nsc/io/VirtualDirectory.scala b/src/reflect/scala/tools/nsc/io/VirtualDirectory.scala index 7272921054..fa016f86f4 100644 --- a/src/reflect/scala/tools/nsc/io/VirtualDirectory.scala +++ b/src/reflect/scala/tools/nsc/io/VirtualDirectory.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL */ package scala.tools.nsc diff --git a/src/reflect/scala/tools/nsc/io/VirtualFile.scala b/src/reflect/scala/tools/nsc/io/VirtualFile.scala index 805bc04165..be888e92e6 100644 --- a/src/reflect/scala/tools/nsc/io/VirtualFile.scala +++ b/src/reflect/scala/tools/nsc/io/VirtualFile.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Martin Odersky */ diff --git a/src/reflect/scala/tools/nsc/io/ZipArchive.scala b/src/reflect/scala/tools/nsc/io/ZipArchive.scala index 766b1fd093..852dba9ec8 100644 --- a/src/reflect/scala/tools/nsc/io/ZipArchive.scala +++ b/src/reflect/scala/tools/nsc/io/ZipArchive.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL * @author Paul Phillips */ diff --git a/test/files/instrumented/inline-in-constructors.check b/test/files/instrumented/inline-in-constructors.check new file mode 100644 index 0000000000..c6c9ae4e15 --- /dev/null +++ b/test/files/instrumented/inline-in-constructors.check @@ -0,0 +1,3 @@ +Method call statistics: + 1 instrumented/Bar.<init>(Z)V + 1 instrumented/Foo.<init>(I)V diff --git a/test/files/instrumented/inline-in-constructors.flags b/test/files/instrumented/inline-in-constructors.flags new file mode 100644 index 0000000000..c9b68d70dc --- /dev/null +++ b/test/files/instrumented/inline-in-constructors.flags @@ -0,0 +1 @@ +-optimise diff --git a/test/files/instrumented/inline-in-constructors/assert_1.scala b/test/files/instrumented/inline-in-constructors/assert_1.scala new file mode 100644 index 0000000000..a03757b89c --- /dev/null +++ b/test/files/instrumented/inline-in-constructors/assert_1.scala @@ -0,0 +1,13 @@ +package instrumented + +object MyPredef { + @inline + final def assert(assertion: Boolean, message: => Any) { + if (!assertion) + throw new java.lang.AssertionError("assertion failed: " + message) + } +} + +class Foo(x: Int) { + MyPredef.assert(x > 0, "not positive: " + x) +} diff --git a/test/files/instrumented/inline-in-constructors/bar_2.scala b/test/files/instrumented/inline-in-constructors/bar_2.scala new file mode 100644 index 0000000000..418dac5a67 --- /dev/null +++ b/test/files/instrumented/inline-in-constructors/bar_2.scala @@ -0,0 +1,7 @@ +package instrumented + +/** Class that uses assert compiled in previous compiler run so we check if + inlining in constructors works across different compilation runs */ +class Bar(x: Boolean) { + MyPredef.assert(x, "not true: " + x) +} diff --git a/test/files/instrumented/inline-in-constructors/test_3.scala b/test/files/instrumented/inline-in-constructors/test_3.scala new file mode 100644 index 0000000000..c4d4cc5f37 --- /dev/null +++ b/test/files/instrumented/inline-in-constructors/test_3.scala @@ -0,0 +1,15 @@ +import scala.tools.partest.instrumented.Instrumentation._ +import instrumented._ + +object Test { + def main(args: Array[String]) { + // force predef initialization before profiling + Predef + MyPredef + startProfiling() + val a = new Foo(2) + val b = new Bar(true) + stopProfiling() + printStatistics() + } +} diff --git a/test/files/jvm/future-spec/FutureTests.scala b/test/files/jvm/future-spec/FutureTests.scala index 30e1a722bf..31bb8c4e44 100644 --- a/test/files/jvm/future-spec/FutureTests.scala +++ b/test/files/jvm/future-spec/FutureTests.scala @@ -6,6 +6,7 @@ import scala.concurrent.util.duration._ import scala.concurrent.util.Duration.Inf import scala.collection._ import scala.runtime.NonLocalReturnControl +import scala.util.{Try,Success,Failure} @@ -197,7 +198,7 @@ object FutureTests extends MinimalScalaTest { } andThen { case _ => q.add(2) } andThen { - case Right(0) => q.add(Int.MaxValue) + case Success(0) => q.add(Int.MaxValue) } andThen { case _ => q.add(3); } @@ -260,13 +261,13 @@ object FutureTests extends MinimalScalaTest { } val futures = (0 to 9) map { - idx => async(idx, idx * 200) + idx => async(idx, idx * 20) } val folded = Future.fold(futures)(0)(_ + _) Await.result(folded, timeout) mustBe (45) val futuresit = (0 to 9) map { - idx => async(idx, idx * 200) + idx => async(idx, idx * 20) } val foldedit = Future.fold(futures)(0)(_ + _) Await.result(foldedit, timeout) mustBe (45) @@ -279,7 +280,7 @@ object FutureTests extends MinimalScalaTest { add } def futures = (0 to 9) map { - idx => async(idx, idx * 200) + idx => async(idx, idx * 20) } val folded = futures.foldLeft(Future(0)) { case (fr, fa) => for (r <- fr; a <- fa) yield (r + a) @@ -295,7 +296,7 @@ object FutureTests extends MinimalScalaTest { add } def futures = (0 to 9) map { - idx => async(idx, idx * 100) + idx => async(idx, idx * 10) } val folded = Future.fold(futures)(0)(_ + _) intercept[IllegalArgumentException] { @@ -326,7 +327,7 @@ object FutureTests extends MinimalScalaTest { "shouldReduceResults" in { def async(idx: Int) = future { - Thread.sleep(idx * 200) + Thread.sleep(idx * 20) idx } val timeout = 10000 millis @@ -348,7 +349,7 @@ object FutureTests extends MinimalScalaTest { } val timeout = 10000 millis def futures = (1 to 10) map { - idx => async(idx, idx * 100) + idx => async(idx, idx * 10) } val failed = Future.reduce(futures)(_ + _) intercept[IllegalArgumentException] { @@ -472,7 +473,7 @@ object FutureTests extends MinimalScalaTest { p1.future.isCompleted mustBe (false) f4.isCompleted mustBe (false) - p1 complete Right("Hello") + p1 complete Success("Hello") Await.ready(latch(7), TestLatch.DefaultTimeout) @@ -509,7 +510,7 @@ object FutureTests extends MinimalScalaTest { } "should not throw when Await.ready" in { - val expected = try Right(5 / 0) catch { case a: ArithmeticException => Left(a) } + val expected = try Success(5 / 0) catch { case a: ArithmeticException => Failure(a) } val f = future(5).map(_ / 0) Await.ready(f, defaultTimeout).value.get.toString mustBe expected.toString } diff --git a/test/files/jvm/future-spec/PromiseTests.scala b/test/files/jvm/future-spec/PromiseTests.scala index d15bb31f36..d9aaa1d5ed 100644 --- a/test/files/jvm/future-spec/PromiseTests.scala +++ b/test/files/jvm/future-spec/PromiseTests.scala @@ -6,7 +6,7 @@ import scala.concurrent.util.duration._ import scala.concurrent.util.Duration.Inf import scala.collection._ import scala.runtime.NonLocalReturnControl - +import scala.util.{Try,Success,Failure} object PromiseTests extends MinimalScalaTest { @@ -48,27 +48,27 @@ object PromiseTests extends MinimalScalaTest { "A successful Promise" should { val result = "test value" - val promise = Promise[String]().complete(Right(result)) + val promise = Promise[String]().complete(Success(result)) promise.isCompleted mustBe (true) futureWithResult(_(promise.future, result)) } "A failed Promise" should { val message = "Expected Exception" - val promise = Promise[String]().complete(Left(new RuntimeException(message))) + val promise = Promise[String]().complete(Failure(new RuntimeException(message))) promise.isCompleted mustBe (true) futureWithException[RuntimeException](_(promise.future, message)) } "An interrupted Promise" should { val message = "Boxed InterruptedException" - val future = Promise[String]().complete(Left(new InterruptedException(message))).future + val future = Promise[String]().complete(Failure(new InterruptedException(message))).future futureWithException[ExecutionException](_(future, message)) } "A NonLocalReturnControl failed Promise" should { val result = "test value" - val future = Promise[String]().complete(Left(new NonLocalReturnControl[String]("test", result))).future + val future = Promise[String]().complete(Failure(new NonLocalReturnControl[String]("test", result))).future futureWithResult(_(future, result)) } @@ -76,7 +76,7 @@ object PromiseTests extends MinimalScalaTest { "be completed" in { f((future, _) => future.isCompleted mustBe (true)) } - "contain a value" in { f((future, result) => future.value mustBe (Some(Right(result)))) } + "contain a value" in { f((future, result) => future.value mustBe (Some(Success(result)))) } "return when ready with 'Await.ready'" in { f((future, result) => Await.ready(future, defaultTimeout).isCompleted mustBe (true)) } @@ -159,7 +159,7 @@ object PromiseTests extends MinimalScalaTest { "contain a value" in { f((future, message) => { - future.value.get.left.get.getMessage mustBe (message) + future.value.get.failed.get.getMessage mustBe (message) }) } diff --git a/test/files/jvm/future-spec/TryTests.scala b/test/files/jvm/future-spec/TryTests.scala new file mode 100644 index 0000000000..82ca12276f --- /dev/null +++ b/test/files/jvm/future-spec/TryTests.scala @@ -0,0 +1,118 @@ +// This is a port of the com.twitter.util Try spec. +// -- +// It lives in the future-spec directory simply because it requires a specs-like +// DSL which has already been minimally implemented for the future spec tests. + +import scala.util.{Try,Success,Failure} + +object TryTests extends MinimalScalaTest { + class MyException extends Exception + val e = new Exception("this is an exception") + + "Try()" should { + "catch exceptions and lift into the Try type" in { + Try[Int](1) mustEqual Success(1) + Try[Int] { throw e } mustEqual Failure(e) + } + } + + "Try" should { + "recoverWith" in { + val myException = new MyException + Success(1) recoverWith { case _ => Success(2) } mustEqual Success(1) + Failure(e) recoverWith { case _ => Success(2) } mustEqual Success(2) + Failure(e) recoverWith { case _ => Failure(e) } mustEqual Failure(e) + } + + "getOrElse" in { + Success(1) getOrElse 2 mustEqual 1 + Failure(e) getOrElse 2 mustEqual 2 + } + + "orElse" in { + Success(1) orElse Success(2) mustEqual Success(1) + Failure(e) orElse Success(2) mustEqual Success(2) + } + + "map" in { + "when there is no exception" in { + Success(1) map(1+) mustEqual Success(2) + Failure[Int](e) map(1+) mustEqual Failure(e) + } + + "when there is an exception" in { + Success(1) map(_ => throw e) mustEqual Failure(e) + + val e2 = new Exception + Failure[Int](e) map(_ => throw e2) mustEqual Failure(e) + } + } + + "flatMap" in { + "when there is no exception" in { + Success(1) flatMap(x => Success(1 + x)) mustEqual Success(2) + Failure[Int](e) flatMap(x => Success(1 + x)) mustEqual Failure(e) + } + + "when there is an exception" in { + Success(1).flatMap[Int](_ => throw e) mustEqual Failure(e) + + val e2 = new Exception + Failure[Int](e).flatMap[Int](_ => throw e2) mustEqual Failure(e) + } + } + + "flatten" in { + "is a Success(Success)" in { + Success(Success(1)).flatten mustEqual Success(1) + } + + "is a Success(Failure)" in { + val e = new Exception + Success(Failure(e)).flatten mustEqual Failure(e) + } + + "is a Throw" in { + val e = new Exception + Failure[Try[Int]](e).flatten mustEqual Failure(e) + } + } + + "for" in { + "with no Failure values" in { + val result = for { + i <- Success(1) + j <- Success(1) + } yield (i + j) + result mustEqual Success(2) + } + + "with Failure values" in { + "throws before" in { + val result = for { + i <- Failure[Int](e) + j <- Success(1) + } yield (i + j) + result mustEqual Failure(e) + } + + "throws after" in { + val result = for { + i <- Success(1) + j <- Failure[Int](e) + } yield (i + j) + result mustEqual Failure(e) + } + + "returns the FIRST Failure" in { + val e2 = new Exception + val result = for { + i <- Failure[Int](e) + j <- Failure[Int](e2) + } yield (i + j) + result mustEqual Failure(e) + } + } + } + } +}
\ No newline at end of file diff --git a/test/files/jvm/future-spec/main.scala b/test/files/jvm/future-spec/main.scala index 45b59d5d20..57183d8cea 100644 --- a/test/files/jvm/future-spec/main.scala +++ b/test/files/jvm/future-spec/main.scala @@ -12,6 +12,7 @@ object Test { def main(args: Array[String]) { FutureTests.check() PromiseTests.check() + TryTests.check() } } @@ -47,7 +48,7 @@ trait MinimalScalaTest extends Output { snippet bufferPrintln("[OK] Test passed.") } catch { - case e => + case e: Throwable => bufferPrintln("[FAILED] " + e) bufferPrintln(e.getStackTrace().mkString("\n")) throwables += e @@ -59,6 +60,7 @@ trait MinimalScalaTest extends Output { implicit def objectops(obj: Any) = new { def mustBe(other: Any) = assert(obj == other, obj + " is not " + other) + def mustEqual(other: Any) = mustBe(other) } diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index dc835bf8b6..6145b6c4d2 100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -1,374 +1,373 @@ -Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> // basics
-
-scala> 3+4
-res0: Int = 7
-
-scala> def gcd(x: Int, y: Int): Int = {
- if (x == 0) y
- else if (y == 0) x
- else gcd(y%x, x)
-}
-gcd: (x: Int, y: Int)Int
-
-scala> val five = gcd(15,35)
-five: Int = 5
-
-scala> var x = 1
-x: Int = 1
-
-scala> x = 2
-x: Int = 2
-
-scala> val three = x+1
-three: Int = 3
-
-scala> type anotherint = Int
-defined type alias anotherint
-
-scala> val four: anotherint = 4
-four: anotherint = 4
-
-scala> val bogus: anotherint = "hello"
-<console>:8: error: type mismatch;
- found : String("hello")
- required: anotherint
- (which expands to) Int
- val bogus: anotherint = "hello"
- ^
-
-scala> trait PointlessTrait
-defined trait PointlessTrait
-
-scala> val (x,y) = (2,3)
-x: Int = 2
-y: Int = 3
-
-scala> println("hello")
-hello
-
-scala>
-
-scala> // ticket #1513
-
-scala> val t1513 = Array(null)
-t1513: Array[Null] = Array(null)
-
-scala> // ambiguous toString problem from #547
-
-scala> val atom = new scala.xml.Atom()
-atom: scala.xml.Atom[Unit] = ()
-
-scala> // overriding toString problem from #1404
-
-scala> class S(override val toString : String)
-defined class S
-
-scala> val fish = new S("fish")
-fish: S = fish
-
-scala> // Test that arrays pretty print nicely.
-
-scala> val arr = Array("What's", "up", "doc?")
-arr: Array[String] = Array(What's, up, doc?)
-
-scala> // Test that arrays pretty print nicely, even when we give them type Any
-
-scala> val arrInt : Any = Array(1,2,3)
-arrInt: Any = Array(1, 2, 3)
-
-scala> // Test that nested arrays are pretty-printed correctly
-
-scala> val arrArrInt : Any = Array(Array(1, 2), Array(3, 4))
-arrArrInt: Any = Array(Array(1, 2), Array(3, 4))
-
-scala>
-
-scala> // implicit conversions
-
-scala> case class Foo(n: Int)
-defined class Foo
-
-scala> case class Bar(n: Int)
-defined class Bar
-
-scala> implicit def foo2bar(foo: Foo) = Bar(foo.n)
-warning: there were 1 feature warnings; re-run with -feature for details
-foo2bar: (foo: Foo)Bar
-
-scala> val bar: Bar = Foo(3)
-bar: Bar = Bar(3)
-
-scala>
-
-scala> // importing from a previous result
-
-scala> import bar._
-import bar._
-
-scala> val m = n
-m: Int = 3
-
-scala>
-
-scala> // stressing the imports mechanism
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala> val one = 1
-one: Int = 1
-
-scala>
-
-scala>
-
-scala> val x1 = 1
-x1: Int = 1
-
-scala> val x2 = 1
-x2: Int = 1
-
-scala> val x3 = 1
-x3: Int = 1
-
-scala> val x4 = 1
-x4: Int = 1
-
-scala> val x5 = 1
-x5: Int = 1
-
-scala> val x6 = 1
-x6: Int = 1
-
-scala> val x7 = 1
-x7: Int = 1
-
-scala> val x8 = 1
-x8: Int = 1
-
-scala> val x9 = 1
-x9: Int = 1
-
-scala> val x10 = 1
-x10: Int = 1
-
-scala> val x11 = 1
-x11: Int = 1
-
-scala> val x12 = 1
-x12: Int = 1
-
-scala> val x13 = 1
-x13: Int = 1
-
-scala> val x14 = 1
-x14: Int = 1
-
-scala> val x15 = 1
-x15: Int = 1
-
-scala> val x16 = 1
-x16: Int = 1
-
-scala> val x17 = 1
-x17: Int = 1
-
-scala> val x18 = 1
-x18: Int = 1
-
-scala> val x19 = 1
-x19: Int = 1
-
-scala> val x20 = 1
-x20: Int = 1
-
-scala>
-
-scala> val two = one + x5
-two: Int = 2
-
-scala>
-
-scala> // handling generic wildcard arrays (#2386)
-
-scala> // It's put here because type feedback is an important part of it.
-
-scala> val xs: Array[_] = Array(1, 2)
-xs: Array[_] = Array(1, 2)
-
-scala> xs.size
-res2: Int = 2
-
-scala> xs.head
-res3: Any = 1
-
-scala> xs filter (_ == 2)
-res4: Array[_] = Array(2)
-
-scala> xs map (_ => "abc")
-res5: Array[String] = Array(abc, abc)
-
-scala> xs map (x => x)
-res6: Array[_] = Array(1, 2)
-
-scala> xs map (x => (x, x))
-warning: there were 1 feature warnings; re-run with -feature for details
-warning: there were 1 feature warnings; re-run with -feature for details
-res7: Array[(_$1, _$1)] forSome { type _$1 } = Array((1,1), (2,2))
-
-scala>
-
-scala> // interior syntax errors should *not* go into multi-line input mode.
-
-scala> // both of the following should abort immediately:
-
-scala> def x => y => z
-<console>:1: error: '=' expected but '=>' found.
- def x => y => z
- ^
-
-scala> [1,2,3]
-<console>:1: error: illegal start of definition
- [1,2,3]
- ^
-
-scala>
-
-scala>
-
-scala> // multi-line XML
-
-scala> <a>
-<b
- c="c"
- d="dd"
-/></a>
-res8: scala.xml.Elem =
-<a>
-<b c="c" d="dd"/></a>
-
-scala>
-
-scala>
-
-scala> /*
- /*
- multi-line comment
- */
-*/
-
-
-You typed two blank lines. Starting a new command.
-
-scala> // multi-line string
-
-scala> """
-hello
-there
-"""
-res12: String =
-"
-hello
-there
-"
-
-scala>
-
-scala> (1 + // give up early by typing two blank lines
-
-
-You typed two blank lines. Starting a new command.
-
-scala> // defining and using quoted names should work (ticket #323)
-
-scala> def `match` = 1
-match: Int
-
-scala> val x = `match`
-x: Int = 1
-
-scala>
-
-scala> // multiple classes defined on one line
-
-scala> sealed class Exp; class Fact extends Exp; class Term extends Exp
-defined class Exp
-defined class Fact
-defined class Term
-
-scala> def f(e: Exp) = e match { // non-exhaustive warning here
- case _:Fact => 3
-}
-<console>:18: warning: match is not exhaustive!
-missing combination Exp
-missing combination Term
-
- def f(e: Exp) = e match { // non-exhaustive warning here
- ^
-f: (e: Exp)Int
-
-scala>
-
-scala>
+Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> // basics + +scala> 3+4 +res0: Int = 7 + +scala> def gcd(x: Int, y: Int): Int = { + if (x == 0) y + else if (y == 0) x + else gcd(y%x, x) +} +gcd: (x: Int, y: Int)Int + +scala> val five = gcd(15,35) +five: Int = 5 + +scala> var x = 1 +x: Int = 1 + +scala> x = 2 +x: Int = 2 + +scala> val three = x+1 +three: Int = 3 + +scala> type anotherint = Int +defined type alias anotherint + +scala> val four: anotherint = 4 +four: anotherint = 4 + +scala> val bogus: anotherint = "hello" +<console>:8: error: type mismatch; + found : String("hello") + required: anotherint + (which expands to) Int + val bogus: anotherint = "hello" + ^ + +scala> trait PointlessTrait +defined trait PointlessTrait + +scala> val (x,y) = (2,3) +x: Int = 2 +y: Int = 3 + +scala> println("hello") +hello + +scala> + +scala> // ticket #1513 + +scala> val t1513 = Array(null) +t1513: Array[Null] = Array(null) + +scala> // ambiguous toString problem from #547 + +scala> val atom = new scala.xml.Atom() +atom: scala.xml.Atom[Unit] = () + +scala> // overriding toString problem from #1404 + +scala> class S(override val toString : String) +defined class S + +scala> val fish = new S("fish") +fish: S = fish + +scala> // Test that arrays pretty print nicely. + +scala> val arr = Array("What's", "up", "doc?") +arr: Array[String] = Array(What's, up, doc?) + +scala> // Test that arrays pretty print nicely, even when we give them type Any + +scala> val arrInt : Any = Array(1,2,3) +arrInt: Any = Array(1, 2, 3) + +scala> // Test that nested arrays are pretty-printed correctly + +scala> val arrArrInt : Any = Array(Array(1, 2), Array(3, 4)) +arrArrInt: Any = Array(Array(1, 2), Array(3, 4)) + +scala> + +scala> // implicit conversions + +scala> case class Foo(n: Int) +defined class Foo + +scala> case class Bar(n: Int) +defined class Bar + +scala> implicit def foo2bar(foo: Foo) = Bar(foo.n) +warning: there were 1 feature warnings; re-run with -feature for details +foo2bar: (foo: Foo)Bar + +scala> val bar: Bar = Foo(3) +bar: Bar = Bar(3) + +scala> + +scala> // importing from a previous result + +scala> import bar._ +import bar._ + +scala> val m = n +m: Int = 3 + +scala> + +scala> // stressing the imports mechanism + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> val one = 1 +one: Int = 1 + +scala> + +scala> + +scala> val x1 = 1 +x1: Int = 1 + +scala> val x2 = 1 +x2: Int = 1 + +scala> val x3 = 1 +x3: Int = 1 + +scala> val x4 = 1 +x4: Int = 1 + +scala> val x5 = 1 +x5: Int = 1 + +scala> val x6 = 1 +x6: Int = 1 + +scala> val x7 = 1 +x7: Int = 1 + +scala> val x8 = 1 +x8: Int = 1 + +scala> val x9 = 1 +x9: Int = 1 + +scala> val x10 = 1 +x10: Int = 1 + +scala> val x11 = 1 +x11: Int = 1 + +scala> val x12 = 1 +x12: Int = 1 + +scala> val x13 = 1 +x13: Int = 1 + +scala> val x14 = 1 +x14: Int = 1 + +scala> val x15 = 1 +x15: Int = 1 + +scala> val x16 = 1 +x16: Int = 1 + +scala> val x17 = 1 +x17: Int = 1 + +scala> val x18 = 1 +x18: Int = 1 + +scala> val x19 = 1 +x19: Int = 1 + +scala> val x20 = 1 +x20: Int = 1 + +scala> + +scala> val two = one + x5 +two: Int = 2 + +scala> + +scala> // handling generic wildcard arrays (#2386) + +scala> // It's put here because type feedback is an important part of it. + +scala> val xs: Array[_] = Array(1, 2) +xs: Array[_] = Array(1, 2) + +scala> xs.size +res2: Int = 2 + +scala> xs.head +res3: Any = 1 + +scala> xs filter (_ == 2) +res4: Array[_] = Array(2) + +scala> xs map (_ => "abc") +res5: Array[String] = Array(abc, abc) + +scala> xs map (x => x) +res6: Array[_] = Array(1, 2) + +scala> xs map (x => (x, x)) +warning: there were 1 feature warnings; re-run with -feature for details +res7: Array[(_$1, _$1)] forSome { type _$1 } = Array((1,1), (2,2)) + +scala> + +scala> // interior syntax errors should *not* go into multi-line input mode. + +scala> // both of the following should abort immediately: + +scala> def x => y => z +<console>:1: error: '=' expected but '=>' found. + def x => y => z + ^ + +scala> [1,2,3] +<console>:1: error: illegal start of definition + [1,2,3] + ^ + +scala> + +scala> + +scala> // multi-line XML + +scala> <a> +<b + c="c" + d="dd" +/></a> +res8: scala.xml.Elem = +<a> +<b c="c" d="dd"/></a> + +scala> + +scala> + +scala> /* + /* + multi-line comment + */ +*/ + + +You typed two blank lines. Starting a new command. + +scala> // multi-line string + +scala> """ +hello +there +""" +res12: String = +" +hello +there +" + +scala> + +scala> (1 + // give up early by typing two blank lines + + +You typed two blank lines. Starting a new command. + +scala> // defining and using quoted names should work (ticket #323) + +scala> def `match` = 1 +match: Int + +scala> val x = `match` +x: Int = 1 + +scala> + +scala> // multiple classes defined on one line + +scala> sealed class Exp; class Fact extends Exp; class Term extends Exp +defined class Exp +defined class Fact +defined class Term + +scala> def f(e: Exp) = e match { // non-exhaustive warning here + case _:Fact => 3 +} +<console>:18: warning: match is not exhaustive! +missing combination Exp +missing combination Term + + def f(e: Exp) = e match { // non-exhaustive warning here + ^ +f: (e: Exp)Int + +scala> + +scala> plusOne: (x: Int)Int res0: Int = 6 res0: String = after reset diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala index 43d4c9dc71..ffb5608fd2 100644 --- a/test/files/jvm/scala-concurrent-tck.scala +++ b/test/files/jvm/scala-concurrent-tck.scala @@ -601,10 +601,10 @@ trait FutureProjections extends TestBase { throw cause } f.failed onComplete { - case Right(t) => + case Success(t) => assert(t == cause) done() - case Left(t) => + case Failure(t) => assert(false) } } @@ -626,9 +626,9 @@ trait FutureProjections extends TestBase { done => val f = future { 0 } f.failed onComplete { - case Right(t) => + case Success(t) => assert(false) - case Left(t) => + case Failure(t) => assert(t.isInstanceOf[NoSuchElementException]) done() } @@ -803,81 +803,6 @@ trait Exceptions extends TestBase { } -// trait TryEitherExtractor extends TestBase { - -// import scala.util.{Try, Success, Failure} - -// def testSuccessMatch(): Unit = once { -// done => -// val thisIsASuccess = Success(42) -// thisIsASuccess match { -// case Success(v) => -// done() -// assert(v == 42) -// case Failure(e) => -// done() -// assert(false) -// case other => -// done() -// assert(false) -// } -// } - -// def testRightMatch(): Unit = once { -// done => -// val thisIsNotASuccess: Right[Throwable, Int] = Right(43) -// thisIsNotASuccess match { -// case Success(v) => -// done() -// assert(v == 43) -// case Failure(e) => -// done() -// assert(false) -// case other => -// done() -// assert(false) -// } -// } - -// def testFailureMatch(): Unit = once { -// done => -// val thisIsAFailure = Failure(new Exception("I'm an exception")) -// thisIsAFailure match { -// case Success(v) => -// done() -// assert(false) -// case Failure(e) => -// done() -// assert(e.getMessage == "I'm an exception") -// case other => -// done() -// assert(false) -// } -// } - -// def testLeftMatch(): Unit = once { -// done => -// val thisIsNotAFailure: Left[Throwable, Int] = Left(new Exception("I'm an exception")) -// thisIsNotAFailure match { -// case Success(v) => -// done() -// assert(false) -// case Failure(e) => -// done() -// assert(e.getMessage == "I'm an exception") -// case other => -// done() -// assert(false) -// } - -// } - -// testSuccessMatch() -// testRightMatch() -// testFailureMatch() -// testLeftMatch() -// } - trait CustomExecutionContext extends TestBase { import scala.concurrent.{ ExecutionContext, Awaitable } @@ -975,13 +900,13 @@ trait CustomExecutionContext extends TestBase { } flatMap { x => Promise.successful(x + 1).future.map(addOne).map(addOne) } onComplete { - case Left(t) => + case Failure(t) => try { throw new AssertionError("error in test: " + t.getMessage, t) } finally { done() } - case Right(x) => + case Success(x) => assertEC() assert(x == 14) done() @@ -1001,6 +926,66 @@ trait CustomExecutionContext extends TestBase { testCallbackChainCustomEC() } +trait ExecutionContextPrepare extends TestBase { + val theLocal = new ThreadLocal[String] { + override protected def initialValue(): String = "" + } + + class PreparingExecutionContext extends ExecutionContext { + def delegate = ExecutionContext.global + + override def execute(runnable: Runnable): Unit = + delegate.execute(runnable) + + override def prepare(): ExecutionContext = { + // save object stored in ThreadLocal storage + val localData = theLocal.get + new PreparingExecutionContext { + override def execute(runnable: Runnable): Unit = { + val wrapper = new Runnable { + override def run(): Unit = { + // now we're on the new thread + // put localData into theLocal + theLocal.set(localData) + runnable.run() + } + } + delegate.execute(wrapper) + } + } + } + + override def reportFailure(t: Throwable): Unit = + delegate.reportFailure(t) + } + + implicit val ec = new PreparingExecutionContext + + def testOnComplete(): Unit = once { + done => + theLocal.set("secret") + val fut = future { 42 } + fut onComplete { + case _ => + assert(theLocal.get == "secret") + done() + } + } + + def testMap(): Unit = once { + done => + theLocal.set("secret2") + val fut = future { 42 } + fut map { x => + assert(theLocal.get == "secret2") + done() + } + } + + testOnComplete() + testMap() +} + object Test extends App with FutureCallbacks @@ -1009,12 +994,9 @@ with FutureProjections with Promises with BlockContexts with Exceptions -// with TryEitherExtractor with CustomExecutionContext +with ExecutionContextPrepare { System.exit(0) } - - - diff --git a/test/files/jvm/t6172.scala b/test/files/jvm/t6172.scala new file mode 100644 index 0000000000..7fa048955c --- /dev/null +++ b/test/files/jvm/t6172.scala @@ -0,0 +1,3005 @@ +trait Foo1 { +trait A1 +trait A2 +trait A3 +trait A4 +trait A5 +trait A6 +trait A7 +trait A8 +trait A9 +trait A10 +trait A11 +trait A12 +trait A13 +trait A14 +trait A15 +trait A16 +trait A17 +trait A18 +trait A19 +trait A20 +trait A21 +trait A22 +trait A23 +trait A24 +trait A25 +trait A26 +trait A27 +trait A28 +trait A29 +trait A30 +trait A31 +trait A32 +trait A33 +trait A34 +trait A35 +trait A36 +trait A37 +trait A38 +trait A39 +trait A40 +trait A41 +trait A42 +trait A43 +trait A44 +trait A45 +trait A46 +trait A47 +trait A48 +trait A49 +trait A50 +trait A51 +trait A52 +trait A53 +trait A54 +trait A55 +trait A56 +trait A57 +trait A58 +trait A59 +trait A60 +trait A61 +trait A62 +trait A63 +trait A64 +trait A65 +trait A66 +trait A67 +trait A68 +trait A69 +trait A70 +trait A71 +trait A72 +trait A73 +trait A74 +trait A75 +trait A76 +trait A77 +trait A78 +trait A79 +trait A80 +trait A81 +trait A82 +trait A83 +trait A84 +trait A85 +trait A86 +trait A87 +trait A88 +trait A89 +trait A90 +trait A91 +trait A92 +trait A93 +trait A94 +trait A95 +trait A96 +trait A97 +trait A98 +trait A99 +trait A100 +trait A101 +trait A102 +trait A103 +trait A104 +trait A105 +trait A106 +trait A107 +trait A108 +trait A109 +trait A110 +trait A111 +trait A112 +trait A113 +trait A114 +trait A115 +trait A116 +trait A117 +trait A118 +trait A119 +trait A120 +trait A121 +trait A122 +trait A123 +trait A124 +trait A125 +trait A126 +trait A127 +trait A128 +trait A129 +trait A130 +trait A131 +trait A132 +trait A133 +trait A134 +trait A135 +trait A136 +trait A137 +trait A138 +trait A139 +trait A140 +trait A141 +trait A142 +trait A143 +trait A144 +trait A145 +trait A146 +trait A147 +trait A148 +trait A149 +trait A150 +trait A151 +trait A152 +trait A153 +trait A154 +trait A155 +trait A156 +trait A157 +trait A158 +trait A159 +trait A160 +trait A161 +trait A162 +trait A163 +trait A164 +trait A165 +trait A166 +trait A167 +trait A168 +trait A169 +trait A170 +trait A171 +trait A172 +trait A173 +trait A174 +trait A175 +trait A176 +trait A177 +trait A178 +trait A179 +trait A180 +trait A181 +trait A182 +trait A183 +trait A184 +trait A185 +trait A186 +trait A187 +trait A188 +trait A189 +trait A190 +trait A191 +trait A192 +trait A193 +trait A194 +trait A195 +trait A196 +trait A197 +trait A198 +trait A199 +trait A200 +trait A201 +trait A202 +trait A203 +trait A204 +trait A205 +trait A206 +trait A207 +trait A208 +trait A209 +trait A210 +trait A211 +trait A212 +trait A213 +trait A214 +trait A215 +trait A216 +trait A217 +trait A218 +trait A219 +trait A220 +trait A221 +trait A222 +trait A223 +trait A224 +trait A225 +trait A226 +trait A227 +trait A228 +trait A229 +trait A230 +trait A231 +trait A232 +trait A233 +trait A234 +trait A235 +trait A236 +trait A237 +trait A238 +trait A239 +trait A240 +trait A241 +trait A242 +trait A243 +trait A244 +trait A245 +trait A246 +trait A247 +trait A248 +trait A249 +trait A250 +trait A251 +trait A252 +trait A253 +trait A254 +trait A255 +trait A256 +trait A257 +trait A258 +trait A259 +trait A260 +trait A261 +trait A262 +trait A263 +trait A264 +trait A265 +trait A266 +trait A267 +trait A268 +trait A269 +trait A270 +trait A271 +trait A272 +trait A273 +trait A274 +trait A275 +trait A276 +trait A277 +trait A278 +trait A279 +trait A280 +trait A281 +trait A282 +trait A283 +trait A284 +trait A285 +trait A286 +trait A287 +trait A288 +trait A289 +trait A290 +trait A291 +trait A292 +trait A293 +trait A294 +trait A295 +trait A296 +trait A297 +trait A298 +trait A299 +trait A300 +trait A301 +trait A302 +trait A303 +trait A304 +trait A305 +trait A306 +trait A307 +trait A308 +trait A309 +trait A310 +trait A311 +trait A312 +trait A313 +trait A314 +trait A315 +trait A316 +trait A317 +trait A318 +trait A319 +trait A320 +trait A321 +trait A322 +trait A323 +trait A324 +trait A325 +trait A326 +trait A327 +trait A328 +trait A329 +trait A330 +trait A331 +trait A332 +trait A333 +trait A334 +trait A335 +trait A336 +trait A337 +trait A338 +trait A339 +trait A340 +trait A341 +trait A342 +trait A343 +trait A344 +trait A345 +trait A346 +trait A347 +trait A348 +trait A349 +trait A350 +trait A351 +trait A352 +trait A353 +trait A354 +trait A355 +trait A356 +trait A357 +trait A358 +trait A359 +trait A360 +trait A361 +trait A362 +trait A363 +trait A364 +trait A365 +trait A366 +trait A367 +trait A368 +trait A369 +trait A370 +trait A371 +trait A372 +trait A373 +trait A374 +trait A375 +trait A376 +trait A377 +trait A378 +trait A379 +trait A380 +trait A381 +trait A382 +trait A383 +trait A384 +trait A385 +trait A386 +trait A387 +trait A388 +trait A389 +trait A390 +trait A391 +trait A392 +trait A393 +trait A394 +trait A395 +trait A396 +trait A397 +trait A398 +trait A399 +trait A400 +trait A401 +trait A402 +trait A403 +trait A404 +trait A405 +trait A406 +trait A407 +trait A408 +trait A409 +trait A410 +trait A411 +trait A412 +trait A413 +trait A414 +trait A415 +trait A416 +trait A417 +trait A418 +trait A419 +trait A420 +trait A421 +trait A422 +trait A423 +trait A424 +trait A425 +trait A426 +trait A427 +trait A428 +trait A429 +trait A430 +trait A431 +trait A432 +trait A433 +trait A434 +trait A435 +trait A436 +trait A437 +trait A438 +trait A439 +trait A440 +trait A441 +trait A442 +trait A443 +trait A444 +trait A445 +trait A446 +trait A447 +trait A448 +trait A449 +trait A450 +trait A451 +trait A452 +trait A453 +trait A454 +trait A455 +trait A456 +trait A457 +trait A458 +trait A459 +trait A460 +trait A461 +trait A462 +trait A463 +trait A464 +trait A465 +trait A466 +trait A467 +trait A468 +trait A469 +trait A470 +trait A471 +trait A472 +trait A473 +trait A474 +trait A475 +trait A476 +trait A477 +trait A478 +trait A479 +trait A480 +trait A481 +trait A482 +trait A483 +trait A484 +trait A485 +trait A486 +trait A487 +trait A488 +trait A489 +trait A490 +trait A491 +trait A492 +trait A493 +trait A494 +trait A495 +trait A496 +trait A497 +trait A498 +trait A499 +trait A500 +trait A501 +trait A502 +trait A503 +trait A504 +trait A505 +trait A506 +trait A507 +trait A508 +trait A509 +trait A510 +trait A511 +trait A512 +trait A513 +trait A514 +trait A515 +trait A516 +trait A517 +trait A518 +trait A519 +trait A520 +trait A521 +trait A522 +trait A523 +trait A524 +trait A525 +trait A526 +trait A527 +trait A528 +trait A529 +trait A530 +trait A531 +trait A532 +trait A533 +trait A534 +trait A535 +trait A536 +trait A537 +trait A538 +trait A539 +trait A540 +trait A541 +trait A542 +trait A543 +trait A544 +trait A545 +trait A546 +trait A547 +trait A548 +trait A549 +trait A550 +trait A551 +trait A552 +trait A553 +trait A554 +trait A555 +trait A556 +trait A557 +trait A558 +trait A559 +trait A560 +trait A561 +trait A562 +trait A563 +trait A564 +trait A565 +trait A566 +trait A567 +trait A568 +trait A569 +trait A570 +trait A571 +trait A572 +trait A573 +trait A574 +trait A575 +trait A576 +trait A577 +trait A578 +trait A579 +trait A580 +trait A581 +trait A582 +trait A583 +trait A584 +trait A585 +trait A586 +trait A587 +trait A588 +trait A589 +trait A590 +trait A591 +trait A592 +trait A593 +trait A594 +trait A595 +trait A596 +trait A597 +trait A598 +trait A599 +trait A600 +trait A601 +trait A602 +trait A603 +trait A604 +trait A605 +trait A606 +trait A607 +trait A608 +trait A609 +trait A610 +trait A611 +trait A612 +trait A613 +trait A614 +trait A615 +trait A616 +trait A617 +trait A618 +trait A619 +trait A620 +trait A621 +trait A622 +trait A623 +trait A624 +trait A625 +trait A626 +trait A627 +trait A628 +trait A629 +trait A630 +trait A631 +trait A632 +trait A633 +trait A634 +trait A635 +trait A636 +trait A637 +trait A638 +trait A639 +trait A640 +trait A641 +trait A642 +trait A643 +trait A644 +trait A645 +trait A646 +trait A647 +trait A648 +trait A649 +trait A650 +trait A651 +trait A652 +trait A653 +trait A654 +trait A655 +trait A656 +trait A657 +trait A658 +trait A659 +trait A660 +trait A661 +trait A662 +trait A663 +trait A664 +trait A665 +trait A666 +trait A667 +trait A668 +trait A669 +trait A670 +trait A671 +trait A672 +trait A673 +trait A674 +trait A675 +trait A676 +trait A677 +trait A678 +trait A679 +trait A680 +trait A681 +trait A682 +trait A683 +trait A684 +trait A685 +trait A686 +trait A687 +trait A688 +trait A689 +trait A690 +trait A691 +trait A692 +trait A693 +trait A694 +trait A695 +trait A696 +trait A697 +trait A698 +trait A699 +trait A700 +trait A701 +trait A702 +trait A703 +trait A704 +trait A705 +trait A706 +trait A707 +trait A708 +trait A709 +trait A710 +trait A711 +trait A712 +trait A713 +trait A714 +trait A715 +trait A716 +trait A717 +trait A718 +trait A719 +trait A720 +trait A721 +trait A722 +trait A723 +trait A724 +trait A725 +trait A726 +trait A727 +trait A728 +trait A729 +trait A730 +trait A731 +trait A732 +trait A733 +trait A734 +trait A735 +trait A736 +trait A737 +trait A738 +trait A739 +trait A740 +trait A741 +trait A742 +trait A743 +trait A744 +trait A745 +trait A746 +trait A747 +trait A748 +trait A749 +trait A750 +trait A751 +trait A752 +trait A753 +trait A754 +trait A755 +trait A756 +trait A757 +trait A758 +trait A759 +trait A760 +trait A761 +trait A762 +trait A763 +trait A764 +trait A765 +trait A766 +trait A767 +trait A768 +trait A769 +trait A770 +trait A771 +trait A772 +trait A773 +trait A774 +trait A775 +trait A776 +trait A777 +trait A778 +trait A779 +trait A780 +trait A781 +trait A782 +trait A783 +trait A784 +trait A785 +trait A786 +trait A787 +trait A788 +trait A789 +trait A790 +trait A791 +trait A792 +trait A793 +trait A794 +trait A795 +trait A796 +trait A797 +trait A798 +trait A799 +trait A800 +trait A801 +trait A802 +trait A803 +trait A804 +trait A805 +trait A806 +trait A807 +trait A808 +trait A809 +trait A810 +trait A811 +trait A812 +trait A813 +trait A814 +trait A815 +trait A816 +trait A817 +trait A818 +trait A819 +trait A820 +trait A821 +trait A822 +trait A823 +trait A824 +trait A825 +trait A826 +trait A827 +trait A828 +trait A829 +trait A830 +trait A831 +trait A832 +trait A833 +trait A834 +trait A835 +trait A836 +trait A837 +trait A838 +trait A839 +trait A840 +trait A841 +trait A842 +trait A843 +trait A844 +trait A845 +trait A846 +trait A847 +trait A848 +trait A849 +trait A850 +trait A851 +trait A852 +trait A853 +trait A854 +trait A855 +trait A856 +trait A857 +trait A858 +trait A859 +trait A860 +trait A861 +trait A862 +trait A863 +trait A864 +trait A865 +trait A866 +trait A867 +trait A868 +trait A869 +trait A870 +trait A871 +trait A872 +trait A873 +trait A874 +trait A875 +trait A876 +trait A877 +trait A878 +trait A879 +trait A880 +trait A881 +trait A882 +trait A883 +trait A884 +trait A885 +trait A886 +trait A887 +trait A888 +trait A889 +trait A890 +trait A891 +trait A892 +trait A893 +trait A894 +trait A895 +trait A896 +trait A897 +trait A898 +trait A899 +trait A900 +trait A901 +trait A902 +trait A903 +trait A904 +trait A905 +trait A906 +trait A907 +trait A908 +trait A909 +trait A910 +trait A911 +trait A912 +trait A913 +trait A914 +trait A915 +trait A916 +trait A917 +trait A918 +trait A919 +trait A920 +trait A921 +trait A922 +trait A923 +trait A924 +trait A925 +trait A926 +trait A927 +trait A928 +trait A929 +trait A930 +trait A931 +trait A932 +trait A933 +trait A934 +trait A935 +trait A936 +trait A937 +trait A938 +trait A939 +trait A940 +trait A941 +trait A942 +trait A943 +trait A944 +trait A945 +trait A946 +trait A947 +trait A948 +trait A949 +trait A950 +trait A951 +trait A952 +trait A953 +trait A954 +trait A955 +trait A956 +trait A957 +trait A958 +trait A959 +trait A960 +trait A961 +trait A962 +trait A963 +trait A964 +trait A965 +trait A966 +trait A967 +trait A968 +trait A969 +trait A970 +trait A971 +trait A972 +trait A973 +trait A974 +trait A975 +trait A976 +trait A977 +trait A978 +trait A979 +trait A980 +trait A981 +trait A982 +trait A983 +trait A984 +trait A985 +trait A986 +trait A987 +trait A988 +trait A989 +trait A990 +trait A991 +trait A992 +trait A993 +trait A994 +trait A995 +trait A996 +trait A997 +trait A998 +trait A999 +trait A1000 +trait A1001 +trait A1002 +trait A1003 +trait A1004 +trait A1005 +trait A1006 +trait A1007 +trait A1008 +trait A1009 +trait A1010 +trait A1011 +trait A1012 +trait A1013 +trait A1014 +trait A1015 +trait A1016 +trait A1017 +trait A1018 +trait A1019 +trait A1020 +trait A1021 +trait A1022 +trait A1023 +trait A1024 +trait A1025 +trait A1026 +trait A1027 +trait A1028 +trait A1029 +trait A1030 +trait A1031 +trait A1032 +trait A1033 +trait A1034 +trait A1035 +trait A1036 +trait A1037 +trait A1038 +trait A1039 +trait A1040 +trait A1041 +trait A1042 +trait A1043 +trait A1044 +trait A1045 +trait A1046 +trait A1047 +trait A1048 +trait A1049 +trait A1050 +trait A1051 +trait A1052 +trait A1053 +trait A1054 +trait A1055 +trait A1056 +trait A1057 +trait A1058 +trait A1059 +trait A1060 +trait A1061 +trait A1062 +trait A1063 +trait A1064 +trait A1065 +trait A1066 +trait A1067 +trait A1068 +trait A1069 +trait A1070 +trait A1071 +trait A1072 +trait A1073 +trait A1074 +trait A1075 +trait A1076 +trait A1077 +trait A1078 +trait A1079 +trait A1080 +trait A1081 +trait A1082 +trait A1083 +trait A1084 +trait A1085 +trait A1086 +trait A1087 +trait A1088 +trait A1089 +trait A1090 +trait A1091 +trait A1092 +trait A1093 +trait A1094 +trait A1095 +trait A1096 +trait A1097 +trait A1098 +trait A1099 +trait A1100 +trait A1101 +trait A1102 +trait A1103 +trait A1104 +trait A1105 +trait A1106 +trait A1107 +trait A1108 +trait A1109 +trait A1110 +trait A1111 +trait A1112 +trait A1113 +trait A1114 +trait A1115 +trait A1116 +trait A1117 +trait A1118 +trait A1119 +trait A1120 +trait A1121 +trait A1122 +trait A1123 +trait A1124 +trait A1125 +trait A1126 +trait A1127 +trait A1128 +trait A1129 +trait A1130 +trait A1131 +trait A1132 +trait A1133 +trait A1134 +trait A1135 +trait A1136 +trait A1137 +trait A1138 +trait A1139 +trait A1140 +trait A1141 +trait A1142 +trait A1143 +trait A1144 +trait A1145 +trait A1146 +trait A1147 +trait A1148 +trait A1149 +trait A1150 +trait A1151 +trait A1152 +trait A1153 +trait A1154 +trait A1155 +trait A1156 +trait A1157 +trait A1158 +trait A1159 +trait A1160 +trait A1161 +trait A1162 +trait A1163 +trait A1164 +trait A1165 +trait A1166 +trait A1167 +trait A1168 +trait A1169 +trait A1170 +trait A1171 +trait A1172 +trait A1173 +trait A1174 +trait A1175 +trait A1176 +trait A1177 +trait A1178 +trait A1179 +trait A1180 +trait A1181 +trait A1182 +trait A1183 +trait A1184 +trait A1185 +trait A1186 +trait A1187 +trait A1188 +trait A1189 +trait A1190 +trait A1191 +trait A1192 +trait A1193 +trait A1194 +trait A1195 +trait A1196 +trait A1197 +trait A1198 +trait A1199 +trait A1200 +trait A1201 +trait A1202 +trait A1203 +trait A1204 +trait A1205 +trait A1206 +trait A1207 +trait A1208 +trait A1209 +trait A1210 +trait A1211 +trait A1212 +trait A1213 +trait A1214 +trait A1215 +trait A1216 +trait A1217 +trait A1218 +trait A1219 +trait A1220 +trait A1221 +trait A1222 +trait A1223 +trait A1224 +trait A1225 +trait A1226 +trait A1227 +trait A1228 +trait A1229 +trait A1230 +trait A1231 +trait A1232 +trait A1233 +trait A1234 +trait A1235 +trait A1236 +trait A1237 +trait A1238 +trait A1239 +trait A1240 +trait A1241 +trait A1242 +trait A1243 +trait A1244 +trait A1245 +trait A1246 +trait A1247 +trait A1248 +trait A1249 +trait A1250 +trait A1251 +trait A1252 +trait A1253 +trait A1254 +trait A1255 +trait A1256 +trait A1257 +trait A1258 +trait A1259 +trait A1260 +trait A1261 +trait A1262 +trait A1263 +trait A1264 +trait A1265 +trait A1266 +trait A1267 +trait A1268 +trait A1269 +trait A1270 +trait A1271 +trait A1272 +trait A1273 +trait A1274 +trait A1275 +trait A1276 +trait A1277 +trait A1278 +trait A1279 +trait A1280 +trait A1281 +trait A1282 +trait A1283 +trait A1284 +trait A1285 +trait A1286 +trait A1287 +trait A1288 +trait A1289 +trait A1290 +trait A1291 +trait A1292 +trait A1293 +trait A1294 +trait A1295 +trait A1296 +trait A1297 +trait A1298 +trait A1299 +trait A1300 +trait A1301 +trait A1302 +trait A1303 +trait A1304 +trait A1305 +trait A1306 +trait A1307 +trait A1308 +trait A1309 +trait A1310 +trait A1311 +trait A1312 +trait A1313 +trait A1314 +trait A1315 +trait A1316 +trait A1317 +trait A1318 +trait A1319 +trait A1320 +trait A1321 +trait A1322 +trait A1323 +trait A1324 +trait A1325 +trait A1326 +trait A1327 +trait A1328 +trait A1329 +trait A1330 +trait A1331 +trait A1332 +trait A1333 +trait A1334 +trait A1335 +trait A1336 +trait A1337 +trait A1338 +trait A1339 +trait A1340 +trait A1341 +trait A1342 +trait A1343 +trait A1344 +trait A1345 +trait A1346 +trait A1347 +trait A1348 +trait A1349 +trait A1350 +trait A1351 +trait A1352 +trait A1353 +trait A1354 +trait A1355 +trait A1356 +trait A1357 +trait A1358 +trait A1359 +trait A1360 +trait A1361 +trait A1362 +trait A1363 +trait A1364 +trait A1365 +trait A1366 +trait A1367 +trait A1368 +trait A1369 +trait A1370 +trait A1371 +trait A1372 +trait A1373 +trait A1374 +trait A1375 +trait A1376 +trait A1377 +trait A1378 +trait A1379 +trait A1380 +trait A1381 +trait A1382 +trait A1383 +trait A1384 +trait A1385 +trait A1386 +trait A1387 +trait A1388 +trait A1389 +trait A1390 +trait A1391 +trait A1392 +trait A1393 +trait A1394 +trait A1395 +trait A1396 +trait A1397 +trait A1398 +trait A1399 +trait A1400 +trait A1401 +trait A1402 +trait A1403 +trait A1404 +trait A1405 +trait A1406 +trait A1407 +trait A1408 +trait A1409 +trait A1410 +trait A1411 +trait A1412 +trait A1413 +trait A1414 +trait A1415 +trait A1416 +trait A1417 +trait A1418 +trait A1419 +trait A1420 +trait A1421 +trait A1422 +trait A1423 +trait A1424 +trait A1425 +trait A1426 +trait A1427 +trait A1428 +trait A1429 +trait A1430 +trait A1431 +trait A1432 +trait A1433 +trait A1434 +trait A1435 +trait A1436 +trait A1437 +trait A1438 +trait A1439 +trait A1440 +trait A1441 +trait A1442 +trait A1443 +trait A1444 +trait A1445 +trait A1446 +trait A1447 +trait A1448 +trait A1449 +trait A1450 +trait A1451 +trait A1452 +trait A1453 +trait A1454 +trait A1455 +trait A1456 +trait A1457 +trait A1458 +trait A1459 +trait A1460 +trait A1461 +trait A1462 +trait A1463 +trait A1464 +trait A1465 +trait A1466 +trait A1467 +trait A1468 +trait A1469 +trait A1470 +trait A1471 +trait A1472 +trait A1473 +trait A1474 +trait A1475 +trait A1476 +trait A1477 +trait A1478 +trait A1479 +trait A1480 +trait A1481 +trait A1482 +trait A1483 +trait A1484 +trait A1485 +trait A1486 +trait A1487 +trait A1488 +trait A1489 +trait A1490 +trait A1491 +trait A1492 +trait A1493 +trait A1494 +trait A1495 +trait A1496 +trait A1497 +trait A1498 +trait A1499 +trait A1500 +trait A1501 +trait A1502 +trait A1503 +trait A1504 +trait A1505 +trait A1506 +trait A1507 +trait A1508 +trait A1509 +trait A1510 +trait A1511 +trait A1512 +trait A1513 +trait A1514 +trait A1515 +trait A1516 +trait A1517 +trait A1518 +trait A1519 +trait A1520 +trait A1521 +trait A1522 +trait A1523 +trait A1524 +trait A1525 +trait A1526 +trait A1527 +trait A1528 +trait A1529 +trait A1530 +trait A1531 +trait A1532 +trait A1533 +trait A1534 +trait A1535 +trait A1536 +trait A1537 +trait A1538 +trait A1539 +trait A1540 +trait A1541 +trait A1542 +trait A1543 +trait A1544 +trait A1545 +trait A1546 +trait A1547 +trait A1548 +trait A1549 +trait A1550 +trait A1551 +trait A1552 +trait A1553 +trait A1554 +trait A1555 +trait A1556 +trait A1557 +trait A1558 +trait A1559 +trait A1560 +trait A1561 +trait A1562 +trait A1563 +trait A1564 +trait A1565 +trait A1566 +trait A1567 +trait A1568 +trait A1569 +trait A1570 +trait A1571 +trait A1572 +trait A1573 +trait A1574 +trait A1575 +trait A1576 +trait A1577 +trait A1578 +trait A1579 +trait A1580 +trait A1581 +trait A1582 +trait A1583 +trait A1584 +trait A1585 +trait A1586 +trait A1587 +trait A1588 +trait A1589 +trait A1590 +trait A1591 +trait A1592 +trait A1593 +trait A1594 +trait A1595 +trait A1596 +trait A1597 +trait A1598 +trait A1599 +trait A1600 +trait A1601 +trait A1602 +trait A1603 +trait A1604 +trait A1605 +trait A1606 +trait A1607 +trait A1608 +trait A1609 +trait A1610 +trait A1611 +trait A1612 +trait A1613 +trait A1614 +trait A1615 +trait A1616 +trait A1617 +trait A1618 +trait A1619 +trait A1620 +trait A1621 +trait A1622 +trait A1623 +trait A1624 +trait A1625 +trait A1626 +trait A1627 +trait A1628 +trait A1629 +trait A1630 +trait A1631 +trait A1632 +trait A1633 +trait A1634 +trait A1635 +trait A1636 +trait A1637 +trait A1638 +trait A1639 +trait A1640 +trait A1641 +trait A1642 +trait A1643 +trait A1644 +trait A1645 +trait A1646 +trait A1647 +trait A1648 +trait A1649 +trait A1650 +trait A1651 +trait A1652 +trait A1653 +trait A1654 +trait A1655 +trait A1656 +trait A1657 +trait A1658 +trait A1659 +trait A1660 +trait A1661 +trait A1662 +trait A1663 +trait A1664 +trait A1665 +trait A1666 +trait A1667 +trait A1668 +trait A1669 +trait A1670 +trait A1671 +trait A1672 +trait A1673 +trait A1674 +trait A1675 +trait A1676 +trait A1677 +trait A1678 +trait A1679 +trait A1680 +trait A1681 +trait A1682 +trait A1683 +trait A1684 +trait A1685 +trait A1686 +trait A1687 +trait A1688 +trait A1689 +trait A1690 +trait A1691 +trait A1692 +trait A1693 +trait A1694 +trait A1695 +trait A1696 +trait A1697 +trait A1698 +trait A1699 +trait A1700 +trait A1701 +trait A1702 +trait A1703 +trait A1704 +trait A1705 +trait A1706 +trait A1707 +trait A1708 +trait A1709 +trait A1710 +trait A1711 +trait A1712 +trait A1713 +trait A1714 +trait A1715 +trait A1716 +trait A1717 +trait A1718 +trait A1719 +trait A1720 +trait A1721 +trait A1722 +trait A1723 +trait A1724 +trait A1725 +trait A1726 +trait A1727 +trait A1728 +trait A1729 +trait A1730 +trait A1731 +trait A1732 +trait A1733 +trait A1734 +trait A1735 +trait A1736 +trait A1737 +trait A1738 +trait A1739 +trait A1740 +trait A1741 +trait A1742 +trait A1743 +trait A1744 +trait A1745 +trait A1746 +trait A1747 +trait A1748 +trait A1749 +trait A1750 +trait A1751 +trait A1752 +trait A1753 +trait A1754 +trait A1755 +trait A1756 +trait A1757 +trait A1758 +trait A1759 +trait A1760 +trait A1761 +trait A1762 +trait A1763 +trait A1764 +trait A1765 +trait A1766 +trait A1767 +trait A1768 +trait A1769 +trait A1770 +trait A1771 +trait A1772 +trait A1773 +trait A1774 +trait A1775 +trait A1776 +trait A1777 +trait A1778 +trait A1779 +trait A1780 +trait A1781 +trait A1782 +trait A1783 +trait A1784 +trait A1785 +trait A1786 +trait A1787 +trait A1788 +trait A1789 +trait A1790 +trait A1791 +trait A1792 +trait A1793 +trait A1794 +trait A1795 +trait A1796 +trait A1797 +trait A1798 +trait A1799 +trait A1800 +trait A1801 +trait A1802 +trait A1803 +trait A1804 +trait A1805 +trait A1806 +trait A1807 +trait A1808 +trait A1809 +trait A1810 +trait A1811 +trait A1812 +trait A1813 +trait A1814 +trait A1815 +trait A1816 +trait A1817 +trait A1818 +trait A1819 +trait A1820 +trait A1821 +trait A1822 +trait A1823 +trait A1824 +trait A1825 +trait A1826 +trait A1827 +trait A1828 +trait A1829 +trait A1830 +trait A1831 +trait A1832 +trait A1833 +trait A1834 +trait A1835 +trait A1836 +trait A1837 +trait A1838 +trait A1839 +trait A1840 +trait A1841 +trait A1842 +trait A1843 +trait A1844 +trait A1845 +trait A1846 +trait A1847 +trait A1848 +trait A1849 +trait A1850 +trait A1851 +trait A1852 +trait A1853 +trait A1854 +trait A1855 +trait A1856 +trait A1857 +trait A1858 +trait A1859 +trait A1860 +trait A1861 +trait A1862 +trait A1863 +trait A1864 +trait A1865 +trait A1866 +trait A1867 +trait A1868 +trait A1869 +trait A1870 +trait A1871 +trait A1872 +trait A1873 +trait A1874 +trait A1875 +trait A1876 +trait A1877 +trait A1878 +trait A1879 +trait A1880 +trait A1881 +trait A1882 +trait A1883 +trait A1884 +trait A1885 +trait A1886 +trait A1887 +trait A1888 +trait A1889 +trait A1890 +trait A1891 +trait A1892 +trait A1893 +trait A1894 +trait A1895 +trait A1896 +trait A1897 +trait A1898 +trait A1899 +trait A1900 +trait A1901 +trait A1902 +trait A1903 +trait A1904 +trait A1905 +trait A1906 +trait A1907 +trait A1908 +trait A1909 +trait A1910 +trait A1911 +trait A1912 +trait A1913 +trait A1914 +trait A1915 +trait A1916 +trait A1917 +trait A1918 +trait A1919 +trait A1920 +trait A1921 +trait A1922 +trait A1923 +trait A1924 +trait A1925 +trait A1926 +trait A1927 +trait A1928 +trait A1929 +trait A1930 +trait A1931 +trait A1932 +trait A1933 +trait A1934 +trait A1935 +trait A1936 +trait A1937 +trait A1938 +trait A1939 +trait A1940 +trait A1941 +trait A1942 +trait A1943 +trait A1944 +trait A1945 +trait A1946 +trait A1947 +trait A1948 +trait A1949 +trait A1950 +trait A1951 +trait A1952 +trait A1953 +trait A1954 +trait A1955 +trait A1956 +trait A1957 +trait A1958 +trait A1959 +trait A1960 +trait A1961 +trait A1962 +trait A1963 +trait A1964 +trait A1965 +trait A1966 +trait A1967 +trait A1968 +trait A1969 +trait A1970 +trait A1971 +trait A1972 +trait A1973 +trait A1974 +trait A1975 +trait A1976 +trait A1977 +trait A1978 +trait A1979 +trait A1980 +trait A1981 +trait A1982 +trait A1983 +trait A1984 +trait A1985 +trait A1986 +trait A1987 +trait A1988 +trait A1989 +trait A1990 +trait A1991 +trait A1992 +trait A1993 +trait A1994 +trait A1995 +trait A1996 +trait A1997 +trait A1998 +trait A1999 +trait A2000 +trait A2001 +trait A2002 +trait A2003 +trait A2004 +trait A2005 +trait A2006 +trait A2007 +trait A2008 +trait A2009 +trait A2010 +trait A2011 +trait A2012 +trait A2013 +trait A2014 +trait A2015 +trait A2016 +trait A2017 +trait A2018 +trait A2019 +trait A2020 +trait A2021 +trait A2022 +trait A2023 +trait A2024 +trait A2025 +trait A2026 +trait A2027 +trait A2028 +trait A2029 +trait A2030 +trait A2031 +trait A2032 +trait A2033 +trait A2034 +trait A2035 +trait A2036 +trait A2037 +trait A2038 +trait A2039 +trait A2040 +trait A2041 +trait A2042 +trait A2043 +trait A2044 +trait A2045 +trait A2046 +trait A2047 +trait A2048 +trait A2049 +trait A2050 +trait A2051 +trait A2052 +trait A2053 +trait A2054 +trait A2055 +trait A2056 +trait A2057 +trait A2058 +trait A2059 +trait A2060 +trait A2061 +trait A2062 +trait A2063 +trait A2064 +trait A2065 +trait A2066 +trait A2067 +trait A2068 +trait A2069 +trait A2070 +trait A2071 +trait A2072 +trait A2073 +trait A2074 +trait A2075 +trait A2076 +trait A2077 +trait A2078 +trait A2079 +trait A2080 +trait A2081 +trait A2082 +trait A2083 +trait A2084 +trait A2085 +trait A2086 +trait A2087 +trait A2088 +trait A2089 +trait A2090 +trait A2091 +trait A2092 +trait A2093 +trait A2094 +trait A2095 +trait A2096 +trait A2097 +trait A2098 +trait A2099 +trait A2100 +trait A2101 +trait A2102 +trait A2103 +trait A2104 +trait A2105 +trait A2106 +trait A2107 +trait A2108 +trait A2109 +trait A2110 +trait A2111 +trait A2112 +trait A2113 +trait A2114 +trait A2115 +trait A2116 +trait A2117 +trait A2118 +trait A2119 +trait A2120 +trait A2121 +trait A2122 +trait A2123 +trait A2124 +trait A2125 +trait A2126 +trait A2127 +trait A2128 +trait A2129 +trait A2130 +trait A2131 +trait A2132 +trait A2133 +trait A2134 +trait A2135 +trait A2136 +trait A2137 +trait A2138 +trait A2139 +trait A2140 +trait A2141 +trait A2142 +trait A2143 +trait A2144 +trait A2145 +trait A2146 +trait A2147 +trait A2148 +trait A2149 +trait A2150 +trait A2151 +trait A2152 +trait A2153 +trait A2154 +trait A2155 +trait A2156 +trait A2157 +trait A2158 +trait A2159 +trait A2160 +trait A2161 +trait A2162 +trait A2163 +trait A2164 +trait A2165 +trait A2166 +trait A2167 +trait A2168 +trait A2169 +trait A2170 +trait A2171 +trait A2172 +trait A2173 +trait A2174 +trait A2175 +trait A2176 +trait A2177 +trait A2178 +trait A2179 +trait A2180 +trait A2181 +trait A2182 +trait A2183 +trait A2184 +trait A2185 +trait A2186 +trait A2187 +trait A2188 +trait A2189 +trait A2190 +trait A2191 +trait A2192 +trait A2193 +trait A2194 +trait A2195 +trait A2196 +trait A2197 +trait A2198 +trait A2199 +trait A2200 +trait A2201 +trait A2202 +trait A2203 +trait A2204 +trait A2205 +trait A2206 +trait A2207 +trait A2208 +trait A2209 +trait A2210 +trait A2211 +trait A2212 +trait A2213 +trait A2214 +trait A2215 +trait A2216 +trait A2217 +trait A2218 +trait A2219 +trait A2220 +trait A2221 +trait A2222 +trait A2223 +trait A2224 +trait A2225 +trait A2226 +trait A2227 +trait A2228 +trait A2229 +trait A2230 +trait A2231 +trait A2232 +trait A2233 +trait A2234 +trait A2235 +trait A2236 +trait A2237 +trait A2238 +trait A2239 +trait A2240 +trait A2241 +trait A2242 +trait A2243 +trait A2244 +trait A2245 +trait A2246 +trait A2247 +trait A2248 +trait A2249 +trait A2250 +trait A2251 +trait A2252 +trait A2253 +trait A2254 +trait A2255 +trait A2256 +trait A2257 +trait A2258 +trait A2259 +trait A2260 +trait A2261 +trait A2262 +trait A2263 +trait A2264 +trait A2265 +trait A2266 +trait A2267 +trait A2268 +trait A2269 +trait A2270 +trait A2271 +trait A2272 +trait A2273 +trait A2274 +trait A2275 +trait A2276 +trait A2277 +trait A2278 +trait A2279 +trait A2280 +trait A2281 +trait A2282 +trait A2283 +trait A2284 +trait A2285 +trait A2286 +trait A2287 +trait A2288 +trait A2289 +trait A2290 +trait A2291 +trait A2292 +trait A2293 +trait A2294 +trait A2295 +trait A2296 +trait A2297 +trait A2298 +trait A2299 +trait A2300 +trait A2301 +trait A2302 +trait A2303 +trait A2304 +trait A2305 +trait A2306 +trait A2307 +trait A2308 +trait A2309 +trait A2310 +trait A2311 +trait A2312 +trait A2313 +trait A2314 +trait A2315 +trait A2316 +trait A2317 +trait A2318 +trait A2319 +trait A2320 +trait A2321 +trait A2322 +trait A2323 +trait A2324 +trait A2325 +trait A2326 +trait A2327 +trait A2328 +trait A2329 +trait A2330 +trait A2331 +trait A2332 +trait A2333 +trait A2334 +trait A2335 +trait A2336 +trait A2337 +trait A2338 +trait A2339 +trait A2340 +trait A2341 +trait A2342 +trait A2343 +trait A2344 +trait A2345 +trait A2346 +trait A2347 +trait A2348 +trait A2349 +trait A2350 +trait A2351 +trait A2352 +trait A2353 +trait A2354 +trait A2355 +trait A2356 +trait A2357 +trait A2358 +trait A2359 +trait A2360 +trait A2361 +trait A2362 +trait A2363 +trait A2364 +trait A2365 +trait A2366 +trait A2367 +trait A2368 +trait A2369 +trait A2370 +trait A2371 +trait A2372 +trait A2373 +trait A2374 +trait A2375 +trait A2376 +trait A2377 +trait A2378 +trait A2379 +trait A2380 +trait A2381 +trait A2382 +trait A2383 +trait A2384 +trait A2385 +trait A2386 +trait A2387 +trait A2388 +trait A2389 +trait A2390 +trait A2391 +trait A2392 +trait A2393 +trait A2394 +trait A2395 +trait A2396 +trait A2397 +trait A2398 +trait A2399 +trait A2400 +trait A2401 +trait A2402 +trait A2403 +trait A2404 +trait A2405 +trait A2406 +trait A2407 +trait A2408 +trait A2409 +trait A2410 +trait A2411 +trait A2412 +trait A2413 +trait A2414 +trait A2415 +trait A2416 +trait A2417 +trait A2418 +trait A2419 +trait A2420 +trait A2421 +trait A2422 +trait A2423 +trait A2424 +trait A2425 +trait A2426 +trait A2427 +trait A2428 +trait A2429 +trait A2430 +trait A2431 +trait A2432 +trait A2433 +trait A2434 +trait A2435 +trait A2436 +trait A2437 +trait A2438 +trait A2439 +trait A2440 +trait A2441 +trait A2442 +trait A2443 +trait A2444 +trait A2445 +trait A2446 +trait A2447 +trait A2448 +trait A2449 +trait A2450 +trait A2451 +trait A2452 +trait A2453 +trait A2454 +trait A2455 +trait A2456 +trait A2457 +trait A2458 +trait A2459 +trait A2460 +trait A2461 +trait A2462 +trait A2463 +trait A2464 +trait A2465 +trait A2466 +trait A2467 +trait A2468 +trait A2469 +trait A2470 +trait A2471 +trait A2472 +trait A2473 +trait A2474 +trait A2475 +trait A2476 +trait A2477 +trait A2478 +trait A2479 +trait A2480 +trait A2481 +trait A2482 +trait A2483 +trait A2484 +trait A2485 +trait A2486 +trait A2487 +trait A2488 +trait A2489 +trait A2490 +trait A2491 +trait A2492 +trait A2493 +trait A2494 +trait A2495 +trait A2496 +trait A2497 +trait A2498 +trait A2499 +trait A2500 +trait A2501 +trait A2502 +trait A2503 +trait A2504 +trait A2505 +trait A2506 +trait A2507 +trait A2508 +trait A2509 +trait A2510 +trait A2511 +trait A2512 +trait A2513 +trait A2514 +trait A2515 +trait A2516 +trait A2517 +trait A2518 +trait A2519 +trait A2520 +trait A2521 +trait A2522 +trait A2523 +trait A2524 +trait A2525 +trait A2526 +trait A2527 +trait A2528 +trait A2529 +trait A2530 +trait A2531 +trait A2532 +trait A2533 +trait A2534 +trait A2535 +trait A2536 +trait A2537 +trait A2538 +trait A2539 +trait A2540 +trait A2541 +trait A2542 +trait A2543 +trait A2544 +trait A2545 +trait A2546 +trait A2547 +trait A2548 +trait A2549 +trait A2550 +trait A2551 +trait A2552 +trait A2553 +trait A2554 +trait A2555 +trait A2556 +trait A2557 +trait A2558 +trait A2559 +trait A2560 +trait A2561 +trait A2562 +trait A2563 +trait A2564 +trait A2565 +trait A2566 +trait A2567 +trait A2568 +trait A2569 +trait A2570 +trait A2571 +trait A2572 +trait A2573 +trait A2574 +trait A2575 +trait A2576 +trait A2577 +trait A2578 +trait A2579 +trait A2580 +trait A2581 +trait A2582 +trait A2583 +trait A2584 +trait A2585 +trait A2586 +trait A2587 +trait A2588 +trait A2589 +trait A2590 +trait A2591 +trait A2592 +trait A2593 +trait A2594 +trait A2595 +trait A2596 +trait A2597 +trait A2598 +trait A2599 +trait A2600 +trait A2601 +trait A2602 +trait A2603 +trait A2604 +trait A2605 +trait A2606 +trait A2607 +trait A2608 +trait A2609 +trait A2610 +trait A2611 +trait A2612 +trait A2613 +trait A2614 +trait A2615 +trait A2616 +trait A2617 +trait A2618 +trait A2619 +trait A2620 +trait A2621 +trait A2622 +trait A2623 +trait A2624 +trait A2625 +trait A2626 +trait A2627 +trait A2628 +trait A2629 +trait A2630 +trait A2631 +trait A2632 +trait A2633 +trait A2634 +trait A2635 +trait A2636 +trait A2637 +trait A2638 +trait A2639 +trait A2640 +trait A2641 +trait A2642 +trait A2643 +trait A2644 +trait A2645 +trait A2646 +trait A2647 +trait A2648 +trait A2649 +trait A2650 +trait A2651 +trait A2652 +trait A2653 +trait A2654 +trait A2655 +trait A2656 +trait A2657 +trait A2658 +trait A2659 +trait A2660 +trait A2661 +trait A2662 +trait A2663 +trait A2664 +trait A2665 +trait A2666 +trait A2667 +trait A2668 +trait A2669 +trait A2670 +trait A2671 +trait A2672 +trait A2673 +trait A2674 +trait A2675 +trait A2676 +trait A2677 +trait A2678 +trait A2679 +trait A2680 +trait A2681 +trait A2682 +trait A2683 +trait A2684 +trait A2685 +trait A2686 +trait A2687 +trait A2688 +trait A2689 +trait A2690 +trait A2691 +trait A2692 +trait A2693 +trait A2694 +trait A2695 +trait A2696 +trait A2697 +trait A2698 +trait A2699 +trait A2700 +trait A2701 +trait A2702 +trait A2703 +trait A2704 +trait A2705 +trait A2706 +trait A2707 +trait A2708 +trait A2709 +trait A2710 +trait A2711 +trait A2712 +trait A2713 +trait A2714 +trait A2715 +trait A2716 +trait A2717 +trait A2718 +trait A2719 +trait A2720 +trait A2721 +trait A2722 +trait A2723 +trait A2724 +trait A2725 +trait A2726 +trait A2727 +trait A2728 +trait A2729 +trait A2730 +trait A2731 +trait A2732 +trait A2733 +trait A2734 +trait A2735 +trait A2736 +trait A2737 +trait A2738 +trait A2739 +trait A2740 +trait A2741 +trait A2742 +trait A2743 +trait A2744 +trait A2745 +trait A2746 +trait A2747 +trait A2748 +trait A2749 +trait A2750 +trait A2751 +trait A2752 +trait A2753 +trait A2754 +trait A2755 +trait A2756 +trait A2757 +trait A2758 +trait A2759 +trait A2760 +trait A2761 +trait A2762 +trait A2763 +trait A2764 +trait A2765 +trait A2766 +trait A2767 +trait A2768 +trait A2769 +trait A2770 +trait A2771 +trait A2772 +trait A2773 +trait A2774 +trait A2775 +trait A2776 +trait A2777 +trait A2778 +trait A2779 +trait A2780 +trait A2781 +trait A2782 +trait A2783 +trait A2784 +trait A2785 +trait A2786 +trait A2787 +trait A2788 +trait A2789 +trait A2790 +trait A2791 +trait A2792 +trait A2793 +trait A2794 +trait A2795 +trait A2796 +trait A2797 +trait A2798 +trait A2799 +trait A2800 +trait A2801 +trait A2802 +trait A2803 +trait A2804 +trait A2805 +trait A2806 +trait A2807 +trait A2808 +trait A2809 +trait A2810 +trait A2811 +trait A2812 +trait A2813 +trait A2814 +trait A2815 +trait A2816 +trait A2817 +trait A2818 +trait A2819 +trait A2820 +trait A2821 +trait A2822 +trait A2823 +trait A2824 +trait A2825 +trait A2826 +trait A2827 +trait A2828 +trait A2829 +trait A2830 +trait A2831 +trait A2832 +trait A2833 +trait A2834 +trait A2835 +trait A2836 +trait A2837 +trait A2838 +trait A2839 +trait A2840 +trait A2841 +trait A2842 +trait A2843 +trait A2844 +trait A2845 +trait A2846 +trait A2847 +trait A2848 +trait A2849 +trait A2850 +trait A2851 +trait A2852 +trait A2853 +trait A2854 +trait A2855 +trait A2856 +trait A2857 +trait A2858 +trait A2859 +trait A2860 +trait A2861 +trait A2862 +trait A2863 +trait A2864 +trait A2865 +trait A2866 +trait A2867 +trait A2868 +trait A2869 +trait A2870 +trait A2871 +trait A2872 +trait A2873 +trait A2874 +trait A2875 +trait A2876 +trait A2877 +trait A2878 +trait A2879 +trait A2880 +trait A2881 +trait A2882 +trait A2883 +trait A2884 +trait A2885 +trait A2886 +trait A2887 +trait A2888 +trait A2889 +trait A2890 +trait A2891 +trait A2892 +trait A2893 +trait A2894 +trait A2895 +trait A2896 +trait A2897 +trait A2898 +trait A2899 +trait A2900 +trait A2901 +trait A2902 +trait A2903 +trait A2904 +trait A2905 +trait A2906 +trait A2907 +trait A2908 +trait A2909 +trait A2910 +trait A2911 +trait A2912 +trait A2913 +trait A2914 +trait A2915 +trait A2916 +trait A2917 +trait A2918 +trait A2919 +trait A2920 +trait A2921 +trait A2922 +trait A2923 +trait A2924 +trait A2925 +trait A2926 +trait A2927 +trait A2928 +trait A2929 +trait A2930 +trait A2931 +trait A2932 +trait A2933 +trait A2934 +trait A2935 +trait A2936 +trait A2937 +trait A2938 +trait A2939 +trait A2940 +trait A2941 +trait A2942 +trait A2943 +trait A2944 +trait A2945 +trait A2946 +trait A2947 +trait A2948 +trait A2949 +trait A2950 +trait A2951 +trait A2952 +trait A2953 +trait A2954 +trait A2955 +trait A2956 +trait A2957 +trait A2958 +trait A2959 +trait A2960 +trait A2961 +trait A2962 +trait A2963 +trait A2964 +trait A2965 +trait A2966 +trait A2967 +trait A2968 +trait A2969 +trait A2970 +trait A2971 +trait A2972 +trait A2973 +trait A2974 +trait A2975 +trait A2976 +trait A2977 +trait A2978 +trait A2979 +trait A2980 +trait A2981 +trait A2982 +trait A2983 +trait A2984 +trait A2985 +trait A2986 +trait A2987 +trait A2988 +trait A2989 +trait A2990 +trait A2991 +trait A2992 +trait A2993 +trait A2994 +trait A2995 +trait A2996 +trait A2997 +trait A2998 +trait A2999 +trait A3000 +} +object Test extends App { + new Foo1{} +} diff --git a/test/files/jvm/try-type-tests.scala b/test/files/jvm/try-type-tests.scala index eecbb0ae57..17811f64c5 100644 --- a/test/files/jvm/try-type-tests.scala +++ b/test/files/jvm/try-type-tests.scala @@ -59,12 +59,12 @@ trait TryStandard { def testRescueSuccess(): Unit = { val t = Success(1) - t.rescue{ case x => assert(false); Try() } + t.recoverWith{ case x => assert(false); Try() } } def testRescueFailure(): Unit = { val t = Failure(new Exception("foo")) - val n = t.rescue{ case x => Try(1) } + val n = t.recoverWith{ case x => Try(1) } assert(n.get == 1) } @@ -103,6 +103,20 @@ trait TryStandard { } } + def testSuccessTransform(): Unit = { + val s = Success(1) + val succ = (x: Int) => Success(x * 10) + val fail = (x: Throwable) => Success(0) + assert(s.transform(succ, fail).get == 10) + } + + def testFailureTransform(): Unit = { + val f = Failure(new Exception("foo")) + val succ = (x: Int) => Success(x * 10) + val fail = (x: Throwable) => Success(0) + assert(f.transform(succ, fail).get == 0) + } + testForeachSuccess() testForeachFailure() testFlatMapSuccess() @@ -119,132 +133,12 @@ trait TryStandard { testFlattenSuccess() testFailedSuccess() testFailedFailure() -} - -// tests that implicit conversions from Try to Either behave as expected -trait TryImplicitConversionTry2Either { - - def testTry2RightMap(): Unit = { - val t = Success(1) - val n = t.right.map(x => x * 100) - assert(n == Right(100)) - } - - def testTry2LeftMap(): Unit = { - val e = new Exception("foo") - val t = Failure(e) - val n = t.left.map(x => x) - assert(n == Left(e)) - } - - def testTry2FoldSuccess(): Unit = { - val t = Success(1) - val n = t.fold(x => assert(false), y => y * 200) - assert(n == 200) - } - - def testTry2FoldFailure(): Unit = { - val e = new Exception("foo") - val t = Failure(e) - val n = t.fold(x => x, y => assert(false)) - assert(n == e) - } - - def testTry2SwapSuccess(): Unit = { - val t = Success(1) - val n = t.swap - assert(n == Left(1)) - } - - def testTry2SwapFailure(): Unit = { - val e = new Exception("foo") - val t = Failure(e) - val n = t.swap - assert(n == Right(e)) - } - - // def testTry2MergeSucccess(): Unit = { - // val t: Try[Int] = Success(1) - // val n = (t: Either[Any, Any]).t.merge // connecting two implicit conversions - // assert(n == 1) - // } - - // def testTry2MergeFailure(): Unit = { - // val e = new Exception("foo") - // val t = Failure(e) - // val n = (t: Either[Any, Any]).merge // connecting two implicit conversions - // assert(n == e) - // } - - testTry2RightMap() - testTry2LeftMap() - testTry2FoldSuccess() - testTry2FoldFailure() - testTry2SwapSuccess() - testTry2SwapFailure() - // testTry2MergeSucccess() - // testTry2MergeFailure() -} - -// tests that implicit conversions from Either to Try behave as expected -trait TryImplicitConversionEither2Try { - - def testRight2FilterSuccessTrue(): Unit = { - def expectsTry[U <% Try[Int]](rght: U): Try[Int] = { - val n = rght.filter(x => x > 0) // this should be converted to a Try - n - } - val r = Right(1) - val n = expectsTry(r) - assert(n == Success(1)) - } - - def testRight2FilterSuccessFalse(): Unit = { - def expectsTry[U <% Try[Int]](rght: U): Try[Int] = { - val n = rght.filter(x => x < 0) // this should be converted to a Try - n - } - val r = Right(1) - val n = expectsTry(r) - n match { - case Failure(e: NoSuchElementException) => assert(true) - case _ => assert(false) - } - } - - def testLeft2FilterFailure(): Unit = { - def expectsTry[U <% Try[Int]](rght: U): Try[Int] = { - val n = rght.filter(x => x > 0) // this should be converted to a Try - n - } - val r = Left(new Exception("foo")) - val n = expectsTry(r) - n match { - case Failure(e: Exception) => assert(true) - case _ => assert(false) - } - } - - def testRight2GetSuccess(): Unit = { - def expectsTry[U <% Try[Int]](rght: U): Int = { - val n = rght.get // this should be converted to a Try - n - } - val r = Right(1) - val n = expectsTry(r) - assert(n == 1) - } - - testRight2FilterSuccessTrue() - testRight2FilterSuccessFalse() - testLeft2FilterFailure() - testRight2GetSuccess() + testSuccessTransform() + testFailureTransform() } object Test extends App -with TryStandard -with TryImplicitConversionTry2Either -with TryImplicitConversionEither2Try { +with TryStandard { System.exit(0) }
\ No newline at end of file diff --git a/test/files/neg/macro-basic-mamdmi.check b/test/files/neg/macro-basic-mamdmi.check index eef444f7b3..67b00c0ec5 100644 --- a/test/files/neg/macro-basic-mamdmi.check +++ b/test/files/neg/macro-basic-mamdmi.check @@ -1,5 +1,4 @@ Impls_Macros_Test_1.scala:36: error: macro implementation not found: foo (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
-if you do need to define macro implementations along with the rest of your program, consider two-phase compilation with -Xmacro-fallback-classpath in the second phase pointing to the output of the first phase
println(foo(2) + Macros.bar(2) * new Macros().quux(4))
^
one error found
diff --git a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala index 8abde907bb..908438cf65 100644 --- a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala +++ b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { diff --git a/test/files/neg/macro-cyclic/Impls_Macros_1.scala b/test/files/neg/macro-cyclic/Impls_Macros_1.scala index 2ecdc3416e..ac9b7938db 100644 --- a/test/files/neg/macro-cyclic/Impls_Macros_1.scala +++ b/test/files/neg/macro-cyclic/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Macros { def impl(c: Context) = { diff --git a/test/files/neg/macro-invalidimpl-a/Impls_1.scala b/test/files/neg/macro-invalidimpl-a/Impls_1.scala index c2f1843b8b..cfa1218038 100644 --- a/test/files/neg/macro-invalidimpl-a/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-a/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} class Impls { def foo(c: Ctx)(x: c.Expr[Any]) = ??? diff --git a/test/files/neg/macro-invalidimpl-b/Impls_1.scala b/test/files/neg/macro-invalidimpl-b/Impls_1.scala index 7b1620d117..4467021545 100644 --- a/test/files/neg/macro-invalidimpl-b/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-b/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Any]) = ??? diff --git a/test/files/neg/macro-invalidimpl-c/Impls_Macros_1.scala b/test/files/neg/macro-invalidimpl-c/Impls_Macros_1.scala index 657e2d4260..67a0eb348b 100644 --- a/test/files/neg/macro-invalidimpl-c/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidimpl-c/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} class Macros { object Impls { diff --git a/test/files/neg/macro-invalidimpl-d/Impls_1.scala b/test/files/neg/macro-invalidimpl-d/Impls_1.scala index f18e699a1e..e0819c938c 100644 --- a/test/files/neg/macro-invalidimpl-d/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-d/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} trait MacroHelpers { object Impls { diff --git a/test/files/neg/macro-invalidimpl-e.check b/test/files/neg/macro-invalidimpl-e.check index 61d1e05b87..5cfcf85625 100644 --- a/test/files/neg/macro-invalidimpl-e.check +++ b/test/files/neg/macro-invalidimpl-e.check @@ -1,12 +1,12 @@ Macros_Test_2.scala:2: error: ambiguous reference to overloaded definition,
-both method foo in object Impls of type (c: scala.reflect.makro.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing
-and method foo in object Impls of type (c: scala.reflect.makro.Context)(x: c.Expr[Any])Nothing
+both method foo in object Impls of type (c: scala.reflect.macros.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing
+and method foo in object Impls of type (c: scala.reflect.macros.Context)(x: c.Expr[Any])Nothing
match expected type ?
def foo(x: Any) = macro Impls.foo
^
Macros_Test_2.scala:3: error: ambiguous reference to overloaded definition,
-both method foo in object Impls of type (c: scala.reflect.makro.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing
-and method foo in object Impls of type (c: scala.reflect.makro.Context)(x: c.Expr[Any])Nothing
+both method foo in object Impls of type (c: scala.reflect.macros.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing
+and method foo in object Impls of type (c: scala.reflect.macros.Context)(x: c.Expr[Any])Nothing
match expected type ?
def foo(x: Any, y: Any) = macro Impls.foo
^
diff --git a/test/files/neg/macro-invalidimpl-e/Impls_1.scala b/test/files/neg/macro-invalidimpl-e/Impls_1.scala index ad3eed5cd5..fd40119c31 100644 --- a/test/files/neg/macro-invalidimpl-e/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-e/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Any]) = ??? diff --git a/test/files/neg/macro-invalidimpl-f.check b/test/files/neg/macro-invalidimpl-f.check index ec82faa58c..14f1e25287 100644 --- a/test/files/neg/macro-invalidimpl-f.check +++ b/test/files/neg/macro-invalidimpl-f.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape: - required: (c: scala.reflect.makro.Context)(): c.Expr[Unit] - found : (c: scala.reflect.makro.Context): c.Expr[Unit] -number of parameter sections differ - def bar1() = macro Impls.fooNullary - ^ -one error found +Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.macros.Context)(): c.Expr[Unit]
+ found : (c: scala.reflect.macros.Context): c.Expr[Unit]
+number of parameter sections differ
+ def bar1() = macro Impls.fooNullary
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidimpl-f/Impls_1.scala b/test/files/neg/macro-invalidimpl-f/Impls_1.scala index 3b8f15b90c..334ee714be 100644 --- a/test/files/neg/macro-invalidimpl-f/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-f/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def fooNullary(c: Ctx) = { diff --git a/test/files/neg/macro-invalidimpl-g.check b/test/files/neg/macro-invalidimpl-g.check index 9c01f01dc8..a886436d35 100644 --- a/test/files/neg/macro-invalidimpl-g.check +++ b/test/files/neg/macro-invalidimpl-g.check @@ -1,6 +1,6 @@ Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.makro.Context): c.Expr[Unit]
- found : (c: scala.reflect.makro.Context)(): c.Expr[Unit]
+ required: (c: scala.reflect.macros.Context): c.Expr[Unit]
+ found : (c: scala.reflect.macros.Context)(): c.Expr[Unit]
number of parameter sections differ
def foo1 = macro Impls.fooEmpty
^
diff --git a/test/files/neg/macro-invalidimpl-g/Impls_1.scala b/test/files/neg/macro-invalidimpl-g/Impls_1.scala index 3b8f15b90c..334ee714be 100644 --- a/test/files/neg/macro-invalidimpl-g/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-g/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def fooNullary(c: Ctx) = { diff --git a/test/files/neg/macro-invalidimpl-h/Impls_1.scala b/test/files/neg/macro-invalidimpl-h/Impls_1.scala index 7db8bcd324..427fd3d5c0 100644 --- a/test/files/neg/macro-invalidimpl-h/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-h/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo[U <: Int](c: Ctx) = ??? diff --git a/test/files/neg/macro-invalidret-nontree.check b/test/files/neg/macro-invalidret-nontree.check index 0b793cf421..78ab08df3e 100644 --- a/test/files/neg/macro-invalidret-nontree.check +++ b/test/files/neg/macro-invalidret-nontree.check @@ -1,6 +1,6 @@ Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.makro.Context): c.Expr[Any]
- found : (c: scala.reflect.makro.Context): Int
+ required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ found : (c: scala.reflect.macros.Context): Int
type mismatch for return type: Int does not conform to c.Expr[Any]
def foo = macro Impls.foo
^
diff --git a/test/files/neg/macro-invalidret-nontree/Impls_1.scala b/test/files/neg/macro-invalidret-nontree/Impls_1.scala index efc8d4bfec..ef19b1b405 100644 --- a/test/files/neg/macro-invalidret-nontree/Impls_1.scala +++ b/test/files/neg/macro-invalidret-nontree/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = 2 diff --git a/test/files/neg/macro-invalidret-nonuniversetree.check b/test/files/neg/macro-invalidret-nonuniversetree.check index 1b9487982f..09df2c0a92 100644 --- a/test/files/neg/macro-invalidret-nonuniversetree.check +++ b/test/files/neg/macro-invalidret-nonuniversetree.check @@ -1,6 +1,6 @@ Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.makro.Context): c.Expr[Any]
- found : (c: scala.reflect.makro.Context): reflect.basis.Literal
+ 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]
def foo = macro Impls.foo
^
diff --git a/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala b/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala index da0eb0ac83..8311d474c2 100644 --- a/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala +++ b/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = scala.reflect.basis.Literal(scala.reflect.basis.Constant(42)) diff --git a/test/files/neg/macro-invalidshape-a/Impls_1.scala b/test/files/neg/macro-invalidshape-a/Impls_1.scala index 7b1620d117..4467021545 100644 --- a/test/files/neg/macro-invalidshape-a/Impls_1.scala +++ b/test/files/neg/macro-invalidshape-a/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Any]) = ??? diff --git a/test/files/neg/macro-invalidshape-b/Impls_1.scala b/test/files/neg/macro-invalidshape-b/Impls_1.scala index 7b1620d117..4467021545 100644 --- a/test/files/neg/macro-invalidshape-b/Impls_1.scala +++ b/test/files/neg/macro-invalidshape-b/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Any]) = ??? diff --git a/test/files/neg/macro-invalidshape-c/Impls_1.scala b/test/files/neg/macro-invalidshape-c/Impls_1.scala index 7b1620d117..4467021545 100644 --- a/test/files/neg/macro-invalidshape-c/Impls_1.scala +++ b/test/files/neg/macro-invalidshape-c/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Any]) = ??? diff --git a/test/files/neg/macro-invalidshape-d/Impls_1.scala b/test/files/neg/macro-invalidshape-d/Impls_1.scala index 7b1620d117..4467021545 100644 --- a/test/files/neg/macro-invalidshape-d/Impls_1.scala +++ b/test/files/neg/macro-invalidshape-d/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Any]) = ??? diff --git a/test/files/neg/macro-invalidsig-context-bounds.check b/test/files/neg/macro-invalidsig-context-bounds.check index b2ce4b1caa..894eabc442 100644 --- a/test/files/neg/macro-invalidsig-context-bounds.check +++ b/test/files/neg/macro-invalidsig-context-bounds.check @@ -1,4 +1,4 @@ -Impls_1.scala:5: error: macro implementations cannot have implicit parameters other than TypeTag evidences
- def foo[U: c.TypeTag: Numeric](c: Ctx) = {
+Impls_1.scala:5: error: macro implementations cannot have implicit parameters other than AbsTypeTag evidences
+ def foo[U: c.AbsTypeTag: Numeric](c: Ctx) = {
^
one error found
diff --git a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala index 2eef7aac8b..5aa9a7eaf9 100644 --- a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala @@ -1,8 +1,8 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.TypeTag: Numeric](c: Ctx) = { + def foo[U: c.AbsTypeTag: Numeric](c: Ctx) = { import c.universe._ Literal(Constant(42)) } diff --git a/test/files/neg/macro-invalidsig-ctx-badargc.check b/test/files/neg/macro-invalidsig-ctx-badargc.check index 1e1621ab61..8a1ca6a8b1 100644 --- a/test/files/neg/macro-invalidsig-ctx-badargc.check +++ b/test/files/neg/macro-invalidsig-ctx-badargc.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape: - required: (c: scala.reflect.makro.Context): c.Expr[Any] - found : : Nothing -number of parameter sections differ - def foo = macro Impls.foo - ^ -one error found +Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ found : : Nothing
+number of parameter sections differ
+ def foo = macro Impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-ctx-badtype.check b/test/files/neg/macro-invalidsig-ctx-badtype.check index b1702bbca6..9e57ab8631 100644 --- a/test/files/neg/macro-invalidsig-ctx-badtype.check +++ b/test/files/neg/macro-invalidsig-ctx-badtype.check @@ -1,7 +1,7 @@ Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.makro.Context): c.Expr[Any]
+ required: (c: scala.reflect.macros.Context): c.Expr[Any]
found : (c: scala.reflect.api.Universe): Nothing
-type mismatch for parameter c: scala.reflect.makro.Context does not conform to scala.reflect.api.Universe
+type mismatch for parameter c: scala.reflect.macros.Context does not conform to scala.reflect.api.Universe
def foo = macro Impls.foo
^
one error found
diff --git a/test/files/neg/macro-invalidsig-ctx-badvarargs.check b/test/files/neg/macro-invalidsig-ctx-badvarargs.check index 18e3d6201f..37941a7dc9 100644 --- a/test/files/neg/macro-invalidsig-ctx-badvarargs.check +++ b/test/files/neg/macro-invalidsig-ctx-badvarargs.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape: - required: (c: scala.reflect.makro.Context): c.Expr[Any] - found : (cs: scala.reflect.makro.Context*): Nothing -types incompatible for parameter cs: corresponding is not a vararg parameter - def foo = macro Impls.foo - ^ -one error found +Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ found : (cs: scala.reflect.macros.Context*): Nothing
+types incompatible for parameter cs: corresponding is not a vararg parameter
+ def foo = macro Impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-ctx-badvarargs/Impls_1.scala b/test/files/neg/macro-invalidsig-ctx-badvarargs/Impls_1.scala index b2fb2539ec..c4ed8be91e 100644 --- a/test/files/neg/macro-invalidsig-ctx-badvarargs/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-ctx-badvarargs/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(cs: Ctx*) = ??? diff --git a/test/files/neg/macro-invalidsig-ctx-noctx.check b/test/files/neg/macro-invalidsig-ctx-noctx.check index 66fa7c3514..722fe9dfb6 100644 --- a/test/files/neg/macro-invalidsig-ctx-noctx.check +++ b/test/files/neg/macro-invalidsig-ctx-noctx.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape: - required: (c: scala.reflect.makro.Context)(x: c.Expr[Any]): c.Expr[Any] - found : (c: scala.reflect.makro.Context): Nothing -number of parameter sections differ - def foo(x: Any) = macro Impls.foo - ^ -one error found +Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.macros.Context)(x: c.Expr[Any]): c.Expr[Any]
+ found : (c: scala.reflect.macros.Context): Nothing
+number of parameter sections differ
+ def foo(x: Any) = macro Impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-ctx-noctx/Impls_1.scala b/test/files/neg/macro-invalidsig-ctx-noctx/Impls_1.scala index 1e0ed755af..6904cfb1dc 100644 --- a/test/files/neg/macro-invalidsig-ctx-noctx/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-ctx-noctx/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = ??? diff --git a/test/files/neg/macro-invalidsig-implicit-params.check b/test/files/neg/macro-invalidsig-implicit-params.check index 6416ed0a09..029b8a4634 100644 --- a/test/files/neg/macro-invalidsig-implicit-params.check +++ b/test/files/neg/macro-invalidsig-implicit-params.check @@ -1,4 +1,4 @@ -Impls_Macros_1.scala:5: error: macro implementations cannot have implicit parameters other than TypeTag evidences
- def foo_targs[T, U: c.TypeTag](c: Ctx)(implicit x: c.Expr[Int]) = {
- ^
+Impls_Macros_1.scala:5: error: macro implementations cannot have implicit parameters other than AbsTypeTag evidences
+ def foo_targs[T, U: c.AbsTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = {
+ ^
one error found
diff --git a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala index 5bfe73ec59..f724538993 100644 --- a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala @@ -1,14 +1,14 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo_targs[T, U: c.TypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { + def foo_targs[T, U: c.AbsTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { import c.{prefix => prefix} import c.universe._ val body = Block( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticTpe)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.TypeTag[U]].tpe)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.AbsTypeTag[U]].tpe)))), Literal(Constant(()))) c.Expr[Unit](body) } diff --git a/test/files/neg/macro-invalidsig-params-badargc.check b/test/files/neg/macro-invalidsig-params-badargc.check index 6de8c5e95a..ab4fb535c5 100644 --- a/test/files/neg/macro-invalidsig-params-badargc.check +++ b/test/files/neg/macro-invalidsig-params-badargc.check @@ -1,7 +1,7 @@ -Impls_Macros_1.scala:8: error: macro implementation has wrong shape: - required: (c: scala.reflect.makro.Context)(x: c.Expr[Int]): c.Expr[Any] - found : (c: scala.reflect.makro.Context)(x: c.Expr[Int], y: c.Expr[Int]): Nothing -parameter lists have different length, found extra parameter y: c.Expr[Int] - def foo(x: Int) = macro Impls.foo - ^ -one error found +Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any]
+ found : (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): Nothing
+parameter lists have different length, found extra parameter y: c.Expr[Int]
+ def foo(x: Int) = macro Impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-params-badargc/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-params-badargc/Impls_Macros_1.scala index 4b449f35ed..ae16612b93 100644 --- a/test/files/neg/macro-invalidsig-params-badargc/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-params-badargc/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = ??? diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check index e4f67e650a..007620a366 100644 --- a/test/files/neg/macro-invalidsig-params-badtype.check +++ b/test/files/neg/macro-invalidsig-params-badtype.check @@ -1,6 +1,6 @@ Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
- required: (c: scala.reflect.makro.Context)(x: c.Expr[Int]): c.Expr[Any]
- found : (c: scala.reflect.makro.Context)(x: c.universe.Tree): Nothing
+ required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any]
+ found : (c: scala.reflect.macros.Context)(x: c.universe.Tree): Nothing
type mismatch for parameter x: c.Expr[Int] does not conform to c.universe.Tree
def foo(x: Int) = macro Impls.foo
^
diff --git a/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala index 6393e6d395..ab90b85881 100644 --- a/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.universe.Tree) = ??? diff --git a/test/files/neg/macro-invalidsig-params-badvarargs.check b/test/files/neg/macro-invalidsig-params-badvarargs.check index 0827680299..f0dcc24d03 100644 --- a/test/files/neg/macro-invalidsig-params-badvarargs.check +++ b/test/files/neg/macro-invalidsig-params-badvarargs.check @@ -1,7 +1,7 @@ -Impls_Macros_1.scala:8: error: macro implementation has wrong shape: - required: (c: scala.reflect.makro.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] - found : (c: scala.reflect.makro.Context)(xs: c.Expr[Int]*): Nothing -parameter lists have different length, required extra parameter y: c.Expr[Int] - def foo(x: Int, y: Int) = macro Impls.foo - ^ -one error found +Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any]
+ found : (c: scala.reflect.macros.Context)(xs: c.Expr[Int]*): Nothing
+parameter lists have different length, required extra parameter y: c.Expr[Int]
+ def foo(x: Int, y: Int) = macro Impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-params-badvarargs/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-params-badvarargs/Impls_Macros_1.scala index 2ee1c2767c..b4c75ad0ba 100644 --- a/test/files/neg/macro-invalidsig-params-badvarargs/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-params-badvarargs/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = ??? diff --git a/test/files/neg/macro-invalidsig-params-namemismatch.check b/test/files/neg/macro-invalidsig-params-namemismatch.check index ca7270cca8..00d781a2ac 100644 --- a/test/files/neg/macro-invalidsig-params-namemismatch.check +++ b/test/files/neg/macro-invalidsig-params-namemismatch.check @@ -1,7 +1,7 @@ -Impls_Macros_1.scala:8: error: macro implementation has wrong shape: - required: (c: scala.reflect.makro.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] - found : (c: scala.reflect.makro.Context)(y: c.Expr[Int], x: c.Expr[Int]): Nothing -parameter names differ: x != y - def foo(x: Int, y: Int) = macro Impls.foo - ^ -one error found +Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any]
+ found : (c: scala.reflect.macros.Context)(y: c.Expr[Int], x: c.Expr[Int]): Nothing
+parameter names differ: x != y
+ def foo(x: Int, y: Int) = macro Impls.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-invalidsig-params-namemismatch/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-params-namemismatch/Impls_Macros_1.scala index 89c5347647..c7cf0b06c4 100644 --- a/test/files/neg/macro-invalidsig-params-namemismatch/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-params-namemismatch/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(y: c.Expr[Int], x: c.Expr[Int]) = ??? diff --git a/test/files/neg/macro-invalidsig-tparams-badtype.check b/test/files/neg/macro-invalidsig-tparams-badtype.check index 9166db3574..e5e8366ba4 100644 --- a/test/files/neg/macro-invalidsig-tparams-badtype.check +++ b/test/files/neg/macro-invalidsig-tparams-badtype.check @@ -1,6 +1,6 @@ Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.makro.Context): c.Expr[Any]
- found : (c: scala.reflect.makro.Context)(U: c.universe.Type): Nothing
+ required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ found : (c: scala.reflect.macros.Context)(U: c.universe.Type): Nothing
number of parameter sections differ
def foo[U] = macro Impls.foo[U]
^
diff --git a/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala index 9886331502..dbeca178a7 100644 --- a/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-badtype/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo[U](c: Ctx)(U: c.universe.Type) = ??? diff --git a/test/files/neg/macro-invalidsig-tparams-bounds-a/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-bounds-a/Impls_1.scala index 88b85d48f4..89020de7dd 100644 --- a/test/files/neg/macro-invalidsig-tparams-bounds-a/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-bounds-a/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo[U <: String](c: Ctx) = ??? diff --git a/test/files/neg/macro-invalidsig-tparams-bounds-b/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-bounds-b/Impls_1.scala index 88b85d48f4..89020de7dd 100644 --- a/test/files/neg/macro-invalidsig-tparams-bounds-b/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-bounds-b/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo[U <: String](c: Ctx) = ??? diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala index ea472e6f91..afbe0f0915 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala @@ -1,6 +1,6 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.TypeTag](c: Ctx) = ??? + def foo[U: c.AbsTypeTag](c: Ctx) = ??? }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala index c4eb3d9b4a..b48f9d5f98 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala @@ -1,10 +1,10 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T: c.TypeTag, U: c.TypeTag, V](c: Ctx)(implicit V: c.TypeTag[V]): c.Expr[Unit] = { - println(implicitly[c.TypeTag[T]]) - println(implicitly[c.TypeTag[U]]) + def foo[T: c.AbsTypeTag, U: c.AbsTypeTag, V](c: Ctx)(implicit V: c.AbsTypeTag[V]): c.Expr[Unit] = { + println(implicitly[c.AbsTypeTag[T]]) + println(implicitly[c.AbsTypeTag[U]]) println(V) c.literalUnit } diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c.check b/test/files/neg/macro-invalidsig-tparams-notparams-c.check index b64a469cc3..b1078fb233 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-c.check +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.makro.Context)(implicit evidence$1: c.TypeTag[T], implicit evidence$2: c.TypeTag[U], implicit V: c.TypeTag[V])c.Expr[Unit]
+Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.AbsTypeTag[T], implicit evidence$2: c.AbsTypeTag[U], implicit V: c.AbsTypeTag[V])c.Expr[Unit]
def foo[V] = macro Impls.foo[V]
^
one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala index 41facc881e..3506bdc789 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala @@ -1,11 +1,11 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T: c.TypeTag, U: c.TypeTag, V](c: Ctx)(implicit V: c.TypeTag[V]): c.Expr[Unit] = { + def foo[T: c.AbsTypeTag, U: c.AbsTypeTag, V](c: Ctx)(implicit V: c.AbsTypeTag[V]): c.Expr[Unit] = { import c.universe._ - println(implicitly[c.TypeTag[T]]) - println(implicitly[c.TypeTag[U]]) + println(implicitly[c.AbsTypeTag[T]]) + println(implicitly[c.AbsTypeTag[U]]) println(V) c.literalUnit } diff --git a/test/files/neg/macro-invalidusage-badargs/Impls_1.scala b/test/files/neg/macro-invalidusage-badargs/Impls_1.scala index 2346a6106d..52c9f9c3e9 100644 --- a/test/files/neg/macro-invalidusage-badargs/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-badargs/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = x diff --git a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala b/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala index 88b85d48f4..89020de7dd 100644 --- a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo[U <: String](c: Ctx) = ??? diff --git a/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala b/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala index 2346a6106d..52c9f9c3e9 100644 --- a/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = x diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala index 31e758e9a0..8d7fdf3e8a 100644 --- a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/neg/macro-noexpand/Impls_1.scala b/test/files/neg/macro-noexpand/Impls_1.scala index 7b1620d117..4467021545 100644 --- a/test/files/neg/macro-noexpand/Impls_1.scala +++ b/test/files/neg/macro-noexpand/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Any]) = ??? diff --git a/test/files/neg/macro-nontypeablebody/Impls_1.scala b/test/files/neg/macro-nontypeablebody/Impls_1.scala index 7b1620d117..4467021545 100644 --- a/test/files/neg/macro-nontypeablebody/Impls_1.scala +++ b/test/files/neg/macro-nontypeablebody/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Any]) = ??? diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala b/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala index cb0b152852..e43264f52f 100644 --- a/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def impl(c: Ctx)(x: c.Expr[Int]) = x diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala b/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala index cb0b152852..e43264f52f 100644 --- a/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def impl(c: Ctx)(x: c.Expr[Int]) = x diff --git a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala index d6493caad9..ec93dd4111 100644 --- a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala +++ b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { diff --git a/test/files/neg/macro-without-xmacros-a/Impls_1.scala b/test/files/neg/macro-without-xmacros-a/Impls_1.scala index 0b6fbe240e..8976f8e28d 100644 --- a/test/files/neg/macro-without-xmacros-a/Impls_1.scala +++ b/test/files/neg/macro-without-xmacros-a/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { diff --git a/test/files/neg/macro-without-xmacros-b/Impls_1.scala b/test/files/neg/macro-without-xmacros-b/Impls_1.scala index 0b6fbe240e..8976f8e28d 100644 --- a/test/files/neg/macro-without-xmacros-b/Impls_1.scala +++ b/test/files/neg/macro-without-xmacros-b/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { diff --git a/test/files/neg/t3692-new.check b/test/files/neg/t3692-new.check index 349e4fe48a..5aa991c105 100644 --- a/test/files/neg/t3692-new.check +++ b/test/files/neg/t3692-new.check @@ -1,4 +1,14 @@ -t3692-new.scala:16: error: unreachable code
- case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
- ^
-one error found
+t3692-new.scala:14: warning: non-variable type argument Int in type pattern Map[Int,Int] is unchecked since it is eliminated by erasure + case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer] + ^ +t3692-new.scala:15: warning: non-variable type argument Int in type pattern Map[Int,V] is unchecked since it is eliminated by erasure + case m1: Map[Int, V] => new java.util.HashMap[Integer, V] + ^ +t3692-new.scala:16: warning: non-variable type argument Int in type pattern Map[T,Int] is unchecked since it is eliminated by erasure + case m2: Map[T, Int] => new java.util.HashMap[T, Integer] + ^ +t3692-new.scala:16: error: unreachable code + case m2: Map[T, Int] => new java.util.HashMap[T, Integer] + ^ +three warnings found +one error found diff --git a/test/files/neg/t3692-old.check b/test/files/neg/t3692-old.check index 92d71f7e4e..950f82951c 100644 --- a/test/files/neg/t3692-old.check +++ b/test/files/neg/t3692-old.check @@ -1,11 +1,20 @@ -t3692-old.scala:11: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = {
- ^
-t3692-old.scala:11: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = {
- ^
-t3692-old.scala:15: error: unreachable code
- case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
- ^
-two warnings found
-one error found
+t3692-old.scala:13: warning: non-variable type argument Int in type pattern Map[Int,Int] is unchecked since it is eliminated by erasure + case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer] + ^ +t3692-old.scala:14: warning: non-variable type argument Int in type pattern Map[Int,V] is unchecked since it is eliminated by erasure + case m1: Map[Int, V] => new java.util.HashMap[Integer, V] + ^ +t3692-old.scala:15: warning: non-variable type argument Int in type pattern Map[T,Int] is unchecked since it is eliminated by erasure + case m2: Map[T, Int] => new java.util.HashMap[T, Integer] + ^ +t3692-old.scala:11: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead + private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = { + ^ +t3692-old.scala:11: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead + private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = { + ^ +t3692-old.scala:15: error: unreachable code + case m2: Map[T, Int] => new java.util.HashMap[T, Integer] + ^ +5 warnings found +one error found diff --git a/test/files/neg/t5689.check b/test/files/neg/t5689.check index 6abc4c13f6..3b25dd612e 100644 --- a/test/files/neg/t5689.check +++ b/test/files/neg/t5689.check @@ -1,6 +1,6 @@ t5689.scala:4: error: macro implementation has wrong shape:
- required: (c: scala.reflect.makro.Context)(i: c.Expr[Double]): c.Expr[String]
- found : (c: scala.reflect.makro.Context)(i: c.Expr[Double]): c.Expr[Int]
+ required: (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[String]
+ found : (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[Int]
type mismatch for return type: c.Expr[Int] does not conform to c.Expr[String]
def returnsString(i: Double): String = macro returnsIntImpl
^
diff --git a/test/files/neg/t5689.scala b/test/files/neg/t5689.scala index ef7a45b364..3266039c35 100644 --- a/test/files/neg/t5689.scala +++ b/test/files/neg/t5689.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Macros { def returnsString(i: Double): String = macro returnsIntImpl diff --git a/test/files/neg/t6040.check b/test/files/neg/t6040.check new file mode 100644 index 0000000000..f44a81c471 --- /dev/null +++ b/test/files/neg/t6040.check @@ -0,0 +1,7 @@ +error: extension of type scala.Dynamic needs to be enabled +by making the implicit value language.dynamics visible. +This can be achieved by adding the import clause 'import language.dynamics' +or by setting the compiler option -language:dynamics. +See the Scala docs for value scala.language.dynamics for a discussion +why the feature needs to be explicitly enabled. +one error found diff --git a/test/files/neg/t6040.scala b/test/files/neg/t6040.scala new file mode 100644 index 0000000000..b8f7dab7a4 --- /dev/null +++ b/test/files/neg/t6040.scala @@ -0,0 +1 @@ +class X extends Dynamic
\ No newline at end of file diff --git a/test/files/neg/t6074.check b/test/files/neg/t6074.check new file mode 100644 index 0000000000..38670e5b3d --- /dev/null +++ b/test/files/neg/t6074.check @@ -0,0 +1,4 @@ +t6074.scala:5: error: constructor A in class A cannot be accessed in object T + def t = new A() + ^ +one error found diff --git a/test/files/neg/t6074.scala b/test/files/neg/t6074.scala new file mode 100644 index 0000000000..8c14f00f19 --- /dev/null +++ b/test/files/neg/t6074.scala @@ -0,0 +1,6 @@ +class A private () { } +class B { } +object T { + implicit def a2b(a: A): B = null + def t = new A() +} diff --git a/test/files/neg/unchecked-suppress.check b/test/files/neg/unchecked-suppress.check new file mode 100644 index 0000000000..2e23d21386 --- /dev/null +++ b/test/files/neg/unchecked-suppress.check @@ -0,0 +1,10 @@ +unchecked-suppress.scala:4: error: non-variable type argument Int in type pattern Set[Int] is unchecked since it is eliminated by erasure + case xs: Set[Int] => xs.head // unchecked + ^ +unchecked-suppress.scala:5: error: non-variable type argument String in type pattern Map[String @unchecked,String] is unchecked since it is eliminated by erasure + case xs: Map[String @unchecked, String] => xs.head // one unchecked, one okay + ^ +unchecked-suppress.scala:7: error: non-variable type argument Int in type pattern (Int, Int) => Int is unchecked since it is eliminated by erasure + case f: ((Int, Int) => Int) => // unchecked + ^ +three errors found diff --git a/test/files/neg/unchecked-suppress.flags b/test/files/neg/unchecked-suppress.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/unchecked-suppress.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/unchecked-suppress.scala b/test/files/neg/unchecked-suppress.scala new file mode 100644 index 0000000000..7bd61a2a4d --- /dev/null +++ b/test/files/neg/unchecked-suppress.scala @@ -0,0 +1,10 @@ +class A { + def f(x: Any) = x match { + case xs: List[String @unchecked] => xs.head // okay + case xs: Set[Int] => xs.head // unchecked + case xs: Map[String @unchecked, String] => xs.head // one unchecked, one okay + case f: ((Int @unchecked) => (Int @unchecked)) => f(5) // okay + case f: ((Int, Int) => Int) => // unchecked + case _ => "" + } +} diff --git a/test/files/pos/SI-5788.scala b/test/files/pos/SI-5788.scala new file mode 100644 index 0000000000..93b84bde87 --- /dev/null +++ b/test/files/pos/SI-5788.scala @@ -0,0 +1,4 @@ +trait Test { + trait B[T] + private final def grow[T](): B[T] = grow[T]() +} diff --git a/test/files/pos/t5706.scala b/test/files/pos/t5706.scala index 847acb693f..20a8b255cc 100644 --- a/test/files/pos/t5706.scala +++ b/test/files/pos/t5706.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context class Logger { def error(message: String) = macro Impls.error diff --git a/test/files/pos/t5897.flags b/test/files/pos/t5897.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t5897.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t5897.scala b/test/files/pos/t5897.scala new file mode 100644 index 0000000000..2e9751afe0 --- /dev/null +++ b/test/files/pos/t5897.scala @@ -0,0 +1,6 @@ +// no warning here +// (strangely, if there's an unreachable code warning *anywhere in this compilation unit*, +// the non-sensical warning goes away under -Xfatal-warnings) +class Test { + () match { case () => } +} diff --git a/test/files/pos/t5930.flags b/test/files/pos/t5930.flags new file mode 100644 index 0000000000..c7d406c649 --- /dev/null +++ b/test/files/pos/t5930.flags @@ -0,0 +1 @@ +-Ywarn-dead-code -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t5930.scala b/test/files/pos/t5930.scala new file mode 100644 index 0000000000..de9d62cfe8 --- /dev/null +++ b/test/files/pos/t5930.scala @@ -0,0 +1,4 @@ +// should not warn about dead code (`matchEnd(throw new MatchError)`) + class Test { + 0 match { case x: Int => } +}
\ No newline at end of file diff --git a/test/files/pos/t6040.scala b/test/files/pos/t6040.scala new file mode 100644 index 0000000000..9c00ecd8e1 --- /dev/null +++ b/test/files/pos/t6040.scala @@ -0,0 +1,3 @@ +import language.dynamics + +class X extends Dynamic
\ No newline at end of file diff --git a/test/files/pos/t6047.scala b/test/files/pos/t6047.scala index 66b52b285f..80d5e9668b 100644 --- a/test/files/pos/t6047.scala +++ b/test/files/pos/t6047.scala @@ -1,10 +1,10 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context import java.io.InputStream object Macros { def unpack[A](input: InputStream): A = macro unpack_impl[A] - def unpack_impl[A: c.TypeTag](c: Context)(input: c.Expr[InputStream]): c.Expr[A] = { + def unpack_impl[A: c.AbsTypeTag](c: Context)(input: c.Expr[InputStream]): c.Expr[A] = { import c.universe._ def unpackcode(tpe: c.Type): c.Expr[_] = { @@ -14,7 +14,7 @@ object Macros { ??? } - unpackcode(c.typeOf[A]) + unpackcode(implicitly[c.AbsTypeTag[A]].tpe) ??? } }
\ No newline at end of file diff --git a/test/files/pos/t6084.scala b/test/files/pos/t6084.scala new file mode 100644 index 0000000000..1aa1fed391 --- /dev/null +++ b/test/files/pos/t6084.scala @@ -0,0 +1,15 @@ +package object foo { type X[T, U] = (T => U) } + +package foo { + abstract class Foo[T, U](val d: T => U) extends (T => U) { + def f1(r: X[T, U]) = r match { case x: Foo[_,_] => x.d } // inferred ok + def f2(r: X[T, U]): (T => U) = r match { case x: Foo[_,_] => x.d } // dealiased ok + def f3(r: X[T, U]): X[T, U] = r match { case x: Foo[_,_] => x.d } // alias not ok + + // x.d : foo.this.package.type.X[?scala.reflect.internal.Types$NoPrefix$?.T, ?scala.reflect.internal.Types$NoPrefix$?.U] ~>scala.this.Function1[?scala.reflect.internal.Types$NoPrefix$?.T, ?scala.reflect.internal.Types$NoPrefix$?.U] + // at scala.Predef$.assert(Predef.scala:170) + // at scala.tools.nsc.Global.assert(Global.scala:235) + // at scala.tools.nsc.ast.TreeGen.mkCast(TreeGen.scala:252) + // at scala.tools.nsc.typechecker.Typers$Typer.typedCase(Typers.scala:2263) + } +} diff --git a/test/files/pos/t6157.flags b/test/files/pos/t6157.flags new file mode 100644 index 0000000000..0ebca3e7af --- /dev/null +++ b/test/files/pos/t6157.flags @@ -0,0 +1 @@ + -optimize diff --git a/test/files/pos/t6157.scala b/test/files/pos/t6157.scala new file mode 100644 index 0000000000..7463989b14 --- /dev/null +++ b/test/files/pos/t6157.scala @@ -0,0 +1,25 @@ +// SI-6157 - Compiler crash on inlined function and -optimize option + +object Test { + def main(args: Array[String]) { + Console.println( + ErrorHandler.defaultIfIOException("String")("String") + ) + } +} + +import java.io.IOException + +object ErrorHandler { + + @inline + def defaultIfIOException[T](default: => T)(closure: => T): T = { + try { + closure + } catch { + case e: IOException => + default + } + } +} + diff --git a/test/files/run/abstypetags_serialize.check b/test/files/run/abstypetags_serialize.check new file mode 100644 index 0000000000..aafb4761ad --- /dev/null +++ b/test/files/run/abstypetags_serialize.check @@ -0,0 +1,2 @@ +java.io.NotSerializableException: Test$$typecreator1$1
+java.io.NotSerializableException: Test$$typecreator2$1
diff --git a/test/files/run/abstypetags_serialize.scala b/test/files/run/abstypetags_serialize.scala new file mode 100644 index 0000000000..5b9142f6d5 --- /dev/null +++ b/test/files/run/abstypetags_serialize.scala @@ -0,0 +1,32 @@ +import java.io._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + def test(tag: AbsTypeTag[_]) = + try { + val fout = new ByteArrayOutputStream() + val out = new ObjectOutputStream(fout) + out.writeObject(tag) + out.close() + fout.close() + + val fin = new ByteArrayInputStream(fout.toByteArray) + val in = new ObjectInputStream(fin) + val retag = in.readObject().asInstanceOf[scala.reflect.basis.AbsTypeTag[_]].in(cm) + in.close() + fin.close() + + println(retag) + } catch { + case ex: Exception => + println(ex) + } + + def qwe[T, U[_]] = { + test(implicitly[AbsTypeTag[T]]) + test(implicitly[AbsTypeTag[U[String]]]) + } + + qwe +}
\ No newline at end of file diff --git a/test/files/run/applydynamic_sip.flags b/test/files/run/applydynamic_sip.flags new file mode 100644 index 0000000000..1141f97507 --- /dev/null +++ b/test/files/run/applydynamic_sip.flags @@ -0,0 +1 @@ +-language:dynamics diff --git a/test/files/run/compiler-asSeenFrom.scala b/test/files/run/compiler-asSeenFrom.scala index 1fc3a5ee71..19feb45101 100644 --- a/test/files/run/compiler-asSeenFrom.scala +++ b/test/files/run/compiler-asSeenFrom.scala @@ -47,10 +47,10 @@ package ll { for (p <- typeRefPrefixes ; c <- classes filter (isPossibleEnclosure(p.typeSymbol, _)) ; a <- targs) yield typeRef(p, c, List(a)) ) - + val wfmt = "%-" + 25 + "s" def to_s(x: Any): String = wfmt.format(x.toString.replaceAll("""\bll\.""", "")) - + def fmt(args: Any*): String = { (args map to_s mkString " ").replaceAll("""\s+$""", "") } @@ -61,7 +61,7 @@ package ll { } def permuteAsSeenFrom(targs: List[Type]) = ( - for { + for { tp <- typeRefs(targs filterNot (_ eq NoType)) prefix <- asSeenPrefixes if tp.prefix != prefix @@ -72,11 +72,11 @@ package ll { } yield ((site, tp, prefix, seen)) ) - + def block(label: Any)(lines: List[String]): List[String] = { val first = "" + label + " {" val last = "}" - + first +: lines.map(" " + _) :+ last } @@ -84,7 +84,7 @@ package ll { permuteAsSeenFrom(targs).groupBy(_._1).toList.sortBy(_._1.toString) flatMap { case (site, xs) => block(fmt(site)) { - fmt("type", "seen from prefix", "is") :: + fmt("type", "seen from prefix", "is") :: fmt("----", "----------------", "--") :: { xs.groupBy(_._2).toList.sortBy(_._1.toString) flatMap { case (tp, ys) => @@ -95,15 +95,15 @@ package ll { } } } - + def pretty(xs: List[_]) = if (xs.isEmpty) "" else xs.mkString("\n ", "\n ", "\n") def signaturesIn(info: Type): List[String] = ( - info.members + info.members.toList filterNot (s => s.isType || s.owner == ObjectClass || s.owner == AnyClass || s.isConstructor) map (_.defString) ) - + def check(source: String, unit: global.CompilationUnit) = { import syms._ diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check index 37784a20ca..da97a378e6 100644 --- a/test/files/run/constrained-types.check +++ b/test/files/run/constrained-types.check @@ -76,12 +76,10 @@ four: String = four scala> val four2 = m(four) // should have an existential bound warning: there were 1 feature warnings; re-run with -feature for details -warning: there were 1 feature warnings; re-run with -feature for details four2: String @Annot(x) forSome { val x: String } = four scala> val four3 = four2 // should have the same type as four2 warning: there were 1 feature warnings; re-run with -feature for details -warning: there were 1 feature warnings; re-run with -feature for details four3: String @Annot(x) forSome { val x: String } = four scala> val stuff = m("stuff") // should not crash @@ -105,7 +103,6 @@ scala> def m = { y } // x should not escape the local scope with a narrow type warning: there were 1 feature warnings; re-run with -feature for details -warning: there were 1 feature warnings; re-run with -feature for details m: String @Annot(x) forSome { val x: String } scala> diff --git a/test/files/run/exprs_serialize.check b/test/files/run/exprs_serialize.check new file mode 100644 index 0000000000..a3bf9ccdc4 --- /dev/null +++ b/test/files/run/exprs_serialize.check @@ -0,0 +1,2 @@ +java.io.NotSerializableException: Test$$treecreator1$1
+java.io.NotSerializableException: Test$$treecreator2$1
diff --git a/test/files/run/exprs_serialize.scala b/test/files/run/exprs_serialize.scala new file mode 100644 index 0000000000..075c902a34 --- /dev/null +++ b/test/files/run/exprs_serialize.scala @@ -0,0 +1,28 @@ +import java.io._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + def test(expr: Expr[_]) = + try { + val fout = new ByteArrayOutputStream() + val out = new ObjectOutputStream(fout) + out.writeObject(expr) + out.close() + fout.close() + + val fin = new ByteArrayInputStream(fout.toByteArray) + val in = new ObjectInputStream(fin) + val reexpr = in.readObject().asInstanceOf[scala.reflect.basis.Expr[_]].in(cm) + in.close() + fin.close() + + println(reexpr) + } catch { + case ex: Exception => + println(ex) + } + + test(reify(2)) + test(reify{def foo = "hello"; foo + "world!"}) +}
\ No newline at end of file diff --git a/test/files/run/macro-abort-fresh/Macros_1.scala b/test/files/run/macro-abort-fresh/Macros_1.scala index 440d1e2915..af1e292588 100644 --- a/test/files/run/macro-abort-fresh/Macros_1.scala +++ b/test/files/run/macro-abort-fresh/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Impls { def impl(c: Context) = { diff --git a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala index 039488ba3e..646634c972 100644 --- a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala +++ b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { diff --git a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala index 6e1e37a485..aa1e52e4aa 100644 --- a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala +++ b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { diff --git a/test/files/run/macro-basic-mamd-mi/Impls_1.scala b/test/files/run/macro-basic-mamd-mi/Impls_1.scala index 96d26741f7..061aa2d4a3 100644 --- a/test/files/run/macro-basic-mamd-mi/Impls_1.scala +++ b/test/files/run/macro-basic-mamd-mi/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { diff --git a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala index 7de1e59cc7..0ca0be5a48 100644 --- a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala +++ b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = x diff --git a/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala b/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala index 2934201a16..b589d4be03 100644 --- a/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala +++ b/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Macros { def foo(x: Int) = macro Impls.refToFoo(42) diff --git a/test/files/run/macro-declared-in-annotation/Impls_1.scala b/test/files/run/macro-declared-in-annotation/Impls_1.scala index 2b309e1cc8..a11ee2907a 100644 --- a/test/files/run/macro-declared-in-annotation/Impls_1.scala +++ b/test/files/run/macro-declared-in-annotation/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-anonymous/Impls_1.scala b/test/files/run/macro-declared-in-anonymous/Impls_1.scala index d95dbd42c6..6f06f6d3f0 100644 --- a/test/files/run/macro-declared-in-anonymous/Impls_1.scala +++ b/test/files/run/macro-declared-in-anonymous/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-block/Impls_1.scala b/test/files/run/macro-declared-in-block/Impls_1.scala index d95dbd42c6..6f06f6d3f0 100644 --- a/test/files/run/macro-declared-in-block/Impls_1.scala +++ b/test/files/run/macro-declared-in-block/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-class-class/Impls_1.scala b/test/files/run/macro-declared-in-class-class/Impls_1.scala index 5c61086a40..1f8f3cbd5a 100644 --- a/test/files/run/macro-declared-in-class-class/Impls_1.scala +++ b/test/files/run/macro-declared-in-class-class/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-class-object/Impls_1.scala b/test/files/run/macro-declared-in-class-object/Impls_1.scala index 5c61086a40..1f8f3cbd5a 100644 --- a/test/files/run/macro-declared-in-class-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-class-object/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-class/Impls_1.scala b/test/files/run/macro-declared-in-class/Impls_1.scala index 5c61086a40..1f8f3cbd5a 100644 --- a/test/files/run/macro-declared-in-class/Impls_1.scala +++ b/test/files/run/macro-declared-in-class/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-default-param/Impls_1.scala b/test/files/run/macro-declared-in-default-param/Impls_1.scala index 5e7351e954..db1e5c7435 100644 --- a/test/files/run/macro-declared-in-default-param/Impls_1.scala +++ b/test/files/run/macro-declared-in-default-param/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala b/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala index e5fb4bcdf3..d506de4252 100644 --- a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala +++ b/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def toOptionOfInt(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-method/Impls_1.scala b/test/files/run/macro-declared-in-method/Impls_1.scala index 5c61086a40..1f8f3cbd5a 100644 --- a/test/files/run/macro-declared-in-method/Impls_1.scala +++ b/test/files/run/macro-declared-in-method/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-object-class/Impls_1.scala b/test/files/run/macro-declared-in-object-class/Impls_1.scala index 5c61086a40..1f8f3cbd5a 100644 --- a/test/files/run/macro-declared-in-object-class/Impls_1.scala +++ b/test/files/run/macro-declared-in-object-class/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-object-object/Impls_1.scala b/test/files/run/macro-declared-in-object-object/Impls_1.scala index 5c61086a40..1f8f3cbd5a 100644 --- a/test/files/run/macro-declared-in-object-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-object-object/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-object/Impls_1.scala b/test/files/run/macro-declared-in-object/Impls_1.scala index 5c61086a40..1f8f3cbd5a 100644 --- a/test/files/run/macro-declared-in-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-object/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-package-object/Impls_1.scala b/test/files/run/macro-declared-in-package-object/Impls_1.scala index 5c61086a40..1f8f3cbd5a 100644 --- a/test/files/run/macro-declared-in-package-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-package-object/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-refinement/Impls_1.scala b/test/files/run/macro-declared-in-refinement/Impls_1.scala index 5c61086a40..1f8f3cbd5a 100644 --- a/test/files/run/macro-declared-in-refinement/Impls_1.scala +++ b/test/files/run/macro-declared-in-refinement/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-declared-in-trait/Impls_1.scala b/test/files/run/macro-declared-in-trait/Impls_1.scala index 5c61086a40..1f8f3cbd5a 100644 --- a/test/files/run/macro-declared-in-trait/Impls_1.scala +++ b/test/files/run/macro-declared-in-trait/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-def-infer-return-type-a/Impls_1.scala b/test/files/run/macro-def-infer-return-type-a/Impls_1.scala index 2346a6106d..52c9f9c3e9 100644 --- a/test/files/run/macro-def-infer-return-type-a/Impls_1.scala +++ b/test/files/run/macro-def-infer-return-type-a/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = x diff --git a/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala b/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala index 8640713846..8a0f18c01b 100644 --- a/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala +++ b/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo[T](c: Ctx)(x: c.Expr[T]) = diff --git a/test/files/run/macro-def-infer-return-type-c/Impls_1.scala b/test/files/run/macro-def-infer-return-type-c/Impls_1.scala index f3e53bbea7..78db67eebf 100644 --- a/test/files/run/macro-def-infer-return-type-c/Impls_1.scala +++ b/test/files/run/macro-def-infer-return-type-c/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo[T](c: Ctx)(x: c.Expr[T]): c.Expr[T] = x diff --git a/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala index d7167e671c..3a91e41ff9 100644 --- a/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} trait Exprs { self: Universe => diff --git a/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala index 44af6949a7..cf9f9ebd0e 100644 --- a/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} trait Exprs { self: Universe => diff --git a/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala index 305146c48b..6cb374d9ba 100644 --- a/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} trait Exprs { self: Universe => diff --git a/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala index aca7f999d5..2daf6fc3fb 100644 --- a/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent-d/Impls_Macros_1.scala @@ -1,9 +1,9 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.Context +import scala.reflect.macros.Context import scala.reflect.api.Universe object Test { def materializeTypeTag[T](u: Universe)(e: T) = macro materializeTypeTag_impl[T] - def materializeTypeTag_impl[T: c.TypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ??? + def materializeTypeTag_impl[T: c.AbsTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ??? }
\ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala index b59555539c..082e6b2efe 100644 --- a/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala index 68ead9b9a5..cceb038f05 100644 --- a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = { diff --git a/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala index a1dd5aa801..fa717b2327 100644 --- a/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala index 68ead9b9a5..cceb038f05 100644 --- a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = { diff --git a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala index 2c1748bc29..11e07932c3 100644 --- a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala +++ b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = { diff --git a/test/files/run/macro-expand-nullary-generic/Impls_1.scala b/test/files/run/macro-expand-nullary-generic/Impls_1.scala index edbe6d504a..fbbc23a824 100644 --- a/test/files/run/macro-expand-nullary-generic/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-generic/Impls_1.scala @@ -1,15 +1,15 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def impl[T: c.TypeTag](c: Ctx) = { + def impl[T: c.AbsTypeTag](c: Ctx) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.TypeTag[T]])))) + val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.AbsTypeTag[T]])))) c.Expr[Unit](body) } - def fooNullary[T: c.TypeTag](c: Ctx) = impl[T](c) - def fooEmpty[T: c.TypeTag](c: Ctx)() = impl[T](c) - def barNullary[T: c.TypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c) - def barEmpty[T: c.TypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c) + def fooNullary[T: c.AbsTypeTag](c: Ctx) = impl[T](c) + def fooEmpty[T: c.AbsTypeTag](c: Ctx)() = impl[T](c) + def barNullary[T: c.AbsTypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c) + def barEmpty[T: c.AbsTypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c) }
\ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala index 0d849a085d..c6bd1cdbf1 100644 --- a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def impl(c: Ctx) = { diff --git a/test/files/run/macro-expand-overload/Impls_1.scala b/test/files/run/macro-expand-overload/Impls_1.scala index f4646d43df..f7c240d9ca 100644 --- a/test/files/run/macro-expand-overload/Impls_1.scala +++ b/test/files/run/macro-expand-overload/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { diff --git a/test/files/run/macro-expand-override/Impls_1.scala b/test/files/run/macro-expand-override/Impls_1.scala index d6493caad9..ec93dd4111 100644 --- a/test/files/run/macro-expand-override/Impls_1.scala +++ b/test/files/run/macro-expand-override/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { diff --git a/test/files/run/macro-expand-recursive/Impls_1.scala b/test/files/run/macro-expand-recursive/Impls_1.scala index 26833ca0b9..61db5c4a9b 100644 --- a/test/files/run/macro-expand-recursive/Impls_1.scala +++ b/test/files/run/macro-expand-recursive/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala index 5019d5d4a7..9b8dafaa97 100644 --- a/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo[U <: String](c: Ctx): c.Expr[Unit] = c.literalUnit diff --git a/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala index abd68696b6..c11c89151c 100644 --- a/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} class C diff --git a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala index d1843275d0..0a879687e8 100644 --- a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala @@ -1,10 +1,10 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.TypeTag](c: Ctx) = { + def foo[U: c.AbsTypeTag](c: Ctx) = { import c.universe._ - val U = implicitly[c.TypeTag[U]] + val U = implicitly[c.AbsTypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) c.Expr[Unit](body) } diff --git a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala index cbc5460720..f6cb63b9c9 100644 --- a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala @@ -1,10 +1,10 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.TypeTag](c: Ctx)(x: c.Expr[U]) = { + def foo[U: c.AbsTypeTag](c: Ctx)(x: c.Expr[U]) = { import c.universe._ - val U = implicitly[c.TypeTag[U]] + val U = implicitly[c.AbsTypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) c.Expr[Unit](body) } diff --git a/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala b/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala index 5019d5d4a7..9b8dafaa97 100644 --- a/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo[U <: String](c: Ctx): c.Expr[Unit] = c.literalUnit diff --git a/test/files/run/macro-expand-tparams-optional/Impls_1.scala b/test/files/run/macro-expand-tparams-optional/Impls_1.scala index 97363edd9a..3b829e2e09 100644 --- a/test/files/run/macro-expand-tparams-optional/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-optional/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo[U](c: Ctx) = { diff --git a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala index cbc5460720..f6cb63b9c9 100644 --- a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala @@ -1,10 +1,10 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.TypeTag](c: Ctx)(x: c.Expr[U]) = { + def foo[U: c.AbsTypeTag](c: Ctx)(x: c.Expr[U]) = { import c.universe._ - val U = implicitly[c.TypeTag[U]] + val U = implicitly[c.AbsTypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) c.Expr[Unit](body) } diff --git a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala index 3d29fa467d..7e0fa26569 100644 --- a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala @@ -1,11 +1,11 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T: c.TypeTag, U: c.TypeTag](c: Ctx)(x: c.Expr[U]) = { + def foo[T: c.AbsTypeTag, U: c.AbsTypeTag](c: Ctx)(x: c.Expr[U]) = { import c.universe._ - val T = implicitly[c.TypeTag[T]] - val U = implicitly[c.TypeTag[U]] + val T = implicitly[c.AbsTypeTag[T]] + val U = implicitly[c.AbsTypeTag[U]] val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) c.Expr[Unit](body) } diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala index a834d809da..ca515be627 100644 --- a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala @@ -1,12 +1,12 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { + def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = { import c.universe._ c.Expr(Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.AbsTypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala index e0de1f3f83..5a554590d8 100644 --- a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala @@ -1,12 +1,12 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { + def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = { import c.universe._ c.Expr(Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.AbsTypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala index f497e5f7a9..ca515be627 100644 --- a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala @@ -1,5 +1,5 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = { diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala index b83fa046e5..2ef8f04be9 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala index 5f550064e1..3c7f94f605 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala index 8c75a7e0ea..2066893bdc 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def myprintln(xs: Int*) = { diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala index b83fa046e5..2ef8f04be9 100644 --- a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala index 8c75a7e0ea..2066893bdc 100644 --- a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def myprintln(xs: Int*) = { diff --git a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala index 8154ab0341..06c58d96ab 100644 --- a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala +++ b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala @@ -1,14 +1,14 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo_targs[T, U: c.TypeTag](c: Ctx = null)(x: c.Expr[Int] = null) = { + def foo_targs[T, U: c.AbsTypeTag](c: Ctx = null)(x: c.Expr[Int] = null) = { import c.{prefix => prefix} import c.universe._ - val U = implicitly[c.TypeTag[U]] + val U = implicitly[c.AbsTypeTag[U]] val body = Block( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticTpe)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix tree is: " + prefix.tree.tpe)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + U.tpe)))), Literal(Constant(()))) diff --git a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala index 367a45a2c3..537f1db8c6 100644 --- a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala +++ b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(unconventionalName: Ctx)(x: unconventionalName.Expr[Int]) = { diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala index 5a7d1a6b9a..b3babd8848 100644 --- a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx): c.Expr[Int] = { diff --git a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala index 04eef976c5..405ae7024f 100644 --- a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala index c63ad01677..0d840eed3f 100644 --- a/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = x diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala index 67a19a6d62..a54b7f4b08 100644 --- a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala @@ -1,7 +1,7 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T: c.TypeTag](c: Ctx)(x: c.Expr[T]) = { + def foo[T: c.AbsTypeTag](c: Ctx)(x: c.Expr[T]) = { import c.universe._ val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(x.tree.toString)))) c.Expr[Unit](body) diff --git a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala index e5bdca008e..5866469499 100644 --- a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = { diff --git a/test/files/run/macro-openmacros/Impls_Macros_1.scala b/test/files/run/macro-openmacros/Impls_Macros_1.scala index 6b92834b81..38d46c5185 100644 --- a/test/files/run/macro-openmacros/Impls_Macros_1.scala +++ b/test/files/run/macro-openmacros/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Macros { def impl(c: Context): c.Expr[Unit] = { diff --git a/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala b/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala index 7cb810c86b..6c14428437 100644 --- a/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala +++ b/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Macros { object Impls { diff --git a/test/files/run/macro-range/Common_1.scala b/test/files/run/macro-range/Common_1.scala index 650257ae16..5c4bc211fc 100644 --- a/test/files/run/macro-range/Common_1.scala +++ b/test/files/run/macro-range/Common_1.scala @@ -1,4 +1,4 @@ -import reflect.makro.Context +import reflect.macros.Context abstract class RangeDefault { val from, to: Int diff --git a/test/files/run/macro-range/Expansion_Impossible_2.scala b/test/files/run/macro-range/Expansion_Impossible_2.scala index fecce6bc48..57e0cee97f 100644 --- a/test/files/run/macro-range/Expansion_Impossible_2.scala +++ b/test/files/run/macro-range/Expansion_Impossible_2.scala @@ -1,4 +1,4 @@ -import reflect.makro.Context +import reflect.macros.Context object Impls { def foreach(c: Context)(f: c.Expr[Int => Unit]): c.Expr[Unit] = { diff --git a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala index b10f4121a6..fa559334d4 100644 --- a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala +++ b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala index dd8fcd4d9e..5d7e077731 100644 --- a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala +++ b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala index 32a8958577..7a2c0a6fa9 100644 --- a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala +++ b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala @@ -9,7 +9,7 @@ object Test extends App { import scala.tools.reflect.ToolBox val macrobody = Select(Ident(newTermName("Impls")), newTermName("foo")) - val macroparam = ValDef(NoMods, newTermName("x"), TypeTree(definitions.IntClass.asType), EmptyTree) + val macroparam = ValDef(NoMods, newTermName("x"), TypeTree(definitions.IntClass.toType), EmptyTree) val macrodef = DefDef(Modifiers(MACRO), newTermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody) val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(Apply(Select(Super(This(EmptyTypeName), EmptyTypeName), nme.CONSTRUCTOR), List()))) val module = ModuleDef(NoMods, newTermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef))) diff --git a/test/files/run/macro-reify-basic/Macros_1.scala b/test/files/run/macro-reify-basic/Macros_1.scala index 8f8598e248..3f6720f10a 100644 --- a/test/files/run/macro-reify-basic/Macros_1.scala +++ b/test/files/run/macro-reify-basic/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Macros { def foo(s: String) = macro Impls.foo diff --git a/test/files/run/macro-reify-freevars/Macros_1.scala b/test/files/run/macro-reify-freevars/Macros_1.scala index df1473511d..57fdc32437 100644 --- a/test/files/run/macro-reify-freevars/Macros_1.scala +++ b/test/files/run/macro-reify-freevars/Macros_1.scala @@ -1,8 +1,8 @@ package scala.collection.slick object QueryableMacros{ - def map[T:c.TypeTag, S:c.TypeTag] - (c: scala.reflect.makro.Context) + def map[T:c.AbsTypeTag, S:c.AbsTypeTag] + (c: scala.reflect.macros.Context) (projection: c.Expr[T => S]) : c.Expr[scala.collection.slick.Queryable[S]] = { import c.universe._ diff --git a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala index b52b962e31..04714970dd 100644 --- a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala @@ -1,6 +1,6 @@ import scala.reflect.runtime.universe._ import scala.reflect.runtime.{universe => ru} -import scala.reflect.makro.Context +import scala.reflect.macros.Context case class Utils[C <: Context]( c:C ) { import c.universe._ @@ -21,9 +21,9 @@ case class Utils[C <: Context]( c:C ) { } } object QueryableMacros{ - def _helper[C <: Context,S:c.TypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + def _helper[C <: Context,S:c.AbsTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { import c.universe._ - val element_type = c.typeOf[S] + val element_type = implicitly[c.AbsTypeTag[S]].tpe val foo = c.Expr[ru.Expr[Queryable[S]]]( c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( @@ -32,8 +32,8 @@ object QueryableMacros{ ))) c.universe.reify{ Queryable.factory[S]( foo.splice )} } - def map[T:c.TypeTag, S:c.TypeTag] - (c: scala.reflect.makro.Context) + def map[T:c.AbsTypeTag, S:c.AbsTypeTag] + (c: scala.reflect.macros.Context) (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) } class Queryable[T]{ diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala index b52b962e31..04714970dd 100644 --- a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala @@ -1,6 +1,6 @@ import scala.reflect.runtime.universe._ import scala.reflect.runtime.{universe => ru} -import scala.reflect.makro.Context +import scala.reflect.macros.Context case class Utils[C <: Context]( c:C ) { import c.universe._ @@ -21,9 +21,9 @@ case class Utils[C <: Context]( c:C ) { } } object QueryableMacros{ - def _helper[C <: Context,S:c.TypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { + def _helper[C <: Context,S:c.AbsTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { import c.universe._ - val element_type = c.typeOf[S] + val element_type = implicitly[c.AbsTypeTag[S]].tpe val foo = c.Expr[ru.Expr[Queryable[S]]]( c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( @@ -32,8 +32,8 @@ object QueryableMacros{ ))) c.universe.reify{ Queryable.factory[S]( foo.splice )} } - def map[T:c.TypeTag, S:c.TypeTag] - (c: scala.reflect.makro.Context) + def map[T:c.AbsTypeTag, S:c.AbsTypeTag] + (c: scala.reflect.macros.Context) (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection ) } class Queryable[T]{ diff --git a/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala b/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala index 66c0ee1e9b..f19fd239f9 100644 --- a/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala +++ b/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { val `Answer to the Ultimate Question of Life, the Universe, and Everything` = 42 diff --git a/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala index 3ddfe6a737..f3e1c9ae95 100644 --- a/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { diff --git a/test/files/run/macro-reify-splice-splice/Macros_1.scala b/test/files/run/macro-reify-splice-splice/Macros_1.scala index 0de780b5a2..efdd5dbaa2 100644 --- a/test/files/run/macro-reify-splice-splice/Macros_1.scala +++ b/test/files/run/macro-reify-splice-splice/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Macros { def foo = macro Impls.foo diff --git a/test/files/run/macro-reify-staticXXX/Macros_1.scala b/test/files/run/macro-reify-staticXXX/Macros_1.scala index b0ce6507f8..f12c8f7dcc 100644 --- a/test/files/run/macro-reify-staticXXX/Macros_1.scala +++ b/test/files/run/macro-reify-staticXXX/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object B { override def toString = "object" } class C { override def toString = "class" } diff --git a/test/files/run/macro-reify-tagful-a/Macros_1.scala b/test/files/run/macro-reify-tagful-a/Macros_1.scala index 32b09bdcdf..0eac74236f 100644 --- a/test/files/run/macro-reify-tagful-a/Macros_1.scala +++ b/test/files/run/macro-reify-tagful-a/Macros_1.scala @@ -1,11 +1,11 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Macros { def foo[T](s: T) = macro Impls.foo[T] object Impls { - def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify { + def foo[T: c.AbsTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify { List(s.splice) } } diff --git a/test/files/run/macro-reify-tagless-a.check b/test/files/run/macro-reify-tagless-a.check index 4ee11190d6..d69f641280 100644 --- a/test/files/run/macro-reify-tagless-a.check +++ b/test/files/run/macro-reify-tagless-a.check @@ -1,3 +1,3 @@ -reflective compilation has failed: - -Macro expansion contains free type variable T defined by foo in Impls_Macros_1.scala:7:13. Have you forgotten to use c.TypeTag annotation for this type parameter? If you have troubles tracking free type variables, consider using -Xlog-free-types +reflective compilation has failed:
+
+Macro expansion contains free type variable T defined by foo in Impls_Macros_1.scala:7:13. Have you forgotten to use c.AbsTypeTag annotation for this type parameter? If you have troubles tracking free type variables, consider using -Xlog-free-types
diff --git a/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala index 77e4b729d3..96cfb75852 100644 --- a/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Macros { def foo[T](s: T) = macro Impls.foo[T] diff --git a/test/files/run/macro-reify-unreify/Macros_1.scala b/test/files/run/macro-reify-unreify/Macros_1.scala index 3e9033966d..620a929210 100644 --- a/test/files/run/macro-reify-unreify/Macros_1.scala +++ b/test/files/run/macro-reify-unreify/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Macros { def foo(s: String) = macro Impls.foo diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check index dc65e5c55b..4a50c60469 100644 --- a/test/files/run/macro-repl-basic.check +++ b/test/files/run/macro-repl-basic.check @@ -6,8 +6,8 @@ scala> scala> import language.experimental.macros
import language.experimental.macros
-scala> import scala.reflect.makro.{Context => Ctx}
-import scala.reflect.makro.{Context=>Ctx}
+scala> import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.{Context=>Ctx}
scala>
diff --git a/test/files/run/macro-repl-basic.scala b/test/files/run/macro-repl-basic.scala index fba0aab116..eae1febb3a 100644 --- a/test/files/run/macro-repl-basic.scala +++ b/test/files/run/macro-repl-basic.scala @@ -3,7 +3,7 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { def code = """ |import language.experimental.macros - |import scala.reflect.makro.{Context => Ctx} + |import scala.reflect.macros.{Context => Ctx} | |object Impls { | def foo(c: Ctx)(x: c.Expr[Int]) = { diff --git a/test/files/run/macro-repl-dontexpand.check b/test/files/run/macro-repl-dontexpand.check index 35845f0cff..3c378cdf09 100644 --- a/test/files/run/macro-repl-dontexpand.check +++ b/test/files/run/macro-repl-dontexpand.check @@ -3,8 +3,8 @@ Type :help for more information. scala>
-scala> def bar(c: scala.reflect.makro.Context) = ???
-bar: (c: scala.reflect.makro.Context)Nothing
+scala> def bar(c: scala.reflect.macros.Context) = ???
+bar: (c: scala.reflect.macros.Context)Nothing
scala> def foo = macro bar
foo: Any
diff --git a/test/files/run/macro-repl-dontexpand.scala b/test/files/run/macro-repl-dontexpand.scala index cd1b2e1969..f3422d88de 100644 --- a/test/files/run/macro-repl-dontexpand.scala +++ b/test/files/run/macro-repl-dontexpand.scala @@ -3,7 +3,7 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { override def extraSettings = "-language:experimental.macros" def code = """ - |def bar(c: scala.reflect.makro.Context) = ??? + |def bar(c: scala.reflect.macros.Context) = ??? |def foo = macro bar |""".stripMargin } diff --git a/test/files/run/macro-settings/Impls_Macros_1.scala b/test/files/run/macro-settings/Impls_Macros_1.scala index 20dcdc1bd1..83d80a5bff 100644 --- a/test/files/run/macro-settings/Impls_Macros_1.scala +++ b/test/files/run/macro-settings/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Impls { def impl(c: Context) = c.universe.reify { diff --git a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala index 013130d181..0793696fd4 100644 --- a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala +++ b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala @@ -1,10 +1,10 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Macros { def impl(c: Context) = { import c.universe._ - val inscope = c.inferImplicitValue(c.mirror.staticClass("SourceLocation").asType) + val inscope = c.inferImplicitValue(c.mirror.staticClass("SourceLocation").toType) val outer = c.Expr[SourceLocation](if (!inscope.isEmpty) inscope else Literal(Constant(null))) val Apply(fun, args) = c.enclosingImplicits(0)._2 diff --git a/test/files/run/macro-sip19/Impls_Macros_1.scala b/test/files/run/macro-sip19/Impls_Macros_1.scala index f6636c298c..f89e51f560 100644 --- a/test/files/run/macro-sip19/Impls_Macros_1.scala +++ b/test/files/run/macro-sip19/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Macros { def impl(c: Context) = { diff --git a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala index 8ed435d629..633cb930fc 100644 --- a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Macros { def impl_with_implicits_enabled(c: Context) = { diff --git a/test/files/run/macro-typecheck-macrosdisabled.check b/test/files/run/macro-typecheck-macrosdisabled.check index da1a28bc24..c560b0e4b5 100644 --- a/test/files/run/macro-typecheck-macrosdisabled.check +++ b/test/files/run/macro-typecheck-macrosdisabled.check @@ -8,11 +8,6 @@ ()
};
def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = {
- val $u: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe];
- val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $treecreator1.this.applyImpl[$u.type]($m).asInstanceOf[U#Tree]
- };
- private def applyImpl[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
$u.Literal.apply($u.Constant.apply(2))
diff --git a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala index 2c9bce92a5..b2f6f7d50e 100644 --- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Macros { def impl_with_macros_enabled(c: Context) = { diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check index 2160d3800a..55e7913250 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2.check +++ b/test/files/run/macro-typecheck-macrosdisabled2.check @@ -8,11 +8,6 @@ ()
};
def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = {
- val $u: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe];
- val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $treecreator1.this.applyImpl[$u.type]($m).asInstanceOf[U#Tree]
- };
- private def applyImpl[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#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))))
@@ -28,7 +23,7 @@ def apply[U >: Nothing <: 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").asModuleSymbol.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asTypeSymbol.asTypeConstructor))
+ $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()
diff --git a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala index 0aca9781f4..948c047351 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Macros { def impl_with_macros_enabled(c: Context) = { diff --git a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala index 7b921c0e57..3d350a50fa 100644 --- a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala +++ b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala @@ -1,5 +1,5 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Macros { def cons_impl[A: c.AbsTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.universe.reify { diff --git a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala index fdba40623b..081894cf52 100644 --- a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala +++ b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala @@ -1,8 +1,8 @@ import scala.reflect.runtime.universe._ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Macros { - def impl[T: c.TypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.universe.reify { println(c.literal(implicitly[c.TypeTag[T]].toString).splice) } + def impl[T: c.AbsTypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.universe.reify { println(c.literal(implicitly[c.AbsTypeTag[T]].toString).splice) } def foo[T](foo: T) = macro impl[T] }
\ No newline at end of file diff --git a/test/files/run/private-inline.scala b/test/files/run/private-inline.scala index a45300b026..a62007779c 100644 --- a/test/files/run/private-inline.scala +++ b/test/files/run/private-inline.scala @@ -30,7 +30,7 @@ final class A { } object Test { - def methodClasses = List("f1a", "f1b", "f2a", "f2b") map ("A$$anonfun$" + _ + "$1") + def methodClasses = List("f1a", "f2a") map ("A$$anonfun$" + _ + "$1") def main(args: Array[String]): Unit = { val a = new A diff --git a/test/files/run/reflection-allmirrors-tostring.check b/test/files/run/reflection-allmirrors-tostring.check new file mode 100644 index 0000000000..b5fe6c33bb --- /dev/null +++ b/test/files/run/reflection-allmirrors-tostring.check @@ -0,0 +1,14 @@ +class mirror for C (bound to null)
+module mirror for M (bound to null)
+instance mirror for an instance of C
+field mirror for C.f1 (bound to an instance of C)
+field mirror for C.f2 (bound to an instance of C)
+method mirror for C.m1: Int (bound to an instance of C)
+method mirror for C.m2(): Int (bound to an instance of C)
+method mirror for C.m3[T >: String <: Int]: T (bound to an instance of C)
+method mirror for C.m4[A, B <: A[Int]](x: A[B])(implicit y: Int): Nothing (bound to an instance of C)
+method mirror for C.m5(x: => Int, y: Int*): String (bound to an instance of C)
+class mirror for C.C (bound to an instance of C)
+module mirror for C.M (bound to an instance of C)
+constructor mirror for C.<init>(): C (bound to null)
+constructor mirror for C.C.<init>(): C.this.C (bound to an instance of C)
diff --git a/test/files/run/reflection-allmirrors-tostring.scala b/test/files/run/reflection-allmirrors-tostring.scala new file mode 100644 index 0000000000..73afff291c --- /dev/null +++ b/test/files/run/reflection-allmirrors-tostring.scala @@ -0,0 +1,43 @@ +import scala.reflect.runtime.universe._ + +class C { + val f1 = 2 + var f2 = 3 + + def m1 = 4 + def m2() = 5 + def m3[T >: String <: Int]: T = ??? + def m4[A[_], B <: A[Int]](x: A[B])(implicit y: Int) = ??? + def m5(x: => Int, y: Int*): String = ??? + + class C + object M + + override def toString = "an instance of C" +} +object M + +object Test extends App { + val cm = scala.reflect.runtime.currentMirror +// println(cm) + + println(cm.reflectClass(cm.staticClass("C"))) + println(cm.reflectModule(cm.staticModule("M"))) + println(cm.reflect(new C)) + + val im = cm.reflect(new C) + println(im.reflectField(typeOf[C].member(newTermName("f1")).asTerm)) + println(im.reflectField(typeOf[C].member(newTermName("f2")).asTerm)) + println(im.reflectMethod(typeOf[C].member(newTermName("m1")).asMethod)) + println(im.reflectMethod(typeOf[C].member(newTermName("m2")).asMethod)) + println(im.reflectMethod(typeOf[C].member(newTermName("m3")).asMethod)) + println(im.reflectMethod(typeOf[C].member(newTermName("m4")).asMethod)) + println(im.reflectMethod(typeOf[C].member(newTermName("m5")).asMethod)) + println(im.reflectClass(typeOf[C].member(newTypeName("C")).asClass)) + println(im.reflectModule(typeOf[C].member(newTermName("M")).asModule)) + + val c = cm.staticClass("C") + val cc = typeOf[C].member(newTypeName("C")).asClass + println(cm.reflectClass(c).reflectConstructor(c.typeSignature.member(nme.CONSTRUCTOR).asMethod)) + println(im.reflectClass(cc).reflectConstructor(cc.typeSignature.member(nme.CONSTRUCTOR).asMethod)) +}
\ No newline at end of file diff --git a/test/files/run/reflection-constructormirror-inner-badpath.scala b/test/files/run/reflection-constructormirror-inner-badpath.scala index a42bedea83..4bccff21fe 100644 --- a/test/files/run/reflection-constructormirror-inner-badpath.scala +++ b/test/files/run/reflection-constructormirror-inner-badpath.scala @@ -12,7 +12,7 @@ class Foo{ val classTag = implicitly[ClassTag[R]] val cl = classTag.runtimeClass.getClassLoader val cm = runtimeMirror(cl) - val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol + val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethod val sig = constructor.typeSignature val sym = cm.classSymbol( classTag.runtimeClass ) try { diff --git a/test/files/run/reflection-constructormirror-inner-good.scala b/test/files/run/reflection-constructormirror-inner-good.scala index c09f464b24..861332161f 100644 --- a/test/files/run/reflection-constructormirror-inner-good.scala +++ b/test/files/run/reflection-constructormirror-inner-good.scala @@ -12,7 +12,7 @@ class Foo{ val classTag = implicitly[ClassTag[R]] val cl = classTag.runtimeClass.getClassLoader val cm = runtimeMirror(cl) - val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol + val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethod val sig = constructor.typeSignature val sym = cm.classSymbol( classTag.runtimeClass ) val cls = cm.reflect( this ).reflectClass( sym ) diff --git a/test/files/run/reflection-constructormirror-nested-badpath.scala b/test/files/run/reflection-constructormirror-nested-badpath.scala index ece0044c61..2983f185de 100644 --- a/test/files/run/reflection-constructormirror-nested-badpath.scala +++ b/test/files/run/reflection-constructormirror-nested-badpath.scala @@ -8,7 +8,7 @@ class Foo{ val classTag = implicitly[ClassTag[R]] val cl = classTag.runtimeClass.getClassLoader val cm = runtimeMirror(cl) - val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol + val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethod val sig = constructor.typeSignature val sym = cm.classSymbol( classTag.runtimeClass ) try { diff --git a/test/files/run/reflection-constructormirror-nested-good.scala b/test/files/run/reflection-constructormirror-nested-good.scala index 432e9d3707..0b7c413975 100644 --- a/test/files/run/reflection-constructormirror-nested-good.scala +++ b/test/files/run/reflection-constructormirror-nested-good.scala @@ -8,7 +8,7 @@ class Foo{ val classTag = implicitly[ClassTag[R]] val cl = classTag.runtimeClass.getClassLoader val cm = runtimeMirror(cl) - val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol + val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethod val sig = constructor.typeSignature val sym = cm.classSymbol( classTag.runtimeClass ) val cls = cm.reflectClass( sym ) diff --git a/test/files/run/reflection-constructormirror-toplevel-badpath.scala b/test/files/run/reflection-constructormirror-toplevel-badpath.scala index 7a7adbd603..cf92929119 100644 --- a/test/files/run/reflection-constructormirror-toplevel-badpath.scala +++ b/test/files/run/reflection-constructormirror-toplevel-badpath.scala @@ -13,7 +13,7 @@ class Foo{ val classTag = implicitly[ClassTag[R]] val cl = classTag.runtimeClass.getClassLoader val cm = runtimeMirror(cl) - val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol + val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethod val sig = constructor.typeSignature val sym = cm.classSymbol( classTag.runtimeClass ) try { diff --git a/test/files/run/reflection-constructormirror-toplevel-good.scala b/test/files/run/reflection-constructormirror-toplevel-good.scala index 96713a11cb..b68134b2cb 100644 --- a/test/files/run/reflection-constructormirror-toplevel-good.scala +++ b/test/files/run/reflection-constructormirror-toplevel-good.scala @@ -13,7 +13,7 @@ class Foo{ val classTag = implicitly[ClassTag[R]] val cl = classTag.runtimeClass.getClassLoader val cm = runtimeMirror(cl) - val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol + val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethod val sig = constructor.typeSignature val sym = cm.classSymbol( classTag.runtimeClass ) val cls = cm.reflectClass( sym ) diff --git a/test/files/run/reflection-enclosed-basic.check b/test/files/run/reflection-enclosed-basic.check new file mode 100644 index 0000000000..41f6a72f1c --- /dev/null +++ b/test/files/run/reflection-enclosed-basic.check @@ -0,0 +1,18 @@ +class B1
+B1
+1
+class B2
+B2
+2
+object B3
+B3
+3
+object B4
+B4
+4
+object B5
+B5
+5
+object B6
+B6
+6
diff --git a/test/files/run/reflection-enclosed-basic.scala b/test/files/run/reflection-enclosed-basic.scala new file mode 100644 index 0000000000..1dcb6c2a27 --- /dev/null +++ b/test/files/run/reflection-enclosed-basic.scala @@ -0,0 +1,46 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.{classTag, ClassTag} + +class B1 { override def toString = "B1"; def foo = 1 } +private class B2 { override def toString = "B2"; def foo = 2 } +object B3 { override def toString = "B3"; def foo = 3 } +private object B4 { override def toString = "B4"; def foo = 4 } +object B5 extends B1 { override def toString = "B5"; override def foo = 5 } +private object B6 extends B2 { override def toString = "B6"; override def foo = 6 } + +object Test extends App { + def testMethodInvocation(instance: Any) = { + val instanceMirror = cm.reflect(instance) + val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val methodMirror = instanceMirror.reflectMethod(method) + println(methodMirror()) + } + + def testNestedClass(name: String) = { + val sym = cm.staticClass(name) + println(sym) + val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctorMirror = cm.reflectClass(sym).reflectConstructor(ctor) + val instance = ctorMirror() + println(instance) + testMethodInvocation(instance) + } + + testNestedClass("B1") + testNestedClass("B2") + + def testNestedModule(name: String) = { + val sym = cm.staticModule(name) + println(sym) + val moduleMirror = cm.reflectModule(sym) + val instance = moduleMirror.instance + println(instance) + testMethodInvocation(instance) + } + + testNestedModule("B3") + testNestedModule("B4") + testNestedModule("B5") + testNestedModule("B6") +} diff --git a/test/files/run/reflection-enclosed-inner-basic.check b/test/files/run/reflection-enclosed-inner-basic.check new file mode 100644 index 0000000000..984fb1ff12 --- /dev/null +++ b/test/files/run/reflection-enclosed-inner-basic.check @@ -0,0 +1,20 @@ +class B
+List(constructor B, class B1, class B2, object B3, object B4, object B5, object B6)
+class B1
+B1
+1
+class B2
+B2
+2
+object B3
+B3
+3
+object B4
+B4
+4
+object B5
+B5
+5
+object B6
+B6
+6
diff --git a/test/files/run/reflection-enclosed-inner-basic.scala b/test/files/run/reflection-enclosed-inner-basic.scala new file mode 100644 index 0000000000..2b2c701993 --- /dev/null +++ b/test/files/run/reflection-enclosed-inner-basic.scala @@ -0,0 +1,52 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.{classTag, ClassTag} + +class B { + class B1 { override def toString = "B1"; def foo = 1 } + private class B2 { override def toString = "B2"; def foo = 2 } + object B3 { override def toString = "B3"; def foo = 3 } + private object B4 { override def toString = "B4"; def foo = 4 } + object B5 extends B1 { override def toString = "B5"; override def foo = 5 } + private object B6 extends B2 { override def toString = "B6"; override def foo = 6 } +} + +object Test extends App { + val b = cm.classSymbol(classTag[B].runtimeClass) + println(b) + println(b.typeSignature.declarations.toList) + + def testMethodInvocation(instance: Any) = { + val instanceMirror = cm.reflect(instance) + val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val methodMirror = instanceMirror.reflectMethod(method) + println(methodMirror()) + } + + def testInnerClass(name: String) = { + val sym = b.typeSignature.declaration(newTypeName(name)).asClass + println(sym) + val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctorMirror = cm.reflect(new B).reflectClass(sym).reflectConstructor(ctor) + val instance = ctorMirror() + println(instance) + testMethodInvocation(instance) + } + + testInnerClass("B1") + testInnerClass("B2") + + def testInnerModule(name: String) = { + val sym = b.typeSignature.declaration(newTermName(name)).asModule + println(sym) + val moduleMirror = cm.reflect(new B).reflectModule(sym) + val instance = moduleMirror.instance + println(instance) + testMethodInvocation(instance) + } + + testInnerModule("B3") + testInnerModule("B4") + testInnerModule("B5") + testInnerModule("B6") +} diff --git a/test/files/run/reflection-enclosed-inner-inner-basic.check b/test/files/run/reflection-enclosed-inner-inner-basic.check new file mode 100644 index 0000000000..8987f31b18 --- /dev/null +++ b/test/files/run/reflection-enclosed-inner-inner-basic.check @@ -0,0 +1,20 @@ +class BB
+List(constructor BB, class B1, class B2, object B3, object B4, object B5, object B6)
+class B1
+B1
+1
+class B2
+B2
+2
+object B3
+B3
+3
+object B4
+B4
+4
+object B5
+B5
+5
+object B6
+B6
+6
diff --git a/test/files/run/reflection-enclosed-inner-inner-basic.scala b/test/files/run/reflection-enclosed-inner-inner-basic.scala new file mode 100644 index 0000000000..1b9e19d37d --- /dev/null +++ b/test/files/run/reflection-enclosed-inner-inner-basic.scala @@ -0,0 +1,58 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.{classTag, ClassTag} + +class B { + class BB { + class B1 { override def toString = "B1"; def foo = 1 } + private class B2 { override def toString = "B2"; def foo = 2 } + object B3 { override def toString = "B3"; def foo = 3 } + private object B4 { override def toString = "B4"; def foo = 4 } + object B5 extends B1 { override def toString = "B5"; override def foo = 5 } + private object B6 extends B2 { override def toString = "B6"; override def foo = 6 } + } +} + +object Test extends App { + val b = cm.classSymbol(classTag[B#BB].runtimeClass) + println(b) + println(b.typeSignature.declarations.toList) + + def testMethodInvocation(instance: Any) = { + val instanceMirror = cm.reflect(instance) + val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val methodMirror = instanceMirror.reflectMethod(method) + println(methodMirror()) + } + + def testInnerClass(name: String) = { + val sym = b.typeSignature.declaration(newTypeName(name)).asClass + println(sym) + val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val outer1 = new B + val outer2 = new outer1.BB + val ctorMirror = cm.reflect(outer2).reflectClass(sym).reflectConstructor(ctor) + val instance = ctorMirror() + println(instance) + testMethodInvocation(instance) + } + + testInnerClass("B1") + testInnerClass("B2") + + def testInnerModule(name: String) = { + val sym = b.typeSignature.declaration(newTermName(name)).asModule + println(sym) + val outer1 = new B + val outer2 = new outer1.BB + val moduleMirror = cm.reflect(outer2).reflectModule(sym) + val instance = moduleMirror.instance + println(instance) + testMethodInvocation(instance) + } + + testInnerModule("B3") + testInnerModule("B4") + testInnerModule("B5") + testInnerModule("B6") +} diff --git a/test/files/run/reflection-enclosed-inner-nested-basic.check b/test/files/run/reflection-enclosed-inner-nested-basic.check new file mode 100644 index 0000000000..0f5176a6e7 --- /dev/null +++ b/test/files/run/reflection-enclosed-inner-nested-basic.check @@ -0,0 +1,20 @@ +object BB +List(constructor BB, class B1, class B2, object B3, object B4, object B5, object B6) +class B1 +B1 +1 +class B2 +B2 +2 +object B3 +B3 +3 +object B4 +B4 +4 +object B5 +B5 +5 +object B6 +B6 +6 diff --git a/test/files/run/reflection-enclosed-inner-nested-basic.scala b/test/files/run/reflection-enclosed-inner-nested-basic.scala new file mode 100644 index 0000000000..2800ee2548 --- /dev/null +++ b/test/files/run/reflection-enclosed-inner-nested-basic.scala @@ -0,0 +1,55 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.{classTag, ClassTag} + +class B { + object BB { + class B1 { override def toString = "B1"; def foo = 1 } + private class B2 { override def toString = "B2"; def foo = 2 } + object B3 { override def toString = "B3"; def foo = 3 } + private object B4 { override def toString = "B4"; def foo = 4 } + object B5 extends B1 { override def toString = "B5"; override def foo = 5 } + private object B6 extends B2 { override def toString = "B6"; override def foo = 6 } + } +} + +object Test extends App { + val outer1 = new B() + val b = cm.moduleSymbol(classTag[outer1.BB.type].runtimeClass) + println(b) + println(b.typeSignature.declarations.toList) + + def testMethodInvocation(instance: Any) = { + val instanceMirror = cm.reflect(instance) + val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val methodMirror = instanceMirror.reflectMethod(method) + println(methodMirror()) + } + + def testNestedClass(name: String) = { + val sym = b.typeSignature.declaration(newTypeName(name)).asClass + println(sym) + val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctorMirror = cm.reflect(outer1.BB).reflectClass(sym).reflectConstructor(ctor) + val instance = ctorMirror() + println(instance) + testMethodInvocation(instance) + } + + testNestedClass("B1") + testNestedClass("B2") + + def testNestedModule(name: String) = { + val sym = b.typeSignature.declaration(newTermName(name)).asModule + println(sym) + val moduleMirror = cm.reflect(outer1.BB).reflectModule(sym) + val instance = moduleMirror.instance + println(instance) + testMethodInvocation(instance) + } + + testNestedModule("B3") + testNestedModule("B4") + testNestedModule("B5") + testNestedModule("B6") +} diff --git a/test/files/run/reflection-enclosed-nested-basic.check b/test/files/run/reflection-enclosed-nested-basic.check new file mode 100644 index 0000000000..b0e61149f8 --- /dev/null +++ b/test/files/run/reflection-enclosed-nested-basic.check @@ -0,0 +1,20 @@ +object B +List(constructor B, class B1, class B2, object B3, object B4, object B5, object B6) +class B1 +B1 +1 +class B2 +B2 +2 +object B3 +B3 +3 +object B4 +B4 +4 +object B5 +B5 +5 +object B6 +B6 +6 diff --git a/test/files/run/reflection-enclosed-nested-basic.scala b/test/files/run/reflection-enclosed-nested-basic.scala new file mode 100644 index 0000000000..8b740c2da2 --- /dev/null +++ b/test/files/run/reflection-enclosed-nested-basic.scala @@ -0,0 +1,52 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.{classTag, ClassTag} + +object B { + class B1 { override def toString = "B1"; def foo = 1 } + private class B2 { override def toString = "B2"; def foo = 2 } + object B3 { override def toString = "B3"; def foo = 3 } + private object B4 { override def toString = "B4"; def foo = 4 } + object B5 extends B1 { override def toString = "B5"; override def foo = 5 } + private object B6 extends B2 { override def toString = "B6"; override def foo = 6 } +} + +object Test extends App { + val b = cm.moduleSymbol(classTag[B.type].runtimeClass) + println(b) + println(b.typeSignature.declarations.toList) + + def testMethodInvocation(instance: Any) = { + val instanceMirror = cm.reflect(instance) + val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val methodMirror = instanceMirror.reflectMethod(method) + println(methodMirror()) + } + + def testNestedClass(name: String) = { + val sym = b.typeSignature.declaration(newTypeName(name)).asClass + println(sym) + val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctorMirror = cm.reflectClass(sym).reflectConstructor(ctor) + val instance = ctorMirror() + println(instance) + testMethodInvocation(instance) + } + + testNestedClass("B1") + testNestedClass("B2") + + def testNestedModule(name: String) = { + val sym = b.typeSignature.declaration(newTermName(name)).asModule + println(sym) + val moduleMirror = cm.reflectModule(sym) + val instance = moduleMirror.instance + println(instance) + testMethodInvocation(instance) + } + + testNestedModule("B3") + testNestedModule("B4") + testNestedModule("B5") + testNestedModule("B6") +} diff --git a/test/files/run/reflection-enclosed-nested-inner-basic.check b/test/files/run/reflection-enclosed-nested-inner-basic.check new file mode 100644 index 0000000000..add7a81c0a --- /dev/null +++ b/test/files/run/reflection-enclosed-nested-inner-basic.check @@ -0,0 +1,20 @@ +class BB +List(constructor BB, class B1, class B2, object B3, object B4, object B5, object B6) +class B1 +B1 +1 +class B2 +B2 +2 +object B3 +B3 +3 +object B4 +B4 +4 +object B5 +B5 +5 +object B6 +B6 +6 diff --git a/test/files/run/reflection-enclosed-nested-inner-basic.scala b/test/files/run/reflection-enclosed-nested-inner-basic.scala new file mode 100644 index 0000000000..7466733d37 --- /dev/null +++ b/test/files/run/reflection-enclosed-nested-inner-basic.scala @@ -0,0 +1,54 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.{classTag, ClassTag} + +object B { + class BB { + class B1 { override def toString = "B1"; def foo = 1 } + private class B2 { override def toString = "B2"; def foo = 2 } + object B3 { override def toString = "B3"; def foo = 3 } + private object B4 { override def toString = "B4"; def foo = 4 } + object B5 extends B1 { override def toString = "B5"; override def foo = 5 } + private object B6 extends B2 { override def toString = "B6"; override def foo = 6 } + } +} + +object Test extends App { + val b = cm.classSymbol(classTag[B.BB].runtimeClass) + println(b) + println(b.typeSignature.declarations.toList) + + def testMethodInvocation(instance: Any) = { + val instanceMirror = cm.reflect(instance) + val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val methodMirror = instanceMirror.reflectMethod(method) + println(methodMirror()) + } + + def testInnerClass(name: String) = { + val sym = b.typeSignature.declaration(newTypeName(name)).asClass + println(sym) + val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctorMirror = cm.reflect(new B.BB).reflectClass(sym).reflectConstructor(ctor) + val instance = ctorMirror() + println(instance) + testMethodInvocation(instance) + } + + testInnerClass("B1") + testInnerClass("B2") + + def testInnerModule(name: String) = { + val sym = b.typeSignature.declaration(newTermName(name)).asModule + println(sym) + val moduleMirror = cm.reflect(new B.BB).reflectModule(sym) + val instance = moduleMirror.instance + println(instance) + testMethodInvocation(instance) + } + + testInnerModule("B3") + testInnerModule("B4") + testInnerModule("B5") + testInnerModule("B6") +} diff --git a/test/files/run/reflection-enclosed-nested-nested-basic.check b/test/files/run/reflection-enclosed-nested-nested-basic.check new file mode 100644 index 0000000000..0f5176a6e7 --- /dev/null +++ b/test/files/run/reflection-enclosed-nested-nested-basic.check @@ -0,0 +1,20 @@ +object BB +List(constructor BB, class B1, class B2, object B3, object B4, object B5, object B6) +class B1 +B1 +1 +class B2 +B2 +2 +object B3 +B3 +3 +object B4 +B4 +4 +object B5 +B5 +5 +object B6 +B6 +6 diff --git a/test/files/run/reflection-enclosed-nested-nested-basic.scala b/test/files/run/reflection-enclosed-nested-nested-basic.scala new file mode 100644 index 0000000000..8335ea482a --- /dev/null +++ b/test/files/run/reflection-enclosed-nested-nested-basic.scala @@ -0,0 +1,54 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.{classTag, ClassTag} + +object B { + object BB { + class B1 { override def toString = "B1"; def foo = 1 } + private class B2 { override def toString = "B2"; def foo = 2 } + object B3 { override def toString = "B3"; def foo = 3 } + private object B4 { override def toString = "B4"; def foo = 4 } + object B5 extends B1 { override def toString = "B5"; override def foo = 5 } + private object B6 extends B2 { override def toString = "B6"; override def foo = 6 } + } +} + +object Test extends App { + val b = cm.moduleSymbol(classTag[B.BB.type].runtimeClass) + println(b) + println(b.typeSignature.declarations.toList) + + def testMethodInvocation(instance: Any) = { + val instanceMirror = cm.reflect(instance) + val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val methodMirror = instanceMirror.reflectMethod(method) + println(methodMirror()) + } + + def testNestedClass(name: String) = { + val sym = b.typeSignature.declaration(newTypeName(name)).asClass + println(sym) + val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctorMirror = cm.reflectClass(sym).reflectConstructor(ctor) + val instance = ctorMirror() + println(instance) + testMethodInvocation(instance) + } + + testNestedClass("B1") + testNestedClass("B2") + + def testNestedModule(name: String) = { + val sym = b.typeSignature.declaration(newTermName(name)).asModule + println(sym) + val moduleMirror = cm.reflectModule(sym) + val instance = moduleMirror.instance + println(instance) + testMethodInvocation(instance) + } + + testNestedModule("B3") + testNestedModule("B4") + testNestedModule("B5") + testNestedModule("B6") +} diff --git a/test/files/run/reflection-equality.check b/test/files/run/reflection-equality.check index feafb58d3b..be531fbbd3 100644 --- a/test/files/run/reflection-equality.check +++ b/test/files/run/reflection-equality.check @@ -29,7 +29,7 @@ java.lang.Object { def methodIntIntInt: <?>
}
-scala> val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethodSymbol
+scala> val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethod
ms: reflect.runtime.universe.MethodSymbol = method methodIntIntInt
scala> val MethodType( _, t1 ) = ms.typeSignature
diff --git a/test/files/run/reflection-equality.scala b/test/files/run/reflection-equality.scala index 35dc47a59f..8fc82721e7 100644 --- a/test/files/run/reflection-equality.scala +++ b/test/files/run/reflection-equality.scala @@ -11,7 +11,7 @@ object Test extends ReplTest { |def im: InstanceMirror = cm.reflect(new X) |val cs: ClassSymbol = im.symbol |val ts: Type = cs.typeSignature - |val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethodSymbol + |val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethod |val MethodType( _, t1 ) = ms.typeSignature |val t2 = typeOf[scala.Int] |t1 == t2 diff --git a/test/files/run/reflection-fieldmirror-accessorsareokay.scala b/test/files/run/reflection-fieldmirror-accessorsareokay.scala index c586ce9bdd..9590cbe811 100644 --- a/test/files/run/reflection-fieldmirror-accessorsareokay.scala +++ b/test/files/run/reflection-fieldmirror-accessorsareokay.scala @@ -13,7 +13,7 @@ object Test extends App { def test(f: Symbol) = { try { - val fm: FieldMirror = im.reflectField(f.asTermSymbol) + val fm: FieldMirror = im.reflectField(f.asTerm) println(fm.symbol.isVariable) println(fm.get) fm.set(2) @@ -24,6 +24,6 @@ object Test extends App { } } - test(cs.typeSignature.declaration(newTermName("x")).asTermSymbol) - test(cs.typeSignature.declaration(newTermName("x_$eq")).asTermSymbol) + test(cs.typeSignature.declaration(newTermName("x")).asTerm) + test(cs.typeSignature.declaration(newTermName("x_$eq")).asTerm) } diff --git a/test/files/run/reflection-fieldmirror-ctorparam.scala b/test/files/run/reflection-fieldmirror-ctorparam.scala index fa9dd81d7f..b9d50fe97b 100644 --- a/test/files/run/reflection-fieldmirror-ctorparam.scala +++ b/test/files/run/reflection-fieldmirror-ctorparam.scala @@ -10,7 +10,7 @@ object Test extends App { val im: InstanceMirror = cm.reflect(a) val cs = im.symbol - val f = cs.typeSignature.declaration(newTermName("x")).asTermSymbol + val f = cs.typeSignature.declaration(newTermName("x")).asTerm try { val fm: FieldMirror = im.reflectField(f) println(fm.get) diff --git a/test/files/run/reflection-fieldmirror-getsetval.scala b/test/files/run/reflection-fieldmirror-getsetval.scala index af9a6e4c56..67c54d9708 100644 --- a/test/files/run/reflection-fieldmirror-getsetval.scala +++ b/test/files/run/reflection-fieldmirror-getsetval.scala @@ -10,7 +10,7 @@ object Test extends App { val im: InstanceMirror = cm.reflect(a) val cs = im.symbol - val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol + val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm val fm: FieldMirror = im.reflectField(f) try { println(fm.get) diff --git a/test/files/run/reflection-fieldmirror-getsetvar.scala b/test/files/run/reflection-fieldmirror-getsetvar.scala index d9fbdaade0..abcf396dd1 100644 --- a/test/files/run/reflection-fieldmirror-getsetvar.scala +++ b/test/files/run/reflection-fieldmirror-getsetvar.scala @@ -10,7 +10,7 @@ object Test extends App { val im: InstanceMirror = cm.reflect(a) val cs = im.symbol - val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol + val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm val fm: FieldMirror = im.reflectField(f) println(fm.get) fm.set(2) diff --git a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala index d89e6a90ef..5cfe583ed5 100644 --- a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala +++ b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala @@ -10,7 +10,7 @@ object Test extends App { val im: InstanceMirror = cm.reflect(a) val cs = im.symbol - val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol + val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm val fm: FieldMirror = im.reflectField(f) println(fm.symbol.isVariable) } diff --git a/test/files/run/reflection-fieldmirror-privatethis.scala b/test/files/run/reflection-fieldmirror-privatethis.scala index 0c415e09e4..7aa179958d 100644 --- a/test/files/run/reflection-fieldmirror-privatethis.scala +++ b/test/files/run/reflection-fieldmirror-privatethis.scala @@ -10,7 +10,7 @@ object Test extends App { val im: InstanceMirror = cm.reflect(a) val cs = im.symbol - val f = cs.typeSignature.declaration(newTermName("x")).asTermSymbol + val f = cs.typeSignature.declaration(newTermName("x")).asTerm val fm: FieldMirror = im.reflectField(f) println(fm.symbol.isVariable) println(fm.get) diff --git a/test/files/run/reflection-fieldsymbol-navigation.check b/test/files/run/reflection-fieldsymbol-navigation.check new file mode 100644 index 0000000000..79f0928ea5 --- /dev/null +++ b/test/files/run/reflection-fieldsymbol-navigation.check @@ -0,0 +1,6 @@ +method x
+false
+variable x
+true
+method x
+method x_=
diff --git a/test/files/run/reflection-fieldsymbol-navigation.scala b/test/files/run/reflection-fieldsymbol-navigation.scala new file mode 100644 index 0000000000..da4612a564 --- /dev/null +++ b/test/files/run/reflection-fieldsymbol-navigation.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ + +class C { + var x = 2 +} + +object Test extends App { + val x = typeOf[C].member(newTermName("x")).asTerm + println(x) + println(x.isVariable) + println(x.accessed) + println(x.accessed.asTerm.isVariable) + println(x.getter) + println(x.setter) +}
\ No newline at end of file diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check new file mode 100644 index 0000000000..674716adfe --- /dev/null +++ b/test/files/run/reflection-magicsymbols-invoke.check @@ -0,0 +1,124 @@ +============ +Any
+it's important to print the list of Any's members
+if some of them change (possibly, adding and/or removing magic symbols), we must update this test
+method !=: (x$1: Any)Boolean
+method ##: ()Int
+method ==: (x$1: Any)Boolean
+method asInstanceOf: [T0]=> T0
+method equals: (x$1: Any)Boolean
+method getClass: ()java.lang.Class[_]
+method hashCode: ()Int
+method isInstanceOf: [T0]=> Boolean
+method toString: ()java.lang.String
+testing Any.!=: false
+testing Any.##: 50
+testing Any.==: true
+testing Any.asInstanceOf: class scala.ScalaReflectionException: Any.asInstanceOf requires a type argument, it cannot be invoked with mirrors
+testing Any.asInstanceOf: class scala.ScalaReflectionException: scala.Any.asInstanceOf[T0]: T0 takes 0 arguments
+testing Any.equals: true
+testing Any.getClass: class java.lang.String
+testing Any.hashCode: 50
+testing Any.isInstanceOf: class scala.ScalaReflectionException: Any.isInstanceOf requires a type argument, it cannot be invoked with mirrors
+testing Any.isInstanceOf: class scala.ScalaReflectionException: scala.Any.isInstanceOf[T0]: Boolean takes 0 arguments
+testing Any.toString: 2
+============ +AnyVal
+it's important to print the list of AnyVal's members
+if some of them change (possibly, adding and/or removing magic symbols), we must update this test
+constructor AnyVal: ()AnyVal
+method getClass: ()Class[_ <: AnyVal]
+testing AnyVal.<init>: class java.lang.InstantiationException: null
+testing AnyVal.getClass: class scala.ScalaReflectionException: expected a member of class Integer, you provided method scala.AnyVal.getClass
+============ +AnyRef
+it's important to print the list of AnyRef's members
+if some of them change (possibly, adding and/or removing magic symbols), we must update this test
+constructor Object: ()java.lang.Object
+method !=: (x$1: Any)Boolean
+method !=: (x$1: AnyRef)Boolean
+method ##: ()Int
+method $asInstanceOf: [T0]()T0
+method $isInstanceOf: [T0]()Boolean
+method ==: (x$1: Any)Boolean
+method ==: (x$1: AnyRef)Boolean
+method asInstanceOf: [T0]=> T0
+method clone: ()java.lang.Object
+method eq: (x$1: AnyRef)Boolean
+method equals: (x$1: Any)Boolean
+method finalize: ()Unit
+method getClass: ()java.lang.Class[_]
+method hashCode: ()Int
+method isInstanceOf: [T0]=> Boolean
+method ne: (x$1: AnyRef)Boolean
+method notify: ()Unit
+method notifyAll: ()Unit
+method synchronized: [T0](x$1: T0)T0
+method toString: ()java.lang.String
+method wait: ()Unit
+method wait: (x$1: Long)Unit
+method wait: (x$1: Long, x$2: Int)Unit
+testing Object.!=: false
+testing Object.##: 50
+testing Object.$asInstanceOf: class scala.ScalaReflectionException: AnyRef.$asInstanceOf is an internal method, it cannot be invoked with mirrors
+testing Object.$asInstanceOf: class scala.ScalaReflectionException: java.lang.Object.$asInstanceOf[T0](): T0 takes 0 arguments
+testing Object.$isInstanceOf: class scala.ScalaReflectionException: AnyRef.$isInstanceOf is an internal method, it cannot be invoked with mirrors
+testing Object.$isInstanceOf: class scala.ScalaReflectionException: java.lang.Object.$isInstanceOf[T0](): Boolean takes 0 arguments
+testing Object.==: true
+testing Object.clone: class java.lang.CloneNotSupportedException: java.lang.String
+testing Object.eq: true
+testing Object.equals: true
+testing Object.finalize: ()
+testing Object.getClass: class java.lang.String
+testing Object.hashCode: 50
+testing Object.ne: false
+testing Object.notify: class java.lang.IllegalMonitorStateException: null
+testing Object.notifyAll: class java.lang.IllegalMonitorStateException: null
+testing Object.synchronized: 2
+testing Object.toString: 2
+TODO: also test AnyRef.wait overloads
+============ +Array
+it's important to print the list of Array's members
+if some of them change (possibly, adding and/or removing magic symbols), we must update this test
+constructor Array: (_length: Int)Array[T]
+constructor Object: ()java.lang.Object
+method !=: (x$1: Any)Boolean
+method !=: (x$1: AnyRef)Boolean
+method ##: ()Int
+method $asInstanceOf: [T0]()T0
+method $isInstanceOf: [T0]()Boolean
+method ==: (x$1: Any)Boolean
+method ==: (x$1: AnyRef)Boolean
+method apply: (i: <?>)T
+method asInstanceOf: [T0]=> T0
+method clone: ()Array[T]
+method eq: (x$1: AnyRef)Boolean
+method equals: (x$1: Any)Boolean
+method finalize: ()Unit
+method getClass: ()java.lang.Class[_]
+method hashCode: ()Int
+method isInstanceOf: [T0]=> Boolean
+method length: => Int
+method ne: (x$1: AnyRef)Boolean
+method notify: ()Unit
+method notifyAll: ()Unit
+method synchronized: [T0](x$1: T0)T0
+method toString: ()java.lang.String
+method update: (i: <?>, x: <?>)Unit
+method wait: ()Unit
+method wait: (x$1: Long)Unit
+method wait: (x$1: Long, x$2: Int)Unit
+value _length: Int
+testing Array.length: 2
+testing Array.apply: 1
+testing Array.update: ()
+testing Array.clone: List(1, 2)
+============ +Other
+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
diff --git a/test/files/run/reflection-magicsymbols-invoke.scala b/test/files/run/reflection-magicsymbols-invoke.scala new file mode 100644 index 0000000000..61ecc6458d --- /dev/null +++ b/test/files/run/reflection-magicsymbols-invoke.scala @@ -0,0 +1,94 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe.definitions._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + def key(sym: Symbol) = sym + ": " + sym.typeSignature + def test(tpe: Type, receiver: Any, method: String, args: Any*) { + def wrap[T](op: => T) = + try { + var result = op.asInstanceOf[AnyRef] + if (scala.runtime.ScalaRunTime.isArray(result)) + result = scala.runtime.ScalaRunTime.toObjectArray(result).toList + println(result) + } catch { + case ex: Throwable => + val realex = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex) + println(realex.getClass + ": " + realex.getMessage) + } + print(s"testing ${tpe.typeSymbol.name}.$method: ") + wrap({ + if (method == nme.CONSTRUCTOR.toString) { + val ctor = tpe.declaration(nme.CONSTRUCTOR).asMethod + cm.reflectClass(ctor.owner.asClass).reflectConstructor(ctor)(args: _*) + } else { + val meth = tpe.declaration(newTermName(method).encodedName.toTermName).asMethod + cm.reflect(receiver).reflectMethod(meth)(args: _*) + } + }) + } + + println("============\nAny") + println("it's important to print the list of Any's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + typeOf[Any].members.toList.sortBy(key).foreach(sym => println(key(sym))) + test(typeOf[Any], "2", "!=", "2") + test(typeOf[Any], "2", "##") + test(typeOf[Any], "2", "==", "2") + test(typeOf[Any], "2", "asInstanceOf") + test(typeOf[Any], "2", "asInstanceOf", typeOf[String]) + test(typeOf[Any], "2", "equals", "2") + test(typeOf[Any], "2", "getClass") + test(typeOf[Any], "2", "hashCode") + test(typeOf[Any], "2", "isInstanceOf") + test(typeOf[Any], "2", "isInstanceOf", typeOf[String]) + test(typeOf[Any], "2", "toString") + + println("============\nAnyVal") + println("it's important to print the list of AnyVal's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + typeOf[AnyVal].declarations.toList.sortBy(key).foreach(sym => println(key(sym))) + test(typeOf[AnyVal], null, "<init>") + test(typeOf[AnyVal], 2, "getClass") + + println("============\nAnyRef") + println("it's important to print the list of AnyRef's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + typeOf[AnyRef].members.toList.sortBy(key).foreach(sym => println(key(sym))) + test(typeOf[AnyRef], "2", "!=", "2") + test(typeOf[AnyRef], "2", "##") + test(typeOf[AnyRef], "2", "$asInstanceOf") + test(typeOf[AnyRef], "2", "$asInstanceOf", typeOf[String]) + test(typeOf[AnyRef], "2", "$isInstanceOf") + test(typeOf[AnyRef], "2", "$isInstanceOf", typeOf[String]) + test(typeOf[AnyRef], "2", "==", "2") + test(typeOf[AnyRef], "2", "clone") + test(typeOf[AnyRef], "2", "eq", "2") + test(typeOf[AnyRef], "2", "equals", "2") + test(typeOf[AnyRef], "2", "finalize") + test(typeOf[AnyRef], "2", "getClass") + test(typeOf[AnyRef], "2", "hashCode") + test(typeOf[AnyRef], "2", "ne", "2") + test(typeOf[AnyRef], "2", "notify") + test(typeOf[AnyRef], "2", "notifyAll") + test(typeOf[AnyRef], "2", "synchronized", "2") + test(typeOf[AnyRef], "2", "toString") + println("TODO: also test AnyRef.wait overloads") + + println("============\nArray") + println("it's important to print the list of Array's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + ArrayClass.typeSignature.members.toList.sortBy(key).foreach(sym => println(key(sym))) + test(ArrayClass.typeSignature, Array(1, 2), "length") + test(ArrayClass.typeSignature, Array(1, 2), "apply", 0) + test(ArrayClass.typeSignature, Array(1, 2), "update", 0, 0) + test(ArrayClass.typeSignature, Array(1, 2), "clone") + + println("============\nOther") + test(typeOf[String], "2", "+", 3) + + 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") +}
\ No newline at end of file diff --git a/test/files/run/reflection-methodsymbol-params.check b/test/files/run/reflection-methodsymbol-params.check new file mode 100644 index 0000000000..11f349d52b --- /dev/null +++ b/test/files/run/reflection-methodsymbol-params.check @@ -0,0 +1,8 @@ +List()
+List(List())
+List(List(value x))
+List(List(value x), List(value y))
+List()
+List(List())
+List(List(value x))
+List(List(value x), List(value y))
diff --git a/test/files/run/reflection-methodsymbol-params.scala b/test/files/run/reflection-methodsymbol-params.scala new file mode 100644 index 0000000000..7174c6f49b --- /dev/null +++ b/test/files/run/reflection-methodsymbol-params.scala @@ -0,0 +1,24 @@ +import scala.reflect.runtime.universe._ + +class C { + def x1: Int = ??? + def x2(): Int = ??? + def x3(x: Int): Int = ??? + def x4(x: Int)(y: Int): Int = ??? + + def y1[T]: Int = ??? + def y2[T](): Int = ??? + def y3[T](x: Int): Int = ??? + def y4[T](x: Int)(y: Int): Int = ??? +} + +object Test extends App { + println(typeOf[C].member(newTermName("x1")).asMethod.params) + println(typeOf[C].member(newTermName("x2")).asMethod.params) + println(typeOf[C].member(newTermName("x3")).asMethod.params) + println(typeOf[C].member(newTermName("x4")).asMethod.params) + println(typeOf[C].member(newTermName("y1")).asMethod.params) + println(typeOf[C].member(newTermName("y2")).asMethod.params) + println(typeOf[C].member(newTermName("y3")).asMethod.params) + println(typeOf[C].member(newTermName("y4")).asMethod.params) +}
\ No newline at end of file diff --git a/test/files/run/reflection-methodsymbol-returntype.check b/test/files/run/reflection-methodsymbol-returntype.check new file mode 100644 index 0000000000..0f30d1beaf --- /dev/null +++ b/test/files/run/reflection-methodsymbol-returntype.check @@ -0,0 +1,8 @@ +Int
+Int
+Int
+Int
+Int
+Int
+Int
+Int
diff --git a/test/files/run/reflection-methodsymbol-returntype.scala b/test/files/run/reflection-methodsymbol-returntype.scala new file mode 100644 index 0000000000..392754dbe4 --- /dev/null +++ b/test/files/run/reflection-methodsymbol-returntype.scala @@ -0,0 +1,24 @@ +import scala.reflect.runtime.universe._ + +class C { + def x1: Int = ??? + def x2(): Int = ??? + def x3(x: Int): Int = ??? + def x4(x: Int)(y: Int): Int = ??? + + def y1[T]: Int = ??? + def y2[T](): Int = ??? + def y3[T](x: Int): Int = ??? + def y4[T](x: Int)(y: Int): Int = ??? +} + +object Test extends App { + println(typeOf[C].member(newTermName("x1")).asMethod.returnType) + println(typeOf[C].member(newTermName("x2")).asMethod.returnType) + println(typeOf[C].member(newTermName("x3")).asMethod.returnType) + println(typeOf[C].member(newTermName("x4")).asMethod.returnType) + println(typeOf[C].member(newTermName("y1")).asMethod.returnType) + println(typeOf[C].member(newTermName("y2")).asMethod.returnType) + println(typeOf[C].member(newTermName("y3")).asMethod.returnType) + println(typeOf[C].member(newTermName("y4")).asMethod.returnType) +}
\ No newline at end of file diff --git a/test/files/run/reflection-methodsymbol-typeparams.check b/test/files/run/reflection-methodsymbol-typeparams.check new file mode 100644 index 0000000000..c888e09a17 --- /dev/null +++ b/test/files/run/reflection-methodsymbol-typeparams.check @@ -0,0 +1,8 @@ +List()
+List()
+List()
+List()
+List(type T)
+List(type T)
+List(type T)
+List(type T)
diff --git a/test/files/run/reflection-methodsymbol-typeparams.scala b/test/files/run/reflection-methodsymbol-typeparams.scala new file mode 100644 index 0000000000..bb0a3c3aec --- /dev/null +++ b/test/files/run/reflection-methodsymbol-typeparams.scala @@ -0,0 +1,24 @@ +import scala.reflect.runtime.universe._ + +class C { + def x1: Int = ??? + def x2(): Int = ??? + def x3(x: Int): Int = ??? + def x4(x: Int)(y: Int): Int = ??? + + def y1[T]: Int = ??? + def y2[T](): Int = ??? + def y3[T](x: Int): Int = ??? + def y4[T](x: Int)(y: Int): Int = ??? +} + +object Test extends App { + println(typeOf[C].member(newTermName("x1")).asMethod.typeParams) + println(typeOf[C].member(newTermName("x2")).asMethod.typeParams) + println(typeOf[C].member(newTermName("x3")).asMethod.typeParams) + println(typeOf[C].member(newTermName("x4")).asMethod.typeParams) + println(typeOf[C].member(newTermName("y1")).asMethod.typeParams) + println(typeOf[C].member(newTermName("y2")).asMethod.typeParams) + println(typeOf[C].member(newTermName("y3")).asMethod.typeParams) + println(typeOf[C].member(newTermName("y4")).asMethod.typeParams) +}
\ No newline at end of file diff --git a/test/files/run/reflection-modulemirror-inner-good.check b/test/files/run/reflection-modulemirror-inner-good.check index 0bf38a73d1..fe658e7087 100644 --- a/test/files/run/reflection-modulemirror-inner-good.check +++ b/test/files/run/reflection-modulemirror-inner-good.check @@ -1,2 +1 @@ -inner and nested modules are not supported yet
-()
+R
diff --git a/test/files/run/reflection-modulemirror-nested-good.check b/test/files/run/reflection-modulemirror-nested-good.check index 0bf38a73d1..fe658e7087 100644 --- a/test/files/run/reflection-modulemirror-nested-good.check +++ b/test/files/run/reflection-modulemirror-nested-good.check @@ -1,2 +1 @@ -inner and nested modules are not supported yet
-()
+R
diff --git a/test/files/run/reflection-repl-classes.check b/test/files/run/reflection-repl-classes.check new file mode 100644 index 0000000000..1c7f86c90c --- /dev/null +++ b/test/files/run/reflection-repl-classes.check @@ -0,0 +1,35 @@ +Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> class A
+defined class A
+
+scala>
+
+scala> class B {
+ def foo(x: A) = 1
+}
+defined class B
+
+scala>
+
+scala> object defs {
+ val cm = reflect.runtime.currentMirror
+ val u = cm.universe
+ val im = cm.reflect(new B)
+ val method = im.symbol.typeSignature.member(u.newTermName("foo")).asMethod
+ val mm = im.reflectMethod(method)
+}
+defined module defs
+
+scala> import defs._
+import defs._
+
+scala>
+
+scala> mm(new A)
+res0: Any = 1
+
+scala>
diff --git a/test/files/run/reflection-repl-classes.scala b/test/files/run/reflection-repl-classes.scala new file mode 100644 index 0000000000..80e332cde3 --- /dev/null +++ b/test/files/run/reflection-repl-classes.scala @@ -0,0 +1,22 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + |class A + | + |class B { + | def foo(x: A) = 1 + |} + | + |object defs { + | val cm = reflect.runtime.currentMirror + | val u = cm.universe + | val im = cm.reflect(new B) + | val method = im.symbol.typeSignature.member(u.newTermName("foo")).asMethod + | val mm = im.reflectMethod(method) + |} + |import defs._ + | + |mm(new A) + |""".stripMargin +} diff --git a/test/files/run/reflection-repl.check b/test/files/run/reflection-repl-elementary.check index 341dd10ab0..341dd10ab0 100644 --- a/test/files/run/reflection-repl.check +++ b/test/files/run/reflection-repl-elementary.check diff --git a/test/files/run/reflection-repl.scala b/test/files/run/reflection-repl-elementary.scala index 72b65a1a70..72b65a1a70 100644 --- a/test/files/run/reflection-repl.scala +++ b/test/files/run/reflection-repl-elementary.scala diff --git a/test/files/run/reflection-sanitychecks.check b/test/files/run/reflection-sanitychecks.check index d977e0ed66..821457a999 100644 --- a/test/files/run/reflection-sanitychecks.check +++ b/test/files/run/reflection-sanitychecks.check @@ -1,8 +1,30 @@ -field: 1
-method: 2
-class: CC
-object: java.lang.Error: inner and nested modules are not supported yet
-field: scala.ScalaReflectionException: expected a member of class C, you provided value D.foo
-method: scala.ScalaReflectionException: expected a member of class C, you provided method D.bar
-class: scala.ScalaReflectionException: expected a member of class C, you provided class D.C
-object: scala.ScalaReflectionException: expected a member of class C, you provided object D.O
+=========members of C in a mirror of D========= +field #1: 11 +method #1: 22 +field #2: 13 +method #2: 14 +constructor #1: scala.ScalaReflectionException: expected a constructor of class D, you provided method bar +constructor #2: scala.ScalaReflectionException: expected a constructor of class D, you provided constructor C +class: CC +object: CO + +=========members of D in a mirror of D========= +field #1: 21 +method #1: 22 +field #2: 13 +method #2: 14 +constructor #1: scala.ScalaReflectionException: expected a constructor of class D, you provided method bar +constructor #2: an instance of class D +class: CC +object: CO + +=========members of E in a mirror of D========= +field #1: scala.ScalaReflectionException: expected a member of class D, you provided value E.foo +method #1: scala.ScalaReflectionException: expected a member of class D, you provided method E.bar +field #2: scala.ScalaReflectionException: expected a member of class D, you provided value E.quux +method #2: scala.ScalaReflectionException: expected a member of class D, you provided method E.baz +constructor #1: scala.ScalaReflectionException: expected a constructor of class D, you provided method bar +constructor #2: scala.ScalaReflectionException: expected a constructor of class D, you provided constructor E +class: scala.ScalaReflectionException: expected a member of class D, you provided class E.C +object: scala.ScalaReflectionException: expected a member of class D, you provided object E.O + diff --git a/test/files/run/reflection-sanitychecks.scala b/test/files/run/reflection-sanitychecks.scala index a6a24088a4..f817f23731 100644 --- a/test/files/run/reflection-sanitychecks.scala +++ b/test/files/run/reflection-sanitychecks.scala @@ -1,30 +1,49 @@ class C { - val foo = 1 - def bar = 2 + val foo = 11 + def bar = 12 + val quux = 13 + def baz = 14 class C { override def toString = "CC" } object O { override def toString = "CO" } + override def toString = "an instance of class C" } -class D { - val foo = 3 - def bar = 4 - class C { override def toString = "DC" } - object O { override def toString = "DO" } +class D extends C { + override val foo = 21 + override def bar = 22 + override def toString = "an instance of class D" +} + +class E { + val foo = 31 + def bar = 32 + val quux = 33 + def baz = 34 + class C { override def toString = "EC" } + object O { override def toString = "EO" } + override def toString = "an instance of class E" } object Test extends App { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} - val im = cm.reflect(new C) + val im = cm.reflect(new D) def test(tpe: Type): Unit = { def failsafe(action: => Any): Any = try action catch { case ex: Throwable => ex.toString } - println("field: " + failsafe(im.reflectField(tpe.member(newTermName("foo")).asTermSymbol).get)) - println("method: " + failsafe(im.reflectMethod(tpe.member(newTermName("bar")).asMethodSymbol)())) - println("class: " + failsafe(im.reflectClass(tpe.member(newTypeName("C")).asClassSymbol).reflectConstructor(typeOf[C].member(newTypeName("C")).asClassSymbol.typeSignature.member(newTermName("<init>")).asMethodSymbol)())) - println("object: " + failsafe(im.reflectModule(tpe.member(newTermName("O")).asModuleSymbol).instance)) + println(s"=========members of ${tpe.typeSymbol.name} in a mirror of D=========") + println("field #1: " + failsafe(im.reflectField(tpe.member(newTermName("foo")).asTerm).get)) + println("method #1: " + failsafe(im.reflectMethod(tpe.member(newTermName("bar")).asMethod)())) + println("field #2: " + failsafe(im.reflectField(tpe.member(newTermName("quux")).asTerm).get)) + println("method #2: " + failsafe(im.reflectMethod(tpe.member(newTermName("baz")).asMethod)())) + println("constructor #1: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("bar")).asMethod)())) + println("constructor #2: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("<init>")).asMethod)())) + println("class: " + failsafe(im.reflectClass(tpe.member(newTypeName("C")).asClass).reflectConstructor(typeOf[C].member(newTypeName("C")).asClass.typeSignature.member(newTermName("<init>")).asMethod)())) + println("object: " + failsafe(im.reflectModule(tpe.member(newTermName("O")).asModule).instance)) + println() } test(typeOf[C]) test(typeOf[D]) + test(typeOf[E]) }
\ No newline at end of file diff --git a/test/files/run/reflection-simple.scala b/test/files/run/reflection-simple.scala deleted file mode 100644 index ec34b71cec..0000000000 --- a/test/files/run/reflection-simple.scala +++ /dev/null @@ -1,12 +0,0 @@ -// a.scala -// Wed May 2 01:01:22 PDT 2012 - -object Test { - def main(args: Array[String]) { - System.out.println("Running") - case class Foo(a: Int, b: Int, c: Int) - import scala.reflect.runtime.{currentMirror => cm} - val props = cm.classSymbol(classOf[Foo]).typeSignature.members.filter(_.isTerm).map(_.toString) - props.toList.sorted foreach System.out.println - } -} diff --git a/test/files/run/reflection-sorted-decls.check b/test/files/run/reflection-sorted-decls.check new file mode 100644 index 0000000000..9a9832a683 --- /dev/null +++ b/test/files/run/reflection-sorted-decls.check @@ -0,0 +1,7 @@ +value a
+value b
+value c
+method c
+method b
+method a
+constructor Foo$1
diff --git a/test/files/run/reflection-sorted-decls.scala b/test/files/run/reflection-sorted-decls.scala new file mode 100644 index 0000000000..242f17d9bb --- /dev/null +++ b/test/files/run/reflection-sorted-decls.scala @@ -0,0 +1,8 @@ +object Test { + def main(args: Array[String]) { + class Foo(val a: Int, val b: Int, val c: Int) + import scala.reflect.runtime.{currentMirror => cm} + val decls = cm.classSymbol(classOf[Foo]).typeSignature.declarations + decls.sorted.toList foreach System.out.println + } +} diff --git a/test/files/run/reflection-simple.check b/test/files/run/reflection-sorted-members.check index 671d9d2716..d58b691c42 100644 --- a/test/files/run/reflection-simple.check +++ b/test/files/run/reflection-sorted-members.check @@ -1,45 +1,34 @@ -Running -constructor Foo$3 -constructor Object -method != -method != -method ## -method $asInstanceOf -method $init$ -method $isInstanceOf -method == -method == -method _1 -method _2 -method _3 -method a -method asInstanceOf -method b -method c -method canEqual -method clone -method copy -method copy$default$1 -method copy$default$2 -method copy$default$3 -method eq -method equals -method finalize -method getClass -method hashCode -method isInstanceOf -method ne -method notify -method notifyAll -method productArity -method productElement -method productIterator -method productPrefix -method synchronized -method toString -method wait -method wait -method wait -value a -value b -value c +value a
+value b
+value c
+method c
+method b
+method a
+constructor Foo$1
+value x
+method x
+constructor Bar$1
+method finalize
+method wait
+method wait
+method wait
+method equals
+method toString
+method hashCode
+method getClass
+method clone
+method notify
+method notifyAll
+constructor Object
+method eq
+method ne
+method ==
+method !=
+method ##
+method synchronized
+method $isInstanceOf
+method $asInstanceOf
+method ==
+method !=
+method isInstanceOf
+method asInstanceOf
diff --git a/test/files/run/reflection-sorted-members.scala b/test/files/run/reflection-sorted-members.scala new file mode 100644 index 0000000000..9980d79999 --- /dev/null +++ b/test/files/run/reflection-sorted-members.scala @@ -0,0 +1,11 @@ +object Test { + def main(args: Array[String]) { + trait T1 { def a: Int; def c: Int } + trait T2 { def a: Int; def b: Int } + class Bar(val x: Int) + class Foo(val a: Int, val b: Int, val c: Int) extends Bar(a + b + c) with T1 with T2 + import scala.reflect.runtime.{currentMirror => cm} + val members = cm.classSymbol(classOf[Foo]).typeSignature.members + members.sorted.toList foreach System.out.println + } +} diff --git a/test/files/run/reflection-valueclasses-derived.check b/test/files/run/reflection-valueclasses-derived.check new file mode 100644 index 0000000000..bfcfcade5e --- /dev/null +++ b/test/files/run/reflection-valueclasses-derived.check @@ -0,0 +1,3 @@ +4
+class C
+C@2
diff --git a/test/files/run/reflection-valueclasses-derived.scala b/test/files/run/reflection-valueclasses-derived.scala new file mode 100644 index 0000000000..6b08f987ba --- /dev/null +++ b/test/files/run/reflection-valueclasses-derived.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +class C(val x: Int) extends AnyVal { + def foo(y: Int) = x + y +} + +object Test extends App { + println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("foo")).asMethod)(2)) + println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("getClass")).asMethod)()) + println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("toString")).asMethod)()) +}
\ No newline at end of file diff --git a/test/files/run/reflection-valueclasses-magic.check b/test/files/run/reflection-valueclasses-magic.check new file mode 100644 index 0000000000..8ecad3eb91 --- /dev/null +++ b/test/files/run/reflection-valueclasses-magic.check @@ -0,0 +1,1456 @@ +============ +Byte +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Byte: ()Byte +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Int +method %: (x: Char)Int +method %: (x: Double)Double +method %: (x: Float)Float +method %: (x: Int)Int +method %: (x: Long)Long +method %: (x: Short)Int +method &: (x: Byte)Int +method &: (x: Char)Int +method &: (x: Int)Int +method &: (x: Long)Long +method &: (x: Short)Int +method *: (x: Byte)Int +method *: (x: Char)Int +method *: (x: Double)Double +method *: (x: Float)Float +method *: (x: Int)Int +method *: (x: Long)Long +method *: (x: Short)Int +method +: (x: Byte)Int +method +: (x: Char)Int +method +: (x: Double)Double +method +: (x: Float)Float +method +: (x: Int)Int +method +: (x: Long)Long +method +: (x: Short)Int +method +: (x: String)String +method -: (x: Byte)Int +method -: (x: Char)Int +method -: (x: Double)Double +method -: (x: Float)Float +method -: (x: Int)Int +method -: (x: Long)Long +method -: (x: Short)Int +method /: (x: Byte)Int +method /: (x: Char)Int +method /: (x: Double)Double +method /: (x: Float)Float +method /: (x: Int)Int +method /: (x: Long)Long +method /: (x: Short)Int +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <<: (x: Int)Int +method <<: (x: Long)Int +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method >>: (x: Int)Int +method >>: (x: Long)Int +method >>>: (x: Int)Int +method >>>: (x: Long)Int +method ^: (x: Byte)Int +method ^: (x: Char)Int +method ^: (x: Int)Int +method ^: (x: Long)Long +method ^: (x: Short)Int +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Byte] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Int +method unary_-: => Int +method unary_~: => Int +method |: (x: Byte)Int +method |: (x: Char)Int +method |: (x: Int)Int +method |: (x: Long)Long +method |: (x: Short)Int +testing Byte.toByte() with receiver = 2 and args = List(): [class java.lang.Byte] =======> 2 +testing Byte.toShort() with receiver = 2 and args = List(): [class java.lang.Short] =======> 2 +testing Byte.toChar() with receiver = 2 and args = List(): [class java.lang.Character] =======> +testing Byte.toInt() with receiver = 2 and args = List(): [class java.lang.Integer] =======> 2 +testing Byte.toLong() with receiver = 2 and args = List(): [class java.lang.Long] =======> 2 +testing Byte.toFloat() with receiver = 2 and args = List(): [class java.lang.Float] =======> 2.0 +testing Byte.toDouble() with receiver = 2 and args = List(): [class java.lang.Double] =======> 2.0 +testing Byte.==(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Byte.==(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Byte.==(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Byte.==(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Byte.==(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Byte.==(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Byte.==(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Byte.!=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Byte.!=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Byte.!=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Byte.!=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Byte.!=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Byte.!=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Byte.!=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Byte.<(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Byte.<(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Byte.<(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Byte.<(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Byte.<(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Byte.<(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Byte.<(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Byte.<=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Byte.<=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Byte.<=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Byte.<=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Byte.<=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Byte.<=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Byte.<=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Byte.>(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Byte.>(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Byte.>(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Byte.>(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Byte.>(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Byte.>(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Byte.>(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Byte.>=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Byte.>=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Byte.>=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Byte.>=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Byte.>=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Byte.>=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Byte.>=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Byte.+(String) with receiver = 2 and args = List(2 class java.lang.String): [class java.lang.String] =======> 22 +testing Byte.+(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Byte.+(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Byte.+(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Byte.+(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Byte.+(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Byte.+(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Byte.+(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Byte.-(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Byte.-(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Byte.-(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Byte.-(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Byte.-(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Byte.-(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Byte.-(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Byte.*(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Byte.*(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Byte.*(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Byte.*(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Byte.*(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Byte.*(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Byte.*(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Byte./(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 1 +testing Byte./(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 1 +testing Byte./(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 1 +testing Byte./(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 1 +testing Byte./(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 1 +testing Byte./(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 1.0 +testing Byte./(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Byte.%(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Byte.%(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Byte.%(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Byte.%(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Byte.%(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Byte.%(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Byte.%(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Short +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Short: ()Short +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Int +method %: (x: Char)Int +method %: (x: Double)Double +method %: (x: Float)Float +method %: (x: Int)Int +method %: (x: Long)Long +method %: (x: Short)Int +method &: (x: Byte)Int +method &: (x: Char)Int +method &: (x: Int)Int +method &: (x: Long)Long +method &: (x: Short)Int +method *: (x: Byte)Int +method *: (x: Char)Int +method *: (x: Double)Double +method *: (x: Float)Float +method *: (x: Int)Int +method *: (x: Long)Long +method *: (x: Short)Int +method +: (x: Byte)Int +method +: (x: Char)Int +method +: (x: Double)Double +method +: (x: Float)Float +method +: (x: Int)Int +method +: (x: Long)Long +method +: (x: Short)Int +method +: (x: String)String +method -: (x: Byte)Int +method -: (x: Char)Int +method -: (x: Double)Double +method -: (x: Float)Float +method -: (x: Int)Int +method -: (x: Long)Long +method -: (x: Short)Int +method /: (x: Byte)Int +method /: (x: Char)Int +method /: (x: Double)Double +method /: (x: Float)Float +method /: (x: Int)Int +method /: (x: Long)Long +method /: (x: Short)Int +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <<: (x: Int)Int +method <<: (x: Long)Int +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method >>: (x: Int)Int +method >>: (x: Long)Int +method >>>: (x: Int)Int +method >>>: (x: Long)Int +method ^: (x: Byte)Int +method ^: (x: Char)Int +method ^: (x: Int)Int +method ^: (x: Long)Long +method ^: (x: Short)Int +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Short] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Int +method unary_-: => Int +method unary_~: => Int +method |: (x: Byte)Int +method |: (x: Char)Int +method |: (x: Int)Int +method |: (x: Long)Long +method |: (x: Short)Int +testing Short.toByte() with receiver = 2 and args = List(): [class java.lang.Byte] =======> 2 +testing Short.toShort() with receiver = 2 and args = List(): [class java.lang.Short] =======> 2 +testing Short.toChar() with receiver = 2 and args = List(): [class java.lang.Character] =======> +testing Short.toInt() with receiver = 2 and args = List(): [class java.lang.Integer] =======> 2 +testing Short.toLong() with receiver = 2 and args = List(): [class java.lang.Long] =======> 2 +testing Short.toFloat() with receiver = 2 and args = List(): [class java.lang.Float] =======> 2.0 +testing Short.toDouble() with receiver = 2 and args = List(): [class java.lang.Double] =======> 2.0 +testing Short.==(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Short.==(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Short.==(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Short.==(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Short.==(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Short.==(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Short.==(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Short.!=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Short.!=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Short.!=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Short.!=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Short.!=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Short.!=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Short.!=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Short.<(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Short.<(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Short.<(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Short.<(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Short.<(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Short.<(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Short.<(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Short.<=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Short.<=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Short.<=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Short.<=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Short.<=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Short.<=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Short.<=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Short.>(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Short.>(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Short.>(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Short.>(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Short.>(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Short.>(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Short.>(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Short.>=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Short.>=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Short.>=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Short.>=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Short.>=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Short.>=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Short.>=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Short.+(String) with receiver = 2 and args = List(2 class java.lang.String): [class java.lang.String] =======> 22 +testing Short.+(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Short.+(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Short.+(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Short.+(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Short.+(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Short.+(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Short.+(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Short.-(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Short.-(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Short.-(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Short.-(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Short.-(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Short.-(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Short.-(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Short.*(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Short.*(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Short.*(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Short.*(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Short.*(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Short.*(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Short.*(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Short./(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 1 +testing Short./(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 1 +testing Short./(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 1 +testing Short./(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 1 +testing Short./(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 1 +testing Short./(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 1.0 +testing Short./(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Short.%(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Short.%(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Short.%(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Short.%(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Short.%(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Short.%(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Short.%(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Char +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Char: ()Char +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Int +method %: (x: Char)Int +method %: (x: Double)Double +method %: (x: Float)Float +method %: (x: Int)Int +method %: (x: Long)Long +method %: (x: Short)Int +method &: (x: Byte)Int +method &: (x: Char)Int +method &: (x: Int)Int +method &: (x: Long)Long +method &: (x: Short)Int +method *: (x: Byte)Int +method *: (x: Char)Int +method *: (x: Double)Double +method *: (x: Float)Float +method *: (x: Int)Int +method *: (x: Long)Long +method *: (x: Short)Int +method +: (x: Byte)Int +method +: (x: Char)Int +method +: (x: Double)Double +method +: (x: Float)Float +method +: (x: Int)Int +method +: (x: Long)Long +method +: (x: Short)Int +method +: (x: String)String +method -: (x: Byte)Int +method -: (x: Char)Int +method -: (x: Double)Double +method -: (x: Float)Float +method -: (x: Int)Int +method -: (x: Long)Long +method -: (x: Short)Int +method /: (x: Byte)Int +method /: (x: Char)Int +method /: (x: Double)Double +method /: (x: Float)Float +method /: (x: Int)Int +method /: (x: Long)Long +method /: (x: Short)Int +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <<: (x: Int)Int +method <<: (x: Long)Int +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method >>: (x: Int)Int +method >>: (x: Long)Int +method >>>: (x: Int)Int +method >>>: (x: Long)Int +method ^: (x: Byte)Int +method ^: (x: Char)Int +method ^: (x: Int)Int +method ^: (x: Long)Long +method ^: (x: Short)Int +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Char] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Int +method unary_-: => Int +method unary_~: => Int +method |: (x: Byte)Int +method |: (x: Char)Int +method |: (x: Int)Int +method |: (x: Long)Long +method |: (x: Short)Int +testing Char.toByte() with receiver = and args = List(): [class java.lang.Byte] =======> 2 +testing Char.toShort() with receiver = and args = List(): [class java.lang.Short] =======> 2 +testing Char.toChar() with receiver = and args = List(): [class java.lang.Character] =======> +testing Char.toInt() with receiver = and args = List(): [class java.lang.Integer] =======> 2 +testing Char.toLong() with receiver = and args = List(): [class java.lang.Long] =======> 2 +testing Char.toFloat() with receiver = and args = List(): [class java.lang.Float] =======> 2.0 +testing Char.toDouble() with receiver = and args = List(): [class java.lang.Double] =======> 2.0 +testing Char.==(Byte) with receiver = and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Char.==(Short) with receiver = and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Char.==(Char) with receiver = and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Char.==(Int) with receiver = and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Char.==(Long) with receiver = and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Char.==(Float) with receiver = and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Char.==(Double) with receiver = and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Char.!=(Byte) with receiver = and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Char.!=(Short) with receiver = and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Char.!=(Char) with receiver = and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Char.!=(Int) with receiver = and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Char.!=(Long) with receiver = and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Char.!=(Float) with receiver = and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Char.!=(Double) with receiver = and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Char.<(Byte) with receiver = and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Char.<(Short) with receiver = and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Char.<(Char) with receiver = and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Char.<(Int) with receiver = and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Char.<(Long) with receiver = and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Char.<(Float) with receiver = and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Char.<(Double) with receiver = and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Char.<=(Byte) with receiver = and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Char.<=(Short) with receiver = and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Char.<=(Char) with receiver = and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Char.<=(Int) with receiver = and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Char.<=(Long) with receiver = and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Char.<=(Float) with receiver = and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Char.<=(Double) with receiver = and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Char.>(Byte) with receiver = and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Char.>(Short) with receiver = and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Char.>(Char) with receiver = and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Char.>(Int) with receiver = and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Char.>(Long) with receiver = and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Char.>(Float) with receiver = and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Char.>(Double) with receiver = and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Char.>=(Byte) with receiver = and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Char.>=(Short) with receiver = and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Char.>=(Char) with receiver = and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Char.>=(Int) with receiver = and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Char.>=(Long) with receiver = and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Char.>=(Float) with receiver = and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Char.>=(Double) with receiver = and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Char.+(String) with receiver = and args = List(2 class java.lang.String): [class java.lang.String] =======> 2 +testing Char.+(Byte) with receiver = and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Char.+(Short) with receiver = and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Char.+(Char) with receiver = and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Char.+(Int) with receiver = and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Char.+(Long) with receiver = and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Char.+(Float) with receiver = and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Char.+(Double) with receiver = and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Char.-(Byte) with receiver = and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Char.-(Short) with receiver = and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Char.-(Char) with receiver = and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Char.-(Int) with receiver = and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Char.-(Long) with receiver = and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Char.-(Float) with receiver = and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Char.-(Double) with receiver = and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Char.*(Byte) with receiver = and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Char.*(Short) with receiver = and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Char.*(Char) with receiver = and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Char.*(Int) with receiver = and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Char.*(Long) with receiver = and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Char.*(Float) with receiver = and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Char.*(Double) with receiver = and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Char./(Byte) with receiver = and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 1 +testing Char./(Short) with receiver = and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 1 +testing Char./(Char) with receiver = and args = List( class java.lang.Character): [class java.lang.Integer] =======> 1 +testing Char./(Int) with receiver = and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 1 +testing Char./(Long) with receiver = and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 1 +testing Char./(Float) with receiver = and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 1.0 +testing Char./(Double) with receiver = and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Char.%(Byte) with receiver = and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Char.%(Short) with receiver = and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Char.%(Char) with receiver = and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Char.%(Int) with receiver = and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Char.%(Long) with receiver = and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Char.%(Float) with receiver = and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Char.%(Double) with receiver = and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Int +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Int: ()Int +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Int +method %: (x: Char)Int +method %: (x: Double)Double +method %: (x: Float)Float +method %: (x: Int)Int +method %: (x: Long)Long +method %: (x: Short)Int +method &: (x: Byte)Int +method &: (x: Char)Int +method &: (x: Int)Int +method &: (x: Long)Long +method &: (x: Short)Int +method *: (x: Byte)Int +method *: (x: Char)Int +method *: (x: Double)Double +method *: (x: Float)Float +method *: (x: Int)Int +method *: (x: Long)Long +method *: (x: Short)Int +method +: (x: Byte)Int +method +: (x: Char)Int +method +: (x: Double)Double +method +: (x: Float)Float +method +: (x: Int)Int +method +: (x: Long)Long +method +: (x: Short)Int +method +: (x: String)String +method -: (x: Byte)Int +method -: (x: Char)Int +method -: (x: Double)Double +method -: (x: Float)Float +method -: (x: Int)Int +method -: (x: Long)Long +method -: (x: Short)Int +method /: (x: Byte)Int +method /: (x: Char)Int +method /: (x: Double)Double +method /: (x: Float)Float +method /: (x: Int)Int +method /: (x: Long)Long +method /: (x: Short)Int +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <<: (x: Int)Int +method <<: (x: Long)Int +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method >>: (x: Int)Int +method >>: (x: Long)Int +method >>>: (x: Int)Int +method >>>: (x: Long)Int +method ^: (x: Byte)Int +method ^: (x: Char)Int +method ^: (x: Int)Int +method ^: (x: Long)Long +method ^: (x: Short)Int +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Int] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Int +method unary_-: => Int +method unary_~: => Int +method |: (x: Byte)Int +method |: (x: Char)Int +method |: (x: Int)Int +method |: (x: Long)Long +method |: (x: Short)Int +testing Int.toByte() with receiver = 2 and args = List(): [class java.lang.Byte] =======> 2 +testing Int.toShort() with receiver = 2 and args = List(): [class java.lang.Short] =======> 2 +testing Int.toChar() with receiver = 2 and args = List(): [class java.lang.Character] =======> +testing Int.toInt() with receiver = 2 and args = List(): [class java.lang.Integer] =======> 2 +testing Int.toLong() with receiver = 2 and args = List(): [class java.lang.Long] =======> 2 +testing Int.toFloat() with receiver = 2 and args = List(): [class java.lang.Float] =======> 2.0 +testing Int.toDouble() with receiver = 2 and args = List(): [class java.lang.Double] =======> 2.0 +testing Int.==(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Int.==(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Int.==(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Int.==(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Int.==(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Int.==(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Int.==(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Int.!=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Int.!=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Int.!=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Int.!=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Int.!=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Int.!=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Int.!=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Int.<(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Int.<(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Int.<(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Int.<(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Int.<(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Int.<(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Int.<(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Int.<=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Int.<=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Int.<=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Int.<=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Int.<=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Int.<=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Int.<=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Int.>(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Int.>(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Int.>(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Int.>(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Int.>(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Int.>(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Int.>(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Int.>=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Int.>=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Int.>=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Int.>=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Int.>=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Int.>=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Int.>=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Int.+(String) with receiver = 2 and args = List(2 class java.lang.String): [class java.lang.String] =======> 22 +testing Int.+(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Int.+(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Int.+(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Int.+(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Int.+(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Int.+(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Int.+(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Int.-(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Int.-(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Int.-(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Int.-(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Int.-(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Int.-(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Int.-(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Int.*(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 4 +testing Int.*(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 4 +testing Int.*(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 4 +testing Int.*(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 4 +testing Int.*(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Int.*(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Int.*(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Int./(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 1 +testing Int./(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 1 +testing Int./(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 1 +testing Int./(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 1 +testing Int./(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 1 +testing Int./(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 1.0 +testing Int./(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Int.%(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Integer] =======> 0 +testing Int.%(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Integer] =======> 0 +testing Int.%(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Integer] =======> 0 +testing Int.%(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Integer] =======> 0 +testing Int.%(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Int.%(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Int.%(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Long +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Long: ()Long +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Long +method %: (x: Char)Long +method %: (x: Double)Double +method %: (x: Float)Float +method %: (x: Int)Long +method %: (x: Long)Long +method %: (x: Short)Long +method &: (x: Byte)Long +method &: (x: Char)Long +method &: (x: Int)Long +method &: (x: Long)Long +method &: (x: Short)Long +method *: (x: Byte)Long +method *: (x: Char)Long +method *: (x: Double)Double +method *: (x: Float)Float +method *: (x: Int)Long +method *: (x: Long)Long +method *: (x: Short)Long +method +: (x: Byte)Long +method +: (x: Char)Long +method +: (x: Double)Double +method +: (x: Float)Float +method +: (x: Int)Long +method +: (x: Long)Long +method +: (x: Short)Long +method +: (x: String)String +method -: (x: Byte)Long +method -: (x: Char)Long +method -: (x: Double)Double +method -: (x: Float)Float +method -: (x: Int)Long +method -: (x: Long)Long +method -: (x: Short)Long +method /: (x: Byte)Long +method /: (x: Char)Long +method /: (x: Double)Double +method /: (x: Float)Float +method /: (x: Int)Long +method /: (x: Long)Long +method /: (x: Short)Long +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <<: (x: Int)Long +method <<: (x: Long)Long +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method >>: (x: Int)Long +method >>: (x: Long)Long +method >>>: (x: Int)Long +method >>>: (x: Long)Long +method ^: (x: Byte)Long +method ^: (x: Char)Long +method ^: (x: Int)Long +method ^: (x: Long)Long +method ^: (x: Short)Long +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Long] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Long +method unary_-: => Long +method unary_~: => Long +method |: (x: Byte)Long +method |: (x: Char)Long +method |: (x: Int)Long +method |: (x: Long)Long +method |: (x: Short)Long +testing Long.toByte() with receiver = 2 and args = List(): [class java.lang.Byte] =======> 2 +testing Long.toShort() with receiver = 2 and args = List(): [class java.lang.Short] =======> 2 +testing Long.toChar() with receiver = 2 and args = List(): [class java.lang.Character] =======> +testing Long.toInt() with receiver = 2 and args = List(): [class java.lang.Integer] =======> 2 +testing Long.toLong() with receiver = 2 and args = List(): [class java.lang.Long] =======> 2 +testing Long.toFloat() with receiver = 2 and args = List(): [class java.lang.Float] =======> 2.0 +testing Long.toDouble() with receiver = 2 and args = List(): [class java.lang.Double] =======> 2.0 +testing Long.==(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Long.==(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Long.==(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Long.==(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Long.==(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Long.==(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Long.==(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Long.!=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Long.!=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Long.!=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Long.!=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Long.!=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Long.!=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Long.!=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Long.<(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Long.<(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Long.<(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Long.<(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Long.<(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Long.<(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Long.<(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Long.<=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Long.<=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Long.<=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Long.<=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Long.<=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Long.<=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Long.<=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Long.>(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Long.>(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Long.>(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Long.>(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Long.>(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Long.>(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Long.>(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Long.>=(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Long.>=(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Long.>=(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Long.>=(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Long.>=(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Long.>=(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Long.>=(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Long.+(String) with receiver = 2 and args = List(2 class java.lang.String): [class java.lang.String] =======> 22 +testing Long.+(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Long] =======> 4 +testing Long.+(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Long] =======> 4 +testing Long.+(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Long] =======> 4 +testing Long.+(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Long] =======> 4 +testing Long.+(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Long.+(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Long.+(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Long.-(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Long] =======> 0 +testing Long.-(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Long] =======> 0 +testing Long.-(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Long] =======> 0 +testing Long.-(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Long] =======> 0 +testing Long.-(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Long.-(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Long.-(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Long.*(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Long] =======> 4 +testing Long.*(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Long] =======> 4 +testing Long.*(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Long] =======> 4 +testing Long.*(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Long] =======> 4 +testing Long.*(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 4 +testing Long.*(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Long.*(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Long./(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Long] =======> 1 +testing Long./(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Long] =======> 1 +testing Long./(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Long] =======> 1 +testing Long./(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Long] =======> 1 +testing Long./(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 1 +testing Long./(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 1.0 +testing Long./(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Long.%(Byte) with receiver = 2 and args = List(2 class java.lang.Byte): [class java.lang.Long] =======> 0 +testing Long.%(Short) with receiver = 2 and args = List(2 class java.lang.Short): [class java.lang.Long] =======> 0 +testing Long.%(Char) with receiver = 2 and args = List( class java.lang.Character): [class java.lang.Long] =======> 0 +testing Long.%(Int) with receiver = 2 and args = List(2 class java.lang.Integer): [class java.lang.Long] =======> 0 +testing Long.%(Long) with receiver = 2 and args = List(2 class java.lang.Long): [class java.lang.Long] =======> 0 +testing Long.%(Float) with receiver = 2 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Long.%(Double) with receiver = 2 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Float +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Float: ()Float +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Float +method %: (x: Char)Float +method %: (x: Double)Double +method %: (x: Float)Float +method %: (x: Int)Float +method %: (x: Long)Float +method %: (x: Short)Float +method *: (x: Byte)Float +method *: (x: Char)Float +method *: (x: Double)Double +method *: (x: Float)Float +method *: (x: Int)Float +method *: (x: Long)Float +method *: (x: Short)Float +method +: (x: Byte)Float +method +: (x: Char)Float +method +: (x: Double)Double +method +: (x: Float)Float +method +: (x: Int)Float +method +: (x: Long)Float +method +: (x: Short)Float +method +: (x: String)String +method -: (x: Byte)Float +method -: (x: Char)Float +method -: (x: Double)Double +method -: (x: Float)Float +method -: (x: Int)Float +method -: (x: Long)Float +method -: (x: Short)Float +method /: (x: Byte)Float +method /: (x: Char)Float +method /: (x: Double)Double +method /: (x: Float)Float +method /: (x: Int)Float +method /: (x: Long)Float +method /: (x: Short)Float +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Float] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Float +method unary_-: => Float +testing Float.toByte() with receiver = 2.0 and args = List(): [class java.lang.Byte] =======> 2 +testing Float.toShort() with receiver = 2.0 and args = List(): [class java.lang.Short] =======> 2 +testing Float.toChar() with receiver = 2.0 and args = List(): [class java.lang.Character] =======> +testing Float.toInt() with receiver = 2.0 and args = List(): [class java.lang.Integer] =======> 2 +testing Float.toLong() with receiver = 2.0 and args = List(): [class java.lang.Long] =======> 2 +testing Float.toFloat() with receiver = 2.0 and args = List(): [class java.lang.Float] =======> 2.0 +testing Float.toDouble() with receiver = 2.0 and args = List(): [class java.lang.Double] =======> 2.0 +testing Float.==(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Float.==(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Float.==(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Float.==(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Float.==(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Float.==(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Float.==(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Float.!=(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Float.!=(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Float.!=(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Float.!=(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Float.!=(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Float.!=(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Float.!=(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Float.<(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Float.<(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Float.<(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Float.<(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Float.<(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Float.<(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Float.<(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Float.<=(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Float.<=(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Float.<=(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Float.<=(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Float.<=(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Float.<=(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Float.<=(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Float.>(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Float.>(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Float.>(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Float.>(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Float.>(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Float.>(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Float.>(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Float.>=(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Float.>=(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Float.>=(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Float.>=(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Float.>=(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Float.>=(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Float.>=(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Float.+(String) with receiver = 2.0 and args = List(2 class java.lang.String): [class java.lang.String] =======> 2.02 +testing Float.+(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Float] =======> 4.0 +testing Float.+(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Float] =======> 4.0 +testing Float.+(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Float] =======> 4.0 +testing Float.+(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Float] =======> 4.0 +testing Float.+(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Float] =======> 4.0 +testing Float.+(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Float.+(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Float.-(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Float] =======> 0.0 +testing Float.-(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Float] =======> 0.0 +testing Float.-(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Float] =======> 0.0 +testing Float.-(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Float] =======> 0.0 +testing Float.-(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Float] =======> 0.0 +testing Float.-(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Float.-(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Float.*(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Float] =======> 4.0 +testing Float.*(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Float] =======> 4.0 +testing Float.*(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Float] =======> 4.0 +testing Float.*(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Float] =======> 4.0 +testing Float.*(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Float] =======> 4.0 +testing Float.*(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 4.0 +testing Float.*(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Float./(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Float] =======> 1.0 +testing Float./(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Float] =======> 1.0 +testing Float./(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Float] =======> 1.0 +testing Float./(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Float] =======> 1.0 +testing Float./(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Float] =======> 1.0 +testing Float./(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 1.0 +testing Float./(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Float.%(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Float] =======> 0.0 +testing Float.%(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Float] =======> 0.0 +testing Float.%(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Float] =======> 0.0 +testing Float.%(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Float] =======> 0.0 +testing Float.%(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Float] =======> 0.0 +testing Float.%(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Float] =======> 0.0 +testing Float.%(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Double +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Double: ()Double +method !=: (x$1: Any)Boolean +method !=: (x: Byte)Boolean +method !=: (x: Char)Boolean +method !=: (x: Double)Boolean +method !=: (x: Float)Boolean +method !=: (x: Int)Boolean +method !=: (x: Long)Boolean +method !=: (x: Short)Boolean +method ##: ()Int +method %: (x: Byte)Double +method %: (x: Char)Double +method %: (x: Double)Double +method %: (x: Float)Double +method %: (x: Int)Double +method %: (x: Long)Double +method %: (x: Short)Double +method *: (x: Byte)Double +method *: (x: Char)Double +method *: (x: Double)Double +method *: (x: Float)Double +method *: (x: Int)Double +method *: (x: Long)Double +method *: (x: Short)Double +method +: (x: Byte)Double +method +: (x: Char)Double +method +: (x: Double)Double +method +: (x: Float)Double +method +: (x: Int)Double +method +: (x: Long)Double +method +: (x: Short)Double +method +: (x: String)String +method -: (x: Byte)Double +method -: (x: Char)Double +method -: (x: Double)Double +method -: (x: Float)Double +method -: (x: Int)Double +method -: (x: Long)Double +method -: (x: Short)Double +method /: (x: Byte)Double +method /: (x: Char)Double +method /: (x: Double)Double +method /: (x: Float)Double +method /: (x: Int)Double +method /: (x: Long)Double +method /: (x: Short)Double +method <: (x: Byte)Boolean +method <: (x: Char)Boolean +method <: (x: Double)Boolean +method <: (x: Float)Boolean +method <: (x: Int)Boolean +method <: (x: Long)Boolean +method <: (x: Short)Boolean +method <=: (x: Byte)Boolean +method <=: (x: Char)Boolean +method <=: (x: Double)Boolean +method <=: (x: Float)Boolean +method <=: (x: Int)Boolean +method <=: (x: Long)Boolean +method <=: (x: Short)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Byte)Boolean +method ==: (x: Char)Boolean +method ==: (x: Double)Boolean +method ==: (x: Float)Boolean +method ==: (x: Int)Boolean +method ==: (x: Long)Boolean +method ==: (x: Short)Boolean +method >: (x: Byte)Boolean +method >: (x: Char)Boolean +method >: (x: Double)Boolean +method >: (x: Float)Boolean +method >: (x: Int)Boolean +method >: (x: Long)Boolean +method >: (x: Short)Boolean +method >=: (x: Byte)Boolean +method >=: (x: Char)Boolean +method >=: (x: Double)Boolean +method >=: (x: Float)Boolean +method >=: (x: Int)Boolean +method >=: (x: Long)Boolean +method >=: (x: Short)Boolean +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Double] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toByte: => Byte +method toChar: => Char +method toDouble: => Double +method toFloat: => Float +method toInt: => Int +method toLong: => Long +method toShort: => Short +method toString: ()java.lang.String +method unary_+: => Double +method unary_-: => Double +testing Double.toByte() with receiver = 2.0 and args = List(): [class java.lang.Byte] =======> 2 +testing Double.toShort() with receiver = 2.0 and args = List(): [class java.lang.Short] =======> 2 +testing Double.toChar() with receiver = 2.0 and args = List(): [class java.lang.Character] =======> +testing Double.toInt() with receiver = 2.0 and args = List(): [class java.lang.Integer] =======> 2 +testing Double.toLong() with receiver = 2.0 and args = List(): [class java.lang.Long] =======> 2 +testing Double.toFloat() with receiver = 2.0 and args = List(): [class java.lang.Float] =======> 2.0 +testing Double.toDouble() with receiver = 2.0 and args = List(): [class java.lang.Double] =======> 2.0 +testing Double.==(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Double.==(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Double.==(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Double.==(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Double.==(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Double.==(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Double.==(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Double.!=(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Double.!=(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Double.!=(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Double.!=(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Double.!=(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Double.!=(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Double.!=(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Double.<(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Double.<(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Double.<(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Double.<(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Double.<(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Double.<(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Double.<(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Double.<=(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Double.<=(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Double.<=(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Double.<=(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Double.<=(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Double.<=(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Double.<=(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Double.>(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> false +testing Double.>(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> false +testing Double.>(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> false +testing Double.>(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> false +testing Double.>(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> false +testing Double.>(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> false +testing Double.>(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> false +testing Double.>=(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Boolean] =======> true +testing Double.>=(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Boolean] =======> true +testing Double.>=(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Boolean] =======> true +testing Double.>=(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Boolean] =======> true +testing Double.>=(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Boolean] =======> true +testing Double.>=(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Boolean] =======> true +testing Double.>=(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Boolean] =======> true +testing Double.+(String) with receiver = 2.0 and args = List(2 class java.lang.String): [class java.lang.String] =======> 2.02 +testing Double.+(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Double] =======> 4.0 +testing Double.+(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Double] =======> 4.0 +testing Double.+(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Double] =======> 4.0 +testing Double.+(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Double] =======> 4.0 +testing Double.+(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Double] =======> 4.0 +testing Double.+(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Double] =======> 4.0 +testing Double.+(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Double.-(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Double] =======> 0.0 +testing Double.-(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Double] =======> 0.0 +testing Double.-(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Double] =======> 0.0 +testing Double.-(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Double] =======> 0.0 +testing Double.-(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Double] =======> 0.0 +testing Double.-(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Double] =======> 0.0 +testing Double.-(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +testing Double.*(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Double] =======> 4.0 +testing Double.*(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Double] =======> 4.0 +testing Double.*(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Double] =======> 4.0 +testing Double.*(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Double] =======> 4.0 +testing Double.*(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Double] =======> 4.0 +testing Double.*(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Double] =======> 4.0 +testing Double.*(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 4.0 +testing Double./(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Double] =======> 1.0 +testing Double./(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Double] =======> 1.0 +testing Double./(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Double] =======> 1.0 +testing Double./(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Double] =======> 1.0 +testing Double./(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Double] =======> 1.0 +testing Double./(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Double] =======> 1.0 +testing Double./(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 1.0 +testing Double.%(Byte) with receiver = 2.0 and args = List(2 class java.lang.Byte): [class java.lang.Double] =======> 0.0 +testing Double.%(Short) with receiver = 2.0 and args = List(2 class java.lang.Short): [class java.lang.Double] =======> 0.0 +testing Double.%(Char) with receiver = 2.0 and args = List( class java.lang.Character): [class java.lang.Double] =======> 0.0 +testing Double.%(Int) with receiver = 2.0 and args = List(2 class java.lang.Integer): [class java.lang.Double] =======> 0.0 +testing Double.%(Long) with receiver = 2.0 and args = List(2 class java.lang.Long): [class java.lang.Double] =======> 0.0 +testing Double.%(Float) with receiver = 2.0 and args = List(2.0 class java.lang.Float): [class java.lang.Double] =======> 0.0 +testing Double.%(Double) with receiver = 2.0 and args = List(2.0 class java.lang.Double): [class java.lang.Double] =======> 0.0 +============ +Boolean +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Boolean: ()Boolean +method !=: (x$1: Any)Boolean +method !=: (x: Boolean)Boolean +method ##: ()Int +method &&: (x: Boolean)Boolean +method &: (x: Boolean)Boolean +method ==: (x$1: Any)Boolean +method ==: (x: Boolean)Boolean +method ^: (x: Boolean)Boolean +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Boolean] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toString: ()java.lang.String +method unary_!: => Boolean +method |: (x: Boolean)Boolean +method ||: (x: Boolean)Boolean +testing Boolean.unary_!() with receiver = true and args = List(): [class java.lang.Boolean] =======> false +testing Boolean.==(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> true +testing Boolean.!=(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> false +testing Boolean.||(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> true +testing Boolean.&&(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> true +testing Boolean.|(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> true +testing Boolean.&(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> true +testing Boolean.^(Boolean) with receiver = true and args = List(true class java.lang.Boolean): [class java.lang.Boolean] =======> false +============ +Unit +it's important to print the list of Byte's members +if some of them change (possibly, adding and/or removing magic symbols), we must update this test +constructor Unit: ()Unit +method !=: (x$1: Any)Boolean +method ##: ()Int +method ==: (x$1: Any)Boolean +method asInstanceOf: [T0]=> T0 +method equals: (x$1: Any)Boolean +method getClass: ()Class[Unit] +method hashCode: ()Int +method isInstanceOf: [T0]=> Boolean +method toString: ()java.lang.String diff --git a/test/files/run/reflection-valueclasses-magic.scala b/test/files/run/reflection-valueclasses-magic.scala new file mode 100644 index 0000000000..f9feb2d504 --- /dev/null +++ b/test/files/run/reflection-valueclasses-magic.scala @@ -0,0 +1,110 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.universe.definitions._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.ClassTag + +object Test extends App { + def key(sym: Symbol) = { + sym match { + // initialize parameter symbols + case meth: MethodSymbol => meth.params.flatten.map(_.typeSignature) + } + sym + ": " + sym.typeSignature + } + + def convert(value: Any, tpe: Type) = { + import scala.runtime.BoxesRunTime._ + if (tpe =:= typeOf[Byte]) toByte(value) + else if (tpe =:= typeOf[Short]) toShort(value) + else if (tpe =:= typeOf[Char]) toCharacter(value) + else if (tpe =:= typeOf[Int]) toInteger(value) + else if (tpe =:= typeOf[Long]) toLong(value) + else if (tpe =:= typeOf[Float]) toFloat(value) + else if (tpe =:= typeOf[Double]) toDouble(value) + else if (tpe =:= typeOf[String]) value.toString + else if (tpe =:= typeOf[Boolean]) value.asInstanceOf[Boolean] + else throw new Exception(s"not supported: value = $value, tpe = $tpe") + } + + def test[T: ClassTag](tpe: Type, receiver: T, method: String, args: Any*) { + def wrap[T](op: => T) = + try { + var result = op.asInstanceOf[AnyRef] + if (scala.runtime.ScalaRunTime.isArray(result)) + result = scala.runtime.ScalaRunTime.toObjectArray(result).toList + println(s"[${result.getClass}] =======> $result") + } catch { + case ex: Throwable => + val realex = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex) + println(realex.getClass + ": " + realex.getMessage) + } + val meth = tpe.declaration(newTermName(method).encodedName.toTermName) + val testees = if (meth.isMethod) List(meth.asMethod) else meth.asTerm.alternatives.map(_.asMethod) + testees foreach (testee => { + val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.params.flatten.apply(i).typeSignature) } + print(s"testing ${tpe.typeSymbol.name}.$method(${testee.params.flatten.map(_.typeSignature).mkString(','.toString)}) with receiver = $receiver and args = ${convertedArgs.map(arg => arg + ' '.toString + arg.getClass).toList}: ") + wrap(cm.reflect(receiver).reflectMethod(testee)(convertedArgs: _*)) + }) + } + def header(tpe: Type) { + println(s"============\n$tpe") + println("it's important to print the list of Byte's members") + println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") + tpe.members.toList.sortBy(key).foreach(sym => println(key(sym))) + } + + def testNumeric[T: ClassTag](tpe: Type, value: T) { + header(tpe) + List("toByte", "toShort", "toChar", "toInt", "toLong", "toFloat", "toDouble") foreach (meth => test(tpe, value, meth)) + test(tpe, value, "==", 2) + test(tpe, value, "!=", 2) + test(tpe, value, "<", 2) + test(tpe, value, "<=", 2) + test(tpe, value, ">", 2) + test(tpe, value, ">=", 2) + test(tpe, value, "+", 2) + test(tpe, value, "-", 2) + test(tpe, value, "*", 2) + test(tpe, value, "/", 2) + test(tpe, value, "%", 2) + } + + def testIntegral[T: ClassTag](tpe: Type, value: T) { + testNumeric(tpe, value) + test(tpe, value, "unary_~") + test(tpe, value, "unary_+") + test(tpe, value, "unary_-") + test(tpe, value, "<<", 2) + test(tpe, value, ">>", 2) + test(tpe, value, ">>>", 2) + test(tpe, value, "|", 2) + test(tpe, value, "&", 2) + test(tpe, value, "^", 2) + } + + def testBoolean() { + header(typeOf[Boolean]) + test(typeOf[Boolean], true, "unary_!") + test(typeOf[Boolean], true, "==", true) + test(typeOf[Boolean], true, "!=", true) + test(typeOf[Boolean], true, "||", true) + test(typeOf[Boolean], true, "&&", true) + test(typeOf[Boolean], true, "|", true) + test(typeOf[Boolean], true, "&", true) + test(typeOf[Boolean], true, "^", true) + } + + def testUnit() { + header(typeOf[Unit]) + } + + testNumeric(typeOf[Byte], 2.toByte) + testNumeric(typeOf[Short], 2.toShort) + testNumeric(typeOf[Char], 2.toChar) + testNumeric(typeOf[Int], 2.toInt) + testNumeric(typeOf[Long], 2.toLong) + testNumeric(typeOf[Float], 2.toFloat) + testNumeric(typeOf[Double], 2.toDouble) + testBoolean() + testUnit() +}
\ No newline at end of file diff --git a/test/files/run/reflection-valueclasses-standard.check b/test/files/run/reflection-valueclasses-standard.check new file mode 100644 index 0000000000..060ab55406 --- /dev/null +++ b/test/files/run/reflection-valueclasses-standard.check @@ -0,0 +1,27 @@ +========byte========
+byte
+2
+========short========
+short
+2
+========int========
+int
+2
+========long========
+long
+2
+========float========
+float
+2.0
+========double========
+double
+2.0
+========char========
+char
+2
+========boolean========
+boolean
+true
+========void========
+void
+()
diff --git a/test/files/run/reflection-valueclasses-standard.scala b/test/files/run/reflection-valueclasses-standard.scala new file mode 100644 index 0000000000..18a3d1fa04 --- /dev/null +++ b/test/files/run/reflection-valueclasses-standard.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.{ClassTag, classTag} + +object Test extends App { + def test[T: ClassTag: TypeTag](x: T) = { + println(s"========${classTag[T].runtimeClass}========") + println(cm.reflect(x).reflectMethod(typeOf[T].member(newTermName("getClass")).asMethod)()) + println(cm.reflect(x).reflectMethod(typeOf[T].member(newTermName("toString")).asMethod)()) + } + + test(2.toByte) + test(2.toShort) + test(2.toInt) + test(2.toLong) + test(2.toFloat) + test(2.toDouble) + test('2') + test(true) + test(()) +}
\ No newline at end of file diff --git a/test/files/run/t3575.scala b/test/files/run/t3575.scala index 9ccd90a8c4..7ede65b00c 100644 --- a/test/files/run/t3575.scala +++ b/test/files/run/t3575.scala @@ -1,8 +1,8 @@ // This is here to tell me if the behavior changes, not because // the output is endorsed. case class Two[ - @specialized A, - @specialized B + @specialized(Specializable.Everything) A, + @specialized(Specializable.Everything) B ](v: A, w: B) case class TwoLong[ @@ -16,8 +16,8 @@ case class TwoCool[ ](v: A, w: B) case class TwoShort[ - @specialized() A, - @specialized() B + @specialized(Specializable.Everything) A, + @specialized(Specializable.Everything) B ](v: A, w: B) case class TwoMinimal[ diff --git a/test/files/run/t4172.check b/test/files/run/t4172.check index 4598e02d1f..f16c9e5151 100644 --- a/test/files/run/t4172.check +++ b/test/files/run/t4172.check @@ -5,7 +5,6 @@ scala> scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) } warning: there were 1 feature warnings; re-run with -feature for details -warning: there were 1 feature warnings; re-run with -feature for details c: (C, C{def f: Int}) forSome { type C <: Object } = (C,C) scala> diff --git a/test/files/run/t4536.flags b/test/files/run/t4536.flags new file mode 100644 index 0000000000..1141f97507 --- /dev/null +++ b/test/files/run/t4536.flags @@ -0,0 +1 @@ +-language:dynamics diff --git a/test/files/run/t4542.check b/test/files/run/t4542.check index a0600ba859..cd7a2905e2 100644 --- a/test/files/run/t4542.check +++ b/test/files/run/t4542.check @@ -15,9 +15,6 @@ scala> val f = new Foo <console>:8: warning: class Foo is deprecated: foooo val f = new Foo ^ -<console>:5: warning: class Foo is deprecated: foooo - lazy val $result = `f` - ^ f: Foo = Bippy scala> diff --git a/test/files/run/t5040.flags b/test/files/run/t5040.flags new file mode 100644 index 0000000000..1141f97507 --- /dev/null +++ b/test/files/run/t5040.flags @@ -0,0 +1 @@ +-language:dynamics diff --git a/test/files/run/t5713/Impls_Macros_1.scala b/test/files/run/t5713/Impls_Macros_1.scala index c041d36523..12c3da2ff0 100644 --- a/test/files/run/t5713/Impls_Macros_1.scala +++ b/test/files/run/t5713/Impls_Macros_1.scala @@ -1,7 +1,7 @@ package m import language.experimental.macros -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Level extends Enumeration { val Error = Value(5) diff --git a/test/files/run/t6063.check b/test/files/run/t6063.check new file mode 100644 index 0000000000..39347383f3 --- /dev/null +++ b/test/files/run/t6063.check @@ -0,0 +1 @@ +public static int foo.Ob.f5() diff --git a/test/files/run/t6063/S_1.scala b/test/files/run/t6063/S_1.scala new file mode 100644 index 0000000000..69b1e91271 --- /dev/null +++ b/test/files/run/t6063/S_1.scala @@ -0,0 +1,11 @@ +package foo + +abstract class Foo { + private[foo] def f1 = 1 + private def f2 = 2 + protected[foo] def f3 = 3 + protected def f4 = 4 + def f5 = 5 +} + +object Ob extends Foo diff --git a/test/files/run/t6063/S_2.scala b/test/files/run/t6063/S_2.scala new file mode 100644 index 0000000000..a990cc7931 --- /dev/null +++ b/test/files/run/t6063/S_2.scala @@ -0,0 +1,8 @@ +import java.lang.reflect.Modifier._ + +object Test { + def main(args: Array[String]): Unit = { + val forwarders = Class.forName("foo.Ob").getMethods.toList filter (m => isStatic(m.getModifiers)) + forwarders.sortBy(_.toString) foreach println + } +} diff --git a/test/files/run/t6102.check b/test/files/run/t6102.check new file mode 100644 index 0000000000..b6fc4c620b --- /dev/null +++ b/test/files/run/t6102.check @@ -0,0 +1 @@ +hello
\ No newline at end of file diff --git a/test/files/run/t6102.flags b/test/files/run/t6102.flags new file mode 100644 index 0000000000..e35535c8ea --- /dev/null +++ b/test/files/run/t6102.flags @@ -0,0 +1 @@ + -Ydead-code diff --git a/test/files/run/t6102.scala b/test/files/run/t6102.scala new file mode 100644 index 0000000000..53584055bb --- /dev/null +++ b/test/files/run/t6102.scala @@ -0,0 +1,13 @@ +// SI-6102 Wrong bytecode in lazyval + no-op finally clause + +object Test { + + def main(args: Array[String]) { + try { + val x = 3 + } finally { + print("hello") + } + } +} + diff --git a/test/files/run/t6175.scala b/test/files/run/t6175.scala new file mode 100644 index 0000000000..69a0a712b6 --- /dev/null +++ b/test/files/run/t6175.scala @@ -0,0 +1,5 @@ +object Test extends App { + import reflect.runtime._ + val m = universe.typeOf[List[_]].members.head.asMethod + currentMirror.reflect (List (2, 3, 1)).reflectMethod(m) +}
\ No newline at end of file diff --git a/test/files/run/t6178.check b/test/files/run/t6178.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/t6178.check @@ -0,0 +1 @@ +2
\ No newline at end of file diff --git a/test/files/run/t6178.scala b/test/files/run/t6178.scala new file mode 100644 index 0000000000..0b4cf0bbf5 --- /dev/null +++ b/test/files/run/t6178.scala @@ -0,0 +1,7 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + val plus = typeOf[java.lang.String].member(newTermName("$plus")).asMethod + println(cm.reflect("").reflectMethod(plus).apply("2")) +}
\ No newline at end of file diff --git a/test/files/run/t6181.check b/test/files/run/t6181.check new file mode 100644 index 0000000000..d8263ee986 --- /dev/null +++ b/test/files/run/t6181.check @@ -0,0 +1 @@ +2
\ No newline at end of file diff --git a/test/files/run/t6181.scala b/test/files/run/t6181.scala new file mode 100644 index 0000000000..fb23eaff63 --- /dev/null +++ b/test/files/run/t6181.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + class C { def test(x: => Int) = println(x) } + val mm = cm.reflect(new C).reflectMethod(typeOf[C].member(newTermName("test")).asMethod) + mm(2) +}
\ No newline at end of file diff --git a/test/files/run/t6188.check b/test/files/run/t6188.check new file mode 100644 index 0000000000..1af3932ecd --- /dev/null +++ b/test/files/run/t6188.check @@ -0,0 +1 @@ +Failure(java.lang.Exception: this is an exception)
diff --git a/test/files/run/t6188.flags b/test/files/run/t6188.flags new file mode 100644 index 0000000000..0ebca3e7af --- /dev/null +++ b/test/files/run/t6188.flags @@ -0,0 +1 @@ + -optimize diff --git a/test/files/run/t6188.scala b/test/files/run/t6188.scala new file mode 100644 index 0000000000..48180ddf9d --- /dev/null +++ b/test/files/run/t6188.scala @@ -0,0 +1,12 @@ +// SI-6188 Optimizer incorrectly removes method invocations containing throw expressions + +import scala.util.Success + +object Test { + def main(args: Array[String]) { + val e = new Exception("this is an exception") + val res = Success(1).flatMap[Int](x => throw e) + println(res) + } +} + diff --git a/test/files/run/t6199-mirror.check b/test/files/run/t6199-mirror.check new file mode 100644 index 0000000000..ec969b5b93 --- /dev/null +++ b/test/files/run/t6199-mirror.check @@ -0,0 +1 @@ +()
diff --git a/test/files/run/t6199-mirror.scala b/test/files/run/t6199-mirror.scala new file mode 100644 index 0000000000..772a384542 --- /dev/null +++ b/test/files/run/t6199-mirror.scala @@ -0,0 +1,7 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + class C { def foo = () } + println(cm.reflect(new C).reflectMethod(typeOf[C].member(newTermName("foo")).asMethod)()) +}
\ No newline at end of file diff --git a/test/files/run/t6199-toolbox.check b/test/files/run/t6199-toolbox.check new file mode 100644 index 0000000000..ec969b5b93 --- /dev/null +++ b/test/files/run/t6199-toolbox.check @@ -0,0 +1 @@ +()
diff --git a/test/files/run/t6199-toolbox.scala b/test/files/run/t6199-toolbox.scala new file mode 100644 index 0000000000..14670f8e21 --- /dev/null +++ b/test/files/run/t6199-toolbox.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val tb = cm.mkToolBox() + println(tb.runExpr(Literal(Constant(())))) +}
\ 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 f4a67e3054..9cf101c69d 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled.check @@ -8,11 +8,6 @@ ()
};
def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = {
- val $u: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe];
- val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $treecreator1.this.applyImpl[$u.type]($m).asInstanceOf[U#Tree]
- };
- private def applyImpl[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
$u.Literal.apply($u.Constant.apply(2))
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check index 53041e328d..d344e33180 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check @@ -8,11 +8,6 @@ ()
};
def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Tree = {
- val $u: scala.reflect.api.Universe = $m$untyped.universe.asInstanceOf[scala.reflect.api.Universe];
- val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $treecreator1.this.applyImpl[$u.type]($m).asInstanceOf[U#Tree]
- };
- private def applyImpl[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#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))))
@@ -28,7 +23,7 @@ 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").asModuleSymbol.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asTypeSymbol.asTypeConstructor))
+ $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()
diff --git a/test/files/run/typetags_serialize.check b/test/files/run/typetags_serialize.check new file mode 100644 index 0000000000..1b898250fb --- /dev/null +++ b/test/files/run/typetags_serialize.check @@ -0,0 +1,2 @@ +java.io.NotSerializableException: scala.reflect.base.TypeTags$PredefTypeCreator
+java.io.NotSerializableException: Test$$typecreator1$1
diff --git a/test/files/run/typetags_serialize.scala b/test/files/run/typetags_serialize.scala new file mode 100644 index 0000000000..3917b69a93 --- /dev/null +++ b/test/files/run/typetags_serialize.scala @@ -0,0 +1,28 @@ +import java.io._ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +object Test extends App { + def test(tag: TypeTag[_]) = + try { + val fout = new ByteArrayOutputStream() + val out = new ObjectOutputStream(fout) + out.writeObject(tag) + out.close() + fout.close() + + val fin = new ByteArrayInputStream(fout.toByteArray) + val in = new ObjectInputStream(fin) + val retag = in.readObject().asInstanceOf[scala.reflect.basis.TypeTag[_]].in(cm) + in.close() + fin.close() + + println(retag) + } catch { + case ex: Exception => + println(ex) + } + + test(implicitly[TypeTag[Int]]) + test(implicitly[TypeTag[String]]) +}
\ No newline at end of file diff --git a/test/files/speclib/instrumented.jar.desired.sha1 b/test/files/speclib/instrumented.jar.desired.sha1 index 0b8ee593da..9dd577164e 100644 --- a/test/files/speclib/instrumented.jar.desired.sha1 +++ b/test/files/speclib/instrumented.jar.desired.sha1 @@ -1 +1 @@ -474d8c20ab31438d5d4a2ba6bc07ebdcdb530b50 *instrumented.jar +1b11ac773055c1e942c6b5eb4aabdf02292a7194 ?instrumented.jar diff --git a/test/pending/run/macro-expand-default/Impls_1.scala b/test/pending/run/macro-expand-default/Impls_1.scala index a539982b45..7cf8d59c75 100644 --- a/test/pending/run/macro-expand-default/Impls_1.scala +++ b/test/pending/run/macro-expand-default/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = { diff --git a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala index 599ddf5ed9..26d4a45fee 100644 --- a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala +++ b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala @@ -1,7 +1,7 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Impls { - def foo[T: c.TypeTag](c: Context): c.Expr[List[T]] = c.universe.reify { + def foo[T: c.AbsTypeTag](c: Context): c.Expr[List[T]] = c.universe.reify { println("openImplicits are: " + c.literal(c.openImplicits.toString).splice) println("enclosingImplicits are: " + c.literal(c.enclosingImplicits.toString).splice) println("typetag is: " + c.literal(c.tag[T].toString).splice) diff --git a/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala b/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala index 3cee65ce72..be00fd0d8a 100644 --- a/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala +++ b/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo[U](c: Ctx)(x: c.Expr[U])(evidence: c.Expr[Numeric[U]]) = { diff --git a/test/pending/run/macro-expand-named/Impls_1.scala b/test/pending/run/macro-expand-named/Impls_1.scala index a539982b45..7cf8d59c75 100644 --- a/test/pending/run/macro-expand-named/Impls_1.scala +++ b/test/pending/run/macro-expand-named/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = { diff --git a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala index d7df919552..d6ebb907e5 100644 --- a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala +++ b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala @@ -1,11 +1,11 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { + def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = { import c.universe._ Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.AbsTypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(()))) } diff --git a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala index d7df919552..d6ebb907e5 100644 --- a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala +++ b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala @@ -1,11 +1,11 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T, U: c.TypeTag, V](c: Ctx)(implicit T: c.TypeTag[T], V: c.TypeTag[V]): c.Expr[Unit] = { + def foo[T, U: c.AbsTypeTag, V](c: Ctx)(implicit T: c.AbsTypeTag[T], V: c.AbsTypeTag[V]): c.Expr[Unit] = { import c.universe._ Block(List( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.TypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.AbsTypeTag[U]].toString)))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(()))) } diff --git a/test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala b/test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala index 0da37cd5c0..daedde4021 100644 --- a/test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala +++ b/test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} trait Impls { def impl(c: Ctx)(x: c.Expr[Any]) = x diff --git a/test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala b/test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala index 04a43080bd..27140a77ad 100644 --- a/test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala +++ b/test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Macros extends Impls { def foo(x: Any) = macro impl diff --git a/test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala b/test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala index d84d04974f..246fc9f904 100644 --- a/test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala +++ b/test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} trait ImplContainer { object Impls { diff --git a/test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala b/test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala index 82f88b62e4..da9445ac52 100644 --- a/test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala +++ b/test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Macros extends ImplContainer { def foo(x: Any) = macro Impls.foo diff --git a/test/pending/run/macro-reify-array/Macros_1.scala b/test/pending/run/macro-reify-array/Macros_1.scala index 4b4cb05884..99006c548a 100644 --- a/test/pending/run/macro-reify-array/Macros_1.scala +++ b/test/pending/run/macro-reify-array/Macros_1.scala @@ -1,10 +1,10 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Macros { def foo[T](s: String) = macro Impls.foo[T] object Impls { - def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify { + def foo[T: c.AbsTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify { Array(s.splice) } } diff --git a/test/pending/run/macro-reify-tagful-b/Macros_1.scala b/test/pending/run/macro-reify-tagful-b/Macros_1.scala index f730bb51f1..a14187e8a7 100644 --- a/test/pending/run/macro-reify-tagful-b/Macros_1.scala +++ b/test/pending/run/macro-reify-tagful-b/Macros_1.scala @@ -1,10 +1,10 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Macros { def foo[T](s: T) = macro Impls.foo[List[T]] object Impls { - def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify { + def foo[T: c.AbsTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify { List(s.splice) } } diff --git a/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala b/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala index 2c5079ea54..a581c47026 100644 --- a/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala +++ b/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.makro.{Context => Ctx} +import scala.reflect.macros.{Context => Ctx} object Macros { def foo[T](s: T) = macro Impls.foo[List[T]] diff --git a/test/pending/run/t5692/Impls_Macros_1.scala b/test/pending/run/t5692/Impls_Macros_1.scala index 7d0e788bd6..94bcffbcaf 100644 --- a/test/pending/run/t5692/Impls_Macros_1.scala +++ b/test/pending/run/t5692/Impls_Macros_1.scala @@ -1,7 +1,7 @@ -import scala.reflect.makro.Context +import scala.reflect.macros.Context object Impls { - def impl[A](c: reflect.makro.Context) = c.universe.reify(()) + def impl[A](c: reflect.macros.Context) = c.universe.reify(()) } object Macros { diff --git a/test/pending/script/dashi.check b/test/pending/script/dashi.check new file mode 100644 index 0000000000..c3cf137155 --- /dev/null +++ b/test/pending/script/dashi.check @@ -0,0 +1 @@ +test.bippy = dingus diff --git a/test/pending/script/dashi.flags b/test/pending/script/dashi.flags new file mode 100644 index 0000000000..5b46a61e4f --- /dev/null +++ b/test/pending/script/dashi.flags @@ -0,0 +1 @@ +-i dashi/a.scala -e 'setBippy ; getBippy' diff --git a/test/pending/script/dashi/a.scala b/test/pending/script/dashi/a.scala new file mode 100644 index 0000000000..c4a07bf9ba --- /dev/null +++ b/test/pending/script/dashi/a.scala @@ -0,0 +1,2 @@ +def setBippy = sys.props("test.bippy") = "dingus" +def getBippy = println("test.bippy = " + sys.props("test.bippy")) diff --git a/test/scaladoc/run/SI-5933.check b/test/scaladoc/run/SI-5933.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/SI-5933.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/SI-5933.scala b/test/scaladoc/run/SI-5933.scala new file mode 100644 index 0000000000..087116fa71 --- /dev/null +++ b/test/scaladoc/run/SI-5933.scala @@ -0,0 +1,43 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + // Test code + override def code = """ + // This example should compile without errors, and the pattern match should be correctly displayed + + import language.higherKinds + + abstract class Base[M[_, _]] { + def foo[A, B]: M[(A, B), Any] + } + + class Derived extends Base[PartialFunction] { + def foo[A, B] /*: PartialFunction[(A, B) => Any]*/ = { case (a, b) => (a: A, b: B) } + } + + object Test { + lazy val lx = { println("hello"); 3 } + def test1(x: Int = lx) = ??? + def test2(x: Int = lx match { case 0 => 1; case 3 => 4 }) = ??? + } + """ + + // no need for special settings + def scaladocSettings = "" + + def testModel(rootPackage: Package) = { + // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) + import access._ + + val Test = rootPackage._object("Test") + val test1 = Test._method("test1") + val test2 = Test._method("test2") + + def assertEqual(s1: String, s2: String) = assert(s1 == s2, s1 + " == " + s2) + + assertEqual(test1.valueParams(0)(0).defaultValue.get.expression, "lx") + assertEqual(test2.valueParams(0)(0).defaultValue.get.expression, "lx match { case 0 => 1; case 3 => 4 }") + } +}
\ No newline at end of file |