summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.xml29
-rw-r--r--docs/examples/plugintemplate/src/plugintemplate/standalone/Main.scala2
-rw-r--r--project/build/ScalaSBTBuilder.scala2
-rw-r--r--src/compiler/scala/reflect/internal/Importers.scala2
-rw-r--r--src/compiler/scala/reflect/internal/Types.scala10
-rw-r--r--src/compiler/scala/reflect/internal/pickling/UnPickler.scala2
-rw-r--r--src/compiler/scala/tools/ant/templates/tool-unix.tmpl22
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala4
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala20
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala23
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/Entity.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interactive/CompilerControl.scala2
-rw-r--r--src/compiler/scala/tools/nsc/io/Lexer.scala2
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/LiftCode.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala17
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala44
-rw-r--r--src/compiler/scala/tools/util/EditDistance.scala54
-rw-r--r--src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala2
-rw-r--r--src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala19
-rw-r--r--src/library/scala/Array.scala4
-rw-r--r--src/library/scala/Enumeration.scala64
-rw-r--r--src/library/scala/Option.scala5
-rw-r--r--src/library/scala/collection/BitSetLike.scala13
-rw-r--r--src/library/scala/collection/GenSeqLike.scala4
-rw-r--r--src/library/scala/collection/SeqLike.scala2
-rw-r--r--src/library/scala/collection/TraversableLike.scala4
-rw-r--r--src/library/scala/collection/immutable/BitSet.scala3
-rw-r--r--src/library/scala/collection/immutable/HashMap.scala2
-rw-r--r--src/library/scala/collection/immutable/List.scala5
-rw-r--r--src/library/scala/collection/immutable/ListMap.scala3
-rw-r--r--src/library/scala/collection/immutable/Queue.scala3
-rw-r--r--src/library/scala/collection/immutable/Range.scala10
-rw-r--r--src/library/scala/collection/immutable/Stack.scala3
-rw-r--r--src/library/scala/collection/immutable/Stream.scala3
-rw-r--r--src/library/scala/collection/immutable/TreeMap.scala3
-rw-r--r--src/library/scala/collection/immutable/TreeSet.scala3
-rw-r--r--src/library/scala/collection/immutable/Vector.scala3
-rw-r--r--src/library/scala/collection/mutable/ArrayBuffer.scala3
-rw-r--r--src/library/scala/collection/mutable/ArraySeq.scala2
-rw-r--r--src/library/scala/collection/mutable/ArrayStack.scala2
-rw-r--r--src/library/scala/collection/mutable/BitSet.scala3
-rw-r--r--src/library/scala/collection/mutable/ConcurrentMap.scala2
-rw-r--r--src/library/scala/collection/mutable/DoubleLinkedList.scala3
-rw-r--r--src/library/scala/collection/mutable/HashMap.scala2
-rw-r--r--src/library/scala/collection/mutable/HashSet.scala2
-rw-r--r--src/library/scala/collection/mutable/LinearSeq.scala2
-rw-r--r--src/library/scala/collection/mutable/LinkedList.scala2
-rw-r--r--src/library/scala/collection/mutable/ListBuffer.scala2
-rw-r--r--src/library/scala/collection/mutable/MutableList.scala2
-rw-r--r--src/library/scala/collection/mutable/Queue.scala2
-rw-r--r--src/library/scala/collection/mutable/Stack.scala2
-rw-r--r--src/library/scala/collection/mutable/StringBuilder.scala2
-rw-r--r--src/library/scala/collection/mutable/WeakHashMap.scala3
-rw-r--r--src/library/scala/math/package.scala12
-rw-r--r--src/library/scala/sys/process/ProcessBuilder.scala2
-rw-r--r--src/library/scala/util/parsing/combinator/Parsers.scala70
-rw-r--r--src/library/scala/util/parsing/combinator/RegexParsers.scala2
-rw-r--r--src/library/scala/util/parsing/json/JSON.scala2
-rw-r--r--src/msil/ch/epfl/lamp/compiler/msil/emit/OpCode.scala4
-rw-r--r--src/msil/ch/epfl/lamp/compiler/msil/emit/OpCodes.scala4
-rw-r--r--test/disabled/presentation/akka.check (renamed from test/files/presentation/akka.check)0
-rw-r--r--test/disabled/presentation/akka.flags (renamed from test/files/presentation/akka.flags)0
-rw-r--r--test/disabled/presentation/akka/Runner.scala (renamed from test/files/presentation/akka/Runner.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/AkkaException.scala (renamed from test/files/presentation/akka/src/akka/AkkaException.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/Actor.scala (renamed from test/files/presentation/akka/src/akka/actor/Actor.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/ActorRef.scala (renamed from test/files/presentation/akka/src/akka/actor/ActorRef.scala)2
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/ActorRegistry.scala (renamed from test/files/presentation/akka/src/akka/actor/ActorRegistry.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/Actors.java (renamed from test/files/presentation/akka/src/akka/actor/Actors.java)0
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/BootableActorLoaderService.scala (renamed from test/files/presentation/akka/src/akka/actor/BootableActorLoaderService.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/FSM.scala (renamed from test/files/presentation/akka/src/akka/actor/FSM.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/Scheduler.scala (renamed from test/files/presentation/akka/src/akka/actor/Scheduler.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/Supervisor.scala (renamed from test/files/presentation/akka/src/akka/actor/Supervisor.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/UntypedActor.scala (renamed from test/files/presentation/akka/src/akka/actor/UntypedActor.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/actor/package.scala (renamed from test/files/presentation/akka/src/akka/actor/package.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/config/Config.scala (renamed from test/files/presentation/akka/src/akka/config/Config.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/config/ConfigParser.scala (renamed from test/files/presentation/akka/src/akka/config/ConfigParser.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/config/Configuration.scala (renamed from test/files/presentation/akka/src/akka/config/Configuration.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/config/Configurator.scala (renamed from test/files/presentation/akka/src/akka/config/Configurator.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/config/Importer.scala (renamed from test/files/presentation/akka/src/akka/config/Importer.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/config/SupervisionConfig.scala (renamed from test/files/presentation/akka/src/akka/config/SupervisionConfig.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/dataflow/DataFlow.scala (renamed from test/files/presentation/akka/src/akka/dataflow/DataFlow.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/dispatch/Dispatchers.scala (renamed from test/files/presentation/akka/src/akka/dispatch/Dispatchers.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala (renamed from test/files/presentation/akka/src/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala (renamed from test/files/presentation/akka/src/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/dispatch/Future.scala (renamed from test/files/presentation/akka/src/akka/dispatch/Future.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/dispatch/MailboxHandling.scala (renamed from test/files/presentation/akka/src/akka/dispatch/MailboxHandling.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/dispatch/MessageHandling.scala (renamed from test/files/presentation/akka/src/akka/dispatch/MessageHandling.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/dispatch/ThreadBasedDispatcher.scala (renamed from test/files/presentation/akka/src/akka/dispatch/ThreadBasedDispatcher.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/dispatch/ThreadPoolBuilder.scala (renamed from test/files/presentation/akka/src/akka/dispatch/ThreadPoolBuilder.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/event/EventHandler.scala (renamed from test/files/presentation/akka/src/akka/event/EventHandler.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/event/JavaEventHandler.java (renamed from test/files/presentation/akka/src/akka/event/JavaEventHandler.java)0
-rw-r--r--test/disabled/presentation/akka/src/akka/japi/JavaAPI.scala (renamed from test/files/presentation/akka/src/akka/japi/JavaAPI.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/remoteinterface/RemoteEventHandler.scala (renamed from test/files/presentation/akka/src/akka/remoteinterface/RemoteEventHandler.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/remoteinterface/RemoteInterface.scala (renamed from test/files/presentation/akka/src/akka/remoteinterface/RemoteInterface.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/routing/Iterators.scala (renamed from test/files/presentation/akka/src/akka/routing/Iterators.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/routing/Listeners.scala (renamed from test/files/presentation/akka/src/akka/routing/Listeners.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/routing/Pool.scala (renamed from test/files/presentation/akka/src/akka/routing/Pool.scala)2
-rw-r--r--test/disabled/presentation/akka/src/akka/routing/Routers.scala (renamed from test/files/presentation/akka/src/akka/routing/Routers.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/routing/Routing.scala (renamed from test/files/presentation/akka/src/akka/routing/Routing.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/util/Address.scala (renamed from test/files/presentation/akka/src/akka/util/Address.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/util/AkkaLoader.scala (renamed from test/files/presentation/akka/src/akka/util/AkkaLoader.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/util/Bootable.scala (renamed from test/files/presentation/akka/src/akka/util/Bootable.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/util/BoundedBlockingQueue.scala (renamed from test/files/presentation/akka/src/akka/util/BoundedBlockingQueue.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/util/Crypt.scala (renamed from test/files/presentation/akka/src/akka/util/Crypt.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/util/Duration.scala (renamed from test/files/presentation/akka/src/akka/util/Duration.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/util/HashCode.scala (renamed from test/files/presentation/akka/src/akka/util/HashCode.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/util/Helpers.scala (renamed from test/files/presentation/akka/src/akka/util/Helpers.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/util/ListenerManagement.scala (renamed from test/files/presentation/akka/src/akka/util/ListenerManagement.scala)4
-rw-r--r--test/disabled/presentation/akka/src/akka/util/LockUtil.scala (renamed from test/files/presentation/akka/src/akka/util/LockUtil.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/util/ReflectiveAccess.scala (renamed from test/files/presentation/akka/src/akka/util/ReflectiveAccess.scala)0
-rw-r--r--test/disabled/presentation/akka/src/akka/util/package.scala (renamed from test/files/presentation/akka/src/akka/util/package.scala)0
-rw-r--r--test/disabled/presentation/akka/src/com/eaio/util/lang/Hex.java (renamed from test/files/presentation/akka/src/com/eaio/util/lang/Hex.java)0
-rw-r--r--test/disabled/presentation/akka/src/com/eaio/uuid/MACAddressParser.java (renamed from test/files/presentation/akka/src/com/eaio/uuid/MACAddressParser.java)0
-rw-r--r--test/disabled/presentation/akka/src/com/eaio/uuid/UUID.java (renamed from test/files/presentation/akka/src/com/eaio/uuid/UUID.java)0
-rw-r--r--test/disabled/presentation/akka/src/com/eaio/uuid/UUIDGen.java (renamed from test/files/presentation/akka/src/com/eaio/uuid/UUIDGen.java)0
-rw-r--r--test/disabled/presentation/akka/src/com/eaio/uuid/UUIDHelper.java (renamed from test/files/presentation/akka/src/com/eaio/uuid/UUIDHelper.java)0
-rw-r--r--test/disabled/presentation/akka/src/com/eaio/uuid/UUIDHolder.java (renamed from test/files/presentation/akka/src/com/eaio/uuid/UUIDHolder.java)0
-rw-r--r--test/disabled/presentation/akka/src/pi.scala (renamed from test/files/presentation/akka/src/pi.scala)0
-rw-r--r--test/disabled/presentation/timeofday.check (renamed from test/files/presentation/timeofday.check)0
-rw-r--r--test/disabled/presentation/timeofday/Runner.scala (renamed from test/files/presentation/timeofday/Runner.scala)0
-rw-r--r--test/disabled/presentation/timeofday/src/timeofday.scala (renamed from test/files/presentation/timeofday/src/timeofday.scala)0
-rw-r--r--test/files/jvm/signum.scala15
-rw-r--r--test/files/neg/nopredefs.check2
-rw-r--r--test/files/neg/reassignment.check13
-rw-r--r--test/files/neg/reassignment.scala7
-rw-r--r--test/files/neg/suggest-similar.check10
-rw-r--r--test/files/neg/suggest-similar.scala11
-rw-r--r--test/files/neg/t0903.check2
-rw-r--r--test/files/neg/t2870.check2
-rw-r--r--test/files/neg/t3481.check29
-rw-r--r--test/files/neg/t3481.scala28
-rw-r--r--test/files/pos/t4758.scala17
-rw-r--r--test/files/pos/t5084.scala5
-rw-r--r--test/files/run/adding-growing-set.scala2
-rw-r--r--test/files/run/enums.check10
-rw-r--r--test/files/run/enums.scala55
-rw-r--r--test/files/run/json.scala2
-rw-r--r--test/files/run/parserFilter.check9
-rw-r--r--test/files/run/parserFilter.scala15
-rw-r--r--test/files/run/parserForFilter.check1
-rw-r--r--test/files/run/parserForFilter.scala12
-rw-r--r--test/files/run/parserNoSuccessMessage.check20
-rw-r--r--test/files/run/parserNoSuccessMessage.scala19
-rw-r--r--test/files/run/reify_anonymous.check1
-rw-r--r--test/files/run/reify_anonymous.scala14
-rw-r--r--test/files/run/reify_for1.check0
-rw-r--r--test/files/run/reify_for1.scala16
-rw-r--r--test/files/run/reify_generic.check1
-rw-r--r--test/files/run/reify_generic.scala15
-rw-r--r--test/files/run/reify_inheritance.check1
-rw-r--r--test/files/run/reify_inheritance.scala23
-rw-r--r--test/files/run/reify_printf.check0
-rw-r--r--test/files/run/reify_printf.scala75
-rw-r--r--test/files/run/reify_varargs.check1
-rw-r--r--test/files/run/reify_varargs.scala17
-rw-r--r--test/files/run/t4658.check80
-rw-r--r--test/files/run/t4658.scala41
-rw-r--r--test/files/run/t5230.check2
-rw-r--r--test/files/run/t5230.scala (renamed from test/pending/run/t5230.scala)0
-rw-r--r--test/pending/run/reify_addressbook.check30
-rw-r--r--test/pending/run/reify_addressbook.scala71
-rw-r--r--test/pending/run/reify_brainf_ck.check4
-rw-r--r--test/pending/run/reify_brainf_ck.scala85
-rw-r--r--test/pending/run/reify_callccinterpreter.check3
-rw-r--r--test/pending/run/reify_callccinterpreter.scala94
-rw-r--r--test/pending/run/reify_complex.check1
-rw-r--r--test/pending/run/reify_complex.scala31
-rw-r--r--test/pending/run/reify_csv.check10
-rw-r--r--test/pending/run/reify_csv.scala42
-rw-r--r--test/pending/run/reify_extendbuiltins.check1
-rw-r--r--test/pending/run/reify_extendbuiltins.scala21
-rw-r--r--test/pending/run/reify_fors.check5
-rw-r--r--test/pending/run/reify_fors.scala107
-rw-r--r--test/pending/run/reify_gadts.check1
-rw-r--r--test/pending/run/reify_gadts.scala45
-rw-r--r--test/pending/run/reify_implicits.check1
-rw-r--r--test/pending/run/reify_implicits.scala21
-rw-r--r--test/pending/run/reify_lazyevaluation.check8
-rw-r--r--test/pending/run/reify_lazyevaluation.scala65
-rw-r--r--test/pending/run/reify_maps.check4
-rw-r--r--test/pending/run/reify_maps.scala26
-rw-r--r--test/pending/run/reify_properties.check2
-rw-r--r--test/pending/run/reify_properties.scala63
-rw-r--r--test/pending/run/reify_simpleinterpreter.check2
-rw-r--r--test/pending/run/reify_simpleinterpreter.scala82
-rw-r--r--test/pending/run/reify_sort.check2
-rw-r--r--test/pending/run/reify_sort.scala57
-rw-r--r--test/pending/run/reify_sort1.check2
-rw-r--r--test/pending/run/reify_sort1.scala27
-rw-r--r--test/pending/run/reify_timeofday.check1
-rw-r--r--test/pending/run/reify_timeofday.scala48
-rw-r--r--test/pending/run/t5224.check9
-rw-r--r--test/pending/run/t5224.scala8
-rw-r--r--test/pending/run/t5225_1.check4
-rw-r--r--test/pending/run/t5225_1.scala8
-rw-r--r--test/pending/run/t5225_2.check4
-rw-r--r--test/pending/run/t5225_2.scala8
-rw-r--r--test/pending/run/t5229_1.check0
-rw-r--r--test/pending/run/t5229_1.scala14
-rw-r--r--test/pending/run/t5229_1_nolift.scala1
-rw-r--r--test/pending/run/t5229_2.check2
-rw-r--r--test/pending/run/t5229_2.scala19
-rw-r--r--test/pending/run/t5230.check1
-rw-r--r--test/pending/run/t5266_1.check2
-rw-r--r--test/pending/run/t5266_1.scala23
-rw-r--r--test/pending/run/t5266_2.check2
-rw-r--r--test/pending/run/t5266_2.scala17
-rw-r--r--test/pending/run/t5269.check1
-rw-r--r--test/pending/run/t5269.scala22
-rw-r--r--test/pending/run/t5270.check1
-rw-r--r--test/pending/run/t5270.scala26
-rw-r--r--test/pending/run/t5271_1.check0
-rw-r--r--test/pending/run/t5271_1.scala14
-rw-r--r--test/pending/run/t5271_2.check1
-rw-r--r--test/pending/run/t5271_2.scala16
-rw-r--r--test/pending/run/t5272.check1
-rw-r--r--test/pending/run/t5272.scala17
-rw-r--r--test/pending/run/t5273_1.check1
-rw-r--r--test/pending/run/t5273_1.scala16
-rw-r--r--test/pending/run/t5273_2.check1
-rw-r--r--test/pending/run/t5273_2.scala17
-rw-r--r--test/pending/run/t5274_1.check3
-rw-r--r--test/pending/run/t5274_1.scala20
-rw-r--r--test/pending/run/t5274_2.check2
-rw-r--r--test/pending/run/t5274_2.scala57
-rw-r--r--test/pending/run/t5275.check1
-rw-r--r--test/pending/run/t5275.scala15
-rw-r--r--test/pending/run/t5276.check1
-rw-r--r--test/pending/run/t5276.scala15
-rw-r--r--test/pending/run/t5277_1.check1
-rw-r--r--test/pending/run/t5277_1.scala21
-rw-r--r--test/pending/run/t5277_2.check2
-rw-r--r--test/pending/run/t5277_2.scala18
-rw-r--r--test/pending/run/t5279.check1
-rw-r--r--test/pending/run/t5279.scala14
-rwxr-xr-xtools/get-scala-revision31
-rw-r--r--tools/get-scala-revision.bat28
242 files changed, 2401 insertions, 168 deletions
diff --git a/build.xml b/build.xml
index 1694ba8b7a..6a708755a3 100644
--- a/build.xml
+++ b/build.xml
@@ -201,7 +201,17 @@ PROPERTIES
INITIALISATION
============================================================================ -->
- <target name="init">
+ <condition property="starr.absent">
+ <not><available file="${lib.dir}/scala-library.jar"/></not>
+ </condition>
+
+ <target name="init.starr" if="starr.absent">
+ <echo level="warn" message="Downloading bootstrap libs. (To do this by hand, run ./pull-binary-libs.sh)"/>
+ <exec osfamily="unix" vmlauncher="false" executable="./pull-binary-libs.sh" failifexecutionfails="true" />
+ <exec osfamily="windows" vmlauncher="false" executable="pull-binary-libs.sh" failifexecutionfails="true" />
+ </target>
+
+ <target name="init" depends="init.starr">
<!-- scalac.args.optimise is selectively overridden in certain antcall tasks. -->
<property name="scalac.args.optimise" value=""/>
<!-- scalac.args.quickonly are added to quick.* targets but not others (particularly, locker.)
@@ -222,10 +232,10 @@ INITIALISATION
<os family="windows"/>
</condition>
- <exec osfamily="unix" executable="tools/get-scala-revision" outputproperty="svn.number" failifexecutionfails="false" />
- <exec osfamily="windows" executable="tools/get-scala-revision.bat" outputproperty="svn.number" failifexecutionfails="false" />
+ <exec osfamily="unix" executable="tools/get-scala-revision" outputproperty="git.describe" failifexecutionfails="false" />
+ <exec osfamily="windows" executable="tools/get-scala-revision.bat" outputproperty="git.describe" failifexecutionfails="false" />
<!-- some default in case something went wrong getting the revision -->
- <property name="svn.number" value="0"/>
+ <property name="git.describe" value="-unknown-"/>
<property name="init.avail" value="yes"/>
@@ -233,10 +243,11 @@ INITIALISATION
<property file="${basedir}/build.number"/>
<property
name="version.number"
- value="${version.major}.${version.minor}.${version.patch}.r${svn.number}-b${time.short}"/>
+ value="${version.major}.${version.minor}.${version.patch}.${git.describe}"/>
+
<!-- And print-out what we are building -->
<echo level="info" message="Build number is '${version.number}'"/>
- <echo level="info" message="Built ${time.human} from revision ${svn.number} with ${java.vm.name} ${java.version}"/>
+ <echo level="info" message="Built ${time.human} from revision ${git.describe} with ${java.vm.name} ${java.version}"/>
<!-- Local libs (developer use.) -->
<mkdir dir="${lib-extra.dir}"/>
@@ -639,7 +650,7 @@ QUICK BUILD (QUICK)
<scalacfork
destdir="${build-quick.dir}/classes/library"
compilerpathref="quick.classpath"
- params="${scalac.args.quick} -Xplugin-require:continuations -P:continuations:enable"
+ params="${scalac.args.quick} -Xplugin-require:continuations"
srcdir="${src.dir}/continuations/library"
jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
@@ -1154,7 +1165,7 @@ BOOTSTRAPPING BUILD (STRAP)
<scalacfork
destdir="${build-strap.dir}/classes/library"
compilerpathref="pack.classpath"
- params="${scalac.args.all} -Xplugin-require:continuations -P:continuations:enable"
+ params="${scalac.args.all} -Xplugin-require:continuations"
srcdir="${src.dir}/continuations/library"
jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
@@ -1614,7 +1625,7 @@ BOOTRAPING TEST AND TEST SUITE
<partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java"
timeout="2400000"
srcdir="${partest.srcdir}"
- scalacopts="${scalac.args.optimise} -Xplugin-require:continuations -P:continuations:enable">
+ scalacopts="${scalac.args.optimise} -Xplugin-require:continuations">
<compilerarg value="-Xpluginsdir"/>
<compilerarg file="${build-quick.dir}/misc/scala-devel/plugins"/>
<compilationpath>
diff --git a/docs/examples/plugintemplate/src/plugintemplate/standalone/Main.scala b/docs/examples/plugintemplate/src/plugintemplate/standalone/Main.scala
index 19d2613649..0bfcbf53c7 100644
--- a/docs/examples/plugintemplate/src/plugintemplate/standalone/Main.scala
+++ b/docs/examples/plugintemplate/src/plugintemplate/standalone/Main.scala
@@ -16,7 +16,7 @@ object Main {
val settings = new Settings
val command = new CompilerCommand(args.toList, settings) {
- /** The command name that will be printed in in the usage message.
+ /** The command name that will be printed in the usage message.
* This is automatically set to the value of 'plugin.commandname' in the
* file build.properties.
*/
diff --git a/project/build/ScalaSBTBuilder.scala b/project/build/ScalaSBTBuilder.scala
index 81c7860020..881e8c8452 100644
--- a/project/build/ScalaSBTBuilder.scala
+++ b/project/build/ScalaSBTBuilder.scala
@@ -351,7 +351,7 @@ object ScalaSBTBuilder {
val stabilityTestTaskDescription = "run stability testing. It is required to use a clean build (for example, execute the clean-all action) in order to ensure correctness of the result."
val paloTaskDescription = "create palo"
val pastaTaskDescription = "create all the jar needed to make a new starr from quick (pasta = packed starr). It does not replace the current library and compiler jars in the libs folder, but the products of the task are instead located in target/pasta"
- val newStarrTaskDescription = "create a new starr and replace the library and compiler jars in the libs folder. It will keep locker locker locked, meaning that if you want to update locker after updating starr, you must run the 'new-locker' command. It will not automatically run partest and stability testing before replacing."
+ val newStarrTaskDescription = "create a new starr and replace the library and compiler jars in the libs folder. It will keep locker locked, meaning that if you want to update locker after updating starr, you must run the 'new-locker' command. It will not automatically run partest and stability testing before replacing."
val newLockerTaskDescription = "replace locker. It will build a new locker. It does not automatically rebuild quick."
val buildForkjoinTaskDescription = "create all the jar needed to make a new forkjoin. It does not replace the current library and compiler jars in the libs folder, but the products of the task are instead located in target/libs."
val newForkjoinTaskDescription = "create a new forkjoin and replace the corresponding jar in the libs folder."
diff --git a/src/compiler/scala/reflect/internal/Importers.scala b/src/compiler/scala/reflect/internal/Importers.scala
index 6d672d9263..60b353a7c4 100644
--- a/src/compiler/scala/reflect/internal/Importers.scala
+++ b/src/compiler/scala/reflect/internal/Importers.scala
@@ -231,6 +231,8 @@ trait Importers { self: SymbolTable =>
new PackageDef(importRefTree(pid), stats map importTree)
case from.ModuleDef(mods, name, impl) =>
new ModuleDef(importModifiers(mods), importName(name).toTermName, importTemplate(impl))
+ case from.emptyValDef =>
+ emptyValDef
case from.ValDef(mods, name, tpt, rhs) =>
new ValDef(importModifiers(mods), importName(name).toTermName, importTree(tpt), importTree(rhs))
case from.DefDef(mods, name, tparams, vparamss, tpt, rhs) =>
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala
index 320fb949ff..265261f594 100644
--- a/src/compiler/scala/reflect/internal/Types.scala
+++ b/src/compiler/scala/reflect/internal/Types.scala
@@ -4174,8 +4174,16 @@ A type's typeSymbol should never be inspected directly.
private def adaptToNewRun(pre: Type, sym: Symbol): Symbol = {
if (phase.flatClasses) {
sym
+ } else if (sym == definitions.RootClass) {
+ definitions.RootClass
+ } else if (sym == definitions.RootPackage) {
+ definitions.RootPackage
} else if (sym.isModuleClass) {
- adaptToNewRun(pre, sym.sourceModule).moduleClass
+ val sourceModule1 = adaptToNewRun(pre, sym.sourceModule)
+ val result = sourceModule1.moduleClass
+ val msg = "sym = %s, sourceModule = %s, sourceModule.moduleClass = %s => sourceModule1 = %s, sourceModule1.moduleClass = %s"
+ assert(result != NoSymbol, msg.format(sym, sym.sourceModule, sym.sourceModule.moduleClass, sourceModule1, sourceModule1.moduleClass))
+ result
} else if ((pre eq NoPrefix) || (pre eq NoType) || sym.isPackageClass) {
sym
} else {
diff --git a/src/compiler/scala/reflect/internal/pickling/UnPickler.scala b/src/compiler/scala/reflect/internal/pickling/UnPickler.scala
index 00dc04de80..9aa3d8a2c3 100644
--- a/src/compiler/scala/reflect/internal/pickling/UnPickler.scala
+++ b/src/compiler/scala/reflect/internal/pickling/UnPickler.scala
@@ -509,7 +509,7 @@ abstract class UnPickler /*extends reflect.generic.UnPickler*/ {
val tpe = if (tag == EMPTYtree) NoType else readTypeRef()
// Set by the three functions to follow. If symbol is non-null
- // after the the new tree 't' has been created, t has its Symbol
+ // after the new tree 't' has been created, t has its Symbol
// set to symbol; and it always has its Type set to tpe.
var symbol: Symbol = null
var mods: Modifiers = null
diff --git a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
index 4275ef7ba1..7e51930fa4 100644
--- a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
+++ b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
@@ -58,12 +58,17 @@ if uname | grep -q ^CYGWIN; then
cygwin="$(uname)"
fi
+unset mingw
+if uname | grep -q ^MINGW; then
+ mingw="$(uname)"
+fi
+
# Finding the root folder for this Scala distribution
SCALA_HOME="$(findScalaHome)"
SEP=":"
# Possible additional command line options
-CYGWIN_OPT=""
+WINDOWS_OPT=""
EMACS_OPT=""
[[ -n "$EMACS" ]] && EMACS_OPT="-Denv.emacs=$EMACS"
@@ -94,10 +99,16 @@ if [[ -n "$cygwin" ]]; then
fi
SCALA_HOME="$(cygpath --$format "$SCALA_HOME")"
TOOL_CLASSPATH="$(cygpath --path --$format "$TOOL_CLASSPATH")"
+elif [[ -n "$mingw" ]]; then
+ SCALA_HOME="$(cmd //c echo "$SCALA_HOME")"
+ TOOL_CLASSPATH="$(cmd //c echo "$TOOL_CLASSPATH")"
+fi
+
+if [[ -n "$cygwin$mingw" ]]; then
case "$TERM" in
rxvt* | xterm*)
stty -icanon min 1 -echo
- CYGWIN_OPT="-Djline.terminal=scala.tools.jline.UnixTerminal"
+ WINDOWS_OPT="-Djline.terminal=scala.tools.jline.UnixTerminal"
;;
esac
fi
@@ -110,9 +121,10 @@ fi
declare -a java_args
declare -a scala_args
-# default to the boot classpath for speed, except on cygwin/mingw.
+# default to the boot classpath for speed, except on cygwin/mingw because
+# JLine on Windows requires a custom DLL to be loaded.
unset usebootcp
-if [[ -z $cygwin ]]; then
+if [[ -z "$cygwin$mingw" ]]; then
usebootcp="true"
fi
@@ -181,7 +193,7 @@ execCommand \
-Dscala.home="$SCALA_HOME" \
-Dscala.usejavacp=true \
$EMACS_OPT \
- $CYGWIN_OPT \
+ $WINDOWS_OPT \
@properties@ @class@ @toolflags@ "$@@"
# record the exit status lest it be overwritten:
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index 9668debbbb..85849cfad4 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -257,6 +257,10 @@ trait Trees extends reflect.internal.Trees { self: Global =>
case _: DefTree | Function(_, _) | Template(_, _, _) =>
resetDef(tree)
tree.tpe = null
+ tree match {
+ case tree: DefDef => tree.tpt.tpe = null
+ case _ => ()
+ }
case tpt: TypeTree =>
if (tpt.wasEmpty) tree.tpe = null
case This(_) if tree.symbol != null && tree.symbol.isPackageClass =>
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index f65481e29a..13f608ed4e 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -310,7 +310,7 @@ abstract class TreeBuilder {
* for (P <- G) E ==> G.foreach (P => E)
*
* Here and in the following (P => E) is interpreted as the function (P => E)
- * if P is a a variable pattern and as the partial function { case P => E } otherwise.
+ * if P is a variable pattern and as the partial function { case P => E } otherwise.
*
* 2.
*
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala
index 8130c99978..1978a23d90 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala
@@ -284,7 +284,7 @@ trait Linearizers {
handler.startBlock +=: lb
}
- // The first block emitted after a try-catch must be the the one that the try / catch
+ // The first block emitted after a try-catch must be the one that the try / catch
// blocks jump to (because in msil, these jumps cannot be emitted manually)
var firstAfter: Option[BasicBlock] = None
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala b/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala
index 70aa8ff54e..865bacffaa 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala
@@ -7,7 +7,7 @@ package scala.tools.nsc
package backend.jvm
import ch.epfl.lamp.fjbg._
-import java.io.{ DataOutputStream, OutputStream, File => JFile }
+import java.io.{ DataOutputStream, FileOutputStream, OutputStream, File => JFile }
import scala.tools.nsc.io._
import scala.tools.nsc.util.ScalaClassLoader
import scala.tools.util.JavapClass
@@ -85,7 +85,7 @@ trait BytecodeWriters {
emitJavap(bytes, javapFile)
}
}
-
+
trait ClassBytecodeWriter extends BytecodeWriter {
def writeClass(label: String, jclass: JClass, sym: Symbol) {
val outfile = getFile(sym, jclass, ".class")
@@ -96,4 +96,20 @@ trait BytecodeWriters {
informProgress("wrote '" + label + "' to " + outfile)
}
}
+
+ trait DumpBytecodeWriter extends BytecodeWriter {
+ val baseDir = Directory(settings.Ydumpclasses.value).createDirectory()
+
+ abstract override def writeClass(label: String, jclass: JClass, sym: Symbol) {
+ super.writeClass(label, jclass, sym)
+
+ val pathName = jclass.getName()
+ var dumpFile = pathName.split("[./]").foldLeft(baseDir: Path) (_ / _) changeExtension "class" toFile;
+ dumpFile.parent.createDirectory()
+ val outstream = new DataOutputStream(new FileOutputStream(dumpFile.path))
+
+ try jclass writeTo outstream
+ finally outstream.close()
+ }
+ }
}
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index 3fe5b83515..e80927f620 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -129,7 +129,12 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
new DirectToJarfileWriter(f.file)
case _ =>
- if (settings.Ygenjavap.isDefault) new ClassBytecodeWriter { }
+ if (settings.Ygenjavap.isDefault) {
+ if(settings.Ydumpclasses.isDefault)
+ new ClassBytecodeWriter { }
+ else
+ new ClassBytecodeWriter with DumpBytecodeWriter { }
+ }
else new ClassBytecodeWriter with JavapBytecodeWriter { }
}
@@ -308,6 +313,18 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
private var innerClassBuffer = mutable.LinkedHashSet[Symbol]()
+ /** Drop redundant interfaces (ones which are implemented by some
+ * other parent) from the immediate parents. This is important on
+ * android because there is otherwise an interface explosion.
+ */
+ private def minimizeInterfaces(interfaces: List[Symbol]): List[Symbol] = (
+ interfaces filterNot (int1 =>
+ interfaces exists (int2 =>
+ (int1 ne int2) && (int2 isSubClass int1)
+ )
+ )
+ )
+
def genClass(c: IClass) {
clasz = c
innerClassBuffer.clear()
@@ -322,7 +339,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
}
val ifaces = superInterfaces match {
case Nil => JClass.NO_INTERFACES
- case _ => mkArray(superInterfaces map (x => javaName(x.typeSymbol)))
+ case _ => mkArray(minimizeInterfaces(superInterfaces map (_.typeSymbol)) map javaName)
}
jclass = fjbgContext.JClass(javaFlags(c.symbol),
@@ -469,7 +486,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
// push the class
jcode emitPUSH javaType(c.symbol).asInstanceOf[JReferenceType]
- // push the the string array of field information
+ // push the string array of field information
jcode emitPUSH fieldList.length
jcode emitANEWARRAY strKind
push(fieldList)
diff --git a/src/compiler/scala/tools/nsc/doc/model/Entity.scala b/src/compiler/scala/tools/nsc/doc/model/Entity.scala
index 266b9294dd..6eb14a4907 100644
--- a/src/compiler/scala/tools/nsc/doc/model/Entity.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/Entity.scala
@@ -376,7 +376,7 @@ trait ParameterEntity extends Entity {
/** A type parameter to a class, trait, or method. */
trait TypeParam extends ParameterEntity with HigherKinded {
- /** The variance of this type type parameter. Valid values are "+", "-", and the empty string. */
+ /** The variance of this type parameter. Valid values are "+", "-", and the empty string. */
def variance: String
/** The lower bound for this type parameter, if it has been defined. */
diff --git a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
index c2e27cd205..f2d59206e0 100644
--- a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
+++ b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
@@ -128,7 +128,7 @@ trait CompilerControl { self: Global =>
}
/** Sets sync var `response` to the smallest fully attributed tree that encloses position `pos`.
- * Note: Unlike for most other ask... operations, the source file belonging to `pos` needs not be be loaded.
+ * Note: Unlike for most other ask... operations, the source file belonging to `pos` needs not be loaded.
*/
def askTypeAt(pos: Position, response: Response[Tree]) =
postWorkItem(new AskTypeAtItem(pos, response))
diff --git a/src/compiler/scala/tools/nsc/io/Lexer.scala b/src/compiler/scala/tools/nsc/io/Lexer.scala
index 8f103f9b98..5ffb5b4d4f 100644
--- a/src/compiler/scala/tools/nsc/io/Lexer.scala
+++ b/src/compiler/scala/tools/nsc/io/Lexer.scala
@@ -281,7 +281,7 @@ class Lexer(rd: Reader) {
/** The current token is a delimiter consisting of given character, reads next token,
* otherwise raises an error.
* @param c the given delimiter character to compare current token with
- * @throws MalformedInput if the the current token `token` is not a delimiter, or
+ * @throws MalformedInput if the current token `token` is not a delimiter, or
* consists of a character different from `c`.
*/
def accept(ch: Char) {
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index 6be15e4e98..7fcfb6fc6d 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -139,6 +139,7 @@ trait ScalaSettings extends AbsScalaSettings
val Yshowsyms = BooleanSetting ("-Yshow-syms", "Print the AST symbol hierarchy after each phase.")
val skip = PhasesSetting ("-Yskip", "Skip")
val Ygenjavap = StringSetting ("-Ygen-javap", "dir", "Generate a parallel output directory of .javap files.", "")
+ val Ydumpclasses = StringSetting ("-Ydump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", "")
val Ynosqueeze = BooleanSetting ("-Yno-squeeze", "Disable creation of compact code in matching.")
val Ystatistics = BooleanSetting ("-Ystatistics", "Print compiler statistics.") .
withPostSetHook(set => util.Statistics.enabled = set.value)
diff --git a/src/compiler/scala/tools/nsc/transform/LiftCode.scala b/src/compiler/scala/tools/nsc/transform/LiftCode.scala
index 7a64fc9b5e..f3f823d197 100644
--- a/src/compiler/scala/tools/nsc/transform/LiftCode.scala
+++ b/src/compiler/scala/tools/nsc/transform/LiftCode.scala
@@ -95,7 +95,7 @@ abstract class LiftCode extends Transform with TypingTransformers {
buf.append(", " + "List(" + annotations + ")")
var s = buf.toString
- if (s.endsWith(", Map()")) s = s.substring(0, s.length - ", Map()".length)
+ if (s.endsWith(", List()")) s = s.substring(0, s.length - ", List()".length)
if (s.endsWith(", newTypeName(\"\")")) s = s.substring(0, s.length - ", newTypeName(\"\")".length)
if (s.endsWith("Set()")) s = s.substring(0, s.length - "Set()".length)
"Modifiers(" + s + ")"
@@ -475,7 +475,7 @@ abstract class LiftCode extends Transform with TypingTransformers {
case tt: TypeTree if (tt.tpe != null) =>
if (!(boundSyms exists (tt.tpe contains _))) mirrorCall("TypeTree", reifyType(tt.tpe))
else if (tt.original != null) reify(tt.original)
- else TypeTree()
+ else mirrorCall("TypeTree")
case global.emptyValDef =>
mirrorSelect("emptyValDef")
case _ =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index d252281002..1d9eb9c292 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -17,13 +17,16 @@ import annotation.tailrec
trait Contexts { self: Analyzer =>
import global._
- val NoContext = new Context {
- override def implicitss: List[List[ImplicitInfo]] = List()
- outer = this
+ object NoContext extends Context {
+ outer = this
+ enclClass = this
+ enclMethod = this
+
+ override def nextEnclosing(p: Context => Boolean): Context = this
+ override def enclosingContextChain: List[Context] = Nil
+ override def implicitss: List[List[ImplicitInfo]] = Nil
override def toString = "NoContext"
}
- NoContext.enclClass = NoContext
- NoContext.enclMethod = NoContext
private val startContext = {
NoContext.make(
@@ -337,7 +340,9 @@ trait Contexts { self: Analyzer =>
}
def nextEnclosing(p: Context => Boolean): Context =
- if (this == NoContext || p(this)) this else outer.nextEnclosing(p)
+ if (p(this)) this else outer.nextEnclosing(p)
+
+ def enclosingContextChain: List[Context] = this :: outer.enclosingContextChain
override def toString = "Context(%s@%s unit=%s scope=%s)".format(
owner.fullName, tree.shortClass, unit, scope.##
diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
index cc88f471ab..e4ebe13217 100644
--- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
@@ -227,7 +227,7 @@ trait NamesDefaults { self: Analyzer =>
// super constructor calls
case Select(sp @ Super(_, _), _) if isConstr =>
// 'moduleQual' fixes #3207. selection of the companion module of the
- // superclass needs to have the same prefix as the the superclass.
+ // superclass needs to have the same prefix as the superclass.
blockWithoutQualifier(moduleQual(baseFun.pos, sp.symbol.tpe.parents.head))
// self constructor calls (in secondary constructors)
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
index 3c72dc8413..c9991614e4 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
@@ -284,7 +284,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
}
/** Add a protected accessor, if needed, and return a tree that calls
- * the accessor and returns the the same member. The result is already
+ * the accessor and returns the same member. The result is already
* typed.
*/
private def makeAccessor(tree: Select, targs: List[Tree]): Tree = {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index b969e9629f..7671ccbed7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -19,6 +19,7 @@ import symtab.Flags._
import util.Statistics
import util.Statistics._
import scala.tools.util.StringOps.{ countAsString, countElementsAsString }
+import scala.tools.util.EditDistance.similarString
// Suggestion check whether we can do without priming scopes with symbols of outer scopes,
// like the IDE does.
@@ -3457,12 +3458,10 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
if (treeInfo.isVariableOrGetter(qual1)) {
stopTimer(failedOpEqNanos, opeqStart)
convertToAssignment(fun, qual1, name, args, ex)
- } else {
+ }
+ else {
stopTimer(failedApplyNanos, appStart)
- if ((qual1.symbol ne null) && qual1.symbol.isValue)
- error(tree.pos, "reassignment to val")
- else
- reportTypeError(fun.pos, ex)
+ reportTypeError(fun.pos, ex)
setError(tree)
}
case _ =>
@@ -3754,7 +3753,11 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
defSym = EmptyPackageClass.tpe.nonPrivateMember(name)
defSym != NoSymbol
}
-
+ def startingIdentContext = (
+ // ignore current variable scope in patterns to enforce linearity
+ if ((mode & (PATTERNmode | TYPEPATmode)) == 0) context
+ else context.outer
+ )
// A symbol qualifies if it exists and is not stale. Stale symbols
// are made to disappear here. In addition,
// if we are in a constructor of a pattern, we ignore all definitions
@@ -3770,13 +3773,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
if (defSym == NoSymbol) {
var defEntry: ScopeEntry = null // the scope entry of defSym, if defined in a local scope
- var cx = context
- if ((mode & (PATTERNmode | TYPEPATmode)) != 0) {
- // println("ignoring scope: "+name+" "+cx.scope+" "+cx.outer.scope)
- // ignore current variable scope in patterns to enforce linearity
- cx = cx.outer
- }
-
+ var cx = startingIdentContext
while (defSym == NoSymbol && cx != NoContext) {
currentRun.compileSourceFor(context.asInstanceOf[analyzer.Context], name)
pre = cx.enclClass.prefix
@@ -3874,7 +3871,26 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
if (inaccessibleSym eq NoSymbol) {
// Avoiding some spurious error messages: see SI-2388.
if (reporter.hasErrors && (name startsWith tpnme.ANON_CLASS_NAME)) ()
- else error(tree.pos, "not found: "+decodeWithKind(name, context.owner))
+ else {
+ val similar = (
+ // name length check to limit unhelpful suggestions for e.g. "x" and "b1"
+ if (name.length > 2) {
+ val allowed = (
+ startingIdentContext.enclosingContextChain
+ flatMap (ctx => ctx.scope.toList ++ ctx.imports.flatMap(_.allImportedSymbols))
+ filter (sym => sym.isTerm == name.isTermName)
+ filterNot (sym => sym.isPackage || sym.isSynthetic || sym.hasMeaninglessName)
+ )
+ val allowedStrings = (
+ allowed.map("" + _.name).distinct.sorted
+ filterNot (s => (s contains '$') || (s contains ' '))
+ )
+ similarString("" + name, allowedStrings)
+ }
+ else ""
+ )
+ error(tree.pos, "not found: "+decodeWithKind(name, context.owner) + similar)
+ }
}
else new AccessError(
tree, inaccessibleSym, context.enclClass.owner.thisType,
diff --git a/src/compiler/scala/tools/util/EditDistance.scala b/src/compiler/scala/tools/util/EditDistance.scala
new file mode 100644
index 0000000000..a8d7408532
--- /dev/null
+++ b/src/compiler/scala/tools/util/EditDistance.scala
@@ -0,0 +1,54 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2011 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+package scala.tools
+package util
+
+object EditDistance {
+ def similarString(name: String, allowed: TraversableOnce[String]): String = {
+ val suggested = suggestions(name, allowed.toSeq, maxDistance = 1, maxSuggestions = 2)
+ if (suggested.isEmpty) ""
+ else suggested.mkString(" (similar: ", ", ", ")")
+ }
+
+ def suggestions(a: String, bs: Seq[String], maxDistance: Int, maxSuggestions: Int): Seq[String] = (
+ bs map (b => (b, distance(a, b)))
+ filter (_._2 <= maxDistance)
+ sortBy (_._2)
+ take (maxSuggestions)
+ map (_._1)
+ )
+
+ def distance(a: String, b: String): Int = levenshtein(a, b, transpositions = true)
+
+ def levenshtein(s: String, t: String, transpositions: Boolean): Int = {
+ val n = s.length
+ val m = t.length
+ if (n == 0) return m
+ if (m == 0) return n
+
+ val d = Array.ofDim[Int](n + 1, m + 1)
+ 0 to n foreach (x => d(x)(0) = x)
+ 0 to m foreach (x => d(0)(x) = x)
+
+ for (i <- 1 to n ; val s_i = s(i - 1) ; j <- 1 to m) {
+ val t_j = t(j - 1)
+ val cost = if (s_i == t_j) 0 else 1
+
+ val c1 = d(i - 1)(j) + 1
+ val c2 = d(i)(j - 1) + 1
+ val c3 = d(i - 1)(j - 1) + cost
+
+ d(i)(j) = c1 min c2 min c3
+
+ if (transpositions) {
+ if (i > 1 && j > 1 && s(i - 1) == t(j - 2) && s(i - 2) == t(j - 1))
+ d(i)(j) = d(i)(j) min (d(i - 2)(j - 2) + cost)
+ }
+ }
+
+ d(n)(m)
+ }
+}
diff --git a/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala b/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala
index 5cb06d42db..f4481b800e 100644
--- a/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala
+++ b/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala
@@ -9,7 +9,7 @@ trait CPSUtils {
import global._
import definitions._
- var cpsEnabled = false
+ var cpsEnabled = true
val verbose: Boolean = System.getProperty("cpsVerbose", "false") == "true"
def vprintln(x: =>Any): Unit = if (verbose) println(x)
diff --git a/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala b/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala
index 8a500d6c4d..eb18f03748 100644
--- a/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala
+++ b/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala
@@ -26,7 +26,6 @@ class SelectiveCPSPlugin(val global: Global) extends Plugin {
override val runsBefore = List("uncurry")
}
-
val components = List[PluginComponent](anfPhase, cpsPhase)
val checker = new CPSAnnotationChecker {
@@ -43,19 +42,17 @@ class SelectiveCPSPlugin(val global: Global) extends Plugin {
}
// TODO: require -enabled command-line flag
-
override def processOptions(options: List[String], error: String => Unit) = {
- var enabled = false
- for (option <- options) {
- if (option == "enable") {
- enabled = true
- } else {
- error("Option not understood: "+option)
- }
+ var enabled = true
+ options foreach {
+ case "enable" => enabled = true
+ case "disable" => enabled = false
+ case option => error("Option not understood: "+option)
}
setEnabled(enabled)
}
- override val optionsHelp: Option[String] =
- Some(" -P:continuations:enable Enable continuations")
+ override val optionsHelp: Option[String] = {
+ Some(" -P:continuations:disable Disable continuations plugin")
+ }
}
diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala
index ae0dd68dfd..99c54ce58c 100644
--- a/src/library/scala/Array.scala
+++ b/src/library/scala/Array.scala
@@ -24,7 +24,7 @@ class FallbackArrayBuilding {
* Called instead of `Array.newBuilder` if the element type of an array
* does not have a class manifest. Note that fallbackBuilder factory
* needs an implicit parameter (otherwise it would not be dominated in
- * implicit search by `Array.canBuildFrom`). We make sure that that
+ * implicit search by `Array.canBuildFrom`). We make sure that
* implicit search is always successful.
*/
implicit def fallbackCanBuildFrom[T](implicit m: DummyImplicit): CanBuildFrom[Array[_], T, ArraySeq[T]] =
@@ -465,7 +465,7 @@ object Array extends FallbackArrayBuilding {
*
* @author Martin Odersky
* @version 1.0
- * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_38.html "The Scala 2.8 Collections API"]]
+ * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_38.html#anchor "The Scala 2.8 Collections' API"]]
* section on `Array` by Martin Odersky for more information.
*/
final class Array[T](_length: Int) extends java.io.Serializable with java.lang.Cloneable {
diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala
index 07e758013c..c967a48abc 100644
--- a/src/library/scala/Enumeration.scala
+++ b/src/library/scala/Enumeration.scala
@@ -8,7 +8,7 @@
package scala
-import scala.collection.{ mutable, immutable, generic, SetLike, AbstractSet }
+import scala.collection.{ mutable, immutable, generic, SortedSetLike, AbstractSet }
import java.lang.reflect.{ Modifier, Method => JMethod, Field => JField }
import scala.reflect.NameTransformer._
import java.util.regex.Pattern
@@ -53,10 +53,14 @@ import java.util.regex.Pattern
* @author Matthias Zenger
*/
@SerialVersionUID(8476000850333817230L)
-abstract class Enumeration(initial: Int, names: String*) extends Serializable {
+abstract class Enumeration(initial: Int,
+ @deprecated("Names should be specified individually or discovered via reflection", "2.10")
+ names: String*) extends Serializable {
thisenum =>
def this() = this(0)
+
+ @deprecated("Names should be specified individually or discovered via reflection", "2.10")
def this(names: String*) = this(0, names: _*)
/* Note that `readResolve` cannot be private, since otherwise
@@ -86,7 +90,7 @@ abstract class Enumeration(initial: Int, names: String*) extends Serializable {
*/
def values: ValueSet = {
if (!vsetDefined) {
- vset = new ValueSet(immutable.SortedSet.empty[Int] ++ (vmap.values map (_.id)))
+ vset = (ValueSet.newBuilder ++= vmap.values).result()
vsetDefined = true
}
vset
@@ -104,6 +108,10 @@ abstract class Enumeration(initial: Int, names: String*) extends Serializable {
* enumeration. */
private var topId = initial
+ /** The lowest integer amongst those used to identify values in this
+ * enumeration, but no higher than 0. */
+ private var bottomId = if(initial < 0) initial else 0
+
/** The highest integer amongst those used to identify values in this
* enumeration. */
final def maxId = topId
@@ -200,6 +208,9 @@ abstract class Enumeration(initial: Int, names: String*) extends Serializable {
case _ => false
}
override def hashCode: Int = id.##
+
+ /** Create a ValueSet which contains this value and another one */
+ def + (v: Value) = ValueSet(this, v)
}
/** A class implementing the [[scala.Enumeration.Value]] type. This class
@@ -217,6 +228,7 @@ abstract class Enumeration(initial: Int, names: String*) extends Serializable {
vsetDefined = false
nextId = i + 1
if (nextId > topId) topId = nextId
+ if (i < bottomId) bottomId = i
def id = i
override def toString() =
if (name != null) name
@@ -230,34 +242,56 @@ abstract class Enumeration(initial: Int, names: String*) extends Serializable {
}
}
+ /** An ordering by id for values of this set */
+ object ValueOrdering extends Ordering[Value] {
+ def compare(x: Value, y: Value): Int = x.id - y.id
+ }
+
/** A class for sets of values.
* Iterating through this set will yield values in increasing order of their ids.
*
- * @param ids The set of ids of values, organized as a `SortedSet`.
+ * @param nnIds The set of ids of values (adjusted so that the lowest value does
+ * not fall below zero), organized as a `BitSet`.
*/
- class ValueSet private[Enumeration] (val ids: immutable.SortedSet[Int])
+ class ValueSet private[ValueSet] (private[this] var nnIds: immutable.BitSet)
extends AbstractSet[Value]
- with Set[Value]
- with SetLike[Value, ValueSet] {
+ with immutable.SortedSet[Value]
+ with SortedSetLike[Value, ValueSet]
+ with Serializable {
+
+ implicit def ordering: Ordering[Value] = ValueOrdering
+ def rangeImpl(from: Option[Value], until: Option[Value]): ValueSet =
+ new ValueSet(nnIds.rangeImpl(from.map(_.id - bottomId), until.map(_.id - bottomId)))
override def empty = ValueSet.empty
- def contains(v: Value) = ids contains (v.id)
- def + (value: Value) = new ValueSet(ids + value.id)
- def - (value: Value) = new ValueSet(ids - value.id)
- def iterator = ids.iterator map thisenum.apply
+ def contains(v: Value) = nnIds contains (v.id - bottomId)
+ def + (value: Value) = new ValueSet(nnIds + (value.id - bottomId))
+ def - (value: Value) = new ValueSet(nnIds - (value.id - bottomId))
+ def iterator = nnIds.iterator map (id => thisenum.apply(id + bottomId))
override def stringPrefix = thisenum + ".ValueSet"
+ /** Creates a bit mask for the zero-adjusted ids in this set as a
+ * new array of longs */
+ def toBitMask: Array[Long] = nnIds.toBitMask
}
-
+
/** A factory object for value sets */
object ValueSet {
import generic.CanBuildFrom
/** The empty value set */
- val empty = new ValueSet(immutable.SortedSet.empty)
+ val empty = new ValueSet(immutable.BitSet.empty)
/** A value set consisting of given elements */
- def apply(elems: Value*): ValueSet = empty ++ elems
+ def apply(elems: Value*): ValueSet = (newBuilder ++= elems).result()
+ /** A value set containing all the values for the zero-adjusted ids
+ * corresponding to the bits in an array */
+ def fromBitMask(elems: Array[Long]): ValueSet = new ValueSet(immutable.BitSet.fromBitMask(elems))
/** A builder object for value sets */
- def newBuilder: mutable.Builder[Value, ValueSet] = new mutable.SetBuilder(empty)
+ def newBuilder: mutable.Builder[Value, ValueSet] = new mutable.Builder[Value, ValueSet] {
+ private[this] val b = new mutable.BitSet
+ def += (x: Value) = { b += (x.id - bottomId); this }
+ def clear() = b.clear
+ def result() = new ValueSet(b.toImmutable)
+ }
/** The implicit builder for value sets */
implicit def canBuildFrom: CanBuildFrom[ValueSet, Value, ValueSet] =
new CanBuildFrom[ValueSet, Value, ValueSet] {
diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala
index c1b64808b0..bd498de847 100644
--- a/src/library/scala/Option.scala
+++ b/src/library/scala/Option.scala
@@ -162,6 +162,11 @@ sealed abstract class Option[+A] extends Product with Serializable {
@inline final def filterNot(p: A => Boolean): Option[A] =
if (isEmpty || !p(this.get)) this else None
+ /** Returns false if the option is $none, true otherwise.
+ * @note Implemented here to avoid the implicit conversion to Iterable.
+ */
+ final def nonEmpty = isDefined
+
/** Necessary to keep $option from being implicitly converted to
* [[scala.collection.Iterable]] in `for` comprehensions.
*/
diff --git a/src/library/scala/collection/BitSetLike.scala b/src/library/scala/collection/BitSetLike.scala
index 7d9f48f299..e4f9fd436a 100644
--- a/src/library/scala/collection/BitSetLike.scala
+++ b/src/library/scala/collection/BitSetLike.scala
@@ -65,7 +65,7 @@ trait BitSetLike[+This <: BitSetLike[This] with SortedSet[Int]] extends SortedSe
var i = nwords
while (i > 0) {
i -= 1
- s += popCount(word(i))
+ s += java.lang.Long.bitCount(word(i))
}
s
}
@@ -221,15 +221,4 @@ object BitSetLike {
else assert(w == 0L)
newelems
}
-
- private val pc1: Array[Int] = {
- def countBits(x: Int): Int = if (x == 0) 0 else x % 2 + countBits(x >>> 1)
- Array.tabulate(256)(countBits _)
- }
-
- private def popCount(w: Long): Int = {
- def pc2(w: Int) = if (w == 0) 0 else pc1(w & 0xff) + pc1(w >>> 8)
- def pc4(w: Int) = if (w == 0) 0 else pc2(w & 0xffff) + pc2(w >>> 16)
- if (w == 0L) 0 else pc4(w.toInt) + pc4((w >>> 32).toInt)
- }
}
diff --git a/src/library/scala/collection/GenSeqLike.scala b/src/library/scala/collection/GenSeqLike.scala
index b3dd4764a9..63e9543711 100644
--- a/src/library/scala/collection/GenSeqLike.scala
+++ b/src/library/scala/collection/GenSeqLike.scala
@@ -276,6 +276,8 @@ trait GenSeqLike[+A, +Repr] extends GenIterableLike[A, Repr] with Equals with Pa
/** A copy of the $coll with an element prepended.
*
* Note that :-ending operators are right associative (see example).
+ * A mnemonic for `+:` vs. `:+` is: the COLon goes on the COLlection side.
+ *
* Also, the original $coll is not modified, so you will want to capture the result.
*
* Example:
@@ -304,6 +306,8 @@ trait GenSeqLike[+A, +Repr] extends GenIterableLike[A, Repr] with Equals with Pa
/** A copy of this $coll with an element appended.
*
+ * A mnemonic for `+:` vs. `:+` is: the COLon goes on the COLlection side.
+ *
* $willNotTerminateInf
* @param elem the appended element
* @tparam B the element type of the returned $coll.
diff --git a/src/library/scala/collection/SeqLike.scala b/src/library/scala/collection/SeqLike.scala
index 8a4f2ff31a..b6b4bfb96d 100644
--- a/src/library/scala/collection/SeqLike.scala
+++ b/src/library/scala/collection/SeqLike.scala
@@ -21,7 +21,7 @@ import scala.math.Ordering
* @define seqInfo
* Sequences are special cases of iterable collections of class `Iterable`.
* Unlike iterables, sequences always have a defined order of elements.
- * Sequences provide a method `apply` for indexing. Indices range from `0` up the the `length` of
+ * Sequences provide a method `apply` for indexing. Indices range from `0` up to the `length` of
* a sequence. Sequences support a number to find occurrences of elements or subsequences, including
* `segmentLength`, `prefixLength`, `indexWhere`, `indexOf`, `lastIndexWhere`, `lastIndexOf`,
* `startsWith`, `endsWith`, `indexOfSlice`.
diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala
index 6fa05bd85b..4f0fec1de3 100644
--- a/src/library/scala/collection/TraversableLike.scala
+++ b/src/library/scala/collection/TraversableLike.scala
@@ -159,8 +159,10 @@ trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr]
/** As with `++`, returns a new collection containing the elements from the left operand followed by the
* elements from the right operand.
+ *
* It differs from `++` in that the right operand determines the type of
* the resulting collection rather than the left one.
+ * Mnemonic: the COLon is on the side of the new COLlection type.
*
* Example:
* {{{
@@ -195,8 +197,10 @@ trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr]
/** As with `++`, returns a new collection containing the elements from the
* left operand followed by the elements from the right operand.
+ *
* It differs from `++` in that the right operand determines the type of
* the resulting collection rather than the left one.
+ * Mnemonic: the COLon is on the side of the new COLlection type.
*
* Example:
* {{{
diff --git a/src/library/scala/collection/immutable/BitSet.scala b/src/library/scala/collection/immutable/BitSet.scala
index ce4d688707..abccd91f9c 100644
--- a/src/library/scala/collection/immutable/BitSet.scala
+++ b/src/library/scala/collection/immutable/BitSet.scala
@@ -17,6 +17,9 @@ import mutable.{ Builder, SetBuilder }
/** A class for immutable bitsets.
* $bitsetinfo
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#immutable_bitsets "Scala's Collection Library overview"]]
+ * section on `Immutable BitSets` for more information.
+ *
* @define Coll immutable.BitSet
* @define coll immutable bitset
*/
diff --git a/src/library/scala/collection/immutable/HashMap.scala b/src/library/scala/collection/immutable/HashMap.scala
index 79ee067d63..55ce8fa822 100644
--- a/src/library/scala/collection/immutable/HashMap.scala
+++ b/src/library/scala/collection/immutable/HashMap.scala
@@ -25,6 +25,8 @@ import parallel.immutable.ParHashMap
* @author Tiark Rompf
* @version 2.8
* @since 2.3
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#hash_tries "Scala's Collection Library overview"]]
+ * section on `Hash Tries` for more information.
* @define Coll immutable.HashMap
* @define coll immutable hash map
* @define mayNotTerminateInf
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala
index d5e5f2aee0..531eac6c01 100644
--- a/src/library/scala/collection/immutable/List.scala
+++ b/src/library/scala/collection/immutable/List.scala
@@ -57,10 +57,9 @@ import annotation.tailrec
* @author Martin Odersky and others
* @version 2.8
* @since 1.0
+ * @see [["http://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#lists" "Scala's Collection Library overview"]]
+ * section on `Lists` for more information.
*
- * @tparam A the type of the list's elements
- *
- * @define Coll List
* @define coll list
* @define thatinfo the class of the returned collection. In the standard library configuration,
* `That` is always `List[B]` because an implicit of type `CanBuildFrom[List, B, That]`
diff --git a/src/library/scala/collection/immutable/ListMap.scala b/src/library/scala/collection/immutable/ListMap.scala
index b2b933c51a..e008fb86e3 100644
--- a/src/library/scala/collection/immutable/ListMap.scala
+++ b/src/library/scala/collection/immutable/ListMap.scala
@@ -16,6 +16,9 @@ import annotation.{tailrec, bridge}
/** $factoryInfo
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#list_maps "Scala's Collection Library overview"]]
+ * section on `List Maps` for more information.
+ *
* @define Coll immutable.ListMap
* @define coll immutable list map
*/
diff --git a/src/library/scala/collection/immutable/Queue.scala b/src/library/scala/collection/immutable/Queue.scala
index 6e73eef101..da04446281 100644
--- a/src/library/scala/collection/immutable/Queue.scala
+++ b/src/library/scala/collection/immutable/Queue.scala
@@ -27,6 +27,9 @@ import annotation.tailrec
* @author Erik Stenman
* @version 1.0, 08/07/2003
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#immutable_queues "Scala's Collection Library overview"]]
+ * section on `Immutable Queues` for more information.
+ *
* @define Coll immutable.Queue
* @define coll immutable queue
* @define mayNotTerminateInf
diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala
index 47ce2f0341..e891f8bec8 100644
--- a/src/library/scala/collection/immutable/Range.scala
+++ b/src/library/scala/collection/immutable/Range.scala
@@ -31,6 +31,9 @@ import annotation.bridge
* @author Paul Phillips
* @version 2.8
* @since 2.5
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#ranges "Scala's Collection Library overview"]]
+ * section on `Ranges` for more information.
+ *
* @define Coll Range
* @define coll range
* @define mayNotTerminateInf
@@ -211,6 +214,13 @@ extends collection.AbstractSeq[Int]
final def contains(x: Int) = isWithinBoundaries(x) && ((x - start) % step == 0)
+ final override def sum[B >: Int](implicit num: Numeric[B]): Int = {
+ val len = length
+ if (len == 0) 0
+ else if (len == 1) head
+ else (len.toLong * (head + last) / 2).toInt
+ }
+
override def toIterable = this
override def toSeq = this
diff --git a/src/library/scala/collection/immutable/Stack.scala b/src/library/scala/collection/immutable/Stack.scala
index d65300ecb7..50fc2795c0 100644
--- a/src/library/scala/collection/immutable/Stack.scala
+++ b/src/library/scala/collection/immutable/Stack.scala
@@ -34,6 +34,9 @@ object Stack extends SeqFactory[Stack] {
* @author Matthias Zenger
* @version 1.0, 10/07/2003
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#immutable_stacks "Scala's Collection Library overview"]]
+ * section on `Immutable stacks` for more information.
+ *
* @define Coll immutable.Stack
* @define coll immutable stack
* @define orderDependent
diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala
index 7bae387ad2..e6587f9615 100644
--- a/src/library/scala/collection/immutable/Stream.scala
+++ b/src/library/scala/collection/immutable/Stream.scala
@@ -172,6 +172,9 @@ import Stream.cons
* @author Martin Odersky, Matthias Zenger
* @version 1.1 08/08/03
* @since 2.8
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#streams "Scala's Collection Library overview"]]
+ * section on `Streams` for more information.
+
* @define naturalsEx def naturalsFrom(i: Int): Stream[Int] = i #:: naturalsFrom(i + 1)
* @define Coll Stream
* @define coll stream
diff --git a/src/library/scala/collection/immutable/TreeMap.scala b/src/library/scala/collection/immutable/TreeMap.scala
index a46583c541..ef0eac3701 100644
--- a/src/library/scala/collection/immutable/TreeMap.scala
+++ b/src/library/scala/collection/immutable/TreeMap.scala
@@ -36,6 +36,9 @@ object TreeMap extends ImmutableSortedMapFactory[TreeMap] {
* @author Matthias Zenger
* @version 1.1, 03/05/2004
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#redblack_trees "Scala's Collection Library overview"]]
+ * section on `Red-Black Trees` for more information.
+ *
* @define Coll immutable.TreeMap
* @define coll immutable tree map
* @define orderDependent
diff --git a/src/library/scala/collection/immutable/TreeSet.scala b/src/library/scala/collection/immutable/TreeSet.scala
index 3fa1213359..8b90ece143 100644
--- a/src/library/scala/collection/immutable/TreeSet.scala
+++ b/src/library/scala/collection/immutable/TreeSet.scala
@@ -36,6 +36,9 @@ object TreeSet extends ImmutableSortedSetFactory[TreeSet] {
* @author Martin Odersky
* @version 2.0, 02/01/2007
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#redblack_trees "Scala's Collection Library overview"]]
+ * section on `Red-Black Trees` for more information.
+ *
* @define Coll immutable.TreeSet
* @define coll immutable tree set
* @define orderDependent
diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala
index ab12300097..55c31feec2 100644
--- a/src/library/scala/collection/immutable/Vector.scala
+++ b/src/library/scala/collection/immutable/Vector.scala
@@ -35,6 +35,9 @@ object Vector extends SeqFactory[Vector] {
* endian bit-mapped vector trie with a branching factor of 32. Locality is very good, but not
* contiguous, which is good for very large sequences.
*
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#vectors "Scala's Collection Library overview"]]
+ * section on `Vectors` for more information.
+ *
* @tparam A the element type
*
* @define Coll Vector
diff --git a/src/library/scala/collection/mutable/ArrayBuffer.scala b/src/library/scala/collection/mutable/ArrayBuffer.scala
index ea56eee395..bfdc08536c 100644
--- a/src/library/scala/collection/mutable/ArrayBuffer.scala
+++ b/src/library/scala/collection/mutable/ArrayBuffer.scala
@@ -23,6 +23,9 @@ import parallel.mutable.ParArray
* @author Martin Odersky
* @version 2.8
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#array_buffers "Scala's Collection Library overview"]]
+ * section on `Array Buffers` for more information.
+
*
* @tparam A the type of this arraybuffer's elements.
*
diff --git a/src/library/scala/collection/mutable/ArraySeq.scala b/src/library/scala/collection/mutable/ArraySeq.scala
index 414d80b462..cb86c416fe 100644
--- a/src/library/scala/collection/mutable/ArraySeq.scala
+++ b/src/library/scala/collection/mutable/ArraySeq.scala
@@ -21,6 +21,8 @@ import parallel.mutable.ParArray
* @author Martin Odersky
* @version 2.8
* @since 2.8
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#array_sequences "Scala's Collection Library overview"]]
+ * section on `Array Sequences` for more information.
*
* @tparam A type of the elements contained in this array sequence.
* @param length the length of the underlying array.
diff --git a/src/library/scala/collection/mutable/ArrayStack.scala b/src/library/scala/collection/mutable/ArrayStack.scala
index c46955477b..f5287312b9 100644
--- a/src/library/scala/collection/mutable/ArrayStack.scala
+++ b/src/library/scala/collection/mutable/ArrayStack.scala
@@ -46,6 +46,8 @@ object ArrayStack extends SeqFactory[ArrayStack] {
*
* @author David MacIver
* @since 2.7
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#array_stacks "Scala's Collection Library overview"]]
+ * section on `Array Stacks` for more information.
*
* @tparam T type of the elements contained in this array stack.
*
diff --git a/src/library/scala/collection/mutable/BitSet.scala b/src/library/scala/collection/mutable/BitSet.scala
index 9dce3ff9e2..6b9673dae6 100644
--- a/src/library/scala/collection/mutable/BitSet.scala
+++ b/src/library/scala/collection/mutable/BitSet.scala
@@ -18,6 +18,9 @@ import BitSetLike.{LogWL, updateArray}
*
* $bitsetinfo
*
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#mutable_bitsets "Scala's Collection Library overview"]]
+ * section on `Mutable Bitsets` for more information.
+ *
* @define Coll BitSet
* @define coll bitset
* @define thatinfo the class of the returned collection. In the standard library configuration,
diff --git a/src/library/scala/collection/mutable/ConcurrentMap.scala b/src/library/scala/collection/mutable/ConcurrentMap.scala
index 7e526fd4ea..fbb356ffb3 100644
--- a/src/library/scala/collection/mutable/ConcurrentMap.scala
+++ b/src/library/scala/collection/mutable/ConcurrentMap.scala
@@ -14,6 +14,8 @@ package mutable
* $concurrentmapinfo
*
* @since 2.8
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#concurrent_maps "Scala's Collection Library overview"]]
+ * section on `Concurrent Maps` for more information.
*
* @tparam A the key type of the map
* @tparam B the value type of the map
diff --git a/src/library/scala/collection/mutable/DoubleLinkedList.scala b/src/library/scala/collection/mutable/DoubleLinkedList.scala
index dd111b3800..49378a4f4e 100644
--- a/src/library/scala/collection/mutable/DoubleLinkedList.scala
+++ b/src/library/scala/collection/mutable/DoubleLinkedList.scala
@@ -20,6 +20,9 @@ import generic._
* @author Martin Odersky
* @version 2.8
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#double_linked_lists "Scala's Collection Library overview"]]
+ * section on `Double Linked Lists` for more information.
+
*
* @tparam A the type of the elements contained in this double linked list.
*
diff --git a/src/library/scala/collection/mutable/HashMap.scala b/src/library/scala/collection/mutable/HashMap.scala
index c86ee39256..65a10f4ba9 100644
--- a/src/library/scala/collection/mutable/HashMap.scala
+++ b/src/library/scala/collection/mutable/HashMap.scala
@@ -15,6 +15,8 @@ import scala.collection.parallel.mutable.ParHashMap
/** This class implements mutable maps using a hashtable.
*
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#hash_tables "Scala's Collection Library overview"]]
+ * section on `Hash Tables` for more information.
*
* @tparam A the type of the keys contained in this hash map.
* @tparam B the type of the values assigned to keys in this hash map.
diff --git a/src/library/scala/collection/mutable/HashSet.scala b/src/library/scala/collection/mutable/HashSet.scala
index 6a6964609c..8ed6b925aa 100644
--- a/src/library/scala/collection/mutable/HashSet.scala
+++ b/src/library/scala/collection/mutable/HashSet.scala
@@ -22,6 +22,8 @@ import collection.parallel.mutable.ParHashSet
* @author Martin Odersky
* @version 2.0, 31/12/2006
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#hash_tables "Scala's Collection Library overview"]]
+ * section on `Hash Tables` for more information.
*
* @define Coll mutable.HashSet
* @define coll mutable hash set
diff --git a/src/library/scala/collection/mutable/LinearSeq.scala b/src/library/scala/collection/mutable/LinearSeq.scala
index e29d6bf3e6..522ebfd277 100644
--- a/src/library/scala/collection/mutable/LinearSeq.scala
+++ b/src/library/scala/collection/mutable/LinearSeq.scala
@@ -19,6 +19,8 @@ import generic._
*
* @define Coll LinearSeq
* @define coll linear sequence
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#mutable_lists "Scala's Collection Library overview"]]
+ * section on `Mutable Lists` for more information.
*/
trait LinearSeq[A] extends Seq[A]
with scala.collection.LinearSeq[A]
diff --git a/src/library/scala/collection/mutable/LinkedList.scala b/src/library/scala/collection/mutable/LinkedList.scala
index 65391f5884..8510827697 100644
--- a/src/library/scala/collection/mutable/LinkedList.scala
+++ b/src/library/scala/collection/mutable/LinkedList.scala
@@ -33,6 +33,8 @@ import generic._
* @author Martin Odersky
* @version 2.8
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#linked_lists "Scala's Collection Library overview"]]
+ * section on `Linked Lists` for more information.
*
* @tparam A the type of the elements contained in this linked list.
*
diff --git a/src/library/scala/collection/mutable/ListBuffer.scala b/src/library/scala/collection/mutable/ListBuffer.scala
index 233544c4ca..131cdd0005 100644
--- a/src/library/scala/collection/mutable/ListBuffer.scala
+++ b/src/library/scala/collection/mutable/ListBuffer.scala
@@ -21,6 +21,8 @@ import immutable.{List, Nil, ::}
* @author Martin Odersky
* @version 2.8
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#list_buffers "Scala's Collection Library overview"]]
+ * section on `List Buffers` for more information.
*
* @tparam A the type of this list buffer's elements.
*
diff --git a/src/library/scala/collection/mutable/MutableList.scala b/src/library/scala/collection/mutable/MutableList.scala
index 20910e48f4..c9e44ac165 100644
--- a/src/library/scala/collection/mutable/MutableList.scala
+++ b/src/library/scala/collection/mutable/MutableList.scala
@@ -23,6 +23,8 @@ import immutable.{List, Nil}
* @author Martin Odersky
* @version 2.8
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#mutable_lists "Scala's Collection Library overview"]]
+ * section on `Mutable Lists` for more information.
*/
@SerialVersionUID(5938451523372603072L)
class MutableList[A]
diff --git a/src/library/scala/collection/mutable/Queue.scala b/src/library/scala/collection/mutable/Queue.scala
index e1723241f5..77b1ae21cb 100644
--- a/src/library/scala/collection/mutable/Queue.scala
+++ b/src/library/scala/collection/mutable/Queue.scala
@@ -20,6 +20,8 @@ import generic._
* @author Martin Odersky
* @version 2.8
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#mutable_queues "Scala's Collection Library overview"]]
+ * section on `Queues` for more information.
*
* @define Coll mutable.Queue
* @define coll mutable queue
diff --git a/src/library/scala/collection/mutable/Stack.scala b/src/library/scala/collection/mutable/Stack.scala
index c795609b67..ffac3b78b7 100644
--- a/src/library/scala/collection/mutable/Stack.scala
+++ b/src/library/scala/collection/mutable/Stack.scala
@@ -44,6 +44,8 @@ object Stack extends SeqFactory[Stack] {
* @author Martin Odersky
* @version 2.8
* @since 1
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#stacks"Scala's Collection Library overview"]]
+ * section on `Stacks` for more information.
* @define Coll Stack
* @define coll stack
* @define orderDependent
diff --git a/src/library/scala/collection/mutable/StringBuilder.scala b/src/library/scala/collection/mutable/StringBuilder.scala
index 6fb4b839ef..603086d209 100644
--- a/src/library/scala/collection/mutable/StringBuilder.scala
+++ b/src/library/scala/collection/mutable/StringBuilder.scala
@@ -21,6 +21,8 @@ import immutable.StringLike
* @author Martin Odersky
* @version 2.8
* @since 2.7
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html# "Scala's Collection Library overview"]]
+ * section on `StringBuilders` for more information.
*/
@SerialVersionUID(0 - 8525408645367278351L)
final class StringBuilder(private val underlying: JavaStringBuilder)
diff --git a/src/library/scala/collection/mutable/WeakHashMap.scala b/src/library/scala/collection/mutable/WeakHashMap.scala
index be2daa05ce..89d7c7a695 100644
--- a/src/library/scala/collection/mutable/WeakHashMap.scala
+++ b/src/library/scala/collection/mutable/WeakHashMap.scala
@@ -23,6 +23,9 @@ import generic._
* @tparam B type of values associated with the keys
*
* @since 2.8
+ * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#weak_hash_maps "Scala's Collection Library overview"]]
+ * section on `Weak Hash Maps` for more information.
+ *
* @define Coll WeakHashMap
* @define coll weak hash map
* @define thatinfo the class of the returned collection. In the standard library configuration,
diff --git a/src/library/scala/math/package.scala b/src/library/scala/math/package.scala
index 8948722340..0417461f85 100644
--- a/src/library/scala/math/package.scala
+++ b/src/library/scala/math/package.scala
@@ -127,15 +127,9 @@ package object math {
else if (x > 0) 1.0f
else x // NaN
- def signum(x: Long): Long =
- if (x == 0l) 0l
- else if (x < 0) -1l
- else 1l
-
- def signum(x: Int): Int =
- if (x == 0) 0
- else if (x < 0) -1
- else 1
+ def signum(x: Long): Long = java.lang.Long.signum(x)
+
+ def signum(x: Int): Int = java.lang.Integer.signum(x)
// -----------------------------------------------------------------------
// root functions
diff --git a/src/library/scala/sys/process/ProcessBuilder.scala b/src/library/scala/sys/process/ProcessBuilder.scala
index 9acdc59094..214d908012 100644
--- a/src/library/scala/sys/process/ProcessBuilder.scala
+++ b/src/library/scala/sys/process/ProcessBuilder.scala
@@ -42,7 +42,7 @@ import ProcessBuilder._
* 2. `#&&` conditionally executes the second command if the previous one finished with
* exit value 0. It mirrors shell's `&&`.
* 3. `#||` conditionally executes the third command if the exit value of the previous
- * command is is different than zero. It mirrors shell's `&&`.
+ * command is different than zero. It mirrors shell's `&&`.
*
* Not shown here, the equivalent of a shell's `;` would be `###`. The reason for this name is
* that `;` is a reserved token in Scala.
diff --git a/src/library/scala/util/parsing/combinator/Parsers.scala b/src/library/scala/util/parsing/combinator/Parsers.scala
index e7ea9f598b..751539243b 100644
--- a/src/library/scala/util/parsing/combinator/Parsers.scala
+++ b/src/library/scala/util/parsing/combinator/Parsers.scala
@@ -108,6 +108,8 @@ trait Parsers {
def flatMapWithNext[U](f: T => Input => ParseResult[U]): ParseResult[U]
+ def filterWithError(p: T => Boolean, error: T => String, position: Input): ParseResult[T]
+
def append[U >: T](a: => ParseResult[U]): ParseResult[U]
def isEmpty = !successful
@@ -137,6 +139,10 @@ trait Parsers {
def flatMapWithNext[U](f: T => Input => ParseResult[U]): ParseResult[U]
= f(result)(next)
+ def filterWithError(p: T => Boolean, error: T => String, position: Input): ParseResult[T] =
+ if (p(result)) this
+ else Failure(error(result), position)
+
def append[U >: T](a: => ParseResult[U]): ParseResult[U] = this
def get: T = result
@@ -161,6 +167,8 @@ trait Parsers {
def flatMapWithNext[U](f: Nothing => Input => ParseResult[U]): ParseResult[U]
= this
+ def filterWithError(p: Nothing => Boolean, error: Nothing => String, position: Input): ParseResult[Nothing] = this
+
def get: Nothing = sys.error("No result when parsing failed")
}
/** An extractor so `NoSuccess(msg, next)` can be used in matches. */
@@ -224,6 +232,12 @@ trait Parsers {
def map[U](f: T => U): Parser[U] //= flatMap{x => success(f(x))}
= Parser{ in => this(in) map(f)}
+ def filter(p: T => Boolean): Parser[T]
+ = withFilter(p)
+
+ def withFilter(p: T => Boolean): Parser[T]
+ = Parser{ in => this(in) filterWithError(p, "Input doesn't match filter: "+_, in)}
+
// no filter yet, dealing with zero is tricky!
@migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.")
@@ -443,6 +457,62 @@ trait Parsers {
* @return opt(this)
*/
def ? = opt(this)
+
+ /** Changes the failure message produced by a parser.
+ *
+ * This doesn't change the behavior of a parser on neither
+ * success nor error, just on failure. The semantics are
+ * slightly different than those obtained by doing `| failure(msg)`,
+ * in that the message produced by this method will always
+ * replace the message produced, which is not guaranteed
+ * by that idiom.
+ *
+ * For example, parser `p` below will always produce the
+ * designated failure message, while `q` will not produce
+ * it if `sign` is parsed but `number` is not.
+ *
+ * {{{
+ * def p = sign.? ~ number withFailureMessage "Number expected!"
+ * def q = sign.? ~ number | failure("Number expected!")
+ * }}}
+ *
+ * @param msg The message that will replace the default failure message.
+ * @return A parser with the same properties and different failure message.
+ */
+ def withFailureMessage(msg: String) = Parser{ in =>
+ this(in) match {
+ case Failure(_, next) => Failure(msg, next)
+ case other => other
+ }
+ }
+
+ /** Changes the error message produced by a parser.
+ *
+ * This doesn't change the behavior of a parser on neither
+ * success nor failure, just on error. The semantics are
+ * slightly different than those obtained by doing `| error(msg)`,
+ * in that the message produced by this method will always
+ * replace the message produced, which is not guaranteed
+ * by that idiom.
+ *
+ * For example, parser `p` below will always produce the
+ * designated error message, while `q` will not produce
+ * it if `sign` is parsed but `number` is not.
+ *
+ * {{{
+ * def p = sign.? ~ number withErrorMessage "Number expected!"
+ * def q = sign.? ~ number | error("Number expected!")
+ * }}}
+ *
+ * @param msg The message that will replace the default error message.
+ * @return A parser with the same properties and different error message.
+ */
+ def withErrorMessage(msg: String) = Parser{ in =>
+ this(in) match {
+ case Error(_, next) => Error(msg, next)
+ case other => other
+ }
+ }
}
/** Wrap a parser so that its failures become errors (the `|` combinator
diff --git a/src/library/scala/util/parsing/combinator/RegexParsers.scala b/src/library/scala/util/parsing/combinator/RegexParsers.scala
index a06b9d59ce..86eecd03c4 100644
--- a/src/library/scala/util/parsing/combinator/RegexParsers.scala
+++ b/src/library/scala/util/parsing/combinator/RegexParsers.scala
@@ -23,7 +23,7 @@ import scala.collection.immutable.PagedSeq
* - There's an implicit conversion from [[scala.util.matching.Regex]] to `Parser[String]`,
* so that regex expressions can be used as parser combinators.
* - The parsing methods call the method `skipWhitespace` (defaults to `true`) and, if true,
- * skip any whitespace before before each parser is called.
+ * skip any whitespace before each parser is called.
* - Protected val `whiteSpace` returns a regex that identifies whitespace.
*
* For example, this creates a very simple calculator receiving `String` input:
diff --git a/src/library/scala/util/parsing/json/JSON.scala b/src/library/scala/util/parsing/json/JSON.scala
index 1464f80e3f..15d43cf2af 100644
--- a/src/library/scala/util/parsing/json/JSON.scala
+++ b/src/library/scala/util/parsing/json/JSON.scala
@@ -45,7 +45,7 @@ object JSON extends Parser {
/**
* Parse the given `JSON` string and return a list of elements. If the
* string is a `JSON` object it will be a `JSONObject`. If it's a `JSON`
- * array it will be be a `JSONArray`.
+ * array it will be a `JSONArray`.
*
* @param input the given `JSON` string.
* @return an optional `JSONType` element.
diff --git a/src/msil/ch/epfl/lamp/compiler/msil/emit/OpCode.scala b/src/msil/ch/epfl/lamp/compiler/msil/emit/OpCode.scala
index fbcdbf893f..b0c26884af 100644
--- a/src/msil/ch/epfl/lamp/compiler/msil/emit/OpCode.scala
+++ b/src/msil/ch/epfl/lamp/compiler/msil/emit/OpCode.scala
@@ -887,7 +887,7 @@ opcode(Readonly, CEE_READONLY , "readonly." , 0xFFFFFE1E, POP_NONE, PUSH_NONE
opcode(Bne_Un_S, CEE_BNE_UN_S, "bne.un.s", 0xFFFFFF33, POP_1_1 , PUSH_NONE, INLINE_TARGET_S, FLOW_COND_BRANCH)
/**
- * Transfers control to a target instruction (short form) if if the the first value is greather
+ * Transfers control to a target instruction (short form) if the first value is greather
* than the second value, when comparing unsigned integer values or unordered float values.
*/
final val Bge_Un_S = new OpCode()
@@ -973,7 +973,7 @@ opcode(Readonly, CEE_READONLY , "readonly." , 0xFFFFFE1E, POP_NONE, PUSH_NONE
opcode(Bne_Un, CEE_BNE_UN , "bne.un", 0xFFFFFF40, POP_1_1 , PUSH_NONE, INLINE_TARGET, FLOW_COND_BRANCH)
/**
- * Transfers control to a target instruction if the the first value is greather than
+ * Transfers control to a target instruction if the first value is greather than
* the second value, when comparing unsigned integer values or unordered float values.
*/
final val Bge_Un = new OpCode()
diff --git a/src/msil/ch/epfl/lamp/compiler/msil/emit/OpCodes.scala b/src/msil/ch/epfl/lamp/compiler/msil/emit/OpCodes.scala
index d486c31af0..80e4267436 100644
--- a/src/msil/ch/epfl/lamp/compiler/msil/emit/OpCodes.scala
+++ b/src/msil/ch/epfl/lamp/compiler/msil/emit/OpCodes.scala
@@ -307,7 +307,7 @@ object OpCodes {
final val Bne_Un_S = OpCode.Bne_Un_S
/**
- * Transfers control to a target instruction (short form) if if the the first value is greather
+ * Transfers control to a target instruction (short form) if the first value is greather
* than the second value, when comparing unsigned integer values or unordered float values.
*/
final val Bge_Un_S = OpCode.Bge_Un_S
@@ -380,7 +380,7 @@ object OpCodes {
final val Bne_Un = OpCode.Bne_Un
/**
- * Transfers control to a target instruction if the the first value is greather than
+ * Transfers control to a target instruction if the first value is greather than
* the second value, when comparing unsigned integer values or unordered float values.
*/
final val Bge_Un = OpCode.Bge_Un
diff --git a/test/files/presentation/akka.check b/test/disabled/presentation/akka.check
index 9cd20ffb1c..9cd20ffb1c 100644
--- a/test/files/presentation/akka.check
+++ b/test/disabled/presentation/akka.check
diff --git a/test/files/presentation/akka.flags b/test/disabled/presentation/akka.flags
index 56d026a62d..56d026a62d 100644
--- a/test/files/presentation/akka.flags
+++ b/test/disabled/presentation/akka.flags
diff --git a/test/files/presentation/akka/Runner.scala b/test/disabled/presentation/akka/Runner.scala
index 14a6aa8350..14a6aa8350 100644
--- a/test/files/presentation/akka/Runner.scala
+++ b/test/disabled/presentation/akka/Runner.scala
diff --git a/test/files/presentation/akka/src/akka/AkkaException.scala b/test/disabled/presentation/akka/src/akka/AkkaException.scala
index 155a7a16b5..155a7a16b5 100644
--- a/test/files/presentation/akka/src/akka/AkkaException.scala
+++ b/test/disabled/presentation/akka/src/akka/AkkaException.scala
diff --git a/test/files/presentation/akka/src/akka/actor/Actor.scala b/test/disabled/presentation/akka/src/akka/actor/Actor.scala
index b955c4c38b..b955c4c38b 100644
--- a/test/files/presentation/akka/src/akka/actor/Actor.scala
+++ b/test/disabled/presentation/akka/src/akka/actor/Actor.scala
diff --git a/test/files/presentation/akka/src/akka/actor/ActorRef.scala b/test/disabled/presentation/akka/src/akka/actor/ActorRef.scala
index 07fa358744..ff67c9468e 100644
--- a/test/files/presentation/akka/src/akka/actor/ActorRef.scala
+++ b/test/disabled/presentation/akka/src/akka/actor/ActorRef.scala
@@ -471,7 +471,7 @@ trait ActorRef extends ActorRefShared with java.lang.Comparable[ActorRef] { scal
* <p/>
* To be invoked from within the actor itself.
*/
- @deprecated("Will be removed after 1.1, use use Actor.remote.actorOf instead and then link on success", "1.1")
+ @deprecated("Will be removed after 1.1, use Actor.remote.actorOf instead and then link on success", "1.1")
def spawnLink(clazz: Class[_ <: Actor]): ActorRef
/**
diff --git a/test/files/presentation/akka/src/akka/actor/ActorRegistry.scala b/test/disabled/presentation/akka/src/akka/actor/ActorRegistry.scala
index df335dc8b4..df335dc8b4 100644
--- a/test/files/presentation/akka/src/akka/actor/ActorRegistry.scala
+++ b/test/disabled/presentation/akka/src/akka/actor/ActorRegistry.scala
diff --git a/test/files/presentation/akka/src/akka/actor/Actors.java b/test/disabled/presentation/akka/src/akka/actor/Actors.java
index a5ec9f37dc..a5ec9f37dc 100644
--- a/test/files/presentation/akka/src/akka/actor/Actors.java
+++ b/test/disabled/presentation/akka/src/akka/actor/Actors.java
diff --git a/test/files/presentation/akka/src/akka/actor/BootableActorLoaderService.scala b/test/disabled/presentation/akka/src/akka/actor/BootableActorLoaderService.scala
index a54fca9ac7..a54fca9ac7 100644
--- a/test/files/presentation/akka/src/akka/actor/BootableActorLoaderService.scala
+++ b/test/disabled/presentation/akka/src/akka/actor/BootableActorLoaderService.scala
diff --git a/test/files/presentation/akka/src/akka/actor/FSM.scala b/test/disabled/presentation/akka/src/akka/actor/FSM.scala
index d9cd9a9ca2..d9cd9a9ca2 100644
--- a/test/files/presentation/akka/src/akka/actor/FSM.scala
+++ b/test/disabled/presentation/akka/src/akka/actor/FSM.scala
diff --git a/test/files/presentation/akka/src/akka/actor/Scheduler.scala b/test/disabled/presentation/akka/src/akka/actor/Scheduler.scala
index 128584f3c5..128584f3c5 100644
--- a/test/files/presentation/akka/src/akka/actor/Scheduler.scala
+++ b/test/disabled/presentation/akka/src/akka/actor/Scheduler.scala
diff --git a/test/files/presentation/akka/src/akka/actor/Supervisor.scala b/test/disabled/presentation/akka/src/akka/actor/Supervisor.scala
index 4a1309faef..4a1309faef 100644
--- a/test/files/presentation/akka/src/akka/actor/Supervisor.scala
+++ b/test/disabled/presentation/akka/src/akka/actor/Supervisor.scala
diff --git a/test/files/presentation/akka/src/akka/actor/UntypedActor.scala b/test/disabled/presentation/akka/src/akka/actor/UntypedActor.scala
index cbc43f22f8..cbc43f22f8 100644
--- a/test/files/presentation/akka/src/akka/actor/UntypedActor.scala
+++ b/test/disabled/presentation/akka/src/akka/actor/UntypedActor.scala
diff --git a/test/files/presentation/akka/src/akka/actor/package.scala b/test/disabled/presentation/akka/src/akka/actor/package.scala
index fbeeed49cb..fbeeed49cb 100644
--- a/test/files/presentation/akka/src/akka/actor/package.scala
+++ b/test/disabled/presentation/akka/src/akka/actor/package.scala
diff --git a/test/files/presentation/akka/src/akka/config/Config.scala b/test/disabled/presentation/akka/src/akka/config/Config.scala
index 6578c66f77..6578c66f77 100644
--- a/test/files/presentation/akka/src/akka/config/Config.scala
+++ b/test/disabled/presentation/akka/src/akka/config/Config.scala
diff --git a/test/files/presentation/akka/src/akka/config/ConfigParser.scala b/test/disabled/presentation/akka/src/akka/config/ConfigParser.scala
index 73fac5e31b..73fac5e31b 100644
--- a/test/files/presentation/akka/src/akka/config/ConfigParser.scala
+++ b/test/disabled/presentation/akka/src/akka/config/ConfigParser.scala
diff --git a/test/files/presentation/akka/src/akka/config/Configuration.scala b/test/disabled/presentation/akka/src/akka/config/Configuration.scala
index 81c32fce90..81c32fce90 100644
--- a/test/files/presentation/akka/src/akka/config/Configuration.scala
+++ b/test/disabled/presentation/akka/src/akka/config/Configuration.scala
diff --git a/test/files/presentation/akka/src/akka/config/Configurator.scala b/test/disabled/presentation/akka/src/akka/config/Configurator.scala
index 2818339b0f..2818339b0f 100644
--- a/test/files/presentation/akka/src/akka/config/Configurator.scala
+++ b/test/disabled/presentation/akka/src/akka/config/Configurator.scala
diff --git a/test/files/presentation/akka/src/akka/config/Importer.scala b/test/disabled/presentation/akka/src/akka/config/Importer.scala
index eebda1d4fe..eebda1d4fe 100644
--- a/test/files/presentation/akka/src/akka/config/Importer.scala
+++ b/test/disabled/presentation/akka/src/akka/config/Importer.scala
diff --git a/test/files/presentation/akka/src/akka/config/SupervisionConfig.scala b/test/disabled/presentation/akka/src/akka/config/SupervisionConfig.scala
index 40f61f615f..40f61f615f 100644
--- a/test/files/presentation/akka/src/akka/config/SupervisionConfig.scala
+++ b/test/disabled/presentation/akka/src/akka/config/SupervisionConfig.scala
diff --git a/test/files/presentation/akka/src/akka/dataflow/DataFlow.scala b/test/disabled/presentation/akka/src/akka/dataflow/DataFlow.scala
index bca7936116..bca7936116 100644
--- a/test/files/presentation/akka/src/akka/dataflow/DataFlow.scala
+++ b/test/disabled/presentation/akka/src/akka/dataflow/DataFlow.scala
diff --git a/test/files/presentation/akka/src/akka/dispatch/Dispatchers.scala b/test/disabled/presentation/akka/src/akka/dispatch/Dispatchers.scala
index 7dd1bf6218..7dd1bf6218 100644
--- a/test/files/presentation/akka/src/akka/dispatch/Dispatchers.scala
+++ b/test/disabled/presentation/akka/src/akka/dispatch/Dispatchers.scala
diff --git a/test/files/presentation/akka/src/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala b/test/disabled/presentation/akka/src/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala
index bc3f29ac68..bc3f29ac68 100644
--- a/test/files/presentation/akka/src/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala
+++ b/test/disabled/presentation/akka/src/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala
diff --git a/test/files/presentation/akka/src/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala b/test/disabled/presentation/akka/src/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala
index 4cba8eec8b..4cba8eec8b 100644
--- a/test/files/presentation/akka/src/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala
+++ b/test/disabled/presentation/akka/src/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala
diff --git a/test/files/presentation/akka/src/akka/dispatch/Future.scala b/test/disabled/presentation/akka/src/akka/dispatch/Future.scala
index 1ad304d726..1ad304d726 100644
--- a/test/files/presentation/akka/src/akka/dispatch/Future.scala
+++ b/test/disabled/presentation/akka/src/akka/dispatch/Future.scala
diff --git a/test/files/presentation/akka/src/akka/dispatch/MailboxHandling.scala b/test/disabled/presentation/akka/src/akka/dispatch/MailboxHandling.scala
index 4c00577157..4c00577157 100644
--- a/test/files/presentation/akka/src/akka/dispatch/MailboxHandling.scala
+++ b/test/disabled/presentation/akka/src/akka/dispatch/MailboxHandling.scala
diff --git a/test/files/presentation/akka/src/akka/dispatch/MessageHandling.scala b/test/disabled/presentation/akka/src/akka/dispatch/MessageHandling.scala
index 20887c3867..20887c3867 100644
--- a/test/files/presentation/akka/src/akka/dispatch/MessageHandling.scala
+++ b/test/disabled/presentation/akka/src/akka/dispatch/MessageHandling.scala
diff --git a/test/files/presentation/akka/src/akka/dispatch/ThreadBasedDispatcher.scala b/test/disabled/presentation/akka/src/akka/dispatch/ThreadBasedDispatcher.scala
index 3169c70ef9..3169c70ef9 100644
--- a/test/files/presentation/akka/src/akka/dispatch/ThreadBasedDispatcher.scala
+++ b/test/disabled/presentation/akka/src/akka/dispatch/ThreadBasedDispatcher.scala
diff --git a/test/files/presentation/akka/src/akka/dispatch/ThreadPoolBuilder.scala b/test/disabled/presentation/akka/src/akka/dispatch/ThreadPoolBuilder.scala
index e847610c4c..e847610c4c 100644
--- a/test/files/presentation/akka/src/akka/dispatch/ThreadPoolBuilder.scala
+++ b/test/disabled/presentation/akka/src/akka/dispatch/ThreadPoolBuilder.scala
diff --git a/test/files/presentation/akka/src/akka/event/EventHandler.scala b/test/disabled/presentation/akka/src/akka/event/EventHandler.scala
index f3176b7c21..f3176b7c21 100644
--- a/test/files/presentation/akka/src/akka/event/EventHandler.scala
+++ b/test/disabled/presentation/akka/src/akka/event/EventHandler.scala
diff --git a/test/files/presentation/akka/src/akka/event/JavaEventHandler.java b/test/disabled/presentation/akka/src/akka/event/JavaEventHandler.java
index 7e6e2d4143..7e6e2d4143 100644
--- a/test/files/presentation/akka/src/akka/event/JavaEventHandler.java
+++ b/test/disabled/presentation/akka/src/akka/event/JavaEventHandler.java
diff --git a/test/files/presentation/akka/src/akka/japi/JavaAPI.scala b/test/disabled/presentation/akka/src/akka/japi/JavaAPI.scala
index f5c4ccdcaa..f5c4ccdcaa 100644
--- a/test/files/presentation/akka/src/akka/japi/JavaAPI.scala
+++ b/test/disabled/presentation/akka/src/akka/japi/JavaAPI.scala
diff --git a/test/files/presentation/akka/src/akka/remoteinterface/RemoteEventHandler.scala b/test/disabled/presentation/akka/src/akka/remoteinterface/RemoteEventHandler.scala
index 1c75618301..1c75618301 100644
--- a/test/files/presentation/akka/src/akka/remoteinterface/RemoteEventHandler.scala
+++ b/test/disabled/presentation/akka/src/akka/remoteinterface/RemoteEventHandler.scala
diff --git a/test/files/presentation/akka/src/akka/remoteinterface/RemoteInterface.scala b/test/disabled/presentation/akka/src/akka/remoteinterface/RemoteInterface.scala
index 0c5da82294..0c5da82294 100644
--- a/test/files/presentation/akka/src/akka/remoteinterface/RemoteInterface.scala
+++ b/test/disabled/presentation/akka/src/akka/remoteinterface/RemoteInterface.scala
diff --git a/test/files/presentation/akka/src/akka/routing/Iterators.scala b/test/disabled/presentation/akka/src/akka/routing/Iterators.scala
index 315e7bea51..315e7bea51 100644
--- a/test/files/presentation/akka/src/akka/routing/Iterators.scala
+++ b/test/disabled/presentation/akka/src/akka/routing/Iterators.scala
diff --git a/test/files/presentation/akka/src/akka/routing/Listeners.scala b/test/disabled/presentation/akka/src/akka/routing/Listeners.scala
index 04f6c1259f..04f6c1259f 100644
--- a/test/files/presentation/akka/src/akka/routing/Listeners.scala
+++ b/test/disabled/presentation/akka/src/akka/routing/Listeners.scala
diff --git a/test/files/presentation/akka/src/akka/routing/Pool.scala b/test/disabled/presentation/akka/src/akka/routing/Pool.scala
index 0fd1bc8f49..d972bb84c8 100644
--- a/test/files/presentation/akka/src/akka/routing/Pool.scala
+++ b/test/disabled/presentation/akka/src/akka/routing/Pool.scala
@@ -220,7 +220,7 @@ trait BoundedCapacityStrategy extends CapacityStrategy with BoundedCapacitor
*/
/**
- * The basic filter trait that composes ramp-up and and back-off subfiltering.
+ * The basic filter trait that composes ramp-up and back-off subfiltering.
*/
trait Filter {
def rampup(pressure: Int, capacity: Int): Int
diff --git a/test/files/presentation/akka/src/akka/routing/Routers.scala b/test/disabled/presentation/akka/src/akka/routing/Routers.scala
index a4c34c5c67..a4c34c5c67 100644
--- a/test/files/presentation/akka/src/akka/routing/Routers.scala
+++ b/test/disabled/presentation/akka/src/akka/routing/Routers.scala
diff --git a/test/files/presentation/akka/src/akka/routing/Routing.scala b/test/disabled/presentation/akka/src/akka/routing/Routing.scala
index befc124248..befc124248 100644
--- a/test/files/presentation/akka/src/akka/routing/Routing.scala
+++ b/test/disabled/presentation/akka/src/akka/routing/Routing.scala
diff --git a/test/files/presentation/akka/src/akka/util/Address.scala b/test/disabled/presentation/akka/src/akka/util/Address.scala
index 65b5c0a834..65b5c0a834 100644
--- a/test/files/presentation/akka/src/akka/util/Address.scala
+++ b/test/disabled/presentation/akka/src/akka/util/Address.scala
diff --git a/test/files/presentation/akka/src/akka/util/AkkaLoader.scala b/test/disabled/presentation/akka/src/akka/util/AkkaLoader.scala
index cb246f2ecf..cb246f2ecf 100644
--- a/test/files/presentation/akka/src/akka/util/AkkaLoader.scala
+++ b/test/disabled/presentation/akka/src/akka/util/AkkaLoader.scala
diff --git a/test/files/presentation/akka/src/akka/util/Bootable.scala b/test/disabled/presentation/akka/src/akka/util/Bootable.scala
index d07643e1ac..d07643e1ac 100644
--- a/test/files/presentation/akka/src/akka/util/Bootable.scala
+++ b/test/disabled/presentation/akka/src/akka/util/Bootable.scala
diff --git a/test/files/presentation/akka/src/akka/util/BoundedBlockingQueue.scala b/test/disabled/presentation/akka/src/akka/util/BoundedBlockingQueue.scala
index f8deda746c..f8deda746c 100644
--- a/test/files/presentation/akka/src/akka/util/BoundedBlockingQueue.scala
+++ b/test/disabled/presentation/akka/src/akka/util/BoundedBlockingQueue.scala
diff --git a/test/files/presentation/akka/src/akka/util/Crypt.scala b/test/disabled/presentation/akka/src/akka/util/Crypt.scala
index 3ce2d559a2..3ce2d559a2 100644
--- a/test/files/presentation/akka/src/akka/util/Crypt.scala
+++ b/test/disabled/presentation/akka/src/akka/util/Crypt.scala
diff --git a/test/files/presentation/akka/src/akka/util/Duration.scala b/test/disabled/presentation/akka/src/akka/util/Duration.scala
index 316cb86689..316cb86689 100644
--- a/test/files/presentation/akka/src/akka/util/Duration.scala
+++ b/test/disabled/presentation/akka/src/akka/util/Duration.scala
diff --git a/test/files/presentation/akka/src/akka/util/HashCode.scala b/test/disabled/presentation/akka/src/akka/util/HashCode.scala
index d015f12f5d..d015f12f5d 100644
--- a/test/files/presentation/akka/src/akka/util/HashCode.scala
+++ b/test/disabled/presentation/akka/src/akka/util/HashCode.scala
diff --git a/test/files/presentation/akka/src/akka/util/Helpers.scala b/test/disabled/presentation/akka/src/akka/util/Helpers.scala
index 48477426c9..48477426c9 100644
--- a/test/files/presentation/akka/src/akka/util/Helpers.scala
+++ b/test/disabled/presentation/akka/src/akka/util/Helpers.scala
diff --git a/test/files/presentation/akka/src/akka/util/ListenerManagement.scala b/test/disabled/presentation/akka/src/akka/util/ListenerManagement.scala
index 7065397a45..863e905d59 100644
--- a/test/files/presentation/akka/src/akka/util/ListenerManagement.scala
+++ b/test/disabled/presentation/akka/src/akka/util/ListenerManagement.scala
@@ -22,7 +22,7 @@ trait ListenerManagement {
protected def manageLifeCycleOfListeners: Boolean = true
/**
- * Adds the <code>listener</code> this this registry's listener list.
+ * Adds the <code>listener</code> this registry's listener list.
* The <code>listener</code> is started by this method if manageLifeCycleOfListeners yields true.
*/
def addListener(listener: ActorRef) {
@@ -31,7 +31,7 @@ trait ListenerManagement {
}
/**
- * Removes the <code>listener</code> this this registry's listener list.
+ * Removes the <code>listener</code> this registry's listener list.
* The <code>listener</code> is stopped by this method if manageLifeCycleOfListeners yields true.
*/
def removeListener(listener: ActorRef) {
diff --git a/test/files/presentation/akka/src/akka/util/LockUtil.scala b/test/disabled/presentation/akka/src/akka/util/LockUtil.scala
index 4aaefadc4a..4aaefadc4a 100644
--- a/test/files/presentation/akka/src/akka/util/LockUtil.scala
+++ b/test/disabled/presentation/akka/src/akka/util/LockUtil.scala
diff --git a/test/files/presentation/akka/src/akka/util/ReflectiveAccess.scala b/test/disabled/presentation/akka/src/akka/util/ReflectiveAccess.scala
index f38d1f9b98..f38d1f9b98 100644
--- a/test/files/presentation/akka/src/akka/util/ReflectiveAccess.scala
+++ b/test/disabled/presentation/akka/src/akka/util/ReflectiveAccess.scala
diff --git a/test/files/presentation/akka/src/akka/util/package.scala b/test/disabled/presentation/akka/src/akka/util/package.scala
index 26a24929c9..26a24929c9 100644
--- a/test/files/presentation/akka/src/akka/util/package.scala
+++ b/test/disabled/presentation/akka/src/akka/util/package.scala
diff --git a/test/files/presentation/akka/src/com/eaio/util/lang/Hex.java b/test/disabled/presentation/akka/src/com/eaio/util/lang/Hex.java
index 7794059517..7794059517 100644
--- a/test/files/presentation/akka/src/com/eaio/util/lang/Hex.java
+++ b/test/disabled/presentation/akka/src/com/eaio/util/lang/Hex.java
diff --git a/test/files/presentation/akka/src/com/eaio/uuid/MACAddressParser.java b/test/disabled/presentation/akka/src/com/eaio/uuid/MACAddressParser.java
index c077147470..c077147470 100644
--- a/test/files/presentation/akka/src/com/eaio/uuid/MACAddressParser.java
+++ b/test/disabled/presentation/akka/src/com/eaio/uuid/MACAddressParser.java
diff --git a/test/files/presentation/akka/src/com/eaio/uuid/UUID.java b/test/disabled/presentation/akka/src/com/eaio/uuid/UUID.java
index 6c49bcd1c8..6c49bcd1c8 100644
--- a/test/files/presentation/akka/src/com/eaio/uuid/UUID.java
+++ b/test/disabled/presentation/akka/src/com/eaio/uuid/UUID.java
diff --git a/test/files/presentation/akka/src/com/eaio/uuid/UUIDGen.java b/test/disabled/presentation/akka/src/com/eaio/uuid/UUIDGen.java
index 7b63f65447..7b63f65447 100644
--- a/test/files/presentation/akka/src/com/eaio/uuid/UUIDGen.java
+++ b/test/disabled/presentation/akka/src/com/eaio/uuid/UUIDGen.java
diff --git a/test/files/presentation/akka/src/com/eaio/uuid/UUIDHelper.java b/test/disabled/presentation/akka/src/com/eaio/uuid/UUIDHelper.java
index 7abbe85895..7abbe85895 100644
--- a/test/files/presentation/akka/src/com/eaio/uuid/UUIDHelper.java
+++ b/test/disabled/presentation/akka/src/com/eaio/uuid/UUIDHelper.java
diff --git a/test/files/presentation/akka/src/com/eaio/uuid/UUIDHolder.java b/test/disabled/presentation/akka/src/com/eaio/uuid/UUIDHolder.java
index d5531f5e00..d5531f5e00 100644
--- a/test/files/presentation/akka/src/com/eaio/uuid/UUIDHolder.java
+++ b/test/disabled/presentation/akka/src/com/eaio/uuid/UUIDHolder.java
diff --git a/test/files/presentation/akka/src/pi.scala b/test/disabled/presentation/akka/src/pi.scala
index b4c644052c..b4c644052c 100644
--- a/test/files/presentation/akka/src/pi.scala
+++ b/test/disabled/presentation/akka/src/pi.scala
diff --git a/test/files/presentation/timeofday.check b/test/disabled/presentation/timeofday.check
index 2a09d0bcfc..2a09d0bcfc 100644
--- a/test/files/presentation/timeofday.check
+++ b/test/disabled/presentation/timeofday.check
diff --git a/test/files/presentation/timeofday/Runner.scala b/test/disabled/presentation/timeofday/Runner.scala
index 1c03e3d5ba..1c03e3d5ba 100644
--- a/test/files/presentation/timeofday/Runner.scala
+++ b/test/disabled/presentation/timeofday/Runner.scala
diff --git a/test/files/presentation/timeofday/src/timeofday.scala b/test/disabled/presentation/timeofday/src/timeofday.scala
index d6355097f1..d6355097f1 100644
--- a/test/files/presentation/timeofday/src/timeofday.scala
+++ b/test/disabled/presentation/timeofday/src/timeofday.scala
diff --git a/test/files/jvm/signum.scala b/test/files/jvm/signum.scala
new file mode 100644
index 0000000000..feb28d3e43
--- /dev/null
+++ b/test/files/jvm/signum.scala
@@ -0,0 +1,15 @@
+object Test {
+ def main(args: Array[String]) {
+ assert(math.signum(Long.MaxValue) == 1L)
+ assert(math.signum(1L) == 1L)
+ assert(math.signum(0L) == 0L)
+ assert(math.signum(-1L) == -1L)
+ assert(math.signum(Long.MinValue) == -1L)
+
+ assert(math.signum(Int.MaxValue) == 1)
+ assert(math.signum(1) == 1)
+ assert(math.signum(0) == 0)
+ assert(math.signum(-1) == -1)
+ assert(math.signum(Int.MinValue) == -1)
+ }
+}
diff --git a/test/files/neg/nopredefs.check b/test/files/neg/nopredefs.check
index 0a0ab34482..e6c1af78a0 100644
--- a/test/files/neg/nopredefs.check
+++ b/test/files/neg/nopredefs.check
@@ -1,4 +1,4 @@
-nopredefs.scala:5: error: not found: value Set
+nopredefs.scala:5: error: not found: value Set (similar: Seq)
val y = Set(3)
^
one error found
diff --git a/test/files/neg/reassignment.check b/test/files/neg/reassignment.check
new file mode 100644
index 0000000000..f0effd1459
--- /dev/null
+++ b/test/files/neg/reassignment.check
@@ -0,0 +1,13 @@
+reassignment.scala:2: error: not found: value x
+ x = 5
+ ^
+reassignment.scala:3: error: not found: value y
+ y := 45
+ ^
+reassignment.scala:4: error: not found: value y
+ y += 45
+ ^
+reassignment.scala:6: error: reassignment to val
+ z = 51
+ ^
+four errors found
diff --git a/test/files/neg/reassignment.scala b/test/files/neg/reassignment.scala
new file mode 100644
index 0000000000..e31eefbf3f
--- /dev/null
+++ b/test/files/neg/reassignment.scala
@@ -0,0 +1,7 @@
+class A {
+ x = 5
+ y := 45
+ y += 45
+ val z = 50
+ z = 51
+} \ No newline at end of file
diff --git a/test/files/neg/suggest-similar.check b/test/files/neg/suggest-similar.check
new file mode 100644
index 0000000000..0a858aaf2e
--- /dev/null
+++ b/test/files/neg/suggest-similar.check
@@ -0,0 +1,10 @@
+suggest-similar.scala:8: error: not found: value flippitx (similar: flippity)
+ flippitx = 123
+ ^
+suggest-similar.scala:9: error: not found: value identiyt (similar: identity)
+ Nil map identiyt
+ ^
+suggest-similar.scala:10: error: not found: type Bingus (similar: Dingus)
+ new Bingus
+ ^
+three errors found
diff --git a/test/files/neg/suggest-similar.scala b/test/files/neg/suggest-similar.scala
new file mode 100644
index 0000000000..ff327478fe
--- /dev/null
+++ b/test/files/neg/suggest-similar.scala
@@ -0,0 +1,11 @@
+class Dingus
+object Dingus {
+ var flippity = 1
+}
+import Dingus._
+
+class A {
+ flippitx = 123
+ Nil map identiyt
+ new Bingus
+}
diff --git a/test/files/neg/t0903.check b/test/files/neg/t0903.check
index db4cd94d2c..2dd05cd3ee 100644
--- a/test/files/neg/t0903.check
+++ b/test/files/neg/t0903.check
@@ -1,4 +1,4 @@
-t0903.scala:3: error: reassignment to val
+t0903.scala:3: error: value += is not a member of Int
x += 1
^
t0903.scala:4: error: reassignment to val
diff --git a/test/files/neg/t2870.check b/test/files/neg/t2870.check
index 6577577d3f..72bc0d98a1 100644
--- a/test/files/neg/t2870.check
+++ b/test/files/neg/t2870.check
@@ -1,4 +1,4 @@
-t2870.scala:1: error: not found: type Jar
+t2870.scala:1: error: not found: type Jar (similar: Jars)
class Jars(jar: Jar)
^
t2870.scala:6: error: illegal cyclic reference involving value <import>
diff --git a/test/files/neg/t3481.check b/test/files/neg/t3481.check
new file mode 100644
index 0000000000..48e6ff357b
--- /dev/null
+++ b/test/files/neg/t3481.check
@@ -0,0 +1,29 @@
+t3481.scala:5: error: type mismatch;
+ found : String("hello")
+ required: _$1 where type +_$1
+ f[A[Int]]("hello")
+ ^
+t3481.scala:11: error: type mismatch;
+ found : _$2 where type +_$2
+ required: b.T
+ (which expands to) _$2
+ def f[T <: B[_]](a: T#T, b: T) = b.m(a)
+ ^
+t3481.scala:12: error: type mismatch;
+ found : String("Hello")
+ required: _$2 where type +_$2
+ f("Hello", new B[Int])
+ ^
+t3481.scala:18: error: type mismatch;
+ found : String("Hello")
+ required: t3481.ex3.b.T2
+ (which expands to) _$3
+ b.m("Hello")
+ ^
+t3481.scala:25: error: type mismatch;
+ found : String("Hello")
+ required: t3481.ex4.Test.b.T2
+ (which expands to) _$4
+ b.m("Hello")
+ ^
+5 errors found
diff --git a/test/files/neg/t3481.scala b/test/files/neg/t3481.scala
new file mode 100644
index 0000000000..f4b781ee37
--- /dev/null
+++ b/test/files/neg/t3481.scala
@@ -0,0 +1,28 @@
+object t3481 {
+ object ex1 {
+ trait A[T] { type B = T }
+ def f[T <: A[_]](a: T#B) = 1
+ f[A[Int]]("hello")
+ }
+
+ object ex2 {
+ trait A { type T; def m(t: T) = t.toString }
+ class B[T2] extends A { type T = T2 }
+ def f[T <: B[_]](a: T#T, b: T) = b.m(a)
+ f("Hello", new B[Int])
+ }
+
+ object ex3 {
+ class B[T] { type T2 = T; def m(t: T2) = t.toString }
+ val b: B[_] = new B[Int]
+ b.m("Hello")
+ }
+
+ object ex4 {
+ abstract class B[T] { type T2 = T; def m(t: T2): Any }
+ object Test {
+ val b: B[_] = sys.error("")
+ b.m("Hello")
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/pos/t4758.scala b/test/files/pos/t4758.scala
new file mode 100644
index 0000000000..627dfd7a23
--- /dev/null
+++ b/test/files/pos/t4758.scala
@@ -0,0 +1,17 @@
+// /scala/trac/4758/a.scala
+// Fri Dec 2 13:41:54 PST 2011
+
+package bar {
+ // works
+ trait M[F[_]]
+ class S[X[_] <: M[X], A](val x:X[A])
+ object S {
+ def apply[X[_] <: M[X], A](x: X[A]): S[X, A] = new S[X, A](x)
+ def unapply[X[_] <: M[X], A](p: S[X, A]) = Some(p.x)
+ }
+}
+package foo {
+ // seemingly equivalent, doesn't work
+ trait M[F[_]]
+ case class S[X[_] <: M[X], A](x: X[A])
+}
diff --git a/test/files/pos/t5084.scala b/test/files/pos/t5084.scala
new file mode 100644
index 0000000000..17d0a68adf
--- /dev/null
+++ b/test/files/pos/t5084.scala
@@ -0,0 +1,5 @@
+case class Search(tpe: Search.Value)
+
+object Search {
+ type Value = String
+}
diff --git a/test/files/run/adding-growing-set.scala b/test/files/run/adding-growing-set.scala
index 5903813ed1..ab94b893b2 100644
--- a/test/files/run/adding-growing-set.scala
+++ b/test/files/run/adding-growing-set.scala
@@ -1,4 +1,4 @@
-/** This will run a a loooong time if Set's builder copies a
+/** This will run a loooong time if Set's builder copies a
* complete new Set for every element.
*/
object Test {
diff --git a/test/files/run/enums.check b/test/files/run/enums.check
index f53aba8794..93eadae6e3 100644
--- a/test/files/run/enums.check
+++ b/test/files/run/enums.check
@@ -3,3 +3,13 @@ test Test2 was successful
test Test3 was successful
test Test4 was successful
+D1.ValueSet(North, East)
+D2.ValueSet(North, East)
+D1.ValueSet(North, East, West)
+D2.ValueSet(North, East, West)
+List(101)
+List(101)
+D1.ValueSet(North, East)
+D2.ValueSet(North, East)
+WeekDays.ValueSet(Tue, Wed, Thu, Fri)
+
diff --git a/test/files/run/enums.scala b/test/files/run/enums.scala
index 6dda8cbc6e..9cdeed2691 100644
--- a/test/files/run/enums.scala
+++ b/test/files/run/enums.scala
@@ -65,6 +65,58 @@ object Test4 {
}
}
+object Test5 {
+
+ object D1 extends Enumeration(0) {
+ val North, South, East, West = Value;
+ }
+
+ object D2 extends Enumeration(-2) {
+ val North, South, East, West = Value;
+ }
+
+ object WeekDays extends Enumeration {
+ val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value
+ }
+
+ def run {
+ val s1 = D1.ValueSet(D1.North, D1.East)
+ val s2 = D2.North + D2.East
+ println(s1)
+ println(s2)
+ println(s1 + D1.West)
+ println(s2 + D2.West)
+ println(s1.toBitMask.map(_.toBinaryString).toList)
+ println(s2.toBitMask.map(_.toBinaryString).toList)
+ println(D1.ValueSet.fromBitMask(s1.toBitMask))
+ println(D2.ValueSet.fromBitMask(s2.toBitMask))
+ println(WeekDays.values.range(WeekDays.Tue, WeekDays.Sat))
+ }
+}
+
+object SerializationTest {
+ object Types extends Enumeration { val X, Y = Value }
+ class A extends java.io.Serializable { val types = Types.values }
+ class B extends java.io.Serializable { val types = Set(Types.X, Types.Y) }
+
+ def serialize(obj: AnyRef) = {
+ val baos = new java.io.ByteArrayOutputStream()
+ val oos = new java.io.ObjectOutputStream(baos)
+ oos.writeObject(obj)
+ oos.close()
+ val bais = new java.io.ByteArrayInputStream(baos.toByteArray)
+ val ois = new java.io.ObjectInputStream(bais)
+ val prime = ois.readObject()
+ ois.close()
+ prime
+ }
+
+ def run {
+ serialize(new B())
+ serialize(new A())
+ }
+}
+
//############################################################################
// Test code
@@ -94,6 +146,9 @@ object Test {
check_success("Test3", Test3.run, 1);
check_success("Test4", Test4.run, 0);
Console.println;
+ Test5.run;
+ Console.println;
+ SerializationTest.run;
}
}
diff --git a/test/files/run/json.scala b/test/files/run/json.scala
index 7d3b635006..a81f12564c 100644
--- a/test/files/run/json.scala
+++ b/test/files/run/json.scala
@@ -3,7 +3,7 @@ import scala.collection.immutable.TreeMap
object Test extends App {
/* This method converts parsed JSON back into real JSON notation with objects in
- * sorted-key order. Not required by the spec, but it allows us to to a stable
+ * sorted-key order. Not required by the spec, but it allows us to do a stable
* toString comparison. */
def jsonToString(in : Any) : String = in match {
case l : List[_] => "[" + l.map(jsonToString).mkString(", ") + "]"
diff --git a/test/files/run/parserFilter.check b/test/files/run/parserFilter.check
new file mode 100644
index 0000000000..be04454426
--- /dev/null
+++ b/test/files/run/parserFilter.check
@@ -0,0 +1,9 @@
+[1.3] failure: Input doesn't match filter: false
+
+if false
+ ^
+[1.1] failure: Input doesn't match filter: not
+
+not true
+^
+[1.8] parsed: (if~true)
diff --git a/test/files/run/parserFilter.scala b/test/files/run/parserFilter.scala
new file mode 100644
index 0000000000..d007d441f4
--- /dev/null
+++ b/test/files/run/parserFilter.scala
@@ -0,0 +1,15 @@
+object Test extends scala.util.parsing.combinator.RegexParsers {
+ val keywords = Set("if", "false")
+ def word: Parser[String] = "\\w+".r
+
+ def keyword: Parser[String] = word filter (keywords.contains)
+ def ident: Parser[String] = word filter(!keywords.contains(_))
+
+ def test = keyword ~ ident
+
+ def main(args: Array[String]) {
+ println(parseAll(test, "if false"))
+ println(parseAll(test, "not true"))
+ println(parseAll(test, "if true"))
+ }
+}
diff --git a/test/files/run/parserForFilter.check b/test/files/run/parserForFilter.check
new file mode 100644
index 0000000000..a53c147719
--- /dev/null
+++ b/test/files/run/parserForFilter.check
@@ -0,0 +1 @@
+[1.13] parsed: (second,first)
diff --git a/test/files/run/parserForFilter.scala b/test/files/run/parserForFilter.scala
new file mode 100644
index 0000000000..1bc44f8033
--- /dev/null
+++ b/test/files/run/parserForFilter.scala
@@ -0,0 +1,12 @@
+object Test extends scala.util.parsing.combinator.RegexParsers {
+ def word: Parser[String] = "\\w+".r
+
+ def twoWords = for {
+ (a ~ b) <- word ~ word
+ } yield (b, a)
+
+ def main(args: Array[String]) {
+ println(parseAll(twoWords, "first second"))
+ }
+}
+
diff --git a/test/files/run/parserNoSuccessMessage.check b/test/files/run/parserNoSuccessMessage.check
new file mode 100644
index 0000000000..fe00d2fd3a
--- /dev/null
+++ b/test/files/run/parserNoSuccessMessage.check
@@ -0,0 +1,20 @@
+[1.2] failure: string matching regex `\d+' expected but `x' found
+
+-x
+ ^
+[1.1] failure: string matching regex `\d+' expected but `x' found
+
+x
+^
+[1.3] parsed: (Some(-)~5)
+[1.2] parsed: (None~5)
+[1.2] error: Number expected!
+
+-x
+ ^
+[1.1] error: Number expected!
+
+x
+^
+[1.3] parsed: (Some(-)~5)
+[1.2] parsed: (None~5)
diff --git a/test/files/run/parserNoSuccessMessage.scala b/test/files/run/parserNoSuccessMessage.scala
new file mode 100644
index 0000000000..93aa252db0
--- /dev/null
+++ b/test/files/run/parserNoSuccessMessage.scala
@@ -0,0 +1,19 @@
+object Test extends scala.util.parsing.combinator.RegexParsers {
+ def sign = "-"
+ def number = "\\d+".r
+ def p = sign.? ~ number withErrorMessage "Number expected!"
+ def q = sign.? ~! number withErrorMessage "Number expected!"
+
+ def main(args: Array[String]) {
+ println(parseAll(p, "-x"))
+ println(parseAll(p, "x"))
+ println(parseAll(p, "-5"))
+ println(parseAll(p, "5"))
+ println(parseAll(q, "-x"))
+ println(parseAll(q, "x"))
+ println(parseAll(q, "-5"))
+ println(parseAll(q, "5"))
+ }
+}
+
+
diff --git a/test/files/run/reify_anonymous.check b/test/files/run/reify_anonymous.check
new file mode 100644
index 0000000000..b8626c4cff
--- /dev/null
+++ b/test/files/run/reify_anonymous.check
@@ -0,0 +1 @@
+4
diff --git a/test/files/run/reify_anonymous.scala b/test/files/run/reify_anonymous.scala
new file mode 100644
index 0000000000..1e7f3fe856
--- /dev/null
+++ b/test/files/run/reify_anonymous.scala
@@ -0,0 +1,14 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ println(new {def x = 2; def y = x * x}.y)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/reify_for1.check b/test/files/run/reify_for1.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/reify_for1.check
diff --git a/test/files/run/reify_for1.scala b/test/files/run/reify_for1.scala
new file mode 100644
index 0000000000..4b03330293
--- /dev/null
+++ b/test/files/run/reify_for1.scala
@@ -0,0 +1,16 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ val sumOfSquares1 = (for (i <- 1 to 100; if (i % 3 == 0)) yield Math.pow(i, 2)).sum
+ val sumOfSquares2 = (1 to 100).filter(_ % 3 == 0).map(Math.pow(_, 2)).sum
+ assert(sumOfSquares1 == sumOfSquares2)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/reify_generic.check b/test/files/run/reify_generic.check
new file mode 100644
index 0000000000..b8626c4cff
--- /dev/null
+++ b/test/files/run/reify_generic.check
@@ -0,0 +1 @@
+4
diff --git a/test/files/run/reify_generic.scala b/test/files/run/reify_generic.scala
new file mode 100644
index 0000000000..aef038b2d8
--- /dev/null
+++ b/test/files/run/reify_generic.scala
@@ -0,0 +1,15 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ val product = List(1, 2, 3).head * List[Any](4, 2, 0).head.asInstanceOf[Int]
+ println(product)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/reify_inheritance.check b/test/files/run/reify_inheritance.check
new file mode 100644
index 0000000000..25bf17fc5a
--- /dev/null
+++ b/test/files/run/reify_inheritance.check
@@ -0,0 +1 @@
+18 \ No newline at end of file
diff --git a/test/files/run/reify_inheritance.scala b/test/files/run/reify_inheritance.scala
new file mode 100644
index 0000000000..2a1b5f764f
--- /dev/null
+++ b/test/files/run/reify_inheritance.scala
@@ -0,0 +1,23 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ class C {
+ def x = 2
+ def y = x * x
+ }
+
+ class D extends C {
+ override def x = 3
+ }
+
+ println(new D().y * new C().x)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/reify_printf.check b/test/files/run/reify_printf.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/reify_printf.check
diff --git a/test/files/run/reify_printf.scala b/test/files/run/reify_printf.scala
new file mode 100644
index 0000000000..30901b98c2
--- /dev/null
+++ b/test/files/run/reify_printf.scala
@@ -0,0 +1,75 @@
+import java.io.{ ByteArrayOutputStream, PrintStream }
+import scala.reflect.Code
+import scala.reflect.mirror._
+import scala.reflect.api._
+import scala.reflect.api.Trees
+import scala.reflect.internal.Types
+import reflect.runtime.Mirror.ToolBox
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import scala.util.matching.Regex
+
+object Test extends App {
+ val tree = tree_printf(Code.lift("hello %s").tree, Code.lift("world").tree)
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter, args mkString " ")
+ val ttree = toolbox.typeCheck(tree)
+
+ val output = new ByteArrayOutputStream()
+ Console.setOut(new PrintStream(output))
+ val evaluated = toolbox.runExpr(ttree)
+
+ assert(output.toString() == "hello world", output.toString() +" == hello world")
+
+ /*
+ macro def printf(format: String, params: Any*) : String = tree_printf(format: Tree, (params: Seq[Tree]): _*)
+ */
+
+ var i = 0
+ def gensym(name: String) = { i += 1; newTermName(name + i) }
+
+ def createTempValDef( value : Tree, tpe : Type ) : (Option[Tree],Tree) = {
+ val local = gensym("temp")
+ (
+ Some(
+ ValDef(
+ Modifiers()
+ , local
+ , TypeTree().setType(tpe)
+ , value
+ )
+ )
+ , Ident(local)
+ )
+ }
+
+ def tree_printf(format: Tree, params: Tree*) = {
+ val Literal(Constant(s_format: String)) = format
+ val paramsStack = scala.collection.mutable.Stack(params: _*)
+ val parsed = s_format.split("(?<=%[\\w%])|(?=%[\\w%])") map {
+ case "%d" => createTempValDef( paramsStack.pop, classToType(classOf[Int]) )
+ case "%s" => createTempValDef( paramsStack.pop, classToType(classOf[String]) )
+ case "%%" => {
+ (None:Option[Tree], Literal(Constant("%")))
+ }
+ case part => {
+ (None:Option[Tree], Literal(Constant(part)))
+ }
+ }
+
+ val evals = for ((Some(eval), _) <- parsed if eval != None) yield (eval: Tree)
+ val prints = for ((_, ref) <- parsed) yield
+ Apply(
+ Select(
+ Select(
+ Ident( newTermName("scala") )
+ , newTermName("Predef")
+ )
+ , newTermName("print")
+ )
+ , List(ref)
+ ): Tree
+ Block((evals ++ prints).toList, Literal(Constant(())))
+ }
+}
diff --git a/test/files/run/reify_varargs.check b/test/files/run/reify_varargs.check
new file mode 100644
index 0000000000..e300a570a7
--- /dev/null
+++ b/test/files/run/reify_varargs.check
@@ -0,0 +1 @@
+Message=On the fifth of August there was a disturbance in the Force on planet Hoth.
diff --git a/test/files/run/reify_varargs.scala b/test/files/run/reify_varargs.scala
new file mode 100644
index 0000000000..d38cbf2aac
--- /dev/null
+++ b/test/files/run/reify_varargs.scala
@@ -0,0 +1,17 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ val msg = java.text.MessageFormat.format(
+ "On {1} there was {2} on planet {0}.",
+ "Hoth", "the fifth of August", "a disturbance in the Force")
+ println("Message="+msg)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/t4658.check b/test/files/run/t4658.check
new file mode 100644
index 0000000000..743b0faee3
--- /dev/null
+++ b/test/files/run/t4658.check
@@ -0,0 +1,80 @@
+Ranges:
+1073741824
+1073741824
+0
+0
+55
+25
+1
+-45
+-55
+0
+-24
+-30
+0
+-40
+-55
+-10
+-24
+-30
+-10
+IntRanges:
+Disabled #1
+Disabled #2
+0
+0
+55
+25
+1
+-45
+-55
+0
+-24
+-30
+0
+-40
+-55
+-10
+-24
+-30
+-10
+LongRanges:
+Disabled #1
+Disabled #2
+0
+0
+55
+25
+1
+-45
+-55
+0
+-24
+-30
+0
+-40
+-55
+-10
+-24
+-30
+-10
+BigIntRanges:
+Disabled #1
+Disabled #2
+0
+0
+55
+25
+1
+-45
+-55
+0
+-24
+-30
+0
+-40
+-55
+-10
+-24
+-30
+-10
diff --git a/test/files/run/t4658.scala b/test/files/run/t4658.scala
new file mode 100644
index 0000000000..e1799fae9b
--- /dev/null
+++ b/test/files/run/t4658.scala
@@ -0,0 +1,41 @@
+import scala.collection.immutable.NumericRange
+//#4658
+object Test {
+
+ case class R(start: Int, end: Int, step: Int = 1, inclusive: Boolean = true)
+
+ val rangeData = Array(
+ R(1, Int.MaxValue), R(-Int.MaxValue, -1), R(0, 0), R(0,0, inclusive = false), R(1,10),
+ R(1,10,2), R(1,10,11), R(-10, -5), R(-10, 0), R(-10, 10), R(-10, -5, 2), R(-10, 0, 2), R(-10, 10, 2),
+ R(-10, -5, inclusive = false), R(-10, 0, inclusive = false), R(-10, 10, inclusive = false),
+ R(-10, -5, 2, inclusive = false), R(-10, 0, 2, inclusive = false), R(-10, 10, 2, inclusive = false)
+ )
+
+ def ranges = rangeData.map(r => if (r.inclusive) r.start to r.end by r.step else r.start until r.end by r.step)
+
+ def numericIntRanges = rangeData.map(r => if (r.inclusive) NumericRange.inclusive(r.start, r.end, r.step) else NumericRange(r.start, r.end, r.step))
+
+ def numericLongRanges = rangeData.map(r => if (r.inclusive) NumericRange.inclusive(r.start.toLong, r.end, r.step) else NumericRange(r.start.toLong, r.end, r.step))
+
+ def numericBigIntRanges = rangeData.map(r => if (r.inclusive) NumericRange.inclusive(BigInt(r.start), BigInt(r.end), BigInt(r.step)) else NumericRange(BigInt(r.start), BigInt(r.end), BigInt(r.step)))
+
+ def main(args: Array[String]) {
+ // We drop the first two tests for all ranges which don't have a decent sum implementation,
+ // because it is just too slow.
+ println("Ranges:")
+ ranges.foreach{range => println(range.sum)}
+ println("IntRanges:")
+ println("Disabled #1")
+ println("Disabled #2")
+ numericIntRanges.drop(2).foreach{range => println(range.sum)}
+ println("LongRanges:")
+ println("Disabled #1")
+ println("Disabled #2")
+ numericLongRanges.drop(2).foreach{range => println(range.sum)}
+ println("BigIntRanges:")
+ println("Disabled #1")
+ println("Disabled #2")
+ numericBigIntRanges.drop(2).foreach{range => println(range.sum)}
+ }
+
+} \ No newline at end of file
diff --git a/test/files/run/t5230.check b/test/files/run/t5230.check
new file mode 100644
index 0000000000..5db6ec9b38
--- /dev/null
+++ b/test/files/run/t5230.check
@@ -0,0 +1,2 @@
+2
+evaluated = null
diff --git a/test/pending/run/t5230.scala b/test/files/run/t5230.scala
index 5aab8f9290..5aab8f9290 100644
--- a/test/pending/run/t5230.scala
+++ b/test/files/run/t5230.scala
diff --git a/test/pending/run/reify_addressbook.check b/test/pending/run/reify_addressbook.check
new file mode 100644
index 0000000000..4e12f87bdc
--- /dev/null
+++ b/test/pending/run/reify_addressbook.check
@@ -0,0 +1,30 @@
+<html>
+ <head>
+ <title>
+ My Address Book
+ </title>
+ <style type="text/css"> table { border-right: 1px solid #cccccc; }
+ th { background-color: #cccccc; }
+ td { border-left: 1px solid #acacac; }
+ td { border-bottom: 1px solid #acacac;
+ </style>
+ </head>
+ <body>
+ <table cellspacing="0" cellpadding="2">
+ <tr>
+ <th>Name</th>
+ <th>Age</th>
+ </tr>
+ <tr>
+ <td> Tom </td>
+ <td> 20 </td>
+ </tr><tr>
+ <td> Bob </td>
+ <td> 22 </td>
+ </tr><tr>
+ <td> James </td>
+ <td> 19 </td>
+ </tr>
+ </table>
+ </body>
+ </html>
diff --git a/test/pending/run/reify_addressbook.scala b/test/pending/run/reify_addressbook.scala
new file mode 100644
index 0000000000..225f26b75e
--- /dev/null
+++ b/test/pending/run/reify_addressbook.scala
@@ -0,0 +1,71 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ case class Person(name: String, age: Int)
+
+ /** An AddressBook takes a variable number of arguments
+ * which are accessed as a Sequence
+ */
+ class AddressBook(a: Person*) {
+ private val people: List[Person] = a.toList
+
+ /** Serialize to XHTML. Scala supports XML literals
+ * which may contain Scala expressions between braces,
+ * which are replaced by their evaluation
+ */
+ def toXHTML =
+ <table cellpadding="2" cellspacing="0">
+ <tr>
+ <th>Name</th>
+ <th>Age</th>
+ </tr>
+ { for (p <- people) yield
+ <tr>
+ <td> { p.name } </td>
+ <td> { p.age.toString() } </td>
+ </tr>
+ }
+ </table>;
+ }
+
+ /** We introduce CSS using raw strings (between triple
+ * quotes). Raw strings may contain newlines and special
+ * characters (like \) are not interpreted.
+ */
+ val header =
+ <head>
+ <title>
+ { "My Address Book" }
+ </title>
+ <style type="text/css"> {
+ """table { border-right: 1px solid #cccccc; }
+ th { background-color: #cccccc; }
+ td { border-left: 1px solid #acacac; }
+ td { border-bottom: 1px solid #acacac;"""}
+ </style>
+ </head>;
+
+ val people = new AddressBook(
+ Person("Tom", 20),
+ Person("Bob", 22),
+ Person("James", 19));
+
+ val page =
+ <html>
+ { header }
+ <body>
+ { people.toXHTML }
+ </body>
+ </html>;
+
+ println(page)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_brainf_ck.check b/test/pending/run/reify_brainf_ck.check
new file mode 100644
index 0000000000..702bb18394
--- /dev/null
+++ b/test/pending/run/reify_brainf_ck.check
@@ -0,0 +1,4 @@
+---running---
+Hello World!
+
+---done---
diff --git a/test/pending/run/reify_brainf_ck.scala b/test/pending/run/reify_brainf_ck.scala
new file mode 100644
index 0000000000..3bfb76c9ea
--- /dev/null
+++ b/test/pending/run/reify_brainf_ck.scala
@@ -0,0 +1,85 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ import scala.annotation._
+
+ trait Func[T] {
+ val zero: T
+ def inc(t: T): T
+ def dec(t: T): T
+ def in: T
+ def out(t: T): Unit
+ }
+
+ object ByteFunc extends Func[Byte] {
+ override val zero: Byte = 0
+ override def inc(t: Byte) = ((t + 1) & 0xFF).toByte
+ override def dec(t: Byte) = ((t - 1) & 0xFF).toByte
+ override def in: Byte = readByte
+ override def out(t: Byte) { print(t.toChar) }
+ }
+
+ case class Tape[T](left: List[T], cell: T, right: List[T])(implicit func: Func[T]) {
+ private def headOf(list:List[T]) = if (list.isEmpty) func.zero else list.head
+ private def tailOf(list:List[T]) = if (list.isEmpty) Nil else list.tail
+ def isZero = cell == func.zero
+ def execute(ch: Char) = (ch: @switch) match {
+ case '+' => copy(cell = func.inc(cell))
+ case '-' => copy(cell = func.dec(cell))
+ case '<' => Tape(tailOf(left), headOf(left), cell :: right)
+ case '>' => Tape(cell :: left, headOf(right), tailOf(right))
+ case '.' => func.out(cell); this
+ case ',' => copy(cell = func.in)
+ case '[' | ']' => this
+ case _ => error("Unexpected token: " + ch)
+ }
+ }
+
+ object Tape {
+ def empty[T](func: Func[T]) = Tape(Nil, func.zero, Nil)(func)
+ }
+
+ class Brainfuck[T](func:Func[T]) {
+
+ def execute(p: String) {
+ val prog = p.replaceAll("[^\\+\\-\\[\\]\\.\\,\\>\\<]", "")
+
+ @tailrec def braceMatcher(pos: Int, stack: List[Int], o2c: Map[Int, Int]): Map[Int,Int] =
+ if(pos == prog.length) o2c else (prog(pos): @switch) match {
+ case '[' => braceMatcher(pos + 1, pos :: stack, o2c)
+ case ']' => braceMatcher(pos + 1, stack.tail, o2c + (stack.head -> pos))
+ case _ => braceMatcher(pos + 1, stack, o2c)
+ }
+
+ val open2close = braceMatcher(0, Nil, Map())
+ val close2open = open2close.map(_.swap)
+
+ @tailrec def ex(pos:Int, tape:Tape[T]): Unit =
+ if(pos < prog.length) ex((prog(pos): @switch) match {
+ case '[' if tape.isZero => open2close(pos)
+ case ']' if ! tape.isZero => close2open(pos)
+ case _ => pos + 1
+ }, tape.execute(prog(pos)))
+
+ println("---running---")
+ ex(0, Tape.empty(func))
+ println("\n---done---")
+ }
+ }
+
+ val bf = new Brainfuck(ByteFunc)
+ bf.execute(""">+++++++++[<++++++++>-]<.>+++++++[<++
+ ++>-]<+.+++++++..+++.[-]>++++++++[<++++>-]
+ <.#>+++++++++++[<+++++>-]<.>++++++++[<++
+ +>-]<.+++.------.--------.[-]>++++++++[<++++>
+ -]<+.[-]++++++++++.""")
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_callccinterpreter.check b/test/pending/run/reify_callccinterpreter.check
new file mode 100644
index 0000000000..ef8fc121df
--- /dev/null
+++ b/test/pending/run/reify_callccinterpreter.check
@@ -0,0 +1,3 @@
+42
+wrong
+5
diff --git a/test/pending/run/reify_callccinterpreter.scala b/test/pending/run/reify_callccinterpreter.scala
new file mode 100644
index 0000000000..c10f4f0b4e
--- /dev/null
+++ b/test/pending/run/reify_callccinterpreter.scala
@@ -0,0 +1,94 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ type Answer = Value;
+
+ /**
+ * A continuation monad.
+ */
+ case class M[A](in: (A => Answer) => Answer) {
+ def bind[B](k: A => M[B]) = M[B](c => in (a => k(a) in c))
+ def map[B](f: A => B): M[B] = bind(x => unitM(f(x)))
+ def flatMap[B](f: A => M[B]): M[B] = bind(f)
+ }
+
+ def unitM[A](a: A) = M[A](c => c(a))
+
+ def id[A] = (x: A) => x
+ def showM(m: M[Value]): String = (m in id).toString()
+
+ def callCC[A](h: (A => M[A]) => M[A]) =
+ M[A](c => h(a => M[A](d => c(a))) in c)
+
+ type Name = String
+
+ trait Term
+ case class Var(x: Name) extends Term
+ case class Con(n: Int) extends Term
+ case class Add(l: Term, r: Term) extends Term
+ case class Lam(x: Name, body: Term) extends Term
+ case class App(fun: Term, arg: Term) extends Term
+ case class Ccc(x: Name, t: Term) extends Term
+
+ trait Value
+ case object Wrong extends Value {
+ override def toString() = "wrong"
+ }
+ case class Num(n: Int) extends Value {
+ override def toString() = n.toString()
+ }
+ case class Fun(f: Value => M[Value]) extends Value {
+ override def toString() = "<function>"
+ }
+
+ type Environment = List[Pair[Name, Value]];
+
+ def lookup(x: Name, e: Environment): M[Value] = e match {
+ case List() => unitM(Wrong)
+ case Pair(y, b) :: e1 => if (x == y) unitM(b) else lookup(x, e1)
+ }
+
+ def add(a: Value, b: Value): M[Value] = Pair(a, b) match {
+ case Pair(Num(m), Num(n)) => unitM(Num(m + n))
+ case _ => unitM(Wrong)
+ }
+
+ def apply(a: Value, b: Value): M[Value] = a match {
+ case Fun(k) => k(b)
+ case _ => unitM(Wrong)
+ }
+
+ def interp(t: Term, e: Environment): M[Value] = t match {
+ case Var(x) => lookup(x, e)
+ case Con(n) => unitM(Num(n))
+ case Add(l, r) => for (a <- interp(l, e);
+ b <- interp(r, e);
+ c <- add(a, b))
+ yield c
+ case Lam(x, t) => unitM(Fun(a => interp(t, Pair(x, a) :: e)))
+ case App(f, t) => for (a <- interp(f, e);
+ b <- interp(t, e);
+ c <- apply(a, b))
+ yield c
+ case Ccc(x, t) => callCC(k => interp(t, Pair(x, Fun(k)) :: e))
+ }
+
+ def test(t: Term): String = showM(interp(t, List()))
+
+ val term0 = App(Lam("x", Add(Var("x"), Var("x"))), Add(Con(10), Con(11)))
+ val term1 = App(Con(1), Con(2))
+ val term2 = Add(Con(1), Ccc("k", Add(Con(2), App(Var("k"), Con(4)))))
+
+ println(test(term0))
+ println(test(term1))
+ println(test(term2))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_complex.check b/test/pending/run/reify_complex.check
new file mode 100644
index 0000000000..7df35e33a0
--- /dev/null
+++ b/test/pending/run/reify_complex.check
@@ -0,0 +1 @@
+3.0+4.0*i
diff --git a/test/pending/run/reify_complex.scala b/test/pending/run/reify_complex.scala
new file mode 100644
index 0000000000..aae4d558cf
--- /dev/null
+++ b/test/pending/run/reify_complex.scala
@@ -0,0 +1,31 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ class Complex(val re: Double, val im: Double) {
+ def + (that: Complex) =
+ new Complex(re + that.re, im + that.im)
+ def - (that: Complex) =
+ new Complex(re - that.re, im - that.im)
+ def * (that: Complex) =
+ new Complex(re * that.re - im * that.im,
+ re * that.im + im * that.re)
+ def / (that: Complex) = {
+ val denom = that.re * that.re + that.im * that.im
+ new Complex((re * that.re + im * that.im) / denom,
+ (im * that.re - re * that.im) / denom)
+ }
+ override def toString =
+ re + (if (im < 0) "-" + (-im) else "+" + im) + "*i"
+ }
+ val x = new Complex(2, 1); val y = new Complex(1, 3)
+ println(x + y)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_csv.check b/test/pending/run/reify_csv.check
new file mode 100644
index 0000000000..b56f4bb50b
--- /dev/null
+++ b/test/pending/run/reify_csv.check
@@ -0,0 +1,10 @@
+List(phase name, id, description)
+record(parser,1,parse source into ASTs, perform simple desugaring)
+record(namer,2,resolve names, attach symbols to named trees)
+record(packageobjects,3,load package objects)
+record(typer,4,the meat and potatoes: type the trees)
+record(superaccessors,5,add super accessors in traits and nested classes)
+record(pickler,6,serialize symbol tables)
+record(refchecks,7,reference/override checking, translate nested objects)
+record(selectiveanf,8,)
+record(liftcode,9,reify trees)
diff --git a/test/pending/run/reify_csv.scala b/test/pending/run/reify_csv.scala
new file mode 100644
index 0000000000..a05a3b55d4
--- /dev/null
+++ b/test/pending/run/reify_csv.scala
@@ -0,0 +1,42 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val csv = """
+ | phase name; id; description
+ | parser; 1; parse source into ASTs, perform simple desugaring
+ | namer; 2; resolve names, attach symbols to named trees
+ |packageobjects; 3; load package objects
+ | typer; 4; the meat and potatoes: type the trees
+ |superaccessors; 5; add super accessors in traits and nested classes
+ | pickler; 6; serialize symbol tables
+ | refchecks; 7; reference/override checking, translate nested objects
+ | selectiveanf; 8;
+ | liftcode; 9; reify trees""".stripMargin.split("\n").map{_.trim()}.drop(1).toList
+
+ val fields = csv.head.split(";").map{_.trim()}.toList
+ println(fields)
+
+ val code = scala.reflect.Code.lift({
+ object Csv {
+ case class record(`phase name`: String, id: String, description: String)
+
+ object record {
+ def parse(lines: List[String]) = {
+ lines drop(1) map { line => line.split(";", -1).toList match {
+ case phase$whitespace$name :: id :: description :: _ => record(phase$whitespace$name.trim(), id.trim(), description.trim())
+ case _ => throw new Exception("format error")
+ }}
+ }
+ }
+ }
+
+ Csv.record.parse(csv) foreach println
+ })
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_extendbuiltins.check b/test/pending/run/reify_extendbuiltins.check
new file mode 100644
index 0000000000..a48033a30d
--- /dev/null
+++ b/test/pending/run/reify_extendbuiltins.check
@@ -0,0 +1 @@
+10! = 3628800
diff --git a/test/pending/run/reify_extendbuiltins.scala b/test/pending/run/reify_extendbuiltins.scala
new file mode 100644
index 0000000000..57acd699ff
--- /dev/null
+++ b/test/pending/run/reify_extendbuiltins.scala
@@ -0,0 +1,21 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ def fact(n: Int): BigInt =
+ if (n == 0) 1 else fact(n-1) * n
+ class Factorizer(n: Int) {
+ def ! = fact(n)
+ }
+ implicit def int2fact(n: Int) = new Factorizer(n)
+
+ println("10! = " + (10!))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_fors.check b/test/pending/run/reify_fors.check
new file mode 100644
index 0000000000..eefddedc20
--- /dev/null
+++ b/test/pending/run/reify_fors.check
@@ -0,0 +1,5 @@
+Persons over 20: John Richard
+divisors(34) = List(1, 2, 17, 34)
+findNums(15) = (4,1) (5,2) (6,1) (7,4) (8,3) (8,5) (9,2) (9,4) (10,1) (10,3) (10,7) (11,2) (11,6) (11,8) (12,1) (12,5) (12,7) (13,4) (13,6) (13,10) (14,3) (14,5) (14,9)
+average(List(3.5, 5.0, 4.5)) = 4.333333333333333
+scalProd(List(3.5, 5.0, 4.5), List(2.0, 1.0, 3.0)) = 25.5
diff --git a/test/pending/run/reify_fors.scala b/test/pending/run/reify_fors.scala
new file mode 100644
index 0000000000..f3556514a9
--- /dev/null
+++ b/test/pending/run/reify_fors.scala
@@ -0,0 +1,107 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ object Persons {
+ /** A list of persons. To create a list, we use Predef.List
+ * which takes a variable number of arguments and constructs
+ * a list out of them.
+ */
+ val persons = List(
+ new Person("Bob", 17),
+ new Person("John", 40),
+ new Person("Richard", 68)
+ )
+
+ /** A Person class. 'val' constructor parameters become
+ * public members of the class.
+ */
+ class Person(val name: String, val age: Int)
+
+ /** Return an iterator over persons that are older than 20.
+ */
+ def olderThan20(xs: Seq[Person]): Iterator[String] =
+ olderThan20(xs.elements)
+
+ /** Return an iterator over persons older than 20, given
+ * an iterator over persons.
+ */
+ def olderThan20(xs: Iterator[Person]): Iterator[String] = {
+
+ // The first expression is called a 'generator' and makes
+ // 'p' take values from 'xs'. The second expression is
+ // called a 'filter' and it is a boolean expression which
+ // selects only persons older than 20. There can be more than
+ // one generator and filter. The 'yield' expression is evaluated
+ // for each 'p' which satisfies the filters and used to assemble
+ // the resulting iterator
+ for (p <- xs if p.age > 20) yield p.name
+ }
+ }
+
+ /** Some functions over lists of numbers which demonstrate
+ * the use of for comprehensions.
+ */
+ object Numeric {
+
+ /** Return the divisors of n. */
+ def divisors(n: Int): List[Int] =
+ for (i <- List.range(1, n+1) if n % i == 0) yield i
+
+ /** Is 'n' a prime number? */
+ def isPrime(n: Int) = divisors(n).length == 2
+
+ /** Return pairs of numbers whose sum is prime. */
+ def findNums(n: Int): Iterable[(Int, Int)] = {
+
+ // a for comprehension using two generators
+ for (i <- 1 until n;
+ j <- 1 until (i-1);
+ if isPrime(i + j)) yield (i, j)
+ }
+
+ /** Return the sum of the elements of 'xs'. */
+ def sum(xs: List[Double]): Double =
+ xs.foldLeft(0.0) { (x, y) => x + y }
+
+ /** Return the sum of pairwise product of the two lists. */
+ def scalProd(xs: List[Double], ys: List[Double]) =
+ sum(for((x, y) <- xs zip ys) yield x * y);
+
+ /** Remove duplicate elements in 'xs'. */
+ def removeDuplicates[A](xs: List[A]): List[A] =
+ if (xs.isEmpty)
+ xs
+ else
+ xs.head :: removeDuplicates(for (x <- xs.tail if x != xs.head) yield x)
+ }
+
+ // import all members of object 'persons' in the current scope
+ import Persons._
+
+ print("Persons over 20:")
+ olderThan20(persons) foreach { x => print(" " + x) }
+ println
+
+ import Numeric._
+
+ println("divisors(34) = " + divisors(34))
+
+ print("findNums(15) =")
+ findNums(15) foreach { x => print(" " + x) }
+ println
+
+ val xs = List(3.5, 5.0, 4.5)
+ println("average(" + xs + ") = " + sum(xs) / xs.length)
+
+ val ys = List(2.0, 1.0, 3.0)
+ println("scalProd(" + xs + ", " + ys +") = " + scalProd(xs, ys))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_gadts.check b/test/pending/run/reify_gadts.check
new file mode 100644
index 0000000000..d81cc0710e
--- /dev/null
+++ b/test/pending/run/reify_gadts.check
@@ -0,0 +1 @@
+42
diff --git a/test/pending/run/reify_gadts.scala b/test/pending/run/reify_gadts.scala
new file mode 100644
index 0000000000..7077de735c
--- /dev/null
+++ b/test/pending/run/reify_gadts.scala
@@ -0,0 +1,45 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ /* The syntax tree of a toy language */
+ abstract class Term[T]
+
+ /* An integer literal */
+ case class Lit(x: Int) extends Term[Int]
+
+ /* Successor of a number */
+ case class Succ(t: Term[Int]) extends Term[Int]
+
+ /* Is 't' equal to zero? */
+ case class IsZero(t: Term[Int]) extends Term[Boolean]
+
+ /* An 'if' expression. */
+ case class If[T](c: Term[Boolean],
+ t1: Term[T],
+ t2: Term[T]) extends Term[T]
+
+ /** A type-safe eval function. The right-hand sides can
+ * make use of the fact that 'T' is a more precise type,
+ * constraint by the pattern type.
+ */
+ def eval[T](t: Term[T]): T = t match {
+ case Lit(n) => n
+
+ // the right hand side makes use of the fact
+ // that T = Int and so it can use '+'
+ case Succ(u) => eval(u) + 1
+ case IsZero(u) => eval(u) == 0
+ case If(c, u1, u2) => eval(if (eval(c)) u1 else u2)
+ }
+ println(
+ eval(If(IsZero(Lit(1)), Lit(41), Succ(Lit(41)))))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_implicits.check b/test/pending/run/reify_implicits.check
new file mode 100644
index 0000000000..e3aeb20f6b
--- /dev/null
+++ b/test/pending/run/reify_implicits.check
@@ -0,0 +1 @@
+x = List(1, 2, 3, 4)
diff --git a/test/pending/run/reify_implicits.scala b/test/pending/run/reify_implicits.scala
new file mode 100644
index 0000000000..a15cef9c97
--- /dev/null
+++ b/test/pending/run/reify_implicits.scala
@@ -0,0 +1,21 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ implicit def arrayWrapper[A : ClassManifest](x: Array[A]) =
+ new {
+ def sort(p: (A, A) => Boolean) = {
+ util.Sorting.stableSort(x, p); x
+ }
+ }
+ val x = Array(2, 3, 1, 4)
+ println("x = "+ x.sort((x: Int, y: Int) => x < y).toList)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_lazyevaluation.check b/test/pending/run/reify_lazyevaluation.check
new file mode 100644
index 0000000000..1c7f96cd96
--- /dev/null
+++ b/test/pending/run/reify_lazyevaluation.check
@@ -0,0 +1,8 @@
+s = Susp(?)
+evaluating...
+s() = 3
+s = Susp(3)
+2 + s = 5
+sl2 = Susp(?)
+sl2() = Some(3)
+sl2 = Susp(Some(3))
diff --git a/test/pending/run/reify_lazyevaluation.scala b/test/pending/run/reify_lazyevaluation.scala
new file mode 100644
index 0000000000..f38af76751
--- /dev/null
+++ b/test/pending/run/reify_lazyevaluation.scala
@@ -0,0 +1,65 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ object lazyLib {
+
+ /** Delay the evaluation of an expression until it is needed. */
+ def delay[A](value: => A): Susp[A] = new SuspImpl[A](value)
+
+ /** Get the value of a delayed expression. */
+ implicit def force[A](s: Susp[A]): A = s()
+
+ /**
+ * Data type of suspended computations. (The name froms from ML.)
+ */
+ abstract class Susp[+A] extends Function0[A]
+
+ /**
+ * Implementation of suspended computations, separated from the
+ * abstract class so that the type parameter can be invariant.
+ */
+ class SuspImpl[A](lazyValue: => A) extends Susp[A] {
+ private var maybeValue: Option[A] = None
+
+ override def apply() = maybeValue match {
+ case None =>
+ val value = lazyValue
+ maybeValue = Some(value)
+ value
+ case Some(value) =>
+ value
+ }
+
+ override def toString() = maybeValue match {
+ case None => "Susp(?)"
+ case Some(value) => "Susp(" + value + ")"
+ }
+ }
+ }
+
+ import lazyLib._
+
+ val s: Susp[Int] = delay { println("evaluating..."); 3 }
+
+ println("s = " + s) // show that s is unevaluated
+ println("s() = " + s()) // evaluate s
+ println("s = " + s) // show that the value is saved
+ println("2 + s = " + (2 + s)) // implicit call to force()
+
+ val sl = delay { Some(3) }
+ val sl1: Susp[Some[Int]] = sl
+ val sl2: Susp[Option[Int]] = sl1 // the type is covariant
+
+ println("sl2 = " + sl2)
+ println("sl2() = " + sl2())
+ println("sl2 = " + sl2)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_maps.check b/test/pending/run/reify_maps.check
new file mode 100644
index 0000000000..08cbbb1359
--- /dev/null
+++ b/test/pending/run/reify_maps.check
@@ -0,0 +1,4 @@
+red has code: 16711680
+Unknown color: green
+Unknown color: blue
+turquoise has code: 65535
diff --git a/test/pending/run/reify_maps.scala b/test/pending/run/reify_maps.scala
new file mode 100644
index 0000000000..589b28d049
--- /dev/null
+++ b/test/pending/run/reify_maps.scala
@@ -0,0 +1,26 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ val colors = Map("red" -> 0xFF0000,
+ "turquoise" -> 0x00FFFF,
+ "black" -> 0x000000,
+ "orange" -> 0xFF8040,
+ "brown" -> 0x804000)
+ for (name <- List("red", "green", "blue", "turquoise")) println(
+ colors.get(name) match {
+ case Some(code) =>
+ name + " has code: " + code
+ case None =>
+ "Unknown color: " + name
+ }
+ )
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_properties.check b/test/pending/run/reify_properties.check
new file mode 100644
index 0000000000..d769bea4b0
--- /dev/null
+++ b/test/pending/run/reify_properties.check
@@ -0,0 +1,2 @@
+user1: MR. ROBERT <noname>
+user2: MR. BOB KUZ
diff --git a/test/pending/run/reify_properties.scala b/test/pending/run/reify_properties.scala
new file mode 100644
index 0000000000..2115a96715
--- /dev/null
+++ b/test/pending/run/reify_properties.scala
@@ -0,0 +1,63 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ /** A mutable property whose getter and setter may be customized. */
+ case class Property[T](init: T) {
+ private var value: T = init
+
+ /** The getter function, defaults to identity. */
+ private var setter: T => T = identity[T]
+
+ /** The setter function, defaults to identity. */
+ private var getter: T => T = identity[T]
+
+ /** Retrive the value held in this property. */
+ def apply(): T = getter(value)
+
+ /** Update the value held in this property, through the setter. */
+ def update(newValue: T) = value = setter(newValue)
+
+ /** Change the getter. */
+ def get(newGetter: T => T) = { getter = newGetter; this }
+
+ /** Change the setter */
+ def set(newSetter: T => T) = { setter = newSetter; this }
+ }
+
+ class User {
+ // Create a property with custom getter and setter
+ val firstname = Property("")
+ .get { v => v.toUpperCase() }
+ .set { v => "Mr. " + v }
+ val lastname = Property("<noname>")
+
+ /** Scala provides syntactic sugar for calling 'apply'. Simply
+ * adding a list of arguments between parenthesis (in this case,
+ * an empty list) is translated to a call to 'apply' with those
+ * arguments.
+ */
+ override def toString() = firstname() + " " + lastname()
+ }
+
+ val user1 = new User
+
+ // Syntactic sugar for 'update': an assignment is translated to a
+ // call to method 'update'
+ user1.firstname() = "Robert"
+
+ val user2 = new User
+ user2.firstname() = "bob"
+ user2.lastname() = "KUZ"
+
+ println("user1: " + user1)
+ println("user2: " + user2)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_simpleinterpreter.check b/test/pending/run/reify_simpleinterpreter.check
new file mode 100644
index 0000000000..4344dc9009
--- /dev/null
+++ b/test/pending/run/reify_simpleinterpreter.check
@@ -0,0 +1,2 @@
+42
+wrong
diff --git a/test/pending/run/reify_simpleinterpreter.scala b/test/pending/run/reify_simpleinterpreter.scala
new file mode 100644
index 0000000000..b39f5583bb
--- /dev/null
+++ b/test/pending/run/reify_simpleinterpreter.scala
@@ -0,0 +1,82 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ case class M[A](value: A) {
+ def bind[B](k: A => M[B]): M[B] = k(value)
+ def map[B](f: A => B): M[B] = bind(x => unitM(f(x)))
+ def flatMap[B](f: A => M[B]): M[B] = bind(f)
+ }
+
+ def unitM[A](a: A): M[A] = M(a)
+
+ def showM(m: M[Value]): String = m.value.toString();
+
+ type Name = String
+
+ trait Term;
+ case class Var(x: Name) extends Term
+ case class Con(n: Int) extends Term
+ case class Add(l: Term, r: Term) extends Term
+ case class Lam(x: Name, body: Term) extends Term
+ case class App(fun: Term, arg: Term) extends Term
+
+ trait Value
+ case object Wrong extends Value {
+ override def toString() = "wrong"
+ }
+ case class Num(n: Int) extends Value {
+ override def toString() = n.toString()
+ }
+ case class Fun(f: Value => M[Value]) extends Value {
+ override def toString() = "<function>"
+ }
+
+ type Environment = List[Pair[Name, Value]]
+
+ def lookup(x: Name, e: Environment): M[Value] = e match {
+ case List() => unitM(Wrong)
+ case Pair(y, b) :: e1 => if (x == y) unitM(b) else lookup(x, e1)
+ }
+
+ def add(a: Value, b: Value): M[Value] = Pair(a, b) match {
+ case Pair(Num(m), Num(n)) => unitM(Num(m + n))
+ case _ => unitM(Wrong)
+ }
+
+ def apply(a: Value, b: Value): M[Value] = a match {
+ case Fun(k) => k(b)
+ case _ => unitM(Wrong)
+ }
+
+ def interp(t: Term, e: Environment): M[Value] = t match {
+ case Var(x) => lookup(x, e)
+ case Con(n) => unitM(Num(n))
+ case Add(l, r) => for (a <- interp(l, e);
+ b <- interp(r, e);
+ c <- add(a, b))
+ yield c
+ case Lam(x, t) => unitM(Fun(a => interp(t, Pair(x, a) :: e)))
+ case App(f, t) => for (a <- interp(f, e);
+ b <- interp(t, e);
+ c <- apply(a, b))
+ yield c
+ }
+
+ def test(t: Term): String =
+ showM(interp(t, List()))
+
+ val term0 = App(Lam("x", Add(Var("x"), Var("x"))), Add(Con(10), Con(11)))
+ val term1 = App(Con(1), Con(2))
+
+ println(test(term0))
+ println(test(term1))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_sort.check b/test/pending/run/reify_sort.check
new file mode 100644
index 0000000000..375536cc29
--- /dev/null
+++ b/test/pending/run/reify_sort.check
@@ -0,0 +1,2 @@
+[6,2,8,5,1]
+[1,2,5,6,8]
diff --git a/test/pending/run/reify_sort.scala b/test/pending/run/reify_sort.scala
new file mode 100644
index 0000000000..42991fe5d2
--- /dev/null
+++ b/test/pending/run/reify_sort.scala
@@ -0,0 +1,57 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ /** Nested methods can use and even update everything
+ * visible in their scope (including local variables or
+ * arguments of enclosing methods).
+ */
+ def sort(a: Array[Int]) {
+
+ def swap(i: Int, j: Int) {
+ val t = a(i); a(i) = a(j); a(j) = t
+ }
+
+ def sort1(l: Int, r: Int) {
+ val pivot = a((l + r) / 2)
+ var i = l
+ var j = r
+ while (i <= j) {
+ while (a(i) < pivot) i += 1
+ while (a(j) > pivot) j -= 1
+ if (i <= j) {
+ swap(i, j)
+ i += 1
+ j -= 1
+ }
+ }
+ if (l < j) sort1(l, j)
+ if (j < r) sort1(i, r)
+ }
+
+ if (a.length > 0)
+ sort1(0, a.length - 1)
+ }
+
+ def println(ar: Array[Int]) {
+ def print1 = {
+ def iter(i: Int): String =
+ ar(i) + (if (i < ar.length-1) "," + iter(i+1) else "")
+ if (ar.length == 0) "" else iter(0)
+ }
+ Console.println("[" + print1 + "]")
+ }
+
+ val ar = Array(6, 2, 8, 5, 1)
+ println(ar)
+ sort(ar)
+ println(ar)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_sort1.check b/test/pending/run/reify_sort1.check
new file mode 100644
index 0000000000..0d30805141
--- /dev/null
+++ b/test/pending/run/reify_sort1.check
@@ -0,0 +1,2 @@
+List(6, 2, 8, 5, 1)
+List(1, 2, 5, 6, 8)
diff --git a/test/pending/run/reify_sort1.scala b/test/pending/run/reify_sort1.scala
new file mode 100644
index 0000000000..42f4c824a5
--- /dev/null
+++ b/test/pending/run/reify_sort1.scala
@@ -0,0 +1,27 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ def sort(a: List[Int]): List[Int] = {
+ if (a.length < 2)
+ a
+ else {
+ val pivot = a(a.length / 2)
+ sort(a.filter(_ < pivot)) :::
+ a.filter(_ == pivot) :::
+ sort(a.filter(_ > pivot))
+ }
+ }
+
+ val xs = List(6, 2, 8, 5, 1)
+ println(xs)
+ println(sort(xs))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/reify_timeofday.check b/test/pending/run/reify_timeofday.check
new file mode 100644
index 0000000000..3fd3b76a62
--- /dev/null
+++ b/test/pending/run/reify_timeofday.check
@@ -0,0 +1 @@
+DateError
diff --git a/test/pending/run/reify_timeofday.scala b/test/pending/run/reify_timeofday.scala
new file mode 100644
index 0000000000..6bd11b0d30
--- /dev/null
+++ b/test/pending/run/reify_timeofday.scala
@@ -0,0 +1,48 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ class DateError extends Exception
+
+ /** Simulating properties in Scala
+ * (example 4.2.1 in ScalaReference.pdf)
+ */
+ class TimeOfDayVar {
+ private var h, m, s: Int = 0
+
+ def hours = h
+
+ /** A method 'ident_=' is a setter for 'ident'. 'code.ident = ...' will
+ * be translated to a call to 'ident_='
+ */
+ def hours_= (h: Int) =
+ if (0 <= h && h < 24) this.h = h
+ else throw new DateError()
+
+ def minutes = m
+ def minutes_= (m: Int) =
+ if (0 <= m && m < 60) this.m = m
+ else throw new DateError()
+
+ def seconds = s
+ def seconds_= (s: Int) =
+ if (0 <= s && s < 60) this.s = s
+ else throw new DateError()
+ }
+
+ val d = new TimeOfDayVar
+ d.hours = 8; d.minutes = 30; d.seconds = 0
+ try { d.hours = 25 // throws a DateError exception
+ } catch {
+ case de: DateError => println("DateError")
+ case e: Exception => println("Exception")
+ }
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5224.check b/test/pending/run/t5224.check
new file mode 100644
index 0000000000..2b920773c0
--- /dev/null
+++ b/test/pending/run/t5224.check
@@ -0,0 +1,9 @@
+{
+ @serializable class C extends Object with ScalaObject {
+ def <init>() = {
+ super.<init>();
+ ()
+ }
+ };
+ ()
+} \ No newline at end of file
diff --git a/test/pending/run/t5224.scala b/test/pending/run/t5224.scala
new file mode 100644
index 0000000000..865ce4bfe9
--- /dev/null
+++ b/test/pending/run/t5224.scala
@@ -0,0 +1,8 @@
+import scala.reflect._
+import scala.reflect.api._
+
+object Test extends App {
+ println(scala.reflect.Code.lift{
+ @serializable class C
+ }.tree.toString)
+} \ No newline at end of file
diff --git a/test/pending/run/t5225_1.check b/test/pending/run/t5225_1.check
new file mode 100644
index 0000000000..b29cd9c365
--- /dev/null
+++ b/test/pending/run/t5225_1.check
@@ -0,0 +1,4 @@
+{
+ @transient @volatile var x: Int = 2;
+ ()
+} \ No newline at end of file
diff --git a/test/pending/run/t5225_1.scala b/test/pending/run/t5225_1.scala
new file mode 100644
index 0000000000..454502e810
--- /dev/null
+++ b/test/pending/run/t5225_1.scala
@@ -0,0 +1,8 @@
+import scala.reflect._
+import scala.reflect.api._
+
+object Test extends App {
+ println(scala.reflect.Code.lift{
+ @transient @volatile var x = 2
+ }.tree.toString)
+} \ No newline at end of file
diff --git a/test/pending/run/t5225_2.check b/test/pending/run/t5225_2.check
new file mode 100644
index 0000000000..88972fd27f
--- /dev/null
+++ b/test/pending/run/t5225_2.check
@@ -0,0 +1,4 @@
+{
+ def foo(@cloneable x: Int): String = "";
+ ()
+}
diff --git a/test/pending/run/t5225_2.scala b/test/pending/run/t5225_2.scala
new file mode 100644
index 0000000000..82bad0f353
--- /dev/null
+++ b/test/pending/run/t5225_2.scala
@@ -0,0 +1,8 @@
+import scala.reflect._
+import scala.reflect.api._
+
+object Test extends App {
+ println(scala.reflect.Code.lift{
+ def foo(@cloneable x: Int) = ""
+ }.tree.toString)
+} \ No newline at end of file
diff --git a/test/pending/run/t5229_1.check b/test/pending/run/t5229_1.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/pending/run/t5229_1.check
diff --git a/test/pending/run/t5229_1.scala b/test/pending/run/t5229_1.scala
new file mode 100644
index 0000000000..1d7bf0590b
--- /dev/null
+++ b/test/pending/run/t5229_1.scala
@@ -0,0 +1,14 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ object C
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5229_1_nolift.scala b/test/pending/run/t5229_1_nolift.scala
new file mode 100644
index 0000000000..33855d2e4f
--- /dev/null
+++ b/test/pending/run/t5229_1_nolift.scala
@@ -0,0 +1 @@
+object C
diff --git a/test/pending/run/t5229_2.check b/test/pending/run/t5229_2.check
new file mode 100644
index 0000000000..5db6ec9b38
--- /dev/null
+++ b/test/pending/run/t5229_2.check
@@ -0,0 +1,2 @@
+2
+evaluated = null
diff --git a/test/pending/run/t5229_2.scala b/test/pending/run/t5229_2.scala
new file mode 100644
index 0000000000..67be7328a6
--- /dev/null
+++ b/test/pending/run/t5229_2.scala
@@ -0,0 +1,19 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ object C {
+ val x = 2
+ }
+
+ println(C.x)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ val evaluated = toolbox.runExpr(ttree)
+ println("evaluated = " + evaluated)
+}
diff --git a/test/pending/run/t5230.check b/test/pending/run/t5230.check
deleted file mode 100644
index 5ef4ff4d04..0000000000
--- a/test/pending/run/t5230.check
+++ /dev/null
@@ -1 +0,0 @@
-evaluated = 2
diff --git a/test/pending/run/t5266_1.check b/test/pending/run/t5266_1.check
new file mode 100644
index 0000000000..3feac16a0b
--- /dev/null
+++ b/test/pending/run/t5266_1.check
@@ -0,0 +1,2 @@
+2
+evaluated = null \ No newline at end of file
diff --git a/test/pending/run/t5266_1.scala b/test/pending/run/t5266_1.scala
new file mode 100644
index 0000000000..06a81a04ea
--- /dev/null
+++ b/test/pending/run/t5266_1.scala
@@ -0,0 +1,23 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ def x = 2
+ println(x)
+ };
+
+ val settings = new Settings
+ settings.debug.value = true
+ settings.Xshowtrees.value = true
+ settings.Xprint.value = List("typer")
+ settings.printtypes.value = true
+ settings.Ytyperdebug.value = true
+
+ val reporter = new ConsoleReporter(settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ val evaluated = toolbox.runExpr(ttree)
+ println("evaluated = " + evaluated)
+} \ No newline at end of file
diff --git a/test/pending/run/t5266_2.check b/test/pending/run/t5266_2.check
new file mode 100644
index 0000000000..3feac16a0b
--- /dev/null
+++ b/test/pending/run/t5266_2.check
@@ -0,0 +1,2 @@
+2
+evaluated = null \ No newline at end of file
diff --git a/test/pending/run/t5266_2.scala b/test/pending/run/t5266_2.scala
new file mode 100644
index 0000000000..cd841da021
--- /dev/null
+++ b/test/pending/run/t5266_2.scala
@@ -0,0 +1,17 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ def x = 2
+ def y = x
+ println(y)
+ };
+
+ val reporter = new ConsoleReporter(settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ val evaluated = toolbox.runExpr(ttree)
+ println("evaluated = " + evaluated)
+}
diff --git a/test/pending/run/t5269.check b/test/pending/run/t5269.check
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/test/pending/run/t5269.check
@@ -0,0 +1 @@
+2
diff --git a/test/pending/run/t5269.scala b/test/pending/run/t5269.scala
new file mode 100644
index 0000000000..a30509f3fe
--- /dev/null
+++ b/test/pending/run/t5269.scala
@@ -0,0 +1,22 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ trait Z {
+ val z = 2
+ }
+
+ class X extends Z {
+ def println() = Predef.println(z)
+ }
+
+ new X().println()
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5270.check b/test/pending/run/t5270.check
new file mode 100644
index 0000000000..08839f6bb2
--- /dev/null
+++ b/test/pending/run/t5270.check
@@ -0,0 +1 @@
+200
diff --git a/test/pending/run/t5270.scala b/test/pending/run/t5270.scala
new file mode 100644
index 0000000000..10f79790b0
--- /dev/null
+++ b/test/pending/run/t5270.scala
@@ -0,0 +1,26 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ class Y {
+ def y = 100
+ }
+
+ trait Z { this: Y =>
+ val z = 2 * y
+ }
+
+ class X extends Y with Z {
+ def println() = Predef.println(z)
+ }
+
+ new X().println()
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5271_1.check b/test/pending/run/t5271_1.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/pending/run/t5271_1.check
diff --git a/test/pending/run/t5271_1.scala b/test/pending/run/t5271_1.scala
new file mode 100644
index 0000000000..5f10e64528
--- /dev/null
+++ b/test/pending/run/t5271_1.scala
@@ -0,0 +1,14 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ case class C(foo: Int, bar: Int)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5271_2.check b/test/pending/run/t5271_2.check
new file mode 100644
index 0000000000..b8626c4cff
--- /dev/null
+++ b/test/pending/run/t5271_2.check
@@ -0,0 +1 @@
+4
diff --git a/test/pending/run/t5271_2.scala b/test/pending/run/t5271_2.scala
new file mode 100644
index 0000000000..71967c04ed
--- /dev/null
+++ b/test/pending/run/t5271_2.scala
@@ -0,0 +1,16 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ case class C(foo: Int, bar: Int)
+ val c = C(2, 2)
+ println(c.foo * c.bar)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5272.check b/test/pending/run/t5272.check
new file mode 100644
index 0000000000..dcf02b2fb6
--- /dev/null
+++ b/test/pending/run/t5272.check
@@ -0,0 +1 @@
+okay
diff --git a/test/pending/run/t5272.scala b/test/pending/run/t5272.scala
new file mode 100644
index 0000000000..3f44d05fb3
--- /dev/null
+++ b/test/pending/run/t5272.scala
@@ -0,0 +1,17 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ 2 match {
+ case 2 => println("okay")
+ case _ => println("not okay")
+ }
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5273_1.check b/test/pending/run/t5273_1.check
new file mode 100644
index 0000000000..c551774ca5
--- /dev/null
+++ b/test/pending/run/t5273_1.check
@@ -0,0 +1 @@
+name = American Dollar, shortname = USD, value = 2,8567
diff --git a/test/pending/run/t5273_1.scala b/test/pending/run/t5273_1.scala
new file mode 100644
index 0000000000..8b75084463
--- /dev/null
+++ b/test/pending/run/t5273_1.scala
@@ -0,0 +1,16 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ val RegexParser = """(.*) \d+([A-Z]+) \| (.*) \|.*""".r
+ val RegexParser(name, shortname, value) = "American Dollar 1USD | 2,8567 | sometext"
+ println("name = %s, shortname = %s, value = %s".format(name, shortname, value))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5273_2.check b/test/pending/run/t5273_2.check
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/test/pending/run/t5273_2.check
@@ -0,0 +1 @@
+2
diff --git a/test/pending/run/t5273_2.scala b/test/pending/run/t5273_2.scala
new file mode 100644
index 0000000000..1175881c9f
--- /dev/null
+++ b/test/pending/run/t5273_2.scala
@@ -0,0 +1,17 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ List(1, 2, 3) match {
+ case foo :: bar :: _ => println(foo * bar)
+ case _ => println("this is getting out of hand!")
+ }
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5274_1.check b/test/pending/run/t5274_1.check
new file mode 100644
index 0000000000..fca8bc3d3e
--- /dev/null
+++ b/test/pending/run/t5274_1.check
@@ -0,0 +1,3 @@
+50! = 30414093201713378043612608166064768844377641568960512000000000000
+49! = 608281864034267560872252163321295376887552831379210240000000000
+50!/49! = 50
diff --git a/test/pending/run/t5274_1.scala b/test/pending/run/t5274_1.scala
new file mode 100644
index 0000000000..c501172518
--- /dev/null
+++ b/test/pending/run/t5274_1.scala
@@ -0,0 +1,20 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ def factorial(n: BigInt): BigInt =
+ if (n == 0) 1 else n * factorial(n-1)
+
+ val f50 = factorial(50); val f49 = factorial(49)
+ println("50! = " + f50)
+ println("49! = " + f49)
+ println("50!/49! = " + (f50 / f49))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5274_2.check b/test/pending/run/t5274_2.check
new file mode 100644
index 0000000000..375536cc29
--- /dev/null
+++ b/test/pending/run/t5274_2.check
@@ -0,0 +1,2 @@
+[6,2,8,5,1]
+[1,2,5,6,8]
diff --git a/test/pending/run/t5274_2.scala b/test/pending/run/t5274_2.scala
new file mode 100644
index 0000000000..42991fe5d2
--- /dev/null
+++ b/test/pending/run/t5274_2.scala
@@ -0,0 +1,57 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ /** Nested methods can use and even update everything
+ * visible in their scope (including local variables or
+ * arguments of enclosing methods).
+ */
+ def sort(a: Array[Int]) {
+
+ def swap(i: Int, j: Int) {
+ val t = a(i); a(i) = a(j); a(j) = t
+ }
+
+ def sort1(l: Int, r: Int) {
+ val pivot = a((l + r) / 2)
+ var i = l
+ var j = r
+ while (i <= j) {
+ while (a(i) < pivot) i += 1
+ while (a(j) > pivot) j -= 1
+ if (i <= j) {
+ swap(i, j)
+ i += 1
+ j -= 1
+ }
+ }
+ if (l < j) sort1(l, j)
+ if (j < r) sort1(i, r)
+ }
+
+ if (a.length > 0)
+ sort1(0, a.length - 1)
+ }
+
+ def println(ar: Array[Int]) {
+ def print1 = {
+ def iter(i: Int): String =
+ ar(i) + (if (i < ar.length-1) "," + iter(i+1) else "")
+ if (ar.length == 0) "" else iter(0)
+ }
+ Console.println("[" + print1 + "]")
+ }
+
+ val ar = Array(6, 2, 8, 5, 1)
+ println(ar)
+ sort(ar)
+ println(ar)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5275.check b/test/pending/run/t5275.check
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/test/pending/run/t5275.check
@@ -0,0 +1 @@
+2
diff --git a/test/pending/run/t5275.scala b/test/pending/run/t5275.scala
new file mode 100644
index 0000000000..d419834ded
--- /dev/null
+++ b/test/pending/run/t5275.scala
@@ -0,0 +1,15 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ class C(val foo: Int)
+ println(new C(2).foo)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5276.check b/test/pending/run/t5276.check
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/test/pending/run/t5276.check
@@ -0,0 +1 @@
+2
diff --git a/test/pending/run/t5276.scala b/test/pending/run/t5276.scala
new file mode 100644
index 0000000000..432fdb91e4
--- /dev/null
+++ b/test/pending/run/t5276.scala
@@ -0,0 +1,15 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ lazy x = 2
+ println(x)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5277_1.check b/test/pending/run/t5277_1.check
new file mode 100644
index 0000000000..a48033a30d
--- /dev/null
+++ b/test/pending/run/t5277_1.check
@@ -0,0 +1 @@
+10! = 3628800
diff --git a/test/pending/run/t5277_1.scala b/test/pending/run/t5277_1.scala
new file mode 100644
index 0000000000..57acd699ff
--- /dev/null
+++ b/test/pending/run/t5277_1.scala
@@ -0,0 +1,21 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ def fact(n: Int): BigInt =
+ if (n == 0) 1 else fact(n-1) * n
+ class Factorizer(n: Int) {
+ def ! = fact(n)
+ }
+ implicit def int2fact(n: Int) = new Factorizer(n)
+
+ println("10! = " + (10!))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5277_2.check b/test/pending/run/t5277_2.check
new file mode 100644
index 0000000000..5f1d0ecea5
--- /dev/null
+++ b/test/pending/run/t5277_2.check
@@ -0,0 +1,2 @@
+2
+1
diff --git a/test/pending/run/t5277_2.scala b/test/pending/run/t5277_2.scala
new file mode 100644
index 0000000000..67b6b000bc
--- /dev/null
+++ b/test/pending/run/t5277_2.scala
@@ -0,0 +1,18 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ def p(implicit i: Int) = print(i)
+ implicit val v = 2
+
+ println(p)
+ println(p(1))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/pending/run/t5279.check b/test/pending/run/t5279.check
new file mode 100644
index 0000000000..f599e28b8a
--- /dev/null
+++ b/test/pending/run/t5279.check
@@ -0,0 +1 @@
+10
diff --git a/test/pending/run/t5279.scala b/test/pending/run/t5279.scala
new file mode 100644
index 0000000000..39e7dd2c66
--- /dev/null
+++ b/test/pending/run/t5279.scala
@@ -0,0 +1,14 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ println(new Integer(10))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/tools/get-scala-revision b/tools/get-scala-revision
index 8731705d06..e8597844cc 100755
--- a/tools/get-scala-revision
+++ b/tools/get-scala-revision
@@ -1,30 +1,19 @@
#!/bin/sh
#
# Usage: get-scala-revision [dir]
-# Figures out current scala revision of an svn checkout or
-# a git-svn mirror (or a git clone.)
+# Figures out current scala revision of a git clone.
#
# If no dir is given, current working dir is used.
-DIR=""
-if [ $# -eq 0 ]; then
- DIR=`pwd`
-else
- DIR=$1
-fi
-
-cd $DIR
+[ -n "$1" ] && cd "$1"
-if [ -d .svn ]; then
- # 2>&1 to catch also error output (e.g. svn warnings)
- svn info . 2>&1 | grep ^Revision | sed 's/Revision: //'
-elif [ -d .git ]; then
- GIT_PAGER=cat
- # this grabs more than one line because otherwise if you have local
- # commits which aren't in git-svn it won't see any revision.
- git log -10 | grep git-svn-id | head -1 | sed 's/[^@]*@\([0-9]*\).*/\1/'
+# dev should be a tag at the merge-base of master and the
+# most recent release.
+if [ -z $(git tag -l dev) ]; then
+ # no dev tag available - this will generate dev-g<sha>
+ echo "dev-g$(git describe HEAD --abbrev=7 --always)"
else
- echo "${DIR} doesn't appear to be git or svn dir." >&2
- echo 0
- exit 1
+ # dev tag exists - this generates dev-NNNN-g<sha>
+ # where NNNN is the number of commits since dev.
+ git describe HEAD --abbrev=7 --match dev
fi
diff --git a/tools/get-scala-revision.bat b/tools/get-scala-revision.bat
index 880bcc3f5c..f4dc24b71f 100644
--- a/tools/get-scala-revision.bat
+++ b/tools/get-scala-revision.bat
@@ -1,17 +1,11 @@
@echo off
rem
rem Usage: get-scala-revison.bat [dir]
-rem Figures out current scala revision of an svn checkout or
-rem a git-svn mirror (or a git clone.)
+rem Figures out current scala revision of a git clone.
rem
rem If no dir is given, current working dir is used.
-if "%OS%" NEQ "Windows_NT" (
- echo "Sorry, your version of Windows is too old to run Scala."
- goto :eof
-)
@setlocal
-
set _DIR=
if "%*"=="" (
for /f "delims=;" %%i in ('cd') do set "_DIR=%%i"
@@ -20,23 +14,9 @@ if "%*"=="" (
)
cd %_DIR%
-if exist .svn\NUL (
- rem 2>&1 to catch also error output (e.g. svn warnings)
- for /f "skip=4 tokens=2" %%i in ('svn info') do (
- echo %%i
- goto :end
- )
-) else ( if exist .git\NUL (
- set _GIT_PAGER=type
- rem this grabs more than one line because otherwise if you have local
- rem commits which aren't in git-svn it won't see any revision.
- rem TODO: git log -10 | findstr git-svn-id | ...
- echo 0
-) else (
- echo %_DIR% doesn't appear to be git or svn dir.
- echo 0
- exit 1
-))
+if exist .git\NUL (
+ git describe HEAD --abbrev=7 --match dev
+)
:end
@endlocal