[scala-2.10] 01/01: Imported Upstream version 2.7.2-r16603
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Tue Nov 15 12:44:48 UTC 2016
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to annotated tag upstream/2.7.2-r16603
in repository scala-2.10.
commit 85d8fcacb8266fa5741f9df0412d7ccfd9537191
Author: Mehdi Dogguy <dogguy at pps.jussieu.fr>
Date: Tue Nov 25 19:06:31 2008 +0100
Imported Upstream version 2.7.2-r16603
---
META-INF/MANIFEST.MF | 2 +-
OMakefile | 2 +-
anttestsuitelog | 787 --------
build.number | 2 +-
build.xml | 537 +++++-
lib/ScalaCheck.jar | Bin 0 -> 737362 bytes
lib/ScalaCheckHelper.jar | Bin 0 -> 6886 bytes
lib/ant/maven-ant-tasks-2.0.9.jar | Bin 0 -> 1018394 bytes
lib/scala-compiler.jar | Bin 5833813 -> 5928188 bytes
lib/scala-library-src.jar | Bin 641370 -> 639599 bytes
lib/scala-library.jar | Bin 3646592 -> 3684490 bytes
partestLog | 749 --------
src/actors/scala/actors/Actor.scala | 2 +-
src/actors/scala/actors/FJTaskScheduler2.scala | 2 +-
src/actors/scala/actors/Future.scala | 2 +-
src/actors/scala/actors/Scheduler.scala | 2 +-
src/actors/scala/actors/TickedScheduler.scala | 2 +-
src/build/four.xml | 7 +-
src/build/maven/maven-deploy.xml | 153 ++
src/build/maven/scala-compiler-pom.xml | 26 +
src/build/maven/scala-dbc-pom.xml | 26 +
src/build/maven/scala-library-pom.xml | 19 +
src/build/maven/scala-swing-pom.xml | 26 +
src/build/pack.xml | 76 +-
src/compiler/scala/tools/ant/FastScalac.scala | 8 +-
src/compiler/scala/tools/ant/Scalac.scala | 2 +-
.../scala/tools/ant/sabbus/ScalacFork.scala | 21 +-
src/compiler/scala/tools/nsc/CompileClient.scala | 40 +-
src/compiler/scala/tools/nsc/CompileServer.scala | 136 +-
src/compiler/scala/tools/nsc/CompileSocket.scala | 6 +-
src/compiler/scala/tools/nsc/CompilerCommand.scala | 32 +-
src/compiler/scala/tools/nsc/Global.scala | 48 +-
src/compiler/scala/tools/nsc/Interpreter.scala | 2 +-
src/compiler/scala/tools/nsc/Main.scala | 23 +-
.../scala/tools/nsc/MainGenericRunner.scala | 92 +-
src/compiler/scala/tools/nsc/Phase.scala | 4 +-
src/compiler/scala/tools/nsc/ScriptRunner.scala | 91 +-
src/compiler/scala/tools/nsc/Settings.scala | 4 +-
.../scala/tools/nsc/ast/TreeBrowsers.scala | 2 +-
src/compiler/scala/tools/nsc/ast/TreeGen.scala | 4 +-
.../scala/tools/nsc/ast/TreePrinters.scala | 2 +-
src/compiler/scala/tools/nsc/ast/Trees.scala | 98 +-
.../scala/tools/nsc/ast/parser/Parsers.scala | 18 +-
.../tools/nsc/ast/parser/SyntaxAnalyzer.scala | 3 +-
.../scala/tools/nsc/ast/parser/TreeBuilder.scala | 4 +-
.../tools/nsc/backend/icode/BasicBlocks.scala | 2 +-
.../scala/tools/nsc/backend/icode/Checkers.scala | 2 +-
.../nsc/backend/icode/ExceptionHandlers.scala | 2 +-
.../scala/tools/nsc/backend/icode/GenICode.scala | 6 +-
.../scala/tools/nsc/backend/icode/Members.scala | 2 +-
.../scala/tools/nsc/backend/icode/Printers.scala | 122 +-
.../scala/tools/nsc/backend/icode/TypeKinds.scala | 2 +-
.../backend/icode/analysis/CopyPropagation.scala | 25 +-
.../backend/icode/analysis/TypeFlowAnalysis.scala | 2 +-
.../scala/tools/nsc/backend/jvm/GenJVM.scala | 2 +-
.../scala/tools/nsc/backend/msil/GenMSIL.scala | 2 +-
.../tools/nsc/backend/opt/ClosureElimination.scala | 3 +-
.../nsc/backend/opt/DeadCodeElimination.scala | 2 +-
.../scala/tools/nsc/backend/opt/Inliners.scala | 7 +-
src/compiler/scala/tools/nsc/doc/script.js | 6 +-
.../tools/nsc/interpreter/InteractiveReader.scala | 38 +-
.../scala/tools/nsc/interpreter/JLineReader.scala | 4 +-
.../scala/tools/nsc/interpreter/SimpleReader.scala | 4 +-
src/compiler/scala/tools/nsc/io/AbstractFile.scala | 6 +-
src/compiler/scala/tools/nsc/io/PlainFile.scala | 4 +-
src/compiler/scala/tools/nsc/io/VirtualFile.scala | 4 +-
src/compiler/scala/tools/nsc/io/ZipArchive.scala | 11 +-
.../scala/tools/nsc/javac/JavaParsers.scala | 27 +-
.../scala/tools/nsc/matching/CodeFactory.scala | 284 +--
.../scala/tools/nsc/matching/MatchUtil.scala | 95 +
.../tools/nsc/matching/ParallelMatching.scala | 1934 ++++++++------------
.../scala/tools/nsc/matching/PatternNodes.scala | 358 ++--
src/compiler/scala/tools/nsc/matching/Set64.scala | 24 -
.../scala/tools/nsc/matching/TransMatcher.scala | 268 +--
.../scala/tools/nsc/symtab/Definitions.scala | 19 +-
.../scala/tools/nsc/symtab/IdeSupport.scala | 7 +
src/compiler/scala/tools/nsc/symtab/StdNames.scala | 3 +-
src/compiler/scala/tools/nsc/symtab/Symbols.scala | 62 +-
src/compiler/scala/tools/nsc/symtab/Types.scala | 181 +-
.../nsc/symtab/classfile/ClassfileParser.scala | 5 +-
.../tools/nsc/symtab/classfile/ICodeReader.scala | 12 +-
.../scala/tools/nsc/transform/Constructors.scala | 2 +-
.../scala/tools/nsc/transform/Erasure.scala | 2 +-
.../scala/tools/nsc/transform/ExplicitOuter.scala | 65 +-
.../scala/tools/nsc/transform/InfoTransform.scala | 2 +-
.../scala/tools/nsc/transform/LambdaLift.scala | 2 +-
.../scala/tools/nsc/transform/LiftCode.scala | 2 +-
src/compiler/scala/tools/nsc/transform/Mixin.scala | 8 +-
.../tools/nsc/transform/OverridingPairs.scala | 2 +-
.../scala/tools/nsc/transform/UnCurry.scala | 19 +-
.../scala/tools/nsc/typechecker/Analyzer.scala | 3 +-
.../scala/tools/nsc/typechecker/Contexts.scala | 8 +-
.../scala/tools/nsc/typechecker/Infer.scala | 19 +-
.../scala/tools/nsc/typechecker/RefChecks.scala | 13 +-
.../tools/nsc/typechecker/SyntheticMethods.scala | 10 +-
.../scala/tools/nsc/typechecker/TreeCheckers.scala | 5 +-
.../scala/tools/nsc/typechecker/Typers.scala | 77 +-
.../scala/tools/nsc/typechecker/Variances.scala | 16 +-
src/compiler/scala/tools/nsc/util/BitSet.scala | 158 --
src/compiler/scala/tools/nsc/util/ClassPath.scala | 4 +-
src/compiler/scala/tools/nsc/util/LinkedList.scala | 12 -
src/compiler/scala/tools/nsc/util/ListBuffer.scala | 61 -
.../scala/tools/nsc/util/NameTransformer.scala | 2 +-
src/compiler/scala/tools/nsc/util/Position.scala | 6 +-
src/compiler/scala/tools/nsc/util/SourceFile.scala | 39 +-
src/compiler/scala/tools/nsc/util/TreeSet.scala | 2 +-
src/compiler/scala/tools/util/SocketServer.scala | 84 +-
src/library/scala/Array.scala | 37 +-
src/library/scala/BigDecimal.scala | 2 +-
src/library/scala/Enumeration.scala | 17 +-
src/library/scala/Iterator.scala | 6 +-
src/library/scala/List.scala | 4 +-
src/library/scala/NotNull.scala | 3 +-
src/library/scala/Predef.scala | 2 +-
src/library/scala/Random.scala | 4 +-
src/library/scala/Range.scala | 2 +-
src/library/scala/Seq.scala | 2 +-
src/library/scala/Stream.scala | 23 +-
.../scala/collection/immutable/IntMap.scala | 19 +
src/library/scala/collection/immutable/Queue.scala | 2 +-
.../scala/collection/mutable/ArrayStack.scala | 11 +
.../scala/collection/mutable/OpenHashMap.scala | 11 +
src/library/scala/concurrent/jolib.scala | 4 +-
src/library/scala/runtime/BoxedArray.scala | 4 +-
src/library/scala/runtime/Nothing$.scala | 4 +-
src/library/scala/runtime/ScalaRunTime.scala | 2 +-
.../scala/{NotNull.scala => uncheckedStable.scala} | 6 +-
src/library/scala/util/matching/Regex.scala | 8 +-
.../util/parsing/combinator/RegexParsers.scala | 2 +-
src/manual/scala/man1/Command.scala | 4 +-
src/manual/scala/man1/fsc.scala | 2 +-
src/manual/scala/man1/sbaz.scala | 2 +-
src/manual/scala/man1/scala.scala | 2 +-
src/manual/scala/man1/scalac.scala | 2 +-
src/manual/scala/man1/scaladoc.scala | 2 +-
src/partest/scala/tools/partest/PartestTask.scala | 20 +-
.../scala/tools/partest/nest/AntRunner.scala | 2 +-
.../scala/tools/partest/nest/CompileManager.scala | 42 +-
.../tools/partest/nest/ConsoleFileManager.scala | 2 +-
.../scala/tools/partest/nest/ConsoleRunner.scala | 4 +-
.../scala/tools/partest/nest/FileManager.scala | 2 +-
src/partest/scala/tools/partest/nest/NestUI.scala | 2 +-
.../tools/partest/nest/ReflectiveRunner.scala | 2 +-
.../scala/tools/partest/nest/TestFile.scala | 31 +-
src/partest/scala/tools/partest/nest/Worker.scala | 12 +-
src/swing/scala/swing/Frame.scala | 5 +
src/swing/scala/swing/Swing.scala | 8 +-
test/files/jvm/mkLibNatives.bat | 4 +-
test/files/jvm/serialization.check | 2 +
test/files/jvm/serialization.scala | 3 +-
test/files/jvm5/genericNest.scala | 13 +
test/files/{run => jvm5}/interpreter.check | 3 +
test/files/{run => jvm5}/interpreter.scala | 2 +
test/files/jvm5/t1464.check | 1 +
test/files/jvm5/t1464/MyTrait.scala | 5 +
test/files/jvm5/t1464/Test.java | 6 +
test/files/lib/ScalaCheck.jar | Bin 0 -> 737362 bytes
test/files/lib/genericNest.jar | Bin 0 -> 1136 bytes
test/files/neg/bug412.check | 9 +-
test/files/neg/bug414.check | 5 +
test/files/neg/bug521.check | 2 +-
test/files/neg/bug692.check | 14 +-
test/files/neg/bug692.scala | 4 +-
test/files/neg/bug961.check | 7 +-
test/files/neg/null-unsoundness.check | 5 +
test/files/neg/null-unsoundness.scala | 15 +
test/files/neg/patmatexhaust.check | 1 +
test/files/neg/t1371.check | 4 +
test/files/neg/t1371.scala | 2 +
test/files/neg/unreachablechar.check | 4 +
test/files/neg/unreachablechar.scala | 8 +
test/files/neg/volatile-intersection.check | 4 +
test/files/neg/volatile-intersection.scala | 21 +
test/files/neg/volatile.check | 7 +
test/files/neg/volatile.scala | 24 +
test/files/pos/annotations.scala | 13 +
test/files/pos/comp-rec-test.flags | 1 +
test/files/pos/comp-rec-test.scala | 24 +
test/files/pos/inferbroadtype.scala | 8 +
test/files/pos/jesper.scala | 30 +
test/files/pos/largecasetest.scala | 6 +
test/files/pos/looping-jsig.scala | 18 +
test/files/pos/needstypeearly.scala | 4 +
test/files/pos/proj-rec-test.flags | 1 +
test/files/pos/proj-rec-test.scala | 13 +
test/{pending => files}/pos/t0288/Foo.scala | 0
test/{pending => files}/pos/t0288/Outer.java | 0
test/files/pos/t0453.scala | 6 +
test/{pending => files}/pos/t0591.scala | 0
test/{pending => files}/pos/t0774/deathname.scala | 0
test/{pending => files}/pos/t0774/unrelated.scala | 0
test/files/pos/t1087.scala | 3 +
test/{pending => files}/pos/t1131.scala | 0
test/files/pos/t1280.scala | 1 +
test/files/pos/t1380.flags | 1 +
test/files/pos/t1380/gnujaxp.jar | Bin 0 -> 231445 bytes
test/files/pos/t1380/hallo.scala | 3 +
test/files/pos/t1391.scala | 43 +
test/files/pos/t1409/AbstractImpl.java | 3 +
test/files/pos/t1409/ConcreteImpl.scala | 3 +
test/files/pos/t1409/OuterInterface.java | 5 +
test/files/pos/t1480.scala | 6 +
test/files/pos/typesafecons.scala | 30 +
test/files/pos5/ilya2/A.scala | 3 +
test/files/pos5/ilya2/B.java | 6 +
test/files/pos5/ilya2/Nullable.java | 7 +
.../pos => files/pos5}/t0695/JavaClass.java | 0
test/{pending/pos => files/pos5}/t0695/Test.scala | 0
test/{pending/pos => files/pos5}/t1232/J.java | 0
test/{pending/pos => files/pos5}/t1232/J2.java | 0
test/{pending/pos => files/pos5}/t1232/S.scala | 0
test/files/run/bug889.check | 1 +
.../run/t0889.scala => files/run/bug889.scala} | 0
test/files/run/checked.check | 4 +-
test/files/run/checked.scala | 2 +-
test/files/run/exceptions-2.check | 2 +-
test/files/run/exceptions-2.scala | 4 +-
test/files/run/infiniteloop.check | 1 +
test/files/run/infiniteloop.scala | 13 +
test/files/run/intgetorelse.scala | 15 -
.../files/run/{intgetorelse.check => intmap.check} | 0
test/files/run/intmap.scala | 8 +
test/files/run/iq.scala | 2 +-
test/files/run/matcharraytail.check | 2 +
test/files/run/matcharraytail.scala | 7 +
test/files/run/matchbytes.check | 1 +
test/files/run/matchbytes.scala | 7 +
test/files/run/matchemptyarray.check | 1 +
test/files/run/matchemptyarray.scala | 5 +
test/files/run/matchintasany.check | 1 +
test/files/run/matchintasany.scala | 8 +
test/files/run/matchonstream.check | 1 +
test/files/run/matchonstream.scala | 3 +
test/files/run/missingparams.check | 1 +
test/files/run/missingparams.scala | 21 +
test/files/run/t1423.check | 1 +
test/files/run/t1423.scala | 8 +
test/files/run/t1500.check | 3 +
test/files/run/t1500.scala | 44 +
test/files/run/t1501.check | 3 +
test/files/run/t1501.scala | 55 +
test/files/run/t1505.scala | 25 +
test/files/run/verify-ctor.check | 1 +
test/files/run/verify-ctor.scala | 13 +
test/files/scalacheck/list.scala | 10 +
test/files/script/fact.bat | 17 +
test/files/script/second.bat | 3 +
test/files/script/t1015.bat | 12 +
test/files/script/t1017.bat | 15 +
test/files/script/utf8.bat | 11 +
test/files/shootout/knucleotide.scala-3.scala | 3 +-
test/partest | 2 +-
test/partest.bat | 2 +-
test/{files => pending}/jvm/inner.scala | 2 +-
test/pending/jvm/timeout.check | 1 +
test/pending/jvm/timeout.scala | 33 +
test/pending/jvm5/t1464.check | 1 +
test/pending/{neg => pos}/t0699/A.scala | 0
test/pending/{neg => pos}/t0699/B.scala | 0
test/pending/pos/t1035.scala | 32 +
test/pending/pos/t1107/Object.scala | 10 +
test/pending/pos/t1107/Trait.scala | 9 +
test/pending/pos/t1164.scala | 29 +
test/pending/pos/t1260.scala | 17 +
test/pending/pos/t1438.scala | 10 +
test/pending/pos/t1439.scala | 7 +
test/pending/pos/t425.scala | 11 +
test/pending/pos/t425variant.scala | 10 +
test/pending/pos/t796.scala | 20 +
test/pending/pos5/misc/A.java | 13 +
test/pending/pos5/misc/B.scala | 7 +
test/pending/pos5/misc/J.java | 4 +
test/pending/pos5/misc/S.scala | 4 +
test/pending/run/castsingleton.check | 2 +
test/pending/run/castsingleton.scala | 10 +
test/pending/run/complicatedmatch.check | 6 +
test/pending/run/complicatedmatch.scala | 31 +
test/pending/run/mixins.scala | 6 +
test/pending/run/preinits.scala | 6 +
test/pending/run/t0508.scala | 13 -
280 files changed, 4131 insertions(+), 4457 deletions(-)
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
index 1907be8..82a7e95 100644
--- a/META-INF/MANIFEST.MF
+++ b/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Scala Distribution
Bundle-SymbolicName: scala.tools.nsc;singleton:=true
-Bundle-Version: 2.7.2.final
+Bundle-Version: 2.7.2.RC4
Eclipse-LazyStart: true
Bundle-ClassPath:
.,
diff --git a/OMakefile b/OMakefile
index fc740f1..98e3aa3 100644
--- a/OMakefile
+++ b/OMakefile
@@ -3,7 +3,7 @@
# If you aren't running on a LAMP system, you need to make sure you
# have JAVA_HOME and JAVACMD (and optionally JAVAC) set correctly.
JAVA_HOME = $(getenv JAVA_HOME, /home/linuxsoft/apps/java-1.6/)
-JAVACMD = $(getenv JAVACMD, $(JAVA_HOME)$(DIRSEP)bin$(DIRSEP)/java)
+JAVACMD = $(getenv JAVACMD, $(JAVA_HOME)$(DIRSEP)bin$(DIRSEP)java)
JAVAC = $(getenv JAVAC, $(JAVA_HOME)$(DIRSEP)bin$(DIRSEP)javac)
JAVAP = $(JAVA_HOME)$(DIRSEP)bin$(DIRSEP)javap
diff --git a/anttestsuitelog b/anttestsuitelog
deleted file mode 100644
index 3042d1a..0000000
--- a/anttestsuitelog
+++ /dev/null
@@ -1,787 +0,0 @@
-Buildfile: build.xml
-
-init:
- [exec] Result: 127
- [echo] Build number is '2.7.2.r0-b20081031230613'
- [echo] Built 31 October 2008, 23:06:13 from revision 0 with Java 1.5.0_16-b02
-
-locker.start:
-
-locker.pre-lib:
-
-locker.lib:
-
-locker.pre-comp:
-
-locker.comp:
-
-locker.done:
-
-quick.start:
-
-quick.pre-lib:
-
-quick.lib:
-
-quick.pre-comp:
-
-quick.comp:
-
-quick.pre-partest:
-
-quick.partest:
-
-quick.pre-bin:
-
-quick.bin:
-
-quick.done:
-
-pack.start:
-
-pack.pre-lib:
-
-pack.lib:
-
-pack.pre-comp:
-
-pack.comp:
-
-pack.pre-partest:
-
-pack.partest:
-
-pack.pre-bin:
-
-pack.bin:
-
-pack.done:
-
-test.suite:
- [partest] Compiling files that are expected to build
- [partest] testing: [...]/files/pos/test [ OK ]
- [partest] testing: [...]/files/pos/propagate.scala [ OK ]
- [partest] testing: [...]/files/pos/bug183.scala [ OK ]
- [partest] testing: [...]/files/pos/A.scala [ OK ]
- [partest] testing: [...]/files/pos/bug533.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0123.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_bounds1.scala [ OK ]
- [partest] testing: [...]/files/pos/lambda.scala [ OK ]
- [partest] testing: [...]/files/pos/bug807.scala [ OK ]
- [partest] testing: [...]/files/pos/bug201.scala [ OK ]
- [partest] testing: [...]/files/pos/bug566.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_checkkinds_mix.scala [ OK ]
- [partest] testing: [...]/files/pos/lambdalift.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0204.scala [ OK ]
- [partest] testing: [...]/files/pos/bug210.scala [ OK ]
- [partest] testing: [...]/files/pos/bug577.scala [ OK ]
- [partest] testing: [...]/files/pos/List1.scala [ OK ]
- [partest] testing: [...]/files/pos/protected-t1010.scala [ OK ]
- [partest] testing: [...]/files/pos/bug812.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_gm.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0304.scala [ OK ]
- [partest] testing: [...]/files/pos/lambdalift1.scala [ OK ]
- [partest] testing: [...]/files/pos/rebind.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_higherorder_bound_method.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0325.scala [ OK ]
- [partest] testing: [...]/files/pos/bug839.scala [ OK ]
- [partest] testing: [...]/files/pos/bug211.scala [ OK ]
- [partest] testing: [...]/files/pos/return_thistype.scala [ OK ]
- [partest] testing: [...]/files/pos/bug592.scala [ OK ]
- [partest] testing: [...]/files/pos/MailBox.scala [ OK ]
- [partest] testing: [...]/files/pos/listpattern.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_late_method_params.scala [ OK ]
- [partest] testing: [...]/files/pos/bug851.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0422.scala [ OK ]
- [partest] testing: [...]/files/pos/bug595.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_method.scala [ OK ]
- [partest] testing: [...]/files/pos/S1.scala [ OK ]
- [partest] testing: [...]/files/pos/bug229.scala [ OK ]
- [partest] testing: [...]/files/pos/bug873.scala [ OK ]
- [partest] testing: [...]/files/pos/localmodules.scala [ OK ]
- [partest] testing: [...]/files/pos/scoping1.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0599.scala [ OK ]
- [partest] testing: [...]/files/pos/bug596.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_overloaded.scala [ OK ]
- [partest] testing: [...]/files/pos/bug245.scala [ OK ]
- [partest] testing: [...]/files/pos/manifest1.scala [ OK ]
- [partest] testing: [...]/files/pos/S3.scala [ OK ]
- [partest] testing: [...]/files/pos/bug880.scala [ OK ]
- [partest] testing: [...]/files/pos/bug599.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0646.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_param_scoping.scala [ OK ]
- [partest] testing: [...]/files/pos/scoping2.scala [ OK ]
- [partest] testing: [...]/files/pos/S5.scala [ OK ]
- [partest] testing: [...]/files/pos/bug892.scala [ OK ]
- [partest] testing: [...]/files/pos/bug247.scala [ OK ]
- [partest] testing: [...]/files/pos/matchStarlift.scala [ OK ]
- [partest] testing: [...]/files/pos/bug602.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1000.scala [ OK ]
- [partest] testing: [...]/files/pos/bug911.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_poly.scala [ OK ]
- [partest] testing: [...]/files/pos/bug604.scala [ OK ]
- [partest] testing: [...]/files/pos/scoping3.scala [ OK ]
- [partest] testing: [...]/files/pos/bug262.scala [ OK ]
- [partest] testing: [...]/files/pos/S8.scala [ OK ]
- [partest] testing: [...]/files/pos/matthias1.scala [ OK ]
- [partest] testing: [...]/files/pos/bug927.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_return_overriding.scala [ OK ]
- [partest] testing: [...]/files/pos/bug607.scala [ OK ]
- [partest] testing: [...]/files/pos/matthias3.scala [ OK ]
- [partest] testing: [...]/files/pos/seqtest2.scala [ OK ]
- [partest] testing: [...]/files/pos/bug946.scala [ OK ]
- [partest] testing: [...]/files/pos/Transactions.scala [ OK ]
- [partest] testing: [...]/files/pos/bug267.scala [ OK ]
- [partest] testing: [...]/files/pos/simplelists.scala [ OK ]
- [partest] testing: [...]/files/pos/caseaccs.scala [ OK ]
- [partest] testing: [...]/files/pos/matthias4.scala [ OK ]
- [partest] testing: [...]/files/pos/bug287.scala [ OK ]
- [partest] testing: [...]/files/pos/bug611.scala [ OK ]
- [partest] testing: [...]/files/pos/X.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_seq.scala [ OK ]
- [partest] testing: [...]/files/pos/stable.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1001.scala [ OK ]
- [partest] testing: [...]/files/pos/cfcrash.scala [ OK ]
- [partest] testing: [...]/files/pos/matthias5.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1006.scala [ OK ]
- [partest] testing: [...]/files/pos/bug613.scala [ OK ]
- [partest] testing: [...]/files/pos/Z.scala [ OK ]
- [partest] testing: [...]/files/pos/strings.scala [ OK ]
- [partest] testing: [...]/files/pos/bug289.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_seq_typealias.scala [ OK ]
- [partest] testing: [...]/files/pos/channels.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1014.scala [ OK ]
- [partest] testing: [...]/files/pos/abstract.scala [ OK ]
- [partest] testing: [...]/files/pos/bug615.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1034.scala [ OK ]
- [partest] testing: [...]/files/pos/bug295.scala [ OK ]
- [partest] testing: [...]/files/pos/maxim1.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_subst.scala [ OK ]
- [partest] testing: [...]/files/pos/sudoku.scala [ OK ]
- [partest] testing: [...]/files/pos/cls.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1049.scala [ OK ]
- [partest] testing: [...]/files/pos/aliases.scala [ OK ]
- [partest] testing: [...]/files/pos/bug296.scala [ OK ]
- [partest] testing: [...]/files/pos/bug616.scala [ OK ]
- [partest] testing: [...]/files/pos/t0055.scala [ OK ]
- [partest] testing: [...]/files/pos/michel1.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_typeapp.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1050.scala [ OK ]
- [partest] testing: [...]/files/pos/cls1.scala [ OK ]
- [partest] testing: [...]/files/pos/bug304.scala [ OK ]
- [partest] testing: [...]/files/pos/annot-inner.scala [ OK ]
- [partest] testing: [...]/files/pos/michel2.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_typesub.scala [ OK ]
- [partest] testing: [...]/files/pos/t0154.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1056.scala [ OK ]
- [partest] testing: [...]/files/pos/annotations.scala [ OK ]
- [partest] testing: [...]/files/pos/bug628.scala [ OK ]
- [partest] testing: [...]/files/pos/clsrefine.scala [ OK ]
- [partest] testing: [...]/files/pos/bug318.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_variance.scala [ OK ]
- [partest] testing: [...]/files/pos/michel3.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1075.scala [ OK ]
- [partest] testing: [...]/files/pos/t0165.scala [ OK ]
- [partest] testing: [...]/files/pos/arrays2.scala [ OK ]
- [partest] testing: [...]/files/pos/code.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_wildcards.scala [ OK ]
- [partest] testing: [...]/files/pos/michel4.scala [ OK ]
- [partest] testing: [...]/files/pos/bug640.scala [ OK ]
- [partest] testing: [...]/files/pos/bug319.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1085.scala [ OK ]
- [partest] testing: [...]/files/pos/t0227.scala [ OK ]
- [partest] testing: [...]/files/pos/collections.scala [ OK ]
- [partest] testing: [...]/files/pos/bug342.scala [ OK ]
- [partest] testing: [...]/files/pos/michel5.scala [ OK ]
- [partest] testing: [...]/files/pos/bug651.scala [ OK ]
- [partest] testing: [...]/files/pos/ted.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1090.scala [ OK ]
- [partest] testing: [...]/files/pos/t0231.scala [ OK ]
- [partest] testing: [...]/files/pos/attributes.scala [ OK ]
- [partest] testing: [...]/files/pos/test1.scala [ OK ]
- [partest] testing: [...]/files/pos/bug344.scala [ OK ]
- [partest] testing: [...]/files/pos/compile.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1107.scala [ OK ]
- [partest] testing: [...]/files/pos/bug661.scala [ OK ]
- [partest] testing: [...]/files/pos/michel6.scala [ OK ]
- [partest] testing: [...]/files/pos/t0273.scala [ OK ]
- [partest] testing: [...]/files/pos/bounds.scala [ OK ]
- [partest] testing: [...]/files/pos/test2.scala [ OK ]
- [partest] testing: [...]/files/pos/bug348plus.scala [ OK ]
- [partest] testing: [...]/files/pos/compile1.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0002.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1119.scala [ OK ]
- [partest] testing: [...]/files/pos/t0301.scala [ OK ]
- [partest] testing: [...]/files/pos/compound.scala [ OK ]
- [partest] testing: [...]/files/pos/bug675.scala [ OK ]
- [partest] testing: [...]/files/pos/bug359.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0017.scala [ OK ]
- [partest] testing: [...]/files/pos/mixins.scala [ OK ]
- [partest] testing: [...]/files/pos/t0438.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1123.scala [ OK ]
- [partest] testing: [...]/files/pos/test4.scala [ OK ]
- [partest] testing: [...]/files/pos/constfold.scala [ OK ]
- [partest] testing: [...]/files/pos/bug360.scala [ OK ]
- [partest] testing: [...]/files/pos/modules.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0020.scala [ OK ]
- [partest] testing: [...]/files/pos/t0504.scala [ OK ]
- [partest] testing: [...]/files/pos/contrib467.scala [ OK ]
- [partest] testing: [...]/files/pos/bug684.scala [ OK ]
- [partest] testing: [...]/files/pos/bug112606A.scala [ OK ]
- [partest] testing: [...]/files/pos/bug361.scala [ OK ]
- [partest] testing: [...]/files/pos/test4a.scala [ OK ]
- [partest] testing: [...]/files/pos/modules1.scala [ OK ]
- [partest] testing: [...]/files/pos/t0586.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0029.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1136.scala [ OK ]
- [partest] testing: [...]/files/pos/bug690.scala [ OK ]
- [partest] testing: [...]/files/pos/bug372.scala [ OK ]
- [partest] testing: [...]/files/pos/contrib701.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0030.scala [ OK ]
- [partest] testing: [...]/files/pos/moduletrans.scala [ OK ]
- [partest] testing: [...]/files/pos/t0651.scala [ OK ]
- [partest] testing: [...]/files/pos/test4refine.scala [ OK ]
- [partest] testing: [...]/files/pos/bug694.scala [ OK ]
- [partest] testing: [...]/files/pos/bug115.scala [ OK ]
- [partest] testing: [...]/files/pos/escapes2.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0031.scala [ OK ]
- [partest] testing: [...]/files/pos/bug374.scala [ OK ]
- [partest] testing: [...]/files/pos/nested.scala [ OK ]
- [partest] testing: [...]/files/pos/t0654.scala [ OK ]
- [partest] testing: [...]/files/pos/bug697.scala [ OK ]
- [partest] testing: [...]/files/pos/eta.scala [ OK ]
- [partest] testing: [...]/files/pos/bug116.scala [ OK ]
- [partest] testing: [...]/files/pos/test5.scala [ OK ]
- [partest] testing: [...]/files/pos/bug389.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0032.scala [ OK ]
- [partest] testing: [...]/files/pos/nested2.scala [ OK ]
- [partest] testing: [...]/files/pos/bug698.scala [ OK ]
- [partest] testing: [...]/files/pos/exceptions.scala [ OK ]
- [partest] testing: [...]/files/pos/bug397.scala [ OK ]
- [partest] testing: [...]/files/pos/null.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1168.scala [ OK ]
- [partest] testing: [...]/files/pos/bug703.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0036.scala [ OK ]
- [partest] testing: [...]/files/pos/test5refine.scala [ OK ]
- [partest] testing: [...]/files/pos/bug402.scala [ OK ]
- [partest] testing: [...]/files/pos/functions.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0039.scala [ OK ]
- [partest] testing: [...]/files/pos/bug119.scala [ OK ]
- [partest] testing: [...]/files/pos/testcast.scala [ OK ]
- [partest] testing: [...]/files/pos/nullary.scala [ OK ]
- [partest] testing: [...]/files/pos/bug404.scala [ OK ]
- [partest] testing: [...]/files/pos/t0674.scala [ OK ]
- [partest] testing: [...]/files/pos/bug704.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1203.scala [ OK ]
- [partest] testing: [...]/files/pos/gadt-gilles.scala [ OK ]
- [partest] testing: [...]/files/pos/thistype.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0049.scala [ OK ]
- [partest] testing: [...]/files/pos/nullary_poly.scala [ OK ]
- [partest] testing: [...]/files/pos/bug711.scala [ OK ]
- [partest] testing: [...]/files/pos/bug121.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0053.scala [ OK ]
- [partest] testing: [...]/files/pos/t0710.scala [ OK ]
- [partest] testing: [...]/files/pos/bug720.scala [ OK ]
- [partest] testing: [...]/files/pos/thistypes.scala [ OK ]
- [partest] testing: [...]/files/pos/bug415.scala [ OK ]
- [partest] testing: [...]/files/pos/override.scala [ OK ]
- [partest] testing: [...]/files/pos/gadts2.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1210.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0054.scala [ OK ]
- [partest] testing: [...]/files/pos/bug757.scala [ OK ]
- [partest] testing: [...]/files/pos/t0770.scala [ OK ]
- [partest] testing: [...]/files/pos/ticket0137.scala [ OK ]
- [partest] testing: [...]/files/pos/partialfun.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0061.scala [ OK ]
- [partest] testing: [...]/files/pos/bug419.scala [ OK ]
- [partest] testing: [...]/files/pos/bug757a.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1210a.scala [ OK ]
- [partest] testing: [...]/files/pos/gosh.scala [ OK ]
- [partest] testing: [...]/files/pos/tinondefcons.scala [ OK ]
- [partest] testing: [...]/files/pos/t0786.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0064.scala [ OK ]
- [partest] testing: [...]/files/pos/pat_gilles.scala [ OK ]
- [partest] testing: [...]/files/pos/bug758.scala [ OK ]
- [partest] testing: [...]/files/pos/bug422.scala [ OK ]
- [partest] testing: [...]/files/pos/bug122.scala [ OK ]
- [partest] testing: [...]/files/pos/traits.scala [ OK ]
- [partest] testing: [...]/files/pos/typealias_dubious.scala [ OK ]
- [partest] testing: [...]/files/pos/t0851.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1237.scala [ OK ]
- [partest] testing: [...]/files/pos/bug759.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0066.scala [ OK ]
- [partest] testing: [...]/files/pos/pat_iuli.scala [ OK ]
- [partest] testing: [...]/files/pos/bug430.scala [ OK ]
- [partest] testing: [...]/files/pos/t0872.scala [ OK ]
- [partest] testing: [...]/files/pos/gui.scala [ OK ]
- [partest] testing: [...]/files/pos/typealiases.scala [ OK ]
- [partest] testing: [...]/files/pos/bug124.scala [ OK ]
- [partest] testing: [...]/files/pos/bug762.scala [ OK ]
- [partest] testing: [...]/files/pos/t0904.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0068.scala [ OK ]
- [partest] testing: [...]/files/pos/homonym.scala [ OK ]
- [partest] testing: [...]/files/pos/bug432.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1241.scala [ OK ]
- [partest] testing: [...]/files/pos/patterns.scala [ OK ]
- [partest] testing: [...]/files/pos/typerep-stephane.scala [ OK ]
- [partest] testing: [...]/files/pos/bug767.scala [ OK ]
- [partest] testing: [...]/files/pos/bug439.scala [ OK ]
- [partest] testing: [...]/files/pos/bug780.scala [ OK ]
- [partest] testing: [...]/files/pos/imp2.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0069.scala [ OK ]
- [partest] testing: [...]/files/pos/patterns1.scala [ OK ]
- [partest] testing: [...]/files/pos/t0905.scala [ OK ]
- [partest] testing: [...]/files/pos/typerep.scala [ OK ]
- [partest] testing: [...]/files/pos/bug1292.scala [ OK ]
- [partest] testing: [...]/files/pos/bug443.scala [ OK ]
- [partest] testing: [...]/files/pos/imports.scala [ OK ]
- [partest] testing: [...]/files/pos/bug151.scala [ OK ]
- [partest] testing: [...]/files/pos/bug788.scala [ OK ]
- [partest] testing: [...]/files/pos/t0999.scala [ OK ]
- [partest] testing: [...]/files/pos/bug514.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0076.scala [ OK ]
- [partest] testing: [...]/files/pos/infer.scala [ OK ]
- [partest] testing: [...]/files/pos/bug159.scala [ OK ]
- [partest] testing: [...]/files/pos/unapply.scala [ OK ]
- [partest] testing: [...]/files/pos/patterns1213.scala [ OK ]
- [partest] testing: [...]/files/pos/bug516.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0081.scala [ OK ]
- [partest] testing: [...]/files/pos/t1001.scala [ OK ]
- [partest] testing: [...]/files/pos/bug789.scala [ OK ]
- [partest] testing: [...]/files/pos/bug160.scala [ OK ]
- [partest] testing: [...]/files/pos/unapplyComplex.scala [ OK ]
- [partest] testing: [...]/files/pos/infer2.scala [ OK ]
- [partest] testing: [...]/files/pos/bug522.scala [ OK ]
- [partest] testing: [...]/files/pos/bug796.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0082.scala [ OK ]
- [partest] testing: [...]/files/pos/t1027.scala [ OK ]
- [partest] testing: [...]/files/pos/patterns2.scala [ OK ]
- [partest] testing: [...]/files/pos/bug175.scala [ OK ]
- [partest] testing: [...]/files/pos/unapplyContexts2.scala [ OK ]
- [partest] testing: [...]/files/pos/bug177.scala [ OK ]
- [partest] testing: [...]/files/pos/init.scala [ OK ]
- [partest] testing: [...]/files/pos/patterns3.scala [ OK ]
- [partest] testing: [...]/files/pos/bug530.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0085.scala [ OK ]
- [partest] testing: [...]/files/pos/t1049.scala [ OK ]
- [partest] testing: [...]/files/pos/bug802.scala [ OK ]
- [partest] testing: [...]/files/pos/unapplyGeneric.scala [ OK ]
- [partest] testing: [...]/files/pos/philippe1.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0091.scala [ OK ]
- [partest] testing: [...]/files/pos/bug803.scala [ OK ]
- [partest] testing: [...]/files/pos/bug531.scala [ OK ]
- [partest] testing: [...]/files/pos/t1059.scala [ OK ]
- [partest] testing: [...]/files/pos/itay.scala [ OK ]
- [partest] testing: [...]/files/pos/unapplyNeedsMemberType.scala [ OK ]
- [partest] testing: [...]/files/pos/bug805.scala [ OK ]
- [partest] testing: [...]/files/pos/bug0093.scala [ OK ]
- [partest] testing: [...]/files/pos/bug532.scala [ OK ]
- [partest] testing: [...]/files/pos/philippe2.scala [ OK ]
- [partest] testing: [...]/files/pos/unapplySeq.scala [ OK ]
- [partest] testing: [...]/files/pos/t1146.scala [ OK ]
- [partest] testing: [...]/files/pos/kinzer.scala [ OK ]
- [partest] testing: [...]/files/pos/t1147.scala [ OK ]
- [partest] testing: [...]/files/pos/ksbug1.scala [ OK ]
- [partest] testing: [...]/files/pos/unapplyVal.scala [ OK ]
- [partest] testing: [...]/files/pos/t1159.scala [ OK ]
- [partest] testing: [...]/files/pos/unicode-decode.scala [ OK ]
- [partest] testing: [...]/files/pos/philippe3.scala [ OK ]
- [partest] testing: [...]/files/pos/tcpoly_boundedmonad.scala [ OK ]
- [partest] testing: [...]/files/pos/philippe4.scala [ OK ]
- [partest] testing: [...]/files/pos/valdefs.scala [ OK ]
- [partest] testing: [...]/files/pos/pmbug.scala [ OK ]
- [partest] testing: [...]/files/pos/variances.scala [ OK ]
- [partest] testing: [...]/files/pos/viewtest1.scala [ OK ]
- [partest] testing: [...]/files/pos/viewtest2.scala [ OK ]
- [partest] Compiling files that are expected to build
- [partest] testing: [...]/files/pos5/t1203 [ OK ]
- [partest] testing: [...]/files/pos5/chang [ OK ]
- [partest] testing: [...]/files/pos5/t1101 [ OK ]
- [partest] testing: [...]/files/pos5/t1102 [ OK ]
- [partest] testing: [...]/files/pos5/t1196 [ OK ]
- [partest] testing: [...]/files/pos5/t1176 [ OK ]
- [partest] testing: [...]/files/pos5/t1230 [ OK ]
- [partest] testing: [...]/files/pos5/t1197 [ OK ]
- [partest] testing: [...]/files/pos5/t1150 [ OK ]
- [partest] testing: [...]/files/pos5/t1231 [ OK ]
- [partest] testing: [...]/files/pos5/t1152 [ OK ]
- [partest] testing: [...]/files/pos5/ilya [ OK ]
- [partest] testing: [...]/files/pos5/t1263 [ OK ]
- [partest] testing: [...]/files/pos5/t1235 [ OK ]
- [partest] Compiling files that are expected to fail
- [partest] testing: [...]/files/neg/bug876.scala [ OK ]
- [partest] testing: [...]/files/neg/lazy-override.scala [ OK ]
- [partest] testing: [...]/files/neg/t0214.scala [ OK ]
- [partest] testing: [...]/files/neg/bug565.scala [ OK ]
- [partest] testing: [...]/files/neg/tcpoly_bounds.scala [ OK ]
- [partest] testing: [...]/files/neg/bug693.scala [ OK ]
- [partest] testing: [...]/files/neg/abstract.scala [ OK ]
- [partest] testing: [...]/files/neg/bug409.scala [ OK ]
- [partest] testing: [...]/files/neg/bug877.scala [ OK ]
- [partest] testing: [...]/files/neg/lazyvals.scala [ OK ]
- [partest] testing: [...]/files/neg/t0218.scala [ OK ]
- [partest] testing: [...]/files/neg/bug576.scala [ OK ]
- [partest] testing: [...]/files/neg/tcpoly_override.scala [ OK ]
- [partest] testing: [...]/files/neg/accesses.scala [ OK ]
- [partest] testing: [...]/files/neg/bug585.scala [ OK ]
- [partest] testing: [...]/files/neg/bug696.scala [ OK ]
- [partest] testing: [...]/files/neg/bug882.scala [ OK ]
- [partest] testing: [...]/files/neg/bug412.scala [ OK ]
- [partest] testing: [...]/files/neg/t0226.scala [ OK ]
- [partest] testing: [...]/files/neg/lubs.scala [ OK ]
- [partest] testing: [...]/files/neg/tcpoly_typealias.scala [ OK ]
- [partest] testing: [...]/files/neg/bug700.scala [ OK ]
- [partest] testing: [...]/files/neg/annot-nonconst.scala [ OK ]
- [partest] testing: [...]/files/neg/bug414.scala [ OK ]
- [partest] testing: [...]/files/neg/bug900.scala [ OK ]
- [partest] testing: [...]/files/neg/bug588.scala [ OK ]
- [partest] testing: [...]/files/neg/t0259.scala [ OK ]
- [partest] testing: [...]/files/neg/bug708.scala [ OK ]
- [partest] testing: [...]/files/neg/tcpoly_variance.scala [ OK ]
- [partest] testing: [...]/files/neg/mixins.scala [ OK ]
- [partest] testing: [...]/files/neg/badtok-1.scala [ OK ]
- [partest] testing: [...]/files/neg/bug418.scala [ OK ]
- [partest] testing: [...]/files/neg/bug591.scala [ OK ]
- [partest] testing: [...]/files/neg/bug712.scala [ OK ]
- [partest] testing: [...]/files/neg/badtok-2.scala [ OK ]
- [partest] testing: [...]/files/neg/t0345.scala [ OK ]
- [partest] testing: [...]/files/neg/bug421.scala [ OK ]
- [partest] testing: [...]/files/neg/bug593.scala [ OK ]
- [partest] testing: [...]/files/neg/bug908.scala [ OK ]
- [partest] testing: [...]/files/neg/tcpoly_variance_enforce.scala [ OK ]
- [partest] testing: [...]/files/neg/bug715.scala [ OK ]
- [partest] testing: [...]/files/neg/multi-array.scala [ OK ]
- [partest] testing: [...]/files/neg/bug1010.scala [ OK ]
- [partest] testing: [...]/files/neg/bug608.scala [ OK ]
- [partest] testing: [...]/files/neg/bug452.scala [ OK ]
- [partest] testing: [...]/files/neg/t0351.scala [ OK ]
- [partest] testing: [...]/files/neg/typeerror.scala [ OK ]
- [partest] testing: [...]/files/neg/nopredefs.scala [ OK ]
- [partest] testing: [...]/files/neg/bug1011.scala [ OK ]
- [partest] testing: [...]/files/neg/bug630.scala [ OK ]
- [partest] testing: [...]/files/neg/bug729.scala [ OK ]
- [partest] testing: [...]/files/neg/bug500.scala [ OK ]
- [partest] testing: [...]/files/neg/overload.scala [ OK ]
- [partest] testing: [...]/files/neg/bug909.scala [ OK ]
- [partest] testing: [...]/files/neg/variances.scala [ OK ]
- [partest] testing: [...]/files/neg/t0503.scala [ OK ]
- [partest] testing: [...]/files/neg/bug752.scala [ OK ]
- [partest] testing: [...]/files/neg/bug631.scala [ OK ]
- [partest] testing: [...]/files/neg/bug1017.scala [ OK ]
- [partest] testing: [...]/files/neg/t0528neg.scala [ OK ]
- [partest] testing: [...]/files/neg/bug501.scala [ OK ]
- [partest] testing: [...]/files/neg/viewtest.scala [ OK ]
- [partest] testing: [...]/files/neg/bug633.scala [ OK ]
- [partest] testing: [...]/files/neg/bug910.scala [ OK ]
- [partest] testing: [...]/files/neg/t0590.scala [ OK ]
- [partest] testing: [...]/files/neg/bug765.scala [ OK ]
- [partest] testing: [...]/files/neg/patmatexhaust.scala [ OK ]
- [partest] testing: [...]/files/neg/bug510.scala [ OK ]
- [partest] testing: [...]/files/neg/bug1041.scala [ OK ]
- [partest] testing: [...]/files/neg/bug639.scala [ OK ]
- [partest] testing: [...]/files/neg/bug960.scala [ OK ]
- [partest] testing: [...]/files/neg/patternalts.scala [ OK ]
- [partest] testing: [...]/files/neg/wellkinded_app.scala [ OK ]
- [partest] testing: [...]/files/neg/bug766.scala [ OK ]
- [partest] testing: [...]/files/neg/bug1106.scala [ OK ]
- [partest] testing: [...]/files/neg/t0606.scala [ OK ]
- [partest] testing: [...]/files/neg/bug649.scala [ OK ]
- [partest] testing: [...]/files/neg/bug512.scala [ OK ]
- [partest] testing: [...]/files/neg/bug961.scala [ OK ]
- [partest] testing: [...]/files/neg/bug779.scala [ OK ]
- [partest] testing: [...]/files/neg/sabin2.scala [ OK ]
- [partest] testing: [...]/files/neg/bug1112.scala [ OK ]
- [partest] testing: [...]/files/neg/t0764.scala [ OK ]
- [partest] testing: [...]/files/neg/wellkinded_app2.scala [ OK ]
- [partest] testing: [...]/files/neg/bug650.scala [ OK ]
- [partest] testing: [...]/files/neg/bug515.scala [ OK ]
- [partest] testing: [...]/files/neg/saito.scala [ OK ]
- [partest] testing: [...]/files/neg/bug783.scala [ OK ]
- [partest] testing: [...]/files/neg/bug987.scala [ OK ]
- [partest] testing: [...]/files/neg/t0842.scala [ OK ]
- [partest] testing: [...]/files/neg/bug1181.scala [ OK ]
- [partest] testing: [...]/files/neg/bug663.scala [ OK ]
- [partest] testing: [...]/files/neg/wellkinded_bounds.scala [ OK ]
- [partest] testing: [...]/files/neg/bug520.scala [ OK ]
- [partest] testing: [...]/files/neg/bug798.scala [ OK ]
- [partest] testing: [...]/files/neg/bug997.scala [ OK ]
- [partest] testing: [...]/files/neg/t0899.scala [ OK ]
- [partest] testing: [...]/files/neg/wellkinded_wrongarity.scala [ OK ]
- [partest] testing: [...]/files/neg/bug664.scala [ OK ]
- [partest] testing: [...]/files/neg/sensitive.scala [ OK ]
- [partest] testing: [...]/files/neg/bug1183.scala [ OK ]
- [partest] testing: [...]/files/neg/checksensible.scala [ OK ]
- [partest] testing: [...]/files/neg/bug521.scala [ OK ]
- [partest] testing: [...]/files/neg/bug800.scala [ OK ]
- [partest] testing: [...]/files/neg/t0903.scala [ OK ]
- [partest] testing: [...]/files/neg/bug667.scala [ OK ]
- [partest] testing: [...]/files/neg/structural.scala [ OK ]
- [partest] testing: [...]/files/neg/constrs.scala [ OK ]
- [partest] testing: [...]/files/neg/wellkinded_wrongarity2.scala [ OK ]
- [partest] testing: [...]/files/neg/bug545.scala [ OK ]
- [partest] testing: [...]/files/neg/bug835.scala [ OK ]
- [partest] testing: [...]/files/neg/t1009.scala [ OK ]
- [partest] testing: [...]/files/neg/bug1224.scala [ OK ]
- [partest] testing: [...]/files/neg/t0003.scala [ OK ]
- [partest] testing: [...]/files/neg/bug550.scala [ OK ]
- [partest] testing: [...]/files/neg/bug668.scala [ OK ]
- [partest] testing: [...]/files/neg/t1033.scala [ OK ]
- [partest] testing: [...]/files/neg/bug836.scala [ OK ]
- [partest] testing: [...]/files/neg/xmlcorner.scala [ OK ]
- [partest] testing: [...]/files/neg/t0015.scala [ OK ]
- [partest] testing: [...]/files/neg/divergent-implicit.scala [ OK ]
- [partest] testing: [...]/files/neg/bug1241.scala [ OK ]
- [partest] testing: [...]/files/neg/bug555.scala [ OK ]
- [partest] testing: [...]/files/neg/bug845.scala [ OK ]
- [partest] testing: [...]/files/neg/t1049.scala [ OK ]
- [partest] testing: [...]/files/neg/bug677.scala [ OK ]
- [partest] testing: [...]/files/neg/bug556.scala [ OK ]
- [partest] testing: [...]/files/neg/xmltruncated1.scala [ OK ]
- [partest] testing: [...]/files/neg/faculty.scala [ OK ]
- [partest] testing: [...]/files/neg/t0117.scala [ OK ]
- [partest] testing: [...]/files/neg/bug1275.scala [ OK ]
- [partest] testing: [...]/files/neg/bug691.scala [ OK ]
- [partest] testing: [...]/files/neg/bug846.scala [ OK ]
- [partest] testing: [...]/files/neg/t1163.scala [ OK ]
- [partest] testing: [...]/files/neg/forward.scala [ OK ]
- [partest] testing: [...]/files/neg/xmltruncated2.scala [ OK ]
- [partest] testing: [...]/files/neg/bug558.scala [ OK ]
- [partest] testing: [...]/files/neg/bug1279a.scala [ OK ]
- [partest] testing: [...]/files/neg/t0152.scala [ OK ]
- [partest] testing: [...]/files/neg/bug692.scala [ OK ]
- [partest] testing: [...]/files/neg/t1168.scala [ OK ]
- [partest] testing: [...]/files/neg/bug562.scala [ OK ]
- [partest] testing: [...]/files/neg/bug856.scala [ OK ]
- [partest] testing: [...]/files/neg/t0204.scala [ OK ]
- [partest] testing: [...]/files/neg/gadts1.scala [ OK ]
- [partest] testing: [...]/files/neg/bug563.scala [ OK ]
- [partest] testing: [...]/files/neg/bug200.scala [ OK ]
- [partest] testing: [...]/files/neg/xmltruncated3.scala [ OK ]
- [partest] testing: [...]/files/neg/t1215.scala [ OK ]
- [partest] testing: [...]/files/neg/bug875.scala [ OK ]
- [partest] testing: [...]/files/neg/t0207.scala [ OK ]
- [partest] testing: [...]/files/neg/higherkind_novalue.scala [ OK ]
- [partest] testing: [...]/files/neg/xmltruncated4.scala [ OK ]
- [partest] testing: [...]/files/neg/bug343.scala [ OK ]
- [partest] testing: [...]/files/neg/t0209.scala [ OK ]
- [partest] testing: [...]/files/neg/imp2.scala [ OK ]
- [partest] testing: [...]/files/neg/xmltruncated5.scala [ OK ]
- [partest] testing: [...]/files/neg/bug391.scala [ OK ]
- [partest] testing: [...]/files/neg/implicits.scala [ OK ]
- [partest] testing: [...]/files/neg/xmltruncated6.scala [ OK ]
- [partest] Compiling and running files
- [partest] testing: [...]/files/jvm/xmlattr.scala [ OK ]
- [partest] testing: [...]/files/jvm/JavaInteraction.scala [ OK ]
- [partest] testing: [...]/files/run/Course-2002-06.scala [ OK ]
- [partest] testing: [...]/files/run/colltest.scala [ OK ]
- [partest] testing: [...]/files/run/bug405.scala [ OK ]
- [partest] testing: [...]/files/run/randomAccessSeq-apply.scala [ OK ]
- [partest] testing: [...]/files/run/t0508.scala [ OK ]
- [partest] testing: [...]/files/run/intgetorelse.scala [ OK ]
- [partest] testing: [...]/files/jvm/xmlmore.scala [ OK ]
- [partest] testing: [...]/files/run/range.scala [ OK ]
- [partest] testing: [...]/files/run/bug428.scala [ OK ]
- [partest] testing: [...]/files/jvm/bigints.scala [ OK ]
- [partest] testing: [...]/files/jvm/xmlpull.scala [ OK ]
- [partest] testing: [...]/files/run/t0528.scala [ OK ]
- [partest] testing: [...]/files/run/retclosure.scala [ OK ]
- [partest] testing: [...]/files/run/bug429.scala [ OK ]
- [partest] testing: [...]/files/run/iq.scala [ OK ]
- [partest] testing: [...]/files/jvm/bug560bis.scala [ OK ]
- [partest] testing: [...]/files/run/t0607.scala [ OK ]
- [partest] testing: [...]/files/run/retsynch.scala [ OK ]
- [partest] testing: [...]/files/run/bug594.scala [ OK ]
- [partest] testing: [...]/files/jvm/xmlstuff.scala [ OK ]
- [partest] testing: [...]/files/run/Course-2002-07.scala [ OK ]
- [partest] testing: [...]/files/run/issue192.scala [ OK ]
- [partest] testing: [...]/files/run/t0631.scala [ OK ]
- [partest] testing: [...]/files/run/bug601.scala [ OK ]
- [partest] testing: [...]/files/jvm/inner.scala [ OK ]
- [partest] testing: [...]/files/run/iterables.scala [ OK ]
- [partest] testing: [...]/files/run/t0663.scala [ OK ]
- [partest] testing: [...]/files/run/richs.scala [ OK ]
- [partest] testing: [...]/files/run/bug603.scala [ OK ]
- [partest] testing: [...]/files/jvm5/annotations.scala [ OK ]
- [partest] testing: [...]/files/run/constrained-types.scala [ OK ]
- [partest] testing: [...]/files/run/Course-2002-08.scala [ OK ]
- [partest] testing: [...]/files/run/t0668.scala [ OK ]
- [partest] testing: [...]/files/jvm/manifests.scala [ OK ]
- [partest] testing: [...]/files/run/runtime-richChar.scala [ OK ]
- [partest] testing: [...]/files/run/bug627.scala [ OK ]
- [partest] testing: [...]/files/run/iterators.scala [ OK ]
- [partest] testing: [...]/files/jvm5/bug676.scala [ OK ]
- [partest] testing: [...]/files/jvm/methvsfield.scala [ OK ]
- [partest] testing: [...]/files/run/t0677.scala [ OK ]
- [partest] testing: [...]/files/jvm5/bug680.scala [ OK ]
- [partest] testing: [...]/files/run/constructors.scala [ OK ]
- [partest] testing: [...]/files/run/bug629.scala [ OK ]
- [partest] testing: [...]/files/run/Course-2002-09.scala [ OK ]
- [partest] testing: [...]/files/run/runtime.scala [ OK ]
- [partest] testing: [...]/files/jvm5/console.scala [ OK ]
- [partest] testing: [...]/files/run/json.scala [ OK ]
- [partest] testing: [...]/files/jvm/natives.scala [ OK ]
- [partest] testing: [...]/files/run/contrib674.scala [ OK ]
- [partest] testing: [...]/files/run/t0700.scala [ OK ]
- [partest] testing: [...]/files/run/slices.scala [ OK ]
- [partest] testing: [...]/files/jvm5/outerEnum.scala [ OK ]
- [partest] testing: [...]/files/run/lazy-exprs.scala [ OK ]
- [partest] testing: [...]/files/jvm/nest.scala [ OK ]
- [partest] testing: [...]/files/run/bug657.scala [ OK ]
- [partest] testing: [...]/files/run/ctor-order.scala [ OK ]
- [partest] testing: [...]/files/run/t0807.scala [ OK ]
- [partest] testing: [...]/files/run/Course-2002-10.scala [ OK ]
- [partest] testing: [...]/files/jvm5/stringbuilder.scala [ OK ]
- [partest] testing: [...]/files/run/sort.scala [ OK ]
- [partest] testing: [...]/files/run/lazy-locals.scala [ OK ]
- [partest] testing: [...]/files/run/t0883.scala [ OK ]
- [partest] testing: [...]/files/run/bug744.scala [ OK ]
- [partest] testing: [...]/files/run/deeps.scala [ OK ]
- [partest] testing: [...]/files/jvm/protectedacc.scala [ OK ]
- [partest] testing: [...]/files/jvm5/sync-var.scala [ OK ]
- [partest] testing: [...]/files/run/streams.scala [ OK ]
- [partest] testing: [...]/files/run/lazy-override.scala [ OK ]
- [partest] testing: [...]/files/run/t0911.scala [ OK ]
- [partest] testing: [...]/files/jvm5/t0014.scala [ OK ]
- [partest] testing: [...]/files/run/bug920.scala [ OK ]
- [partest] testing: [...]/files/run/Course-2002-13.scala [ OK ]
- [partest] testing: [...]/files/run/t0936.scala [ OK ]
- [partest] testing: [...]/files/jvm5/t1461.scala [ OK ]
- [partest] testing: [...]/files/jvm/serialization.scala [ OK ]
- [partest] testing: [...]/files/run/lazy-traits.scala [ OK ]
- [partest] testing: [...]/files/run/bug949.scala [ OK ]
- [partest] testing: [...]/files/run/structural.scala [ OK ]
- [partest] testing: [...]/files/run/NestedClasses.scala [ OK ]
- [partest] testing: [...]/files/run/t1323.scala [ OK ]
- [partest] testing: [...]/files/jvm/t0632.scala [ OK ]
- [partest] testing: [...]/files/jvm5/throws-annot.scala [ OK ]
- [partest] testing: [...]/files/run/syncchannel.scala [ OK ]
- [partest] testing: [...]/files/run/absoverride.scala [ OK ]
- [partest] testing: [...]/files/jvm/t1116.scala [ OK ]
- [partest] testing: [...]/files/run/bug978.scala [ OK ]
- [partest] testing: [...]/files/run/t0005.scala [ OK ]
- [partest] testing: [...]/files/run/docgenerator.scala [ OK ]
- [partest] testing: [...]/files/run/amp.scala [ OK ]
- [partest] testing: [...]/files/jvm/t1143.scala [ OK ]
- [partest] testing: [...]/files/run/lisp.scala [ OK ]
- [partest] testing: [...]/files/run/t0017.scala [ OK ]
- [partest] testing: [...]/files/run/tailcalls.scala [ OK ]
- [partest] testing: [...]/files/run/enums.scala [ OK ]
- [partest] testing: [...]/files/run/lists.scala [ OK ]
- [partest] testing: [...]/files/run/t0042.scala [ OK ]
- [partest] testing: [...]/files/run/tcpoly_monads.scala [ OK ]
- [partest] testing: [...]/files/jvm5/typerep.scala [ OK ]
- [partest] testing: [...]/files/run/exceptions-2.scala [ OK ]
- [partest] testing: [...]/files/run/bugs.scala [ OK ]
- [partest] testing: [...]/files/run/t0091.scala [ OK ]
- [partest] testing: [...]/files/run/arrays.scala [ OK ]
- [partest] testing: [...]/files/run/literals.scala [ OK ]
- [partest] testing: [...]/files/run/tcpoly_overriding.scala [ OK ]
- [partest] testing: [...]/files/run/Course-2002-01.scala [ OK ]
- [partest] testing: [...]/files/run/exceptions.scala [ OK ]
- [partest] testing: [...]/files/run/arybufgrow.scala [ OK ]
- [partest] testing: [...]/files/run/t0412.scala [ OK ]
- [partest] testing: [...]/files/jvm/typerep.scala [ OK ]
- [partest] testing: [...]/files/run/bitsets.scala [ OK ]
- [partest] testing: [...]/files/run/map_test.scala [ OK ]
- [partest] testing: [...]/files/jvm/unittest_io.scala [ OK ]
- [partest] testing: [...]/files/run/byname.scala [ OK ]
- [partest] testing: [...]/files/run/t0421.scala [ OK ]
- [partest] testing: [...]/files/run/existentials.scala [ OK ]
- [partest] testing: [...]/files/run/tcpoly_parseridioms.scala [ OK ]
- [partest] testing: [...]/files/run/boolexprs.scala [ OK ]
- [partest] testing: [...]/files/jvm/unittest_xml.scala [ OK ]
- [partest] testing: [...]/files/run/misc.scala [ OK ]
- [partest] testing: [...]/files/run/exoticnames.scala [ OK ]
- [partest] testing: [...]/files/run/caseclasses.scala [ OK ]
- [partest] testing: [...]/files/run/try-2.scala [ OK ]
- [partest] testing: [...]/files/run/boolord.scala [ OK ]
- [partest] testing: [...]/files/run/t0485.scala [ OK ]
- [partest] testing: [...]/files/run/Course-2002-02.scala [ OK ]
- [partest] testing: [...]/files/jvm/xml01.scala [ OK ]
- [partest] testing: [...]/files/run/t0486.scala [ OK ]
- [partest] testing: [...]/files/run/try.scala [ OK ]
- [partest] testing: [...]/files/run/mixins.scala [ OK ]
- [partest] testing: [...]/files/run/checked.scala [ OK ]
- [partest] testing: [...]/files/jvm/xml02.scala [ OK ]
- [partest] testing: [...]/files/run/fors.scala [ OK ]
- [partest] testing: [...]/files/run/tuples.scala [ OK ]
- [partest] testing: [...]/files/run/classof.scala [ OK ]
- [partest] testing: [...]/files/run/Course-2002-03.scala [ OK ]
- [partest] testing: [...]/files/run/multi-array.scala [ OK ]
- [partest] testing: [...]/files/jvm/xml03syntax.scala [ OK ]
- [partest] testing: [...]/files/run/typealias_overriding.scala [ OK ]
- [partest] testing: [...]/files/run/forvaleq.scala [ OK ]
- [partest] testing: [...]/files/run/collection-stacks.scala [ OK ]
- [partest] testing: [...]/files/run/overloads.scala [ OK ]
- [partest] testing: [...]/files/jvm/xml04embed.scala [ OK ]
- [partest] testing: [...]/files/run/Course-2002-04.scala [ OK ]
- [partest] testing: [...]/files/run/gadts.scala [ OK ]
- [partest] testing: [...]/files/run/unapply.scala [ OK ]
- [partest] testing: [...]/files/run/impconvtimes.scala [ OK ]
- [partest] testing: [...]/files/run/unapplyArray.scala [ OK ]
- [partest] testing: [...]/files/run/Course-2002-05.scala [ OK ]
- [partest] testing: [...]/files/run/implicits.scala [ OK ]
- [partest] testing: [...]/files/run/unboxingBug.scala [ OK ]
- [partest] testing: [...]/files/run/imports.scala [ OK ]
- [partest] testing: [...]/files/run/patmatnew.scala [ OK ]
- [partest] testing: [...]/files/run/collections.scala [ OK ]
- [partest] testing: [...]/files/run/unittest_collection.scala [ OK ]
- [partest] testing: [...]/files/run/infix.scala [ OK ]
- [partest] testing: [...]/files/run/promotion.scala [ OK ]
- [partest] testing: [...]/files/run/unittest_io.scala [ OK ]
- [partest] testing: [...]/files/run/withIndex.scala [ OK ]
- [partest] testing: [...]/files/run/interpreter.scala [ OK ]
- [partest] testing: [...]/files/run/bridges.scala [ OK ]
- [partest] testing: [...]/files/run/bug0325.scala [ OK ]
- [partest] testing: [...]/files/run/bug1074.scala [ OK ]
- [partest] testing: [...]/files/run/bug1192.scala [ OK ]
- [partest] testing: [...]/files/run/bug1220.scala [ OK ]
- [partest] testing: [...]/files/run/bug216.scala [ OK ]
- [partest] Running resident compiler scenarii
- [partest] testing: [...]/files/res/bug597.res [ OK ]
- [partest] testing: [...]/files/res/bug687.res [ OK ]
- [partest] testing: [...]/files/res/bug722.res [ OK ]
- [partest] testing: [...]/files/res/bug735.res [ OK ]
- [partest] testing: [...]/files/res/bug743.res [ OK ]
- [partest] testing: [...]/files/res/bug785.res [ OK ]
- [partest] testing: [...]/files/res/bug831.res [ OK ]
- [partest] Running shootout tests
- [partest] testing: [...]/files/shootout/lists.scala [ OK ]
- [partest] testing: [...]/files/shootout/fannkuch.scala-2.scala [ OK ]
- [partest] testing: [...]/files/shootout/nsieve.scala-2.scala [ OK ]
- [partest] testing: [...]/files/shootout/ackermann.scala [ OK ]
- [partest] testing: [...]/files/shootout/message.scala-2.scala [ OK ]
- [partest] testing: [...]/files/shootout/recursive.scala [ OK ]
- [partest] testing: [...]/files/shootout/fibo.scala [ OK ]
- [partest] testing: [...]/files/shootout/hash2.scala [ OK ]
- [partest] testing: [...]/files/shootout/binarytrees.scala-3.scala [ OK ]
- [partest] testing: [...]/files/shootout/nsievebits.scala-3.scala [ OK ]
- [partest] testing: [...]/files/shootout/hello.scala [ OK ]
- [partest] testing: [...]/files/shootout/nsieve.scala-3.scala [ OK ]
- [partest] testing: [...]/files/shootout/ary.scala [ OK ]
- [partest] testing: [...]/files/shootout/harmonic.scala [ OK ]
- [partest] testing: [...]/files/shootout/objinst.scala [ OK ]
- [partest] testing: [...]/files/shootout/nsievebits.scala [ OK ]
- [partest] testing: [...]/files/shootout/hash.scala [ OK ]
- [partest] testing: [...]/files/shootout/knucleotide.scala-2.scala [ OK ]
- [partest] testing: [...]/files/shootout/binarytrees.scala [ OK ]
- [partest] testing: [...]/files/shootout/nsievebits.scala-2.scala [ OK ]
- [partest] testing: [...]/files/shootout/chameneos.scala [ OK ]
- [partest] testing: [...]/files/shootout/partialsums.scala [ OK ]
- [partest] testing: [...]/files/shootout/binarytrees.scala-2.scala [ OK ]
- [partest] testing: [...]/files/shootout/knucleotide.scala-3.scala [ OK ]
- [partest] testing: [...]/files/shootout/regexdna.scala [ OK ]
- [partest] testing: [...]/files/shootout/except.scala [ OK ]
- [partest] testing: [...]/files/shootout/partialsums.scala-2.scala [ OK ]
- [partest] testing: [...]/files/shootout/spectralnorm.scala-2.scala [ OK ]
- [partest] testing: [...]/files/shootout/strcat.scala [ OK ]
- [partest] testing: [...]/files/shootout/nbody.scala-2.scala [ OK ]
- [partest] testing: [...]/files/shootout/sumcol.scala [ OK ]
- [partest] testing: [...]/files/shootout/sumcol.scala-2.scala [ OK ]
- [partest] testing: [...]/files/shootout/nestedloop.scala [ OK ]
- [partest] testing: [...]/files/shootout/takfp.scala [ OK ]
- [partest] testing: [...]/files/shootout/fannkuch.scala [ OK ]
- [partest] Test suite finished with no failures.
-
-BUILD SUCCESSFUL
-Total time: 4 minutes 31 seconds
diff --git a/build.number b/build.number
index f552534..b96c8a8 100644
--- a/build.number
+++ b/build.number
@@ -1,5 +1,5 @@
#Tue Sep 11 19:21:09 CEST 2007
version.minor=7
version.patch=2
-version.suffix=final
+version.suffix=RC4
version.major=2
diff --git a/build.xml b/build.xml
index 5e18188..bd1b743 100644
--- a/build.xml
+++ b/build.xml
@@ -19,6 +19,9 @@ END-USER TARGETS
<target name="test" depends="test.done"
description="Runs test suite and bootstrapping test on Scala compiler and library."/>
+ <target name="optimised.test" depends="optimised.test.done"
+ description="Runs test suite and bootstrapping test on the optimised Scala compiler and library."/>
+
<target name="docs" depends="docs.done"
description="Builds documentation for the Scala library. Scaladoc is in 'build/scaladoc/library'."/>
@@ -43,7 +46,28 @@ END-USER TARGETS
<target name="newstarr"
description="Replaces the Starr compiler and library by one built from current sources and tests it.">
+ <fail message="This target is not available on Windows. Use 'ant newstarrwin' instead.">
+ <condition>
+ <os family="windows"/>
+ </condition>
+ </fail>
<antcall target="locker.clean"/>
+ <antcall target="pack.done"/>
+ <antcall target="starr.done"/>
+ <antcall target="locker.clean"/>
+ <antcall target="test.done"/>
+ </target>
+
+ <!-- Ant on Windows is not able to delete jar files that are referenced in any <path>.
+ See ticket 1290 on trac. -->
+ <target name="newstarrwin"
+ description="Creates a new Starr on Windows. Manually execute 'ant locker.clean build' first!">
+ <fail message="This target is only available on Windows. Use 'ant newstarr' instead.">
+ <condition>
+ <not><os family="windows"/></not>
+ </condition>
+ </fail>
+ <echo message="CAUTION: Make sure to execute 'ant locker.clean build' prior to calling 'newstarrwin'."/>
<antcall target="starr.done"/>
<antcall target="locker.clean"/>
<antcall target="test.done"/>
@@ -60,6 +84,11 @@ END-USER TARGETS
<antcall target="locker.unlock"/>
<antcall target="locker.done"/>
</target>
+
+ <target name="optimised"
+ description="Build the compiler and standard library using optimisations, running 'quick'">
+ <antcall target="optimised.bin"/>
+ </target>
<!-- ===========================================================================
PROPERTIES
@@ -96,6 +125,7 @@ PROPERTIES
<property name="build.dir" value="${basedir}/build"/>
<property name="build-locker.dir" value="${build.dir}/locker"/>
<property name="build-quick.dir" value="${build.dir}/quick"/>
+ <property name="build-optimised.dir" value="${build.dir}/optimised"/>
<property name="build-pack.dir" value="${build.dir}/pack"/>
<property name="build-strap.dir" value="${build.dir}/strap"/>
<property name="build-docs.dir" value="${build.dir}/scaladoc"/>
@@ -108,7 +138,11 @@ PROPERTIES
into the script runners created with scala.tools.ant.ScalaTool -->
<property name="java.flags" value="-Xmx256M -Xms32M"/>
- <property name="scalacfork.maxmemory" value="512m"/>
+ <property
+ name="scalacfork.jvmargs"
+ value="-Xms512M -Xmx512M -Xss1M -XX:MaxPermSize=128M"/>
+
+ <property name="javac.cmd" value="${env.JAVA_HOME}/bin/javac"/>
<!-- ===========================================================================
INITIALISATION
@@ -143,7 +177,7 @@ INITIALISATION
value="${version.major}.${version.minor}.${version.patch}.r${svn.number}-b${time.short}"/>
<!-- 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 ${java.vm.version}"/>
+ <echo level="info" message="Built ${time.human} from revision ${svn.number} with ${java.vm.name} ${java.version}"/>
<!-- Define tasks that can be run with Starr -->
<path id="starr.classpath">
<pathelement location="${lib.starr.jar}"/>
@@ -187,7 +221,7 @@ LOCAL REFERENCE BUILD (LOCKER)
srcpath="${src.dir}/library"
params="${scalac.args}"
srcdir="${src.dir}/library"
- maxmemory="${scalacfork.maxmemory}">
+ jvmargs="${scalacfork.jvmargs}">
<include name="scala/Predef.scala"/>
<compilationpath>
<pathelement location="${build-locker.dir}/classes/library"/>
@@ -199,7 +233,7 @@ LOCAL REFERENCE BUILD (LOCKER)
srcpath="${src.dir}/library"
params="${scalac.args}"
srcdir="${src.dir}/library"
- maxmemory="${scalacfork.maxmemory}">
+ jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
<exclude name="scala/Predef.scala"/>
<compilationpath>
@@ -237,11 +271,11 @@ LOCAL REFERENCE BUILD (LOCKER)
srcpath="${src.dir}/compiler"
params="${scalac.args}"
srcdir="${src.dir}/compiler"
- maxmemory="${scalacfork.maxmemory}">
+ jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
<compilationpath>
- <pathelement location="${build-locker.dir}/classes/library"/>
- <pathelement location="${build-locker.dir}/classes/compiler"/>
+ <pathelement location="${build-locker.dir}/classes/library"/>
+ <pathelement location="${build-locker.dir}/classes/compiler"/>
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
<pathelement location="${jline.jar}"/>
@@ -325,10 +359,10 @@ QUICK BUILD (QUICK)
srcpath="${src.dir}/library"
params="${scalac.args}"
srcdir="${src.dir}/library"
- maxmemory="${scalacfork.maxmemory}">
+ jvmargs="${scalacfork.jvmargs}">
<include name="scala/Predef.scala"/>
<compilationpath>
- <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/library"/>
</compilationpath>
</scalacfork>
<scalacfork
@@ -337,11 +371,11 @@ QUICK BUILD (QUICK)
srcpath="${src.dir}/library"
params="${scalac.args}"
srcdir="${src.dir}/library"
- maxmemory="${scalacfork.maxmemory}">
+ jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
<exclude name="scala/Predef.scala"/>
<compilationpath>
- <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/library"/>
</compilationpath>
</scalacfork>
<scalacfork
@@ -350,10 +384,10 @@ QUICK BUILD (QUICK)
srcpath="${src.dir}/library"
params="${scalac.args}"
srcdir="${src.dir}/actors"
- maxmemory="${scalacfork.maxmemory}">
+ jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
<compilationpath>
- <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/library"/>
</compilationpath>
</scalacfork>
<scalacfork
@@ -362,10 +396,10 @@ QUICK BUILD (QUICK)
srcpath="${src.dir}/library"
params="${scalac.args}"
srcdir="${src.dir}/dbc"
- maxmemory="${scalacfork.maxmemory}">
+ jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
<compilationpath>
- <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/library"/>
</compilationpath>
</scalacfork>
<scalacfork
@@ -374,10 +408,10 @@ QUICK BUILD (QUICK)
srcpath="${src.dir}/library"
params="${scalac.args}"
srcdir="${src.dir}/swing"
- maxmemory="${scalacfork.maxmemory}">
+ jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
<compilationpath>
- <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/library"/>
</compilationpath>
</scalacfork>
<propertyfile file="${build-quick.dir}/classes/library/library.properties">
@@ -411,11 +445,11 @@ QUICK BUILD (QUICK)
srcpath="${src.dir}/compiler"
params="${scalac.args}"
srcdir="${src.dir}/compiler"
- maxmemory="${scalacfork.maxmemory}">
+ jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
<compilationpath>
- <pathelement location="${build-quick.dir}/classes/library"/>
- <pathelement location="${build-quick.dir}/classes/compiler"/>
+ <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/compiler"/>
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
<pathelement location="${jline.jar}"/>
@@ -452,9 +486,9 @@ QUICK BUILD (QUICK)
destdir="${build-quick.dir}/classes/partest"
target="1.5" source="1.5">
<classpath>
- <pathelement location="${build-quick.dir}/classes/library"/>
- <pathelement location="${build-quick.dir}/classes/compiler"/>
- <pathelement location="${build-quick.dir}/classes/partest"/>
+ <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/compiler"/>
+ <pathelement location="${build-quick.dir}/classes/partest"/>
</classpath>
<include name="**/*.java"/>
<compilerarg line="${javac.args}"/>
@@ -465,12 +499,12 @@ QUICK BUILD (QUICK)
srcpath="${src.dir}/partest"
params="${scalac.args}"
srcdir="${src.dir}/partest"
- maxmemory="${scalacfork.maxmemory}">
+ jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
<compilationpath>
- <pathelement location="${build-quick.dir}/classes/library"/>
- <pathelement location="${build-quick.dir}/classes/compiler"/>
- <pathelement location="${build-quick.dir}/classes/partest"/>
+ <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/compiler"/>
+ <pathelement location="${build-quick.dir}/classes/partest"/>
<pathelement location="${ant.jar}"/>
</compilationpath>
</scalacfork>
@@ -491,8 +525,8 @@ QUICK BUILD (QUICK)
<target name="quick.bin" depends="quick.pre-bin" unless="quick.bin.available">
<path id="quick.bin.classpath">
- <pathelement location="${build-quick.dir}/classes/library"/>
- <pathelement location="${build-quick.dir}/classes/compiler"/>
+ <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/compiler"/>
<pathelement location="${fjbg.jar}"/>
<pathelement location="${jline.jar}"/>
</path>
@@ -524,9 +558,16 @@ QUICK BUILD (QUICK)
<chmod perm="ugo+rx" file="${build-quick.dir}/bin/fsc"/>
<touch file="${build-quick.dir}/bin.complete" verbose="no"/>
</target>
-
- <target name="quick.done" depends="quick.bin"/>
-
+
+ <target name="quick.done" depends="quick.bin">
+ <path id="quick.classpath">
+ <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/compiler"/>
+ <pathelement location="${fjbg.jar}"/>
+ <pathelement location="${ant.jar}"/>
+ </path>
+ </target>
+
<target name="quick.clean" depends="pack.clean">
<delete dir="${build-quick.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
</target>
@@ -580,9 +621,10 @@ PACKED QUICK BUILD (PACK)
<manifest file="${build-pack.dir}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Bundle-Version" value="${version.number}"/>
</manifest>
- <mkdir dir="${build-pack.dir}/lib"/>
+ <mkdir dir="${build-pack.dir}/lib"/>
<jar destfile="${build-pack.dir}/lib/scala-compiler.jar" manifest="${build-pack.dir}/META-INF/MANIFEST.MF">
<fileset dir="${build-quick.dir}/classes/compiler"/>
+ <!-- filemode / dirmode: see trac ticket #1294 -->
<zipfileset dirmode="755" filemode="644" src="${fjbg.jar}"/>
<zipfileset dirmode="755" filemode="644" src="${msil.jar}"/>
<zipfileset dirmode="755" filemode="644" src="${jline.jar}"/>
@@ -613,8 +655,8 @@ PACKED QUICK BUILD (PACK)
<target name="pack.bin" depends="pack.pre-bin" unless="pack.bin.available">
<taskdef name="pack-bin" classname="scala.tools.ant.ScalaTool">
<classpath>
- <pathelement location="${build-pack.dir}/lib/scala-library.jar"/>
- <pathelement location="${build-pack.dir}/lib/scala-compiler.jar"/>
+ <pathelement location="${build-pack.dir}/lib/scala-library.jar"/>
+ <pathelement location="${build-pack.dir}/lib/scala-compiler.jar"/>
</classpath>
</taskdef>
<mkdir dir="${build-pack.dir}/bin"/>
@@ -804,9 +846,9 @@ BOOTSTRAPPING BUILD (STRAP)
destdir="${build-strap.dir}/classes/partest"
target="1.5" source="1.5">
<classpath>
- <pathelement location="${build-strap.dir}/classes/library"/>
- <pathelement location="${build-strap.dir}/classes/compiler"/>
- <pathelement location="${build-strap.dir}/classes/partest"/>
+ <pathelement location="${build-strap.dir}/classes/library"/>
+ <pathelement location="${build-strap.dir}/classes/compiler"/>
+ <pathelement location="${build-strap.dir}/classes/partest"/>
</classpath>
<include name="**/*.java"/>
<compilerarg line="${javac.args}"/>
@@ -840,6 +882,262 @@ BOOTSTRAPPING BUILD (STRAP)
</target>
<!-- ===========================================================================
+OPTIMISED COMPILER
+============================================================================ -->
+
+ <target name="optimised.start" depends="quick.done"/>
+
+ <target name="optimised.pre-lib" depends="optimised.start">
+ <uptodate property="optimised.lib.available" targetfile="${build-optimised.dir}/library.complete">
+ <srcfiles dir="${src.dir}">
+ <include name="library/**"/>
+ <include name="dbc/**"/>
+ <include name="actors/**"/>
+ <include name="swing/**"/>
+ </srcfiles>
+ </uptodate>
+ </target>
+
+ <target name="optimised.lib" depends="optimised.pre-lib" unless="optimised.lib.available">
+ <stopwatch name="optimised.lib.timer"/>
+ <mkdir dir="${build-optimised.dir}/classes/library"/>
+ <javac
+ srcdir="${src.dir}/library"
+ destdir="${build-optimised.dir}/classes/library"
+ classpath="${build-optimised.dir}/classes/library"
+ includes="**/*.java"
+ target="1.5" source="1.5">
+ <compilerarg line="${javac.args}"/>
+ </javac>
+ <javac
+ srcdir="${src.dir}/actors"
+ destdir="${build-optimised.dir}/classes/library"
+ classpath="${build-optimised.dir}/classes/library"
+ includes="**/*.java"
+ target="1.5" source="1.5">
+ <compilerarg line="${javac.args}"/>
+ </javac>
+ <scalacfork
+ destdir="${build-optimised.dir}/classes/library"
+ compilerpathref="quick.classpath"
+ srcpath="${src.dir}/library"
+ params="-optimise ${scalac.args}"
+ srcdir="${src.dir}/library"
+ jvmargs="${scalacfork.jvmargs}">
+ <include name="scala/Predef.scala"/>
+ <compilationpath>
+ <pathelement location="${build-optimised.dir}/classes/library"/>
+ </compilationpath>
+ </scalacfork>
+ <scalacfork
+ destdir="${build-optimised.dir}/classes/library"
+ compilerpathref="quick.classpath"
+ srcpath="${src.dir}/library"
+ params="-optimise ${scalac.args}"
+ srcdir="${src.dir}/library"
+ jvmargs="${scalacfork.jvmargs}">
+ <include name="**/*.scala"/>
+ <exclude name="scala/Predef.scala"/>
+ <compilationpath>
+ <pathelement location="${build-optimised.dir}/classes/library"/>
+ </compilationpath>
+ </scalacfork>
+ <scalacfork
+ destdir="${build-optimised.dir}/classes/library"
+ compilerpathref="quick.classpath"
+ srcpath="${src.dir}/library"
+ params="-optimise ${scalac.args}"
+ srcdir="${src.dir}/actors"
+ jvmargs="${scalacfork.jvmargs}">
+ <include name="**/*.scala"/>
+ <compilationpath>
+ <pathelement location="${build-optimised.dir}/classes/library"/>
+ </compilationpath>
+ </scalacfork>
+ <scalacfork
+ destdir="${build-optimised.dir}/classes/library"
+ compilerpathref="quick.classpath"
+ srcpath="${src.dir}/library"
+ params="-optimise ${scalac.args}"
+ srcdir="${src.dir}/dbc"
+ jvmargs="${scalacfork.jvmargs}">
+ <include name="**/*.scala"/>
+ <compilationpath>
+ <pathelement location="${build-optimised.dir}/classes/library"/>
+ </compilationpath>
+ </scalacfork>
+ <scalacfork
+ destdir="${build-optimised.dir}/classes/library"
+ compilerpathref="quick.classpath"
+ srcpath="${src.dir}/library"
+ params="-optimise ${scalac.args}"
+ srcdir="${src.dir}/swing"
+ jvmargs="${scalacfork.jvmargs}">
+ <include name="**/*.scala"/>
+ <compilationpath>
+ <pathelement location="${build-optimised.dir}/classes/library"/>
+ </compilationpath>
+ </scalacfork>
+ <propertyfile file="${build-optimised.dir}/classes/library/library.properties">
+ <entry key="version.number" value="${version.number}"/>
+ <entry key="copyright.string" value="${copyright.string}"/>
+ </propertyfile>
+ <copy todir="${build-optimised.dir}/classes/library">
+ <fileset dir="${src.dir}/library">
+ <include name="**/*.tmpl"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.js"/>
+ <include name="**/*.css"/>
+ </fileset>
+ </copy>
+ <touch file="${build-optimised.dir}/library.complete" verbose="no"/>
+ <stopwatch name="optimised.lib.timer" action="total"/>
+ </target>
+
+ <target name="optimised.pre-comp" depends="optimised.lib">
+ <uptodate property="optimised.comp.available" targetfile="${build-opimised.dir}/compiler.complete">
+ <srcfiles dir="${src.dir}/compiler"/>
+ </uptodate>
+ </target>
+
+ <target name="optimised.comp" depends="optimised.pre-comp" unless="optimised.comp.available">
+ <stopwatch name="optimised.comp.timer"/>
+ <mkdir dir="${build-optimised.dir}/classes/compiler"/>
+ <scalacfork
+ destdir="${build-optimised.dir}/classes/compiler"
+ compilerpathref="quick.classpath"
+ srcpath="${src.dir}/compiler"
+ params="-optimise ${scalac.args}"
+ srcdir="${src.dir}/compiler"
+ jvmargs="${scalacfork.jvmargs}">
+ <include name="**/*.scala"/>
+ <compilationpath>
+ <pathelement location="${build-optimised.dir}/classes/library"/>
+ <pathelement location="${build-optimised.dir}/classes/compiler"/>
+ <pathelement location="${fjbg.jar}"/>
+ <pathelement location="${msil.jar}"/>
+ <pathelement location="${jline.jar}"/>
+ <pathelement location="${ant.jar}"/>
+ </compilationpath>
+ </scalacfork>
+ <propertyfile file="${build-optimised.dir}/classes/compiler/compiler.properties">
+ <entry key="version.number" value="${version.number}"/>
+ <entry key="copyright.string" value="${copyright.string}"/>
+ </propertyfile>
+ <copy todir="${build-optimised.dir}/classes/compiler">
+ <fileset dir="${src.dir}/compiler">
+ <include name="**/*.tmpl"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.js"/>
+ <include name="**/*.css"/>
+ </fileset>
+ </copy>
+ <touch file="${build-optimised.dir}/compiler.complete" verbose="no"/>
+ <stopwatch name="optimised.comp.timer" action="total"/>
+ </target>
+
+ <target name="optimised.pre-partest" depends="optimised.comp">
+ <uptodate property="optimised.partest.available" targetfile="${build-optimised.dir}/partest.complete">
+ <srcfiles dir="${src.dir}/partest"/>
+ </uptodate>
+ </target>
+
+ <target name="optimised.partest" depends="optimised.pre-partest" unless="optimised.partest.available">
+ <stopwatch name="optimised.partest.timer"/>
+ <mkdir dir="${build-optimised.dir}/classes/partest"/>
+ <javac
+ srcdir="${src.dir}/partest"
+ destdir="${build-optimised.dir}/classes/partest"
+ target="1.5" source="1.5">
+ <classpath>
+ <pathelement location="${build-optimised.dir}/classes/library"/>
+ <pathelement location="${build-optimised.dir}/classes/compiler"/>
+ <pathelement location="${build-optimised.dir}/classes/partest"/>
+ </classpath>
+ <include name="**/*.java"/>
+ <compilerarg line="${javac.args}"/>
+ </javac>
+ <scalacfork
+ destdir="${build-optimised.dir}/classes/partest"
+ compilerpathref="locker.classpath"
+ srcpath="${src.dir}/partest"
+ params="${scalac.args}"
+ srcdir="${src.dir}/partest"
+ jvmargs="${scalacfork.jvmargs}">
+ <include name="**/*.scala"/>
+ <compilationpath>
+ <pathelement location="${build-optimised.dir}/classes/library"/>
+ <pathelement location="${build-optimised.dir}/classes/compiler"/>
+ <pathelement location="${build-optimised.dir}/classes/partest"/>
+ <pathelement location="${ant.jar}"/>
+ </compilationpath>
+ </scalacfork>
+ <copy todir="${build-optimised.dir}/classes/partest">
+ <fileset dir="${src.dir}/partest">
+ <include name="**/*.xml"/>
+ </fileset>
+ </copy>
+ <touch file="${build-optimised.dir}/partest.complete" verbose="no"/>
+ <stopwatch name="optimised.partest.timer" action="total"/>
+ </target>
+
+ <target name="optimised.pre-bin" depends="optimised.partest">
+ <condition property="optimised.bin.available">
+ <isset property="optimised.comp.available"/>
+ </condition>
+ </target>
+
+ <target name="optimised.bin" depends="optimised.pre-bin" unless="optimised.bin.available">
+ <path id="optimised.bin.classpath">
+ <pathelement location="${build-optimised.dir}/classes/library"/>
+ <pathelement location="${build-optimised.dir}/classes/compiler"/>
+ <pathelement location="${fjbg.jar}"/>
+ <pathelement location="${jline.jar}"/>
+ </path>
+ <taskdef name="optimised-bin" classname="scala.tools.ant.ScalaTool" classpathref="optimised.bin.classpath"/>
+ <mkdir dir="${build-optimised.dir}/bin"/>
+ <optimised-bin
+ file="${build-optimised.dir}/bin/scala"
+ class="scala.tools.nsc.MainGenericRunner"
+ javaFlags="${java.flags}"
+ classpathref="optimised.bin.classpath"/>
+ <optimised-bin
+ file="${build-optimised.dir}/bin/scalac"
+ class="scala.tools.nsc.Main"
+ javaFlags="${java.flags}"
+ classpathref="optimised.bin.classpath"/>
+ <optimised-bin
+ file="${build-optimised.dir}/bin/scaladoc"
+ class="scala.tools.nsc.ScalaDoc"
+ javaFlags="${java.flags}"
+ classpathref="optimised.bin.classpath"/>
+ <optimised-bin
+ file="${build-optimised.dir}/bin/fsc"
+ class="scala.tools.nsc.CompileClient"
+ javaFlags="${java.flags}"
+ classpathref="optimised.bin.classpath"/>
+ <chmod perm="ugo+rx" file="${build-optimised.dir}/bin/scala"/>
+ <chmod perm="ugo+rx" file="${build-optimised.dir}/bin/scalac"/>
+ <chmod perm="ugo+rx" file="${build-optimised.dir}/bin/scaladoc"/>
+ <chmod perm="ugo+rx" file="${build-optimised.dir}/bin/fsc"/>
+ <touch file="${build-optimised.dir}/bin.complete" verbose="no"/>
+ </target>
+
+ <target name="optimised.done" depends="optimised.bin">
+ <path id="optimised.classpath">
+ <pathelement location="${build-optimised.dir}/classes/library"/>
+ <pathelement location="${build-optimised.dir}/classes/compiler"/>
+ <pathelement location="${build-optimised.dir}/classes/partest"/>
+ <pathelement location="${fjbg.jar}"/>
+ <pathelement location="${ant.jar}"/>
+ </path>
+ </target>
+
+ <target name="optimised.clean">
+ <delete dir="${build-optimised.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
+ </target>
+
+<!-- ===========================================================================
DOCUMENTATION
============================================================================ -->
@@ -899,7 +1197,8 @@ DOCUMENTATION
destdir="${build.dir}/manmaker/classes"
classpathref="pack.classpath"
srcdir="${src.dir}/manual"
- includes="**/*.scala"/>
+ includes="**/*.scala"
+ addparams="${scalac.args}"/>
<path id="manual.classpath">
<pathelement location="${build-pack.dir}/lib/scala-library.jar"/>
<pathelement location="${build.dir}/manmaker/classes"/>
@@ -909,13 +1208,18 @@ DOCUMENTATION
<target name="docs.man" depends="docs.manmaker" unless="docs.man.available">
<mkdir dir="${build-docs.dir}/manual/man/man1"/>
<mkdir dir="${build-docs.dir}/manual/html"/>
+ <mkdir dir="${build-docs.dir}/manual/genman/man1"/>
<taskdef name="genman"
classname="scala.tools.docutil.ManMaker"
classpathref="manual.classpath"/>
<genman command="fsc, sbaz, scala, scalac, scaladoc"
htmlout="${build-docs.dir}/manual/html"
- manout="${build-docs.dir}/manual/man"/>
- <fixcrlf srcdir="${build-docs.dir}/manual" eol="unix" includes="**/*.1"/>
+ manout="${build-docs.dir}/manual/genman"/>
+ <!-- On Windows source and target files can't be the same ! -->
+ <fixcrlf
+ srcdir="${build-docs.dir}/manual/genman"
+ destdir="${build-docs.dir}/manual/man"
+ eol="unix" includes="**/*.1"/>
<copy todir="${build-docs.dir}/manual/html">
<fileset dir="${src.dir}/manual/scala/tools/docutil/resources">
<include name="**/*.html"/>
@@ -954,11 +1258,11 @@ DOCUMENTATION
<delete dir="${build-docs.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
<delete dir="${build.dir}/manmaker" includeemptydirs="yes" quiet="yes" failonerror="no"/>
</target>
-
+
<!-- ===========================================================================
BOOTRAPING TEST AND TEST SUITE
============================================================================ -->
-
+
<target name="test.stability" depends="strap.done">
<same dir="${build-quick.dir}" todir="${build-strap.dir}" failondifferent="no">
<exclude name="**/*.properties"/>
@@ -967,9 +1271,24 @@ BOOTRAPING TEST AND TEST SUITE
</same>
</target>
+ <target name="test.run" depends="pack.done">
+ <partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java"
+ timeout="1200000" javaccmd="${javac.cmd}">
+ <classpath>
+ <path refid="pack.classpath"/>
+ <fileset dir="${test.dir}/files/lib" includes="*.jar"/>
+ </classpath>
+ <runtests dir="${test.dir}/files">
+ <include name="run/**/*.scala"/>
+ <include name="jvm/**/*.scala"/>
+ </runtests>
+ <jvm5tests dir="${test.dir}/files/jvm5" includes="*.scala"/>
+ </partest>
+ </target>
+
<target name="test.suite" depends="pack.done">
<partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java"
- timeout="1200000">
+ timeout="1200000" javaccmd="${javac.cmd}">
<classpath>
<path refid="pack.classpath"/>
<fileset dir="${test.dir}/files/lib" includes="*.jar"/>
@@ -980,8 +1299,8 @@ BOOTRAPING TEST AND TEST SUITE
<runtests dir="${test.dir}/files">
<include name="run/**/*.scala"/>
<include name="jvm/**/*.scala"/>
- <include name="jvm5/**/*.scala"/>
</runtests>
+ <jvm5tests dir="${test.dir}/files/jvm5" includes="*.scala"/>
<residenttests dir="${test.dir}/files/res" includes="*.res"/>
<!-- <scripttests dir="${test.dir}/files/script" includes="*.scala"/> -->
<shootouttests dir="${test.dir}/files/shootout" includes="*.scala"/>
@@ -990,6 +1309,31 @@ BOOTRAPING TEST AND TEST SUITE
<target name="test.done" depends="test.suite, test.stability"/>
+ <target name="optimised.test.suite" depends="optimised.done">
+ <taskdef resource="scala/tools/partest/antlib.xml" classpathref="optimised.classpath"/>
+ <partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java"
+ timeout="1200000" javaccmd="${javac.cmd}">
+ <classpath>
+ <path refid="optimised.classpath"/>
+ <fileset dir="${test.dir}/files/lib" includes="*.jar"/>
+ </classpath>
+ <postests dir="${test.dir}/files/pos" includes="*.scala"/>
+ <pos5tests dir="${test.dir}/files/pos5" includes="*.scala"/>
+ <negtests dir="${test.dir}/files/neg" includes="*.scala"/>
+ <runtests dir="${test.dir}/files">
+ <include name="run/**/*.scala"/>
+ <include name="jvm/**/*.scala"/>
+ <include name="jvm5/**/*.scala"/>
+ </runtests>
+ <residenttests dir="${test.dir}/files/res" includes="*.res"/>
+ <!-- <scripttests dir="${test.dir}/files/script" includes="*.scala"/> -->
+ <shootouttests dir="${test.dir}/files/shootout" includes="*.scala"/>
+ </partest>
+ </target>
+
+
+ <target name="optimised.test.done" depends="optimised.test.suite"/>
+
<!-- ===========================================================================
DISTRIBUTION
============================================================================ -->
@@ -1013,19 +1357,7 @@ DISTRIBUTION
<chmod perm="ugo+rx" file="${dist.dir}/bin/fsc"/>
</target>
- <target name="dist.latest.unix" depends="dist.base" unless="os.win">
- <symlink link="${dists.dir}/latest" resource="${dist.dir}" overwrite="yes"/>
- </target>
-
- <target name="dist.latest.win" depends="dist.base" if="os.win">
- <copy todir="${dists.dir}/latest">
- <fileset dir="${dist.dir}"/>
- </copy>
- </target>
-
- <target name="dist.latest" depends="dist.latest.unix,dist.latest.win"/>
-
- <target name="dist.doc" depends="dist.latest">
+ <target name="dist.doc" depends="dist.base">
<mkdir dir="${dist.dir}/doc/scala-devel-docs"/>
<copy file="${docs.dir}/LICENSE" toDir="${dist.dir}/doc/scala-devel-docs"/>
<copy file="${docs.dir}/README" toDir="${dist.dir}/doc/scala-devel-docs"/>
@@ -1044,7 +1376,7 @@ DISTRIBUTION
<copy file="${src.dir}/swing/doc/README"
toFile="${dist.dir}/doc/scala-devel-docs/README.scala-swing"/>
</target>
-
+
<target name="dist.man" depends="dist.doc">
<mkdir dir="${dist.dir}/man"/>
<copy toDir="${dist.dir}/man">
@@ -1068,8 +1400,20 @@ DISTRIBUTION
<fileset dir="${src.dir}/compiler"/>
</jar>
</target>
-
- <target name="dist.done" depends="dist.src"/>
+
+ <target name="dist.latest.unix" depends="dist.src" unless="os.win">
+ <symlink link="${dists.dir}/latest" resource="${dist.dir}" overwrite="yes"/>
+ </target>
+
+ <target name="dist.latest.win" depends="dist.src" if="os.win">
+ <copy todir="${dists.dir}/latest">
+ <fileset dir="${dist.dir}"/>
+ </copy>
+ </target>
+
+ <target name="dist.latest" depends="dist.latest.unix,dist.latest.win"/>
+
+ <target name="dist.done" depends="dist.latest"/>
<target name="dist.clean">
<delete dir="${dists.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
@@ -1086,32 +1430,47 @@ TEST AND DISTRIBUTION BUNDLE (ALL)
<!-- ===========================================================================
STABLE REFERENCE (STARR)
============================================================================ -->
-
- <target name="starr.start" depends="pack.done"/>
-
- <target name="starr.clean" depends="locker.clean, starr.start">
- <delete file="${lib.starr.jar}"/>
- <delete file="${comp.starr.jar}"/>
- <delete file="${lib.dir}/scala-library-src.jar"/>
+<!-- Does not use any properties other than ${basedir}, so that it can
+ run without 'init' (when using 'newstarrwin') -->
+
+ <target name="starr.start">
+ <fail message="Library in build/pack not available">
+ <condition><not><and>
+ <available file="${basedir}/build/pack/lib/scala-library.jar"/>
+ </and></not></condition>
+ </fail>
+ <fail message="Compiler in build/quick not available">
+ <condition><not><and>
+ <available file="${basedir}/build/quick/classes/compiler"/>
+ <available file="${basedir}/build/quick/compiler.complete"/>
+ </and></not></condition>
+ </fail>
</target>
-
+
+ <target name="starr.clean" depends="starr.start">
+ <delete file="${basedir}/lib/scala-library.jar"/>
+ <delete file="${basedir}/lib/scala-compiler.jar"/>
+ <delete file="${basedir}/lib/scala-library-src.jar"/>
+ </target>
+
<target name="starr.lib" depends="starr.clean">
- <copy file="${build-pack.dir}/lib/scala-library.jar" toFile="${lib.starr.jar}"/>
+ <copy file="${basedir}/build/pack/lib/scala-library.jar"
+ toFile="${basedir}/lib/scala-library.jar"/>
</target>
-
+
<target name="starr.comp" depends="starr.lib">
- <jar destfile="${comp.starr.jar}">
- <fileset dir="${build-quick.dir}/classes/compiler"/>
+ <jar destfile="${basedir}/lib/scala-compiler.jar">
+ <fileset dir="${basedir}/build/quick/classes/compiler"/>
</jar>
</target>
-
+
<target name="starr.src" depends="starr.comp">
- <jar destfile="${lib.dir}/scala-library-src.jar">
- <fileset dir="${src.dir}/library"/>
- <fileset dir="${src.dir}/actors"/>
+ <jar destfile="${basedir}/lib/scala-library-src.jar">
+ <fileset dir="${basedir}/src/library"/>
+ <fileset dir="${basedir}/src/actors"/>
</jar>
</target>
-
+
<target name="starr.done" depends="starr.src"/>
<!-- ===========================================================================
@@ -1121,19 +1480,19 @@ FORWARDED TARGETS FOR JVM 1.4 BUILD
<target name="four" depends="pack.done">
<ant antfile="${src.dir}/build/four.xml" target="four-pack.done" inheritall="yes" inheritrefs="yes"/>
</target>
-
+
<target name="fourtest" depends="pack.done">
<ant antfile="${src.dir}/build/four.xml" target="four-test.done" inheritall="yes" inheritrefs="yes"/>
</target>
-
+
<target name="fourdist" depends="pack.done">
<ant antfile="${src.dir}/build/four.xml" target="four-all.done" inheritall="yes" inheritrefs="yes"/>
</target>
-
+
<target name="fourclean">
<ant antfile="${src.dir}/build/four.xml" target="four-all.clean" inheritall="yes" inheritrefs="yes"/>
</target>
-
+
<!-- ===========================================================================
FORWARDED TARGETS FOR MSIL BUILD
============================================================================ -->
@@ -1177,16 +1536,16 @@ FORWARDED TARGETS FOR PACKAGING
<!-- ===========================================================================
FORWARDED TARGETS FOR NIGHTLY BUILDS
============================================================================ -->
-
+
<target name="nightly" depends="all.done">
<ant antfile="${src.dir}/build/pack.xml" target="pack-all.done" inheritall="yes" inheritrefs="yes"/>
</target>
-
+
<target name="fournightly" depends="pack.done">
<ant antfile="${src.dir}/build/four.xml" target="four-all.done" inheritall="yes" inheritrefs="yes"/>
<ant antfile="${src.dir}/build/pack.xml" target="fourpack-all.done" inheritall="yes" inheritrefs="yes"/>
</target>
-
+
<target name="fourfournightly">
<ant antfile="${src.dir}/build/four.xml" target="fourfour-test.done"/>
</target>
@@ -1199,19 +1558,19 @@ FORWARDED TARGETS FOR NIGHTLY BUILDS
<!-- ===========================================================================
MISCELLANEOUS
============================================================================ -->
-
+
<target name="graph.init">
<taskdef name="vizant" classname="vizant.Vizant" classpath="${lib-ant.dir}/vizant.jar"/>
</target>
-
+
<target name="graph.clean" depends="graph.init">
<vizant antfile="${ant.file}" outfile="${ant.project.name}.dot" from="starr.clean"/>
</target>
-
+
<target name="graph.all" depends="graph.init">
<vizant antfile="${ant.file}" outfile="${ant.project.name}.dot" from="all.done"/>
</target>
-
+
<target name="graph.sabbus" depends="graph.init">
<vizant antfile="${ant.file}" outfile="${ant.project.name}.dot"/>
</target>
diff --git a/lib/ScalaCheck.jar b/lib/ScalaCheck.jar
new file mode 100644
index 0000000..4789417
Binary files /dev/null and b/lib/ScalaCheck.jar differ
diff --git a/lib/ScalaCheckHelper.jar b/lib/ScalaCheckHelper.jar
new file mode 100644
index 0000000..ff2505f
Binary files /dev/null and b/lib/ScalaCheckHelper.jar differ
diff --git a/lib/ant/maven-ant-tasks-2.0.9.jar b/lib/ant/maven-ant-tasks-2.0.9.jar
new file mode 100644
index 0000000..82a30e5
Binary files /dev/null and b/lib/ant/maven-ant-tasks-2.0.9.jar differ
diff --git a/lib/scala-compiler.jar b/lib/scala-compiler.jar
index b41c14d..1ba03b1 100644
Binary files a/lib/scala-compiler.jar and b/lib/scala-compiler.jar differ
diff --git a/lib/scala-library-src.jar b/lib/scala-library-src.jar
index 8a97588..e6f3305 100644
Binary files a/lib/scala-library-src.jar and b/lib/scala-library-src.jar differ
diff --git a/lib/scala-library.jar b/lib/scala-library.jar
index 7134234..63fb7f2 100644
Binary files a/lib/scala-library.jar and b/lib/scala-library.jar differ
diff --git a/partestLog b/partestLog
deleted file mode 100644
index 4352eef..0000000
--- a/partestLog
+++ /dev/null
@@ -1,749 +0,0 @@
-Scala compiler classes in: /home/cunei/distrib/installer/dependencies/scala/dists/scala-2.7.2.RC6
-Scala version is: Scala compiler version 2.7.2.RC6 -- Copyright 2002-2008, LAMP/EPFL
-Scalac options are: -deprecation
-Java binaries in: /home/linuxsoft/apps/java-1.5.0_16/jre/bin
-Java runtime is: Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
-Java options are:
-Source directory is: /home/cunei/distrib/installer/dependencies/scala/test/files
-
-Testing compiler (on files whose compilation should succeed)
-testing: [...]/files/pos/ted.scala [ OK ]
-testing: [...]/files/pos/S5.scala [ OK ]
-testing: [...]/files/pos/t0872.scala [ OK ]
-testing: [...]/files/pos/bug0082.scala [ OK ]
-testing: [...]/files/pos/bug596.scala [ OK ]
-testing: [...]/files/pos/t1027.scala [ OK ]
-testing: [...]/files/pos/test [ OK ]
-testing: [...]/files/pos/typerep.scala [ OK ]
-testing: [...]/files/pos/manifest1.scala [ OK ]
-testing: [...]/files/pos/bug0020.scala [ OK ]
-testing: [...]/files/pos/patterns3.scala [ OK ]
-testing: [...]/files/pos/bug0029.scala [ OK ]
-testing: [...]/files/pos/bug0064.scala [ OK ]
-testing: [...]/files/pos/tcpoly_return_overriding.scala [ OK ]
-testing: [...]/files/pos/bug1090.scala [ OK ]
-testing: [...]/files/pos/bug0422.scala [ OK ]
-testing: [...]/files/pos/bug0085.scala [ OK ]
-testing: [...]/files/pos/bug0049.scala [ OK ]
-testing: [...]/files/pos/t1146.scala [ OK ]
-testing: [...]/files/pos/S8.scala [ OK ]
-testing: [...]/files/pos/bug1136.scala [ OK ]
-testing: [...]/files/pos/bug796.scala [ OK ]
-testing: [...]/files/pos/tcpoly_boundedmonad.scala [ OK ]
-testing: [...]/files/pos/bug0646.scala [ OK ]
-testing: [...]/files/pos/bounds.scala [ OK ]
-testing: [...]/files/pos/philippe1.scala [ OK ]
-testing: [...]/files/pos/bug1050.scala [ OK ]
-testing: [...]/files/pos/matthias1.scala [ OK ]
-testing: [...]/files/pos/bug599.scala [ OK ]
-testing: [...]/files/pos/bug1075.scala [ OK ]
-testing: [...]/files/pos/bug1292.scala [ OK ]
-testing: [...]/files/pos/bug112606A.scala [ OK ]
-testing: [...]/files/pos/homonym.scala [ OK ]
-testing: [...]/files/pos/matthias5.scala [ OK ]
-testing: [...]/files/pos/bug0068.scala [ OK ]
-testing: [...]/files/pos/scoping1.scala [ OK ]
-testing: [...]/files/pos/philippe4.scala [ OK ]
-testing: [...]/files/pos/bug1237.scala [ OK ]
-testing: [...]/files/pos/MailBox.scala [ OK ]
-testing: [...]/files/pos/ticket0137.scala [ OK ]
-testing: [...]/files/pos/bug0081.scala [ OK ]
-testing: [...]/files/pos/t0999.scala [ OK ]
-testing: [...]/files/pos/contrib701.scala [ OK ]
-testing: [...]/files/pos/contrib467.scala [ OK ]
-testing: [...]/files/pos/matthias3.scala [ OK ]
-testing: [...]/files/pos/nullary_poly.scala [ OK ]
-testing: [...]/files/pos/philippe2.scala [ OK ]
-testing: [...]/files/pos/init.scala [ OK ]
-testing: [...]/files/pos/gosh.scala [ OK ]
-testing: [...]/files/pos/lambdalift.scala [ OK ]
-testing: [...]/files/pos/unapplySeq.scala [ OK ]
-testing: [...]/files/pos/bug201.scala [ OK ]
-testing: [...]/files/pos/modules1.scala [ OK ]
-testing: [...]/files/pos/gadt-gilles.scala [ OK ]
-testing: [...]/files/pos/bug304.scala [ OK ]
-testing: [...]/files/pos/rebind.scala [ OK ]
-testing: [...]/files/pos/partialfun.scala [ OK ]
-testing: [...]/files/pos/bug1119.scala [ OK ]
-testing: [...]/files/pos/bug122.scala [ OK ]
-testing: [...]/files/pos/bug342.scala [ OK ]
-testing: [...]/files/pos/unapplyContexts2.scala [ OK ]
-testing: [...]/files/pos/tcpoly_seq_typealias.scala [ OK ]
-testing: [...]/files/pos/abstract.scala [ OK ]
-testing: [...]/files/pos/List1.scala [ OK ]
-testing: [...]/files/pos/cfcrash.scala [ OK ]
-testing: [...]/files/pos/bug422.scala [ OK ]
-testing: [...]/files/pos/infer.scala [ OK ]
-testing: [...]/files/pos/bug0066.scala [ OK ]
-testing: [...]/files/pos/test4a.scala [ OK ]
-testing: [...]/files/pos/bug704.scala [ OK ]
-testing: [...]/files/pos/code.scala [ OK ]
-testing: [...]/files/pos/pat_iuli.scala [ OK ]
-testing: [...]/files/pos/bug160.scala [ OK ]
-testing: [...]/files/pos/matthias4.scala [ OK ]
-testing: [...]/files/pos/bug703.scala [ OK ]
-testing: [...]/files/pos/bug404.scala [ OK ]
-testing: [...]/files/pos/bug661.scala [ OK ]
-testing: [...]/files/pos/itay.scala [ OK ]
-testing: [...]/files/pos/bug229.scala [ OK ]
-testing: [...]/files/pos/bug121.scala [ OK ]
-testing: [...]/files/pos/caseaccs.scala [ OK ]
-testing: [...]/files/pos/bug780.scala [ OK ]
-testing: [...]/files/pos/bug604.scala [ OK ]
-testing: [...]/files/pos/t0301.scala [ OK ]
-testing: [...]/files/pos/bug720.scala [ OK ]
-testing: [...]/files/pos/cls1.scala [ OK ]
-testing: [...]/files/pos/bug360.scala [ OK ]
-testing: [...]/files/pos/bug361.scala [ OK ]
-testing: [...]/files/pos/bug927.scala [ OK ]
-testing: [...]/files/pos/bug267.scala [ OK ]
-testing: [...]/files/pos/philippe3.scala [ OK ]
-testing: [...]/files/pos/bug245.scala [ OK ]
-testing: [...]/files/pos/bug262.scala [ OK ]
-testing: [...]/files/pos/bug402.scala [ OK ]
-testing: [...]/files/pos/bug522.scala [ OK ]
-testing: [...]/files/pos/bug684.scala [ OK ]
-testing: [...]/files/pos/bug124.scala [ OK ]
-testing: [...]/files/pos/t0227.scala [ OK ]
-testing: [...]/files/pos/clsrefine.scala [ OK ]
-testing: [...]/files/pos/null.scala [ OK ]
-testing: [...]/files/pos/escapes2.scala [ OK ]
-testing: [...]/files/pos/bug803.scala [ OK ]
-testing: [...]/files/pos/listpattern.scala [ OK ]
-testing: [...]/files/pos/bug607.scala [ OK ]
-testing: [...]/files/pos/tcpoly_overloaded.scala [ OK ]
-testing: [...]/files/pos/tcpoly_param_scoping.scala [ OK ]
-testing: [...]/files/pos/unapplyComplex.scala [ OK ]
-testing: [...]/files/pos/traits.scala [ OK ]
-testing: [...]/files/pos/bug602.scala [ OK ]
-testing: [...]/files/pos/bug247.scala [ OK ]
-testing: [...]/files/pos/bug880.scala [ OK ]
-testing: [...]/files/pos/bug0030.scala [ OK ]
-testing: [...]/files/pos/Transactions.scala [ OK ]
-testing: [...]/files/pos/bug443.scala [ OK ]
-testing: [...]/files/pos/nested.scala [ OK ]
-testing: [...]/files/pos/bug807.scala [ OK ]
-testing: [...]/files/pos/bug1000.scala [ OK ]
-testing: [...]/files/pos/mixins.scala [ OK ]
-testing: [...]/files/pos/collections.scala [ OK ]
-testing: [...]/files/pos/valdefs.scala [ OK ]
-testing: [...]/files/pos/bug183.scala [ OK ]
-testing: [...]/files/pos/eta.scala [ OK ]
-testing: [...]/files/pos/bug0032.scala [ OK ]
-testing: [...]/files/pos/bug0031.scala [ OK ]
-testing: [...]/files/pos/bug946.scala [ OK ]
-testing: [...]/files/pos/bug566.scala [ OK ]
-testing: [...]/files/pos/stable.scala [ OK ]
-testing: [...]/files/pos/bug0053.scala [ OK ]
-testing: [...]/files/pos/bug802.scala [ OK ]
-testing: [...]/files/pos/bug805.scala [ OK ]
-testing: [...]/files/pos/bug389.scala [ OK ]
-testing: [...]/files/pos/localmodules.scala [ OK ]
-testing: [...]/files/pos/bug1210a.scala [ OK ]
-testing: [...]/files/pos/arrays2.scala [ OK ]
-testing: [...]/files/pos/michel6.scala [ OK ]
-testing: [...]/files/pos/bug640.scala [ OK ]
-testing: [...]/files/pos/bug287.scala [ OK ]
-testing: [...]/files/pos/bug762.scala [ OK ]
-testing: [...]/files/pos/bug788.scala [ OK ]
-testing: [...]/files/pos/michel1.scala [ OK ]
-testing: [...]/files/pos/bug0091.scala [ OK ]
-testing: [...]/files/pos/functions.scala [ OK ]
-testing: [...]/files/pos/bug1203.scala [ OK ]
-testing: [...]/files/pos/lambda.scala [ OK ]
-testing: [...]/files/pos/gadts2.scala [ OK ]
-testing: [...]/files/pos/tcpoly_higherorder_bound_method.scala [ OK ]
-testing: [...]/files/pos/bug0076.scala [ OK ]
-testing: [...]/files/pos/bug628.scala [ OK ]
-testing: [...]/files/pos/bug344.scala [ OK ]
-testing: [...]/files/pos/bug1241.scala [ OK ]
-testing: [...]/files/pos/A.scala [ OK ]
-testing: [...]/files/pos/t1159.scala [ OK ]
-testing: [...]/files/pos/bug1123.scala [ OK ]
-testing: [...]/files/pos/compound.scala [ OK ]
-testing: [...]/files/pos/typealias_dubious.scala [ OK ]
-testing: [...]/files/pos/ksbug1.scala [ OK ]
-testing: [...]/files/pos/t0504.scala [ OK ]
-testing: [...]/files/pos/michel4.scala [ OK ]
-testing: [...]/files/pos/cls.scala [ OK ]
-testing: [...]/files/pos/bug0017.scala [ OK ]
-testing: [...]/files/pos/bug789.scala [ OK ]
-testing: [...]/files/pos/bug1107.scala [ OK ]
-testing: [...]/files/pos/thistypes.scala [ OK ]
-testing: [...]/files/pos/t0905.scala [ OK ]
-testing: [...]/files/pos/tcpoly_typesub.scala [ OK ]
-testing: [...]/files/pos/t0165.scala [ OK ]
-testing: [...]/files/pos/t0586.scala [ OK ]
-testing: [...]/files/pos/bug1001.scala [ OK ]
-testing: [...]/files/pos/unapplyGeneric.scala [ OK ]
-testing: [...]/files/pos/michel3.scala [ OK ]
-testing: [...]/files/pos/bug0054.scala [ OK ]
-testing: [...]/files/pos/bug289.scala [ OK ]
-testing: [...]/files/pos/t0904.scala [ OK ]
-testing: [...]/files/pos/compile.scala [ OK ]
-testing: [...]/files/pos/bug430.scala [ OK ]
-testing: [...]/files/pos/imports.scala [ OK ]
-testing: [...]/files/pos/t0786.scala [ OK ]
-testing: [...]/files/pos/bug0039.scala [ OK ]
-testing: [...]/files/pos/maxim1.scala [ OK ]
-testing: [...]/files/pos/bug767.scala [ OK ]
-testing: [...]/files/pos/t1059.scala [ OK ]
-testing: [...]/files/pos/bug711.scala [ OK ]
-testing: [...]/files/pos/tcpoly_late_method_params.scala [ OK ]
-testing: [...]/files/pos/strings.scala [ OK ]
-testing: [...]/files/pos/bug0093.scala [ OK ]
-testing: [...]/files/pos/attributes.scala [ OK ]
-testing: [...]/files/pos/michel5.scala [ OK ]
-testing: [...]/files/pos/moduletrans.scala [ OK ]
-testing: [...]/files/pos/bug415.scala [ OK ]
-testing: [...]/files/pos/constfold.scala [ OK ]
-testing: [...]/files/pos/bug116.scala [ OK ]
-testing: [...]/files/pos/tinondefcons.scala [ OK ]
-testing: [...]/files/pos/tcpoly_seq.scala [ OK ]
-testing: [...]/files/pos/bug0036.scala [ OK ]
-testing: [...]/files/pos/return_thistype.scala [ OK ]
-testing: [...]/files/pos/tcpoly_subst.scala [ OK ]
-testing: [...]/files/pos/bug531.scala [ OK ]
-testing: [...]/files/pos/nested2.scala [ OK ]
-testing: [...]/files/pos/bug1049.scala [ OK ]
-testing: [...]/files/pos/typerep-stephane.scala [ OK ]
-testing: [...]/files/pos/michel2.scala [ OK ]
-testing: [...]/files/pos/bug911.scala [ OK ]
-testing: [...]/files/pos/tcpoly_wildcards.scala [ OK ]
-testing: [...]/files/pos/testcast.scala [ OK ]
-testing: [...]/files/pos/bug151.scala [ OK ]
-testing: [...]/files/pos/bug1168.scala [ OK ]
-testing: [...]/files/pos/viewtest1.scala [ OK ]
-testing: [...]/files/pos/bug1006.scala [ OK ]
-testing: [...]/files/pos/bug119.scala [ OK ]
-testing: [...]/files/pos/patterns.scala [ OK ]
-testing: [...]/files/pos/patterns1213.scala [ OK ]
-testing: [...]/files/pos/test5.scala [ OK ]
-testing: [...]/files/pos/channels.scala [ OK ]
-testing: [...]/files/pos/test4.scala [ OK ]
-testing: [...]/files/pos/protected-t1010.scala [ OK ]
-testing: [...]/files/pos/annot-inner.scala [ OK ]
-testing: [...]/files/pos/bug615.scala [ OK ]
-testing: [...]/files/pos/bug812.scala [ OK ]
-testing: [...]/files/pos/bug210.scala [ OK ]
-testing: [...]/files/pos/bug432.scala [ OK ]
-testing: [...]/files/pos/bug1085.scala [ OK ]
-testing: [...]/files/pos/t1001.scala [ OK ]
-testing: [...]/files/pos/annotations.scala [ OK ]
-testing: [...]/files/pos/bug372.scala [ OK ]
-testing: [...]/files/pos/unapply.scala [ OK ]
-testing: [...]/files/pos/simplelists.scala [ OK ]
-testing: [...]/files/pos/bug374.scala [ OK ]
-testing: [...]/files/pos/unapplyNeedsMemberType.scala [ OK ]
-testing: [...]/files/pos/imp2.scala [ OK ]
-testing: [...]/files/pos/thistype.scala [ OK ]
-testing: [...]/files/pos/bug516.scala [ OK ]
-testing: [...]/files/pos/test5refine.scala [ OK ]
-testing: [...]/files/pos/test4refine.scala [ OK ]
-testing: [...]/files/pos/bug159.scala [ OK ]
-testing: [...]/files/pos/unicode-decode.scala [ OK ]
-testing: [...]/files/pos/tcpoly_bounds1.scala [ OK ]
-testing: [...]/files/pos/test1.scala [ OK ]
-testing: [...]/files/pos/viewtest2.scala [ OK ]
-testing: [...]/files/pos/bug177.scala [ OK ]
-testing: [...]/files/pos/bug319.scala [ OK ]
-testing: [...]/files/pos/bug616.scala [ OK ]
-testing: [...]/files/pos/bug359.scala [ OK ]
-testing: [...]/files/pos/tcpoly_gm.scala [ OK ]
-testing: [...]/files/pos/bug514.scala [ OK ]
-testing: [...]/files/pos/test2.scala [ OK ]
-testing: [...]/files/pos/matchStarlift.scala [ OK ]
-testing: [...]/files/pos/t0651.scala [ OK ]
-testing: [...]/files/pos/bug592.scala [ OK ]
-testing: [...]/files/pos/lambdalift1.scala [ OK ]
-testing: [...]/files/pos/t0710.scala [ OK ]
-testing: [...]/files/pos/bug211.scala [ OK ]
-testing: [...]/files/pos/compile1.scala [ OK ]
-testing: [...]/files/pos/kinzer.scala [ OK ]
-testing: [...]/files/pos/bug613.scala [ OK ]
-testing: [...]/files/pos/bug757.scala [ OK ]
-testing: [...]/files/pos/bug397.scala [ OK ]
-testing: [...]/files/pos/bug296.scala [ OK ]
-testing: [...]/files/pos/bug439.scala [ OK ]
-testing: [...]/files/pos/bug0599.scala [ OK ]
-testing: [...]/files/pos/t0231.scala [ OK ]
-testing: [...]/files/pos/bug532.scala [ OK ]
-testing: [...]/files/pos/bug533.scala [ OK ]
-testing: [...]/files/pos/bug595.scala [ OK ]
-testing: [...]/files/pos/aliases.scala [ OK ]
-testing: [...]/files/pos/bug873.scala [ OK ]
-testing: [...]/files/pos/bug175.scala [ OK ]
-testing: [...]/files/pos/tcpoly_poly.scala [ OK ]
-testing: [...]/files/pos/bug115.scala [ OK ]
-testing: [...]/files/pos/bug318.scala [ OK ]
-testing: [...]/files/pos/propagate.scala [ OK ]
-testing: [...]/files/pos/t0770.scala [ OK ]
-testing: [...]/files/pos/bug651.scala [ OK ]
-testing: [...]/files/pos/bug577.scala [ OK ]
-testing: [...]/files/pos/bug0002.scala [ OK ]
-testing: [...]/files/pos/seqtest2.scala [ OK ]
-testing: [...]/files/pos/bug611.scala [ OK ]
-testing: [...]/files/pos/bug690.scala [ OK ]
-testing: [...]/files/pos/t1147.scala [ OK ]
-testing: [...]/files/pos/bug759.scala [ OK ]
-testing: [...]/files/pos/Z.scala [ OK ]
-testing: [...]/files/pos/t0851.scala [ OK ]
-testing: [...]/files/pos/bug892.scala [ OK ]
-testing: [...]/files/pos/bug694.scala [ OK ]
-testing: [...]/files/pos/bug530.scala [ OK ]
-testing: [...]/files/pos/t0154.scala [ OK ]
-testing: [...]/files/pos/tcpoly_variance.scala [ OK ]
-testing: [...]/files/pos/t0438.scala [ OK ]
-testing: [...]/files/pos/X.scala [ OK ]
-testing: [...]/files/pos/t1049.scala [ OK ]
-testing: [...]/files/pos/sudoku.scala [ OK ]
-testing: [...]/files/pos/patterns2.scala [ OK ]
-testing: [...]/files/pos/tcpoly_checkkinds_mix.scala [ OK ]
-testing: [...]/files/pos/bug348plus.scala [ OK ]
-testing: [...]/files/pos/infer2.scala [ OK ]
-testing: [...]/files/pos/t0654.scala [ OK ]
-testing: [...]/files/pos/scoping2.scala [ OK ]
-testing: [...]/files/pos/modules.scala [ OK ]
-testing: [...]/files/pos/tcpoly_method.scala [ OK ]
-testing: [...]/files/pos/override.scala [ OK ]
-testing: [...]/files/pos/bug0325.scala [ OK ]
-testing: [...]/files/pos/bug839.scala [ OK ]
-testing: [...]/files/pos/bug851.scala [ OK ]
-testing: [...]/files/pos/nullary.scala [ OK ]
-testing: [...]/files/pos/pmbug.scala [ OK ]
-testing: [...]/files/pos/bug1014.scala [ OK ]
-testing: [...]/files/pos/gui.scala [ OK ]
-testing: [...]/files/pos/bug758.scala [ OK ]
-testing: [...]/files/pos/bug675.scala [ OK ]
-testing: [...]/files/pos/variances.scala [ OK ]
-testing: [...]/files/pos/bug0204.scala [ OK ]
-testing: [...]/files/pos/bug419.scala [ OK ]
-testing: [...]/files/pos/t0273.scala [ OK ]
-testing: [...]/files/pos/tcpoly_typeapp.scala [ OK ]
-testing: [...]/files/pos/bug0123.scala [ OK ]
-testing: [...]/files/pos/bug295.scala [ OK ]
-testing: [...]/files/pos/patterns1.scala [ OK ]
-testing: [...]/files/pos/pat_gilles.scala [ OK ]
-testing: [...]/files/pos/typealiases.scala [ OK ]
-testing: [...]/files/pos/t0055.scala [ OK ]
-testing: [...]/files/pos/t0674.scala [ OK ]
-testing: [...]/files/pos/exceptions.scala [ OK ]
-testing: [...]/files/pos/bug697.scala [ OK ]
-testing: [...]/files/pos/scoping3.scala [ OK ]
-testing: [...]/files/pos/bug757a.scala [ OK ]
-testing: [...]/files/pos/bug1034.scala [ OK ]
-testing: [...]/files/pos/S1.scala [ OK ]
-testing: [...]/files/pos/S3.scala [ OK ]
-testing: [...]/files/pos/bug1210.scala [ OK ]
-testing: [...]/files/pos/bug698.scala [ OK ]
-testing: [...]/files/pos/bug0304.scala [ OK ]
-testing: [...]/files/pos/bug0061.scala [ OK ]
-testing: [...]/files/pos/bug1056.scala [ OK ]
-testing: [...]/files/pos/unapplyVal.scala [ OK ]
-testing: [...]/files/pos/bug0069.scala [ OK ]
-
-Testing compiler (on files whose compilation should succeed on 1.5 JVM)
-testing: [...]/files/pos5/t1197 [ OK ]
-testing: [...]/files/pos5/chang [ OK ]
-testing: [...]/files/pos5/t1230 [ OK ]
-testing: [...]/files/pos5/t1196 [ OK ]
-testing: [...]/files/pos5/t1203 [ OK ]
-testing: [...]/files/pos5/t1176 [ OK ]
-testing: [...]/files/pos5/t1102 [ OK ]
-testing: [...]/files/pos5/t1101 [ OK ]
-testing: [...]/files/pos5/t1150 [ OK ]
-testing: [...]/files/pos5/t1231 [ OK ]
-testing: [...]/files/pos5/t1152 [ OK ]
-testing: [...]/files/pos5/ilya [ OK ]
-testing: [...]/files/pos5/t1263 [ OK ]
-testing: [...]/files/pos5/t1235 [ OK ]
-
-Testing compiler (on files whose compilation should fail)
-testing: [...]/files/neg/xmltruncated1.scala [ OK ]
-testing: [...]/files/neg/bug200.scala [ OK ]
-testing: [...]/files/neg/bug562.scala [ OK ]
-testing: [...]/files/neg/xmltruncated5.scala [ OK ]
-testing: [...]/files/neg/t0207.scala [ OK ]
-testing: [...]/files/neg/bug1041.scala [ OK ]
-testing: [...]/files/neg/bug708.scala [ OK ]
-testing: [...]/files/neg/bug545.scala [ OK ]
-testing: [...]/files/neg/patternalts.scala [ OK ]
-testing: [...]/files/neg/tcpoly_bounds.scala [ OK ]
-testing: [...]/files/neg/t0903.scala [ OK ]
-testing: [...]/files/neg/lubs.scala [ OK ]
-testing: [...]/files/neg/overload.scala [ OK ]
-testing: [...]/files/neg/bug421.scala [ OK ]
-testing: [...]/files/neg/bug960.scala [ OK ]
-testing: [...]/files/neg/bug961.scala [ OK ]
-testing: [...]/files/neg/forward.scala [ OK ]
-testing: [...]/files/neg/t0226.scala [ OK ]
-testing: [...]/files/neg/t0204.scala [ OK ]
-testing: [...]/files/neg/bug987.scala [ OK ]
-testing: [...]/files/neg/bug766.scala [ OK ]
-testing: [...]/files/neg/bug521.scala [ OK ]
-testing: [...]/files/neg/t0528neg.scala [ OK ]
-testing: [...]/files/neg/bug908.scala [ OK ]
-testing: [...]/files/neg/bug800.scala [ OK ]
-testing: [...]/files/neg/t0345.scala [ OK ]
-testing: [...]/files/neg/bug664.scala [ OK ]
-testing: [...]/files/neg/bug563.scala [ OK ]
-testing: [...]/files/neg/mixins.scala [ OK ]
-testing: [...]/files/neg/bug1241.scala [ OK ]
-testing: [...]/files/neg/t0764.scala [ OK ]
-testing: [...]/files/neg/bug608.scala [ OK ]
-testing: [...]/files/neg/multi-array.scala [ OK ]
-testing: [...]/files/neg/bug882.scala [ OK ]
-testing: [...]/files/neg/bug909.scala [ OK ]
-testing: [...]/files/neg/t0117.scala [ OK ]
-testing: [...]/files/neg/wellkinded_wrongarity.scala [ OK ]
-testing: [...]/files/neg/tcpoly_typealias.scala [ OK ]
-testing: [...]/files/neg/bug1183.scala [ OK ]
-testing: [...]/files/neg/variances.scala [ OK ]
-testing: [...]/files/neg/bug565.scala [ OK ]
-testing: [...]/files/neg/bug585.scala [ OK ]
-testing: [...]/files/neg/bug667.scala [ OK ]
-testing: [...]/files/neg/t0209.scala [ OK ]
-testing: [...]/files/neg/t1033.scala [ OK ]
-testing: [...]/files/neg/badtok-1.scala [ OK ]
-testing: [...]/files/neg/typeerror.scala [ OK ]
-testing: [...]/files/neg/bug1224.scala [ OK ]
-testing: [...]/files/neg/bug555.scala [ OK ]
-testing: [...]/files/neg/saito.scala [ OK ]
-testing: [...]/files/neg/t0842.scala [ OK ]
-testing: [...]/files/neg/tcpoly_variance_enforce.scala [ OK ]
-testing: [...]/files/neg/bug663.scala [ OK ]
-testing: [...]/files/neg/wellkinded_app2.scala [ OK ]
-testing: [...]/files/neg/bug633.scala [ OK ]
-testing: [...]/files/neg/bug836.scala [ OK ]
-testing: [...]/files/neg/bug846.scala [ OK ]
-testing: [...]/files/neg/bug1106.scala [ OK ]
-testing: [...]/files/neg/patmatexhaust.scala [ OK ]
-testing: [...]/files/neg/bug783.scala [ OK ]
-testing: [...]/files/neg/bug729.scala [ OK ]
-testing: [...]/files/neg/bug512.scala [ OK ]
-testing: [...]/files/neg/bug418.scala [ OK ]
-testing: [...]/files/neg/bug1181.scala [ OK ]
-testing: [...]/files/neg/bug765.scala [ OK ]
-testing: [...]/files/neg/bug593.scala [ OK ]
-testing: [...]/files/neg/lazy-override.scala [ OK ]
-testing: [...]/files/neg/bug649.scala [ OK ]
-testing: [...]/files/neg/divergent-implicit.scala [ OK ]
-testing: [...]/files/neg/imp2.scala [ OK ]
-testing: [...]/files/neg/bug752.scala [ OK ]
-testing: [...]/files/neg/t0606.scala [ OK ]
-testing: [...]/files/neg/implicits.scala [ OK ]
-testing: [...]/files/neg/t1163.scala [ OK ]
-testing: [...]/files/neg/higherkind_novalue.scala [ OK ]
-testing: [...]/files/neg/gadts1.scala [ OK ]
-testing: [...]/files/neg/bug712.scala [ OK ]
-testing: [...]/files/neg/bug856.scala [ OK ]
-testing: [...]/files/neg/structural.scala [ OK ]
-testing: [...]/files/neg/bug510.scala [ OK ]
-testing: [...]/files/neg/bug588.scala [ OK ]
-testing: [...]/files/neg/bug1017.scala [ OK ]
-testing: [...]/files/neg/bug630.scala [ OK ]
-testing: [...]/files/neg/constrs.scala [ OK ]
-testing: [...]/files/neg/bug550.scala [ OK ]
-testing: [...]/files/neg/bug515.scala [ OK ]
-testing: [...]/files/neg/bug691.scala [ OK ]
-testing: [...]/files/neg/bug414.scala [ OK ]
-testing: [...]/files/neg/wellkinded_bounds.scala [ OK ]
-testing: [...]/files/neg/accesses.scala [ OK ]
-testing: [...]/files/neg/t1049.scala [ OK ]
-testing: [...]/files/neg/bug715.scala [ OK ]
-testing: [...]/files/neg/bug412.scala [ OK ]
-testing: [...]/files/neg/bug631.scala [ OK ]
-testing: [...]/files/neg/xmltruncated6.scala [ OK ]
-testing: [...]/files/neg/badtok-2.scala [ OK ]
-testing: [...]/files/neg/bug910.scala [ OK ]
-testing: [...]/files/neg/bug1011.scala [ OK ]
-testing: [...]/files/neg/t1168.scala [ OK ]
-testing: [...]/files/neg/bug391.scala [ OK ]
-testing: [...]/files/neg/bug650.scala [ OK ]
-testing: [...]/files/neg/bug1279a.scala [ OK ]
-testing: [...]/files/neg/sensitive.scala [ OK ]
-testing: [...]/files/neg/t0015.scala [ OK ]
-testing: [...]/files/neg/bug452.scala [ OK ]
-testing: [...]/files/neg/bug876.scala [ OK ]
-testing: [...]/files/neg/bug798.scala [ OK ]
-testing: [...]/files/neg/t0152.scala [ OK ]
-testing: [...]/files/neg/t0351.scala [ OK ]
-testing: [...]/files/neg/t0214.scala [ OK ]
-testing: [...]/files/neg/abstract.scala [ OK ]
-testing: [...]/files/neg/bug693.scala [ OK ]
-testing: [...]/files/neg/bug556.scala [ OK ]
-testing: [...]/files/neg/bug1275.scala [ OK ]
-testing: [...]/files/neg/bug835.scala [ OK ]
-testing: [...]/files/neg/t0259.scala [ OK ]
-testing: [...]/files/neg/bug591.scala [ OK ]
-testing: [...]/files/neg/t1009.scala [ OK ]
-testing: [...]/files/neg/lazyvals.scala [ OK ]
-testing: [...]/files/neg/bug997.scala [ OK ]
-testing: [...]/files/neg/xmltruncated3.scala [ OK ]
-testing: [...]/files/neg/sabin2.scala [ OK ]
-testing: [...]/files/neg/t0218.scala [ OK ]
-testing: [...]/files/neg/bug520.scala [ OK ]
-testing: [...]/files/neg/annot-nonconst.scala [ OK ]
-testing: [...]/files/neg/xmlcorner.scala [ OK ]
-testing: [...]/files/neg/wellkinded_wrongarity2.scala [ OK ]
-testing: [...]/files/neg/bug692.scala [ OK ]
-testing: [...]/files/neg/checksensible.scala [ OK ]
-testing: [...]/files/neg/bug1010.scala [ OK ]
-testing: [...]/files/neg/bug343.scala [ OK ]
-testing: [...]/files/neg/t0590.scala [ OK ]
-testing: [...]/files/neg/t1215.scala [ OK ]
-testing: [...]/files/neg/bug576.scala [ OK ]
-testing: [...]/files/neg/xmltruncated2.scala [ OK ]
-testing: [...]/files/neg/bug558.scala [ OK ]
-testing: [...]/files/neg/bug875.scala [ OK ]
-testing: [...]/files/neg/bug500.scala [ OK ]
-testing: [...]/files/neg/bug409.scala [ OK ]
-testing: [...]/files/neg/bug845.scala [ OK ]
-testing: [...]/files/neg/bug1112.scala [ OK ]
-testing: [...]/files/neg/xmltruncated4.scala [ OK ]
-testing: [...]/files/neg/t0899.scala [ OK ]
-testing: [...]/files/neg/bug639.scala [ OK ]
-testing: [...]/files/neg/bug700.scala [ OK ]
-testing: [...]/files/neg/bug779.scala [ OK ]
-testing: [...]/files/neg/bug668.scala [ OK ]
-testing: [...]/files/neg/bug696.scala [ OK ]
-testing: [...]/files/neg/bug501.scala [ OK ]
-testing: [...]/files/neg/faculty.scala [ OK ]
-testing: [...]/files/neg/viewtest.scala [ OK ]
-testing: [...]/files/neg/bug677.scala [ OK ]
-testing: [...]/files/neg/nopredefs.scala [ OK ]
-testing: [...]/files/neg/bug900.scala [ OK ]
-testing: [...]/files/neg/tcpoly_variance.scala [ OK ]
-testing: [...]/files/neg/wellkinded_app.scala [ OK ]
-testing: [...]/files/neg/t0003.scala [ OK ]
-testing: [...]/files/neg/t0503.scala [ OK ]
-testing: [...]/files/neg/bug877.scala [ OK ]
-testing: [...]/files/neg/tcpoly_override.scala [ OK ]
-
-Testing JVM backend
-testing: [...]/files/run/randomAccessSeq-apply.scala [ OK ]
-testing: [...]/files/run/promotion.scala [ OK ]
-testing: [...]/files/run/contrib674.scala [ OK ]
-testing: [...]/files/run/retclosure.scala [ OK ]
-testing: [...]/files/run/bug216.scala [ OK ]
-testing: [...]/files/run/try.scala [ OK ]
-testing: [...]/files/run/overloads.scala [ OK ]
-testing: [...]/files/run/bug1074.scala [ OK ]
-testing: [...]/files/run/colltest.scala [ OK ]
-testing: [...]/files/run/json.scala [ OK ]
-testing: [...]/files/run/lazy-traits.scala [ OK ]
-testing: [...]/files/run/literals.scala [ OK ]
-testing: [...]/files/run/Course-2002-13.scala [ OK ]
-testing: [...]/files/run/forvaleq.scala [ OK ]
-testing: [...]/files/run/Course-2002-05.scala [ OK ]
-testing: [...]/files/run/tcpoly_parseridioms.scala [ OK ]
-testing: [...]/files/run/constrained-types.scala [ OK ]
-testing: [...]/files/run/bug978.scala [ OK ]
-testing: [...]/files/run/bug1192.scala [ OK ]
-testing: [...]/files/run/structural.scala [ OK ]
-testing: [...]/files/run/withIndex.scala [ OK ]
-testing: [...]/files/run/arybufgrow.scala [ OK ]
-testing: [...]/files/run/iterables.scala [ OK ]
-testing: [...]/files/run/iterators.scala [ OK ]
-testing: [...]/files/run/bug603.scala [ OK ]
-testing: [...]/files/run/misc.scala [ OK ]
-testing: [...]/files/run/Course-2002-03.scala [ OK ]
-testing: [...]/files/run/Course-2002-01.scala [ OK ]
-testing: [...]/files/run/t0017.scala [ OK ]
-testing: [...]/files/run/collection-stacks.scala [ OK ]
-testing: [...]/files/run/patmatnew.scala [ OK ]
-testing: [...]/files/run/docgenerator.scala [ OK ]
-testing: [...]/files/run/bug601.scala [ OK ]
-testing: [...]/files/run/retsynch.scala [ OK ]
-testing: [...]/files/run/t0631.scala [ OK ]
-testing: [...]/files/run/deeps.scala [ OK ]
-testing: [...]/files/run/richs.scala [ OK ]
-testing: [...]/files/run/bug0325.scala [ OK ]
-testing: [...]/files/run/bug920.scala [ OK ]
-testing: [...]/files/run/byname.scala [ OK ]
-testing: [...]/files/run/amp.scala [ OK ]
-testing: [...]/files/run/classof.scala [ OK ]
-testing: [...]/files/run/iq.scala [ OK ]
-testing: [...]/files/run/tuples.scala [ OK ]
-testing: [...]/files/run/Course-2002-04.scala [ OK ]
-testing: [...]/files/run/t1323.scala [ OK ]
-testing: [...]/files/run/t0677.scala [ OK ]
-testing: [...]/files/run/Course-2002-09.scala [ OK ]
-testing: [...]/files/run/infix.scala [ OK ]
-testing: [...]/files/run/runtime-richChar.scala [ OK ]
-testing: [...]/files/run/gadts.scala [ OK ]
-testing: [...]/files/run/bug657.scala [ OK ]
-testing: [...]/files/run/Course-2002-02.scala [ OK ]
-testing: [...]/files/run/fors.scala [ OK ]
-testing: [...]/files/run/Course-2002-08.scala [ OK ]
-testing: [...]/files/run/t0528.scala [ OK ]
-testing: [...]/files/run/syncchannel.scala [ OK ]
-testing: [...]/files/run/mixins.scala [ OK ]
-testing: [...]/files/run/t0042.scala [ OK ]
-testing: [...]/files/run/Course-2002-06.scala [ OK ]
-testing: [...]/files/run/bitsets.scala [ OK ]
-testing: [...]/files/run/exceptions-2.scala [ OK ]
-testing: [...]/files/run/tailcalls.scala [ OK ]
-testing: [...]/files/run/constructors.scala [ OK ]
-testing: [...]/files/run/t0936.scala [ OK ]
-testing: [...]/files/run/tcpoly_monads.scala [ OK ]
-testing: [...]/files/run/bug627.scala [ OK ]
-testing: [...]/files/run/t0700.scala [ OK ]
-testing: [...]/files/run/t0005.scala [ OK ]
-testing: [...]/files/run/runtime.scala [ OK ]
-testing: [...]/files/run/bug744.scala [ OK ]
-testing: [...]/files/run/bug429.scala [ OK ]
-testing: [...]/files/run/typealias_overriding.scala [ OK ]
-testing: [...]/files/run/t0421.scala [ OK ]
-testing: [...]/files/run/streams.scala [ OK ]
-testing: [...]/files/run/existentials.scala [ OK ]
-testing: [...]/files/run/exoticnames.scala [ OK ]
-testing: [...]/files/run/lazy-exprs.scala [ OK ]
-testing: [...]/files/run/ctor-order.scala [ OK ]
-testing: [...]/files/run/t0663.scala [ OK ]
-testing: [...]/files/run/t0485.scala [ OK ]
-testing: [...]/files/run/boolexprs.scala [ OK ]
-testing: [...]/files/run/bug629.scala [ OK ]
-testing: [...]/files/run/issue192.scala [ OK ]
-testing: [...]/files/run/unapplyArray.scala [ OK ]
-testing: [...]/files/run/t0486.scala [ OK ]
-testing: [...]/files/run/enums.scala [ OK ]
-testing: [...]/files/run/Course-2002-07.scala [ OK ]
-testing: [...]/files/run/t0508.scala [ OK ]
-testing: [...]/files/run/bug405.scala [ OK ]
-testing: [...]/files/run/lazy-override.scala [ OK ]
-testing: [...]/files/run/checked.scala [ OK ]
-testing: [...]/files/run/caseclasses.scala [ OK ]
-testing: [...]/files/run/unittest_collection.scala [ OK ]
-testing: [...]/files/run/NestedClasses.scala [ OK ]
-testing: [...]/files/run/imports.scala [ OK ]
-testing: [...]/files/run/absoverride.scala [ OK ]
-testing: [...]/files/run/unittest_io.scala [ OK ]
-testing: [...]/files/run/unapply.scala [ OK ]
-testing: [...]/files/run/collections.scala [ OK ]
-testing: [...]/files/run/bug428.scala [ OK ]
-testing: [...]/files/run/t0607.scala [ OK ]
-testing: [...]/files/run/lazy-locals.scala [ OK ]
-testing: [...]/files/run/arrays.scala [ OK ]
-testing: [...]/files/run/implicits.scala [ OK ]
-testing: [...]/files/run/t0807.scala [ OK ]
-testing: [...]/files/run/multi-array.scala [ OK ]
-testing: [...]/files/run/bugs.scala [ OK ]
-testing: [...]/files/run/lisp.scala [ OK ]
-testing: [...]/files/run/boolord.scala [ OK ]
-testing: [...]/files/run/bug1220.scala [ OK ]
-testing: [...]/files/run/try-2.scala [ OK ]
-testing: [...]/files/run/map_test.scala [ OK ]
-testing: [...]/files/run/tcpoly_overriding.scala [ OK ]
-testing: [...]/files/run/slices.scala [ OK ]
-testing: [...]/files/run/t0883.scala [ OK ]
-testing: [...]/files/run/t0091.scala [ OK ]
-testing: [...]/files/run/t0412.scala [ OK ]
-testing: [...]/files/run/impconvtimes.scala [ OK ]
-testing: [...]/files/run/t0911.scala [ OK ]
-testing: [...]/files/run/t0668.scala [ OK ]
-testing: [...]/files/run/bug594.scala [ OK ]
-testing: [...]/files/run/range.scala [ OK ]
-testing: [...]/files/run/exceptions.scala [ OK ]
-testing: [...]/files/run/sort.scala [ OK ]
-testing: [...]/files/run/interpreter.scala [ OK ]
-testing: [...]/files/run/intgetorelse.scala [ OK ]
-testing: [...]/files/run/bridges.scala [ OK ]
-testing: [...]/files/run/bug949.scala [ OK ]
-testing: [...]/files/run/unboxingBug.scala [ OK ]
-testing: [...]/files/run/lists.scala [ OK ]
-testing: [...]/files/run/Course-2002-10.scala [ OK ]
-
-Testing JVM backend
-testing: [...]/files/jvm/nest.scala [ OK ]
-testing: [...]/files/jvm/methvsfield.scala [ OK ]
-testing: [...]/files/jvm/xmlpull.scala [ OK ]
-testing: [...]/files/jvm/bug560bis.scala [ OK ]
-testing: [...]/files/jvm/xmlmore.scala [ OK ]
-testing: [...]/files/jvm/protectedacc.scala [ OK ]
-testing: [...]/files/jvm/natives.scala [ OK ]
-testing: [...]/files/jvm/unittest_io.scala [ OK ]
-testing: [...]/files/jvm/bigints.scala [ OK ]
-testing: [...]/files/jvm/t1143.scala [ OK ]
-testing: [...]/files/jvm/xml03syntax.scala [ OK ]
-testing: [...]/files/jvm/xmlattr.scala [ OK ]
-testing: [...]/files/jvm/xml01.scala [ OK ]
-testing: [...]/files/jvm/serialization.scala [ OK ]
-testing: [...]/files/jvm/xml04embed.scala [ OK ]
-testing: [...]/files/jvm/t1116.scala [ OK ]
-testing: [...]/files/jvm/unittest_xml.scala [ OK ]
-testing: [...]/files/jvm/t0632.scala [ OK ]
-testing: [...]/files/jvm/xml02.scala [ OK ]
-testing: [...]/files/jvm/xmlstuff.scala [ OK ]
-testing: [...]/files/jvm/typerep.scala [ OK ]
-testing: [...]/files/jvm/JavaInteraction.scala [ OK ]
-testing: [...]/files/jvm/manifests.scala [ OK ]
-testing: [...]/files/jvm/inner.scala [ OK ]
-
-Testing JVM backend
-testing: [...]/files/jvm5/t1461.scala [ OK ]
-testing: [...]/files/jvm5/bug680.scala [ OK ]
-testing: [...]/files/jvm5/console.scala [ OK ]
-testing: [...]/files/jvm5/t0014.scala [ OK ]
-testing: [...]/files/jvm5/throws-annot.scala [ OK ]
-testing: [...]/files/jvm5/sync-var.scala [ OK ]
-testing: [...]/files/jvm5/stringbuilder.scala [ OK ]
-testing: [...]/files/jvm5/annotations.scala [ OK ]
-testing: [...]/files/jvm5/bug676.scala [ OK ]
-testing: [...]/files/jvm5/outerEnum.scala [ OK ]
-testing: [...]/files/jvm5/typerep.scala [ OK ]
-
-Testing resident compiler
-testing: [...]/files/res/bug722.res [ OK ]
-testing: [...]/files/res/bug831.res [ OK ]
-testing: [...]/files/res/bug743.res [ OK ]
-testing: [...]/files/res/bug735.res [ OK ]
-testing: [...]/files/res/bug785.res [ OK ]
-testing: [...]/files/res/bug687.res [ OK ]
-testing: [...]/files/res/bug597.res [ OK ]
-
-Testing shootout tests
-testing: [...]/files/shootout/lists.scala [ OK ]
-testing: [...]/files/shootout/fibo.scala [ OK ]
-testing: [...]/files/shootout/harmonic.scala [ OK ]
-testing: [...]/files/shootout/hash.scala [ OK ]
-testing: [...]/files/shootout/nsievebits.scala-2.scala [ OK ]
-testing: [...]/files/shootout/sumcol.scala-2.scala [ OK ]
-testing: [...]/files/shootout/message.scala-2.scala [ OK ]
-testing: [...]/files/shootout/hash2.scala [ OK ]
-testing: [...]/files/shootout/nsievebits.scala-3.scala [ OK ]
-testing: [...]/files/shootout/fannkuch.scala-2.scala [ OK ]
-testing: [...]/files/shootout/takfp.scala [ OK ]
-testing: [...]/files/shootout/except.scala [ OK ]
-testing: [...]/files/shootout/knucleotide.scala-3.scala [ OK ]
-testing: [...]/files/shootout/chameneos.scala [ OK ]
-testing: [...]/files/shootout/knucleotide.scala-2.scala [ OK ]
-testing: [...]/files/shootout/sumcol.scala [ OK ]
-testing: [...]/files/shootout/objinst.scala [ OK ]
-testing: [...]/files/shootout/hello.scala [ OK ]
-testing: [...]/files/shootout/binarytrees.scala-3.scala [ OK ]
-testing: [...]/files/shootout/spectralnorm.scala-2.scala [ OK ]
-testing: [...]/files/shootout/recursive.scala [ OK ]
-testing: [...]/files/shootout/binarytrees.scala-2.scala [ OK ]
-testing: [...]/files/shootout/nsieve.scala-2.scala [ OK ]
-testing: [...]/files/shootout/binarytrees.scala [ OK ]
-testing: [...]/files/shootout/ary.scala [ OK ]
-testing: [...]/files/shootout/partialsums.scala [ OK ]
-testing: [...]/files/shootout/ackermann.scala [ OK ]
-testing: [...]/files/shootout/strcat.scala [ OK ]
-testing: [...]/files/shootout/regexdna.scala [ OK ]
-testing: [...]/files/shootout/nestedloop.scala [ OK ]
-testing: [...]/files/shootout/nsieve.scala-3.scala [ OK ]
-testing: [...]/files/shootout/partialsums.scala-2.scala [ OK ]
-testing: [...]/files/shootout/fannkuch.scala [ OK ]
-testing: [...]/files/shootout/nsievebits.scala [ OK ]
-testing: [...]/files/shootout/nbody.scala-2.scala [ OK ]
-
-Testing script tests
-testing: [...]/files/script/fact.scala [FAILED]
-testing: [...]/files/script/utf8.scala [ OK ]
-testing: [...]/files/script/t1015.scala [ OK ]
-testing: [...]/files/script/second.scala [ OK ]
-testing: [...]/files/script/t1017.scala [ OK ]
-
-1 of 722 tests failed (elapsed time: 00:17:08)
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala
index 6fd121a..76280c7 100644
--- a/src/actors/scala/actors/Actor.scala
+++ b/src/actors/scala/actors/Actor.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Actor.scala 16207 2008-10-06 08:59:54Z phaller $
+// $Id: Actor.scala 16171 2008-09-29 09:28:09Z phaller $
package scala.actors
diff --git a/src/actors/scala/actors/FJTaskScheduler2.scala b/src/actors/scala/actors/FJTaskScheduler2.scala
index 1af3dfe..f40cc29 100644
--- a/src/actors/scala/actors/FJTaskScheduler2.scala
+++ b/src/actors/scala/actors/FJTaskScheduler2.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: FJTaskScheduler2.scala 16207 2008-10-06 08:59:54Z phaller $
+// $Id: FJTaskScheduler2.scala 16171 2008-09-29 09:28:09Z phaller $
package scala.actors
diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala
index ad2dc56..3527966 100644
--- a/src/actors/scala/actors/Future.scala
+++ b/src/actors/scala/actors/Future.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Future.scala 16207 2008-10-06 08:59:54Z phaller $
+// $Id: Future.scala 16171 2008-09-29 09:28:09Z phaller $
package scala.actors
diff --git a/src/actors/scala/actors/Scheduler.scala b/src/actors/scala/actors/Scheduler.scala
index c3b74ba..05da16e 100644
--- a/src/actors/scala/actors/Scheduler.scala
+++ b/src/actors/scala/actors/Scheduler.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Scheduler.scala 16207 2008-10-06 08:59:54Z phaller $
+// $Id: Scheduler.scala 16171 2008-09-29 09:28:09Z phaller $
package scala.actors
diff --git a/src/actors/scala/actors/TickedScheduler.scala b/src/actors/scala/actors/TickedScheduler.scala
index 8eece77..8285e60 100644
--- a/src/actors/scala/actors/TickedScheduler.scala
+++ b/src/actors/scala/actors/TickedScheduler.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: TickedScheduler.scala 16207 2008-10-06 08:59:54Z phaller $
+// $Id: TickedScheduler.scala 16171 2008-09-29 09:28:09Z phaller $
package scala.actors
diff --git a/src/build/four.xml b/src/build/four.xml
index 7929555..64e7987 100644
--- a/src/build/four.xml
+++ b/src/build/four.xml
@@ -297,7 +297,8 @@ work on a JVM 1.5.
============================================================================ -->
<target name="four-test.suite" depends="four-pack.done">
- <partest showlog="yes" erroronfailed="no" scalacopts="-target:jvm-1.4" javacmd="${java.home}/bin/java -Xmx1024M">
+ <partest showlog="yes" erroronfailed="yes" scalacopts="-target:jvm-1.4"
+ javacmd="${java.home}/bin/java -Xmx1024M" javaccmd="${javac.cmd}">
<classpath>
<pathelement location="${build-four-pack.dir}/lib/scala-library.jar"/>
<pathelement location="${build-four-pack.dir}/lib/scala-compiler.jar"/>
@@ -323,6 +324,7 @@ work on a JVM 1.4.
============================================================================ -->
<target name="fourfour-test.start">
+ <echo level="info" message="Java version is ${java.vm.name} ${java.version}"/>
<path id="four-pack.classpath">
<pathelement location="${build-four-pack.dir}/lib/scala-library.jar"/>
<pathelement location="${build-four-pack.dir}/lib/scala-compiler.jar"/>
@@ -333,7 +335,8 @@ work on a JVM 1.4.
</target>
<target name="fourfour-test.suite" depends="fourfour-test.start">
- <partest showlog="yes" erroronfailed="no" scalacopts="-target:jvm-1.4" javacmd="${java.home}/bin/java -Xmx1024M">
+ <partest showlog="yes" erroronfailed="yes" scalacopts="-target:jvm-1.4"
+ javacmd="${java.home}/bin/java -Xmx1024M" javaccmd="${javac.cmd}">
<classpath>
<pathelement location="${build-four-pack.dir}/lib/scala-library.jar"/>
<pathelement location="${build-four-pack.dir}/lib/scala-compiler.jar"/>
diff --git a/src/build/maven/maven-deploy.xml b/src/build/maven/maven-deploy.xml
new file mode 100644
index 0000000..02c4ada
--- /dev/null
+++ b/src/build/maven/maven-deploy.xml
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project name="sabbus-maven-deploy" xmlns:artifact="urn:maven-artifact-ant">
+
+ <description>
+ SuperSabbus extension for deploying a distribution to Maven. THIS FILE IS MEANT TO BE RUN STANDALONE IN THE MAVEN "distpack" DIRECTORY
+ </description>
+ <target name="init.properties">
+ <!-- Pull in properties from build -->
+ <property file="build.properties" />
+ <!-- Initialize specific properties -->
+ <property name="remote.snapshot.repository" value="http://scala-tools.org:8081/nexus/content/repositories/snapshots" />
+ <property name="remote.release.repository" value="http://scala-tools.org:8081/nexus/content/repositories/releases" />
+ <property name="local.snapshot.repository" value="${user.home}/.m2/repository" />
+ <property name="local.release.repository" value="${user.home}/.m2/repository" />
+ <property name="repository.credentials.id" value="scala-tools.org" />
+ <property name="settings.file" value="${user.home}/.m2/settings.xml" />
+
+ <echo>Using server[${repository.credentials.id}] for maven repository credentials.
+ Please make sure that your ~/.m2/settings.xml has the needed username/password for this server id
+ </echo>
+ </target>
+
+ <target name="init.maven" depends="init.properties">
+
+ <!-- Add our maven ant tasks -->
+ <path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.0.9.jar" />
+ <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" />
+ <!-- simplify fixing pom versions -->
+ <macrodef name="make-pom">
+ <attribute name="name" />
+ <attribute name="version" />
+ <sequential>
+ <copy file="@{name}/@{name}-pom.xml" tofile="@{name}/@{name}-pom-fixed.xml" overwrite="true">
+ <filterset>
+ <filter token="VERSION" value="@{version}" />
+ <filter token="RELEASE_REPOSITORY" value="${remote.release.repository}" />
+ <filter token="SNAPSHOT_REPOSITORY" value="${remote.snapshot.repository}" />
+ </filterset>
+ </copy>
+ <artifact:pom id="@{name}.pom" file="@{name}/@{name}-pom-fixed.xml" />
+ </sequential>
+ </macrodef>
+ <!-- Simply attaching documentation -->
+ <macrodef name="attach-doc">
+ <attribute name="name" />
+ <sequential>
+ <artifact:attach type="jar" file="@{name}/@{name}-docs.jar" classifier="javadoc" />
+ </sequential>
+ </macrodef>
+ </target>
+ <!-- macros for local deployment -->
+ <target name="deploy.local.init" depends="init.maven">
+ <!-- Deploy single artifact locally -->
+ <macrodef name="deploy-local">
+ <attribute name="name" />
+ <attribute name="version" />
+ <attribute name="repository" />
+ <element name="extra-attachments" optional="yes" />
+ <sequential>
+ <make-pom name="@{name}" version="@{version}" />
+ <artifact:install file="@{name}/@{name}.jar">
+ <artifact:pom refid="@{name}.pom" />
+ <artifact:localRepository path="@{repository}" id="${repository.credentials.id}" />
+ <artifact:attach type="jar" file="@{name}/@{name}-src.jar" classifier="sources" />
+ <extra-attachments />
+ </artifact:install>
+ </sequential>
+ </macrodef>
+
+ <!-- Deploy all artifacts locally -->
+ <macrodef name="deploy-local-all">
+ <attribute name="repository" />
+ <attribute name="version" />
+ <sequential>
+ <deploy-local name="scala-library" version="@{version}" repository="@{repository}">
+ <extra-attachments>
+ <artifact:attach type="jar" file="scala-library/scala-library-docs.jar" classifier="javadoc" />
+ </extra-attachments>
+ </deploy-local>
+ <deploy-local name="scala-compiler" version="@{version}" repository="@{repository}" />
+ <deploy-local name="scala-dbc" version="@{version}" repository="@{repository}" />
+ <deploy-local name="scala-swing" version="@{version}" repository="@{repository}"/>
+ <!-- scala swing api is included in main library api
+ <extra-attachments>
+ <artifact:attach type="jar" file="scala-swing/scala-swing-docs.jar" classifier="javadoc" />
+ </extra-attachments>
+ </deploy-local>
+ -->
+ </sequential>
+ </macrodef>
+ </target>
+
+ <!-- macros for remote deployment -->
+ <target name="deploy.remote.init" depends="init.maven">
+ <!-- Deploy single artifact locally -->
+ <macrodef name="deploy-remote">
+ <attribute name="name" />
+ <attribute name="repository" />
+ <attribute name="version" />
+ <element name="extra-attachments" optional="yes" />
+ <sequential>
+ <make-pom name="@{name}" version="@{version}" />
+ <artifact:deploy file="@{name}/@{name}.jar" settingsFile="${settings.file}">
+ <artifact:pom refid="@{name}.pom" />
+ <artifact:remoteRepository url="@{repository}" id="${repository.credentials.id}" />
+ <artifact:attach type="jar" file="@{name}/@{name}-src.jar" classifier="sources" />
+ <extra-attachments />
+ </artifact:deploy>
+ </sequential>
+ </macrodef>
+
+ <!-- Deploy all artifacts locally -->
+ <macrodef name="deploy-remote-all">
+ <attribute name="repository" />
+ <attribute name="version" />
+ <sequential>
+ <deploy-remote name="scala-library" version="@{version}" repository="@{repository}">
+ <extra-attachments>
+ <artifact:attach type="jar" file="scala-library/scala-library-docs.jar" classifier="javadoc" />
+ </extra-attachments>
+ </deploy-remote>
+ <deploy-remote name="scala-compiler" version="@{version}" repository="@{repository}" />
+ <deploy-remote name="scala-dbc" version="@{version}" repository="@{repository}" />
+ <deploy-remote name="scala-swing" version="@{version}" repository="@{repository}"/>
+ <!-- scala swing api is included in main library api
+ <extra-attachments>
+ <artifact:attach type="jar" file="scala-swing/scala-swing-docs.jar" classifier="javadoc" />
+ </extra-attachments>
+ </deploy-remote>
+ -->
+ </sequential>
+ </macrodef>
+ </target>
+
+ <!-- Local Targets -->
+ <target name="deploy.snapshot.local" depends="deploy.local.init" description="Deploys the bundled snapshot of the Scala Lanaguage to a local maven repository">
+ <deploy-local-all version="${maven.snapshot.version.number}" repository="${local.snapshot.repository}" />
+ </target>
+
+ <target name="deploy.release.local" depends="deploy.local.init" description="Deploys the bundled files as a release into the local Maven repository">
+ <deploy-local-all version="${version.number}" repository="${local.release.repository}" />
+ </target>
+
+ <!-- Remote Targets -->
+ <target name="deploy.snapshot" depends="deploy.remote.init" description="Deploys the bundled files as a snapshot into the desired remote Maven repository">
+ <deploy-remote-all version="${maven.snapshot.version.number}" repository="${remote.snapshot.repository}" />
+ </target>
+
+ <target name="deploy.release" depends="deploy.remote.init" description="Deploys the bundled files as a release into the desired remote Maven repository">
+ <deploy-remote-all version="${version.number}" repository="${remote.release.repository}" />
+ </target>
+</project>
\ No newline at end of file
diff --git a/src/build/maven/scala-compiler-pom.xml b/src/build/maven/scala-compiler-pom.xml
new file mode 100644
index 0000000..88c3b69
--- /dev/null
+++ b/src/build/maven/scala-compiler-pom.xml
@@ -0,0 +1,26 @@
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-compiler</artifactId>
+ <packaging>jar</packaging>
+ <version>@VERSION@</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>@VERSION@</version>
+ </dependency>
+ </dependencies>
+ <distributionManagement>
+ <repository>
+ <id>scala-tools.org</id>
+ <url>@RELEASE_REPOSITORY@</url>
+ </repository>
+ <snapshotRepository>
+ <id>scala-tools.org</id>
+ <url>@SNAPSHOT_REPOSITORY@</url>
+ <uniqueVersion>false</uniqueVersion>
+ </snapshotRepository>
+ </distributionManagement>
+</project>
\ No newline at end of file
diff --git a/src/build/maven/scala-dbc-pom.xml b/src/build/maven/scala-dbc-pom.xml
new file mode 100644
index 0000000..66be811
--- /dev/null
+++ b/src/build/maven/scala-dbc-pom.xml
@@ -0,0 +1,26 @@
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-dbc</artifactId>
+ <packaging>jar</packaging>
+ <version>@VERSION@</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>@VERSION@</version>
+ </dependency>
+ </dependencies>
+ <distributionManagement>
+ <repository>
+ <id>scala-tools.org</id>
+ <url>@RELEASE_REPOSITORY@</url>
+ </repository>
+ <snapshotRepository>
+ <id>scala-tools.org</id>
+ <url>@SNAPSHOT_REPOSITORY@</url>
+ <uniqueVersion>false</uniqueVersion>
+ </snapshotRepository>
+ </distributionManagement>
+</project>
\ No newline at end of file
diff --git a/src/build/maven/scala-library-pom.xml b/src/build/maven/scala-library-pom.xml
new file mode 100644
index 0000000..8c1d343
--- /dev/null
+++ b/src/build/maven/scala-library-pom.xml
@@ -0,0 +1,19 @@
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <packaging>jar</packaging>
+ <version>@VERSION@</version>
+ <distributionManagement>
+ <repository>
+ <id>scala-tools.org</id>
+ <url>@RELEASE_REPOSITORY@</url>
+ </repository>
+ <snapshotRepository>
+ <id>scala-tools.org</id>
+ <url>@SNAPSHOT_REPOSITORY@</url>
+ <uniqueVersion>false</uniqueVersion>
+ </snapshotRepository>
+ </distributionManagement>
+</project>
\ No newline at end of file
diff --git a/src/build/maven/scala-swing-pom.xml b/src/build/maven/scala-swing-pom.xml
new file mode 100644
index 0000000..a2d5fea
--- /dev/null
+++ b/src/build/maven/scala-swing-pom.xml
@@ -0,0 +1,26 @@
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-swing</artifactId>
+ <packaging>jar</packaging>
+ <version>@VERSION@</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>@VERSION@</version>
+ </dependency>
+ </dependencies>
+ <distributionManagement>
+ <repository>
+ <id>scala-tools.org</id>
+ <url>@RELEASE_REPOSITORY@</url>
+ </repository>
+ <snapshotRepository>
+ <id>scala-tools.org</id>
+ <url>@SNAPSHOT_REPOSITORY@</url>
+ <uniqueVersion>false</uniqueVersion>
+ </snapshotRepository>
+ </distributionManagement>
+</project>
\ No newline at end of file
diff --git a/src/build/pack.xml b/src/build/pack.xml
index 5d769c4..d20e422 100644
--- a/src/build/pack.xml
+++ b/src/build/pack.xml
@@ -142,7 +142,73 @@ MAIN DISTRIBUTION SBAZ
<target name="pack-sbaz.done" depends="pack-sbaz.all"/>
-
+
+ <target name="pack-maven.start">
+ <mkdir dir="${dists.dir}/maven/${version.number}"/>
+ </target>
+
+ <target name="pack-maven.libs" depends="pack-maven.start">
+ <macrodef name="mvn-copy-lib">
+ <attribute name="mvn.artifact.name"/>
+ <sequential>
+ <mkdir dir="${dists.dir}/maven/${version.number}/@{mvn.artifact.name}"/>
+ <copy todir="${dists.dir}/maven/${version.number}/@{mvn.artifact.name}">
+ <fileset dir="${dist.dir}/lib/">
+ <filename name="@{mvn.artifact.name}.jar"/>
+ </fileset>
+ <fileset dir="${src.dir}/build/maven/">
+ <filename name="@{mvn.artifact.name}-pom.xml"/>
+ </fileset>
+ <fileset dir="${dist.dir}/src/">
+ <filename name="@{mvn.artifact.name}-src.jar"/>
+ </fileset>
+ </copy>
+ </sequential>
+ </macrodef>
+ <mvn-copy-lib mvn.artifact.name="scala-library"/>
+ <mvn-copy-lib mvn.artifact.name="scala-compiler"/>
+ <mvn-copy-lib mvn.artifact.name="scala-dbc"/>
+ <mvn-copy-lib mvn.artifact.name="scala-swing"/>
+ </target>
+
+ <target name="pack-maven.docs" depends="pack-maven.libs">
+ <jar destfile="${dists.dir}/maven/${version.number}/scala-library/scala-library-docs.jar"
+ basedir="${build-docs.dir}/library">
+ <include name="**/*"/>
+ </jar>
+ <!-- scala-swing api is included in main library api
+ <jar destfile="${dists.dir}/maven/${version.number}/scala-swing/scala-swing-docs.jar"
+ basedir="${build-docs.dir}/swing">
+ <include name="**/*"/>
+ </jar>
+ -->
+ </target>
+
+ <target name="pack-maven.latest.unix" depends="pack-maven.docs" unless="os.win">
+ <symlink link="${dists.dir}/maven/latest"
+ resource="${dists.dir}/maven/${version.number}"
+ overwrite="yes"/>
+ </target>
+
+ <target name="pack-maven.latest.win" depends="pack-maven.docs" if="os.win">
+ <copy todir="${dists.dir}/maven/latest">
+ <fileset dir="${dists.dir}/maven/${version.number}"/>
+ </copy>
+ </target>
+
+ <target name="pack-maven.scripts" depends="pack-maven.latest.unix,pack-maven.latest.win">
+ <copy todir="${dists.dir}/maven/${version.number}"
+ file="${lib-ant.dir}/maven-ant-tasks-2.0.9.jar"/>
+ <copyfile dest="${dists.dir}/maven/${version.number}/build.xml"
+ src="${src.dir}/build/maven/maven-deploy.xml"/>
+ <!-- export properties for use when deploying -->
+ <property name="maven.snapshot.version.number"
+ value="${version.major}.${version.minor}.${version.patch}-SNAPSHOT"/>
+ <echoproperties destfile="${dists.dir}/maven/${version.number}/build.properties"/>
+ </target>
+
+ <target name="pack-maven.done" depends="pack-maven.scripts"/>
+
<!-- ===========================================================================
JAVA FOUR DISTRIBUTION PACKAGING
============================================================================ -->
@@ -228,9 +294,9 @@ MSIL DISTRIBUTION PACKAGING
<!-- ===========================================================================
MISCELLANEOUS
============================================================================ -->
-
- <target name="pack-all.done" depends="pack-archives.done, pack-sbaz.done"/>
-
+
+ <target name="pack-all.done" depends="pack-archives.done, pack-sbaz.done, pack-maven.done"/>
+
<target name="fourpack-all.done" depends="fourpack-archives.done"/>
<target name="msilpack-all.done" depends="msilpack-archives.done, msilpack-sbaz.done"/>
@@ -238,7 +304,7 @@ MISCELLANEOUS
<!-- ===========================================================================
MISCELLANEOUS
============================================================================ -->
-
+
<target name="graph.init">
<echo message="${basedir}/lib/ant/vizant.jar"/>
<taskdef name="vizant" classname="vizant.Vizant" classpath="${basedir}/../../lib/ant/vizant.jar"/>
diff --git a/src/compiler/scala/tools/ant/FastScalac.scala b/src/compiler/scala/tools/ant/FastScalac.scala
index 619f97f..ca0f1cb 100644
--- a/src/compiler/scala/tools/ant/FastScalac.scala
+++ b/src/compiler/scala/tools/ant/FastScalac.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: FastScalac.scala 15995 2008-09-02 09:58:08Z rytz $
+// $Id: FastScalac.scala 16244 2008-10-10 16:54:02Z cunei $
package scala.tools.ant
@@ -49,11 +49,7 @@ class FastScalac extends Scalac {
* @param input The value for <code>server</code>.
*/
def setServer(input: String): Unit = {
- def isHostNameValid(host: String): Boolean =
- try { val _ = java.net.InetAddress.getByName(host); true }
- catch { case _ => false }
- if (isHostNameValid(input)) serverAddr = Some(input)
- else error("Unknown server '" + input + "'")
+ serverAddr = Some(input)
}
/** Sets the <code>shutdown</code> attribute. Used by Ant.
diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala
index a1829af..42d3991 100644
--- a/src/compiler/scala/tools/ant/Scalac.scala
+++ b/src/compiler/scala/tools/ant/Scalac.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Scalac.scala 15995 2008-09-02 09:58:08Z rytz $
+// $Id: Scalac.scala 16315 2008-10-22 12:49:56Z rytz $
package scala.tools.ant
diff --git a/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala b/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala
index 7ab0464..e973672 100644
--- a/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala
+++ b/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala
@@ -9,23 +9,23 @@ class ScalacFork extends MatchingTask with TaskArgs {
def setSrcdir(input: File) {
sourceDir = Some(input)
}
-
+
def setFailOnError(input: Boolean): Unit = {
failOnError = input
}
-
+
def setTimeout(input: Long): Unit = {
timeout = Some(input)
}
- def setMaxMemory(input: String): Unit = {
- maxmemory = Some(input)
+ def setJvmArgs(input: String): Unit = {
+ jvmArgs = Some(input)
}
-
+
private var sourceDir: Option[File] = None
private var failOnError: Boolean = true
private var timeout: Option[Long] = None
- private var maxmemory: Option[String] = None
+ private var jvmArgs: Option[String] = None
override def execute() {
if (compilerPath.isEmpty) error("Mandatory attribute 'compilerpath' is not set.")
@@ -38,9 +38,9 @@ class ScalacFork extends MatchingTask with TaskArgs {
if (!compilationPath.isEmpty) settings.classpath = compilationPath.get
if (!sourcePath.isEmpty) settings.sourcepath = sourcePath.get
if (!params.isEmpty) settings.more = params.get
-
+
// not yet used: compilerPath, sourcedir (used in mapper), failonerror, timeout
-
+
val mapper = new GlobPatternMapper()
mapper.setTo("*.class")
mapper.setFrom("*.scala")
@@ -57,15 +57,16 @@ class ScalacFork extends MatchingTask with TaskArgs {
val java = new Java(this) // set this as owner
java.setFork(true)
+ // using 'setLine' creates multiple arguments out of a space-separated string
+ if (!jvmArgs.isEmpty) java.createJvmarg().setLine(jvmArgs.get)
java.setClasspath(compilerPath.get)
java.setClassname("scala.tools.nsc.Main")
if (!timeout.isEmpty) java.setTimeout(timeout.get)
- if (!maxmemory.isEmpty) java.setMaxmemory(maxmemory.get)
for (arg <- settings.toArgs)
java.createArg().setValue(arg)
for (file <- includedFiles)
java.createArg().setFile(file)
-
+
log(java.getCommandLine.getCommandline.mkString("", " ", ""), Project.MSG_VERBOSE)
val res = java.executeJava()
if (failOnError && res != 0)
diff --git a/src/compiler/scala/tools/nsc/CompileClient.scala b/src/compiler/scala/tools/nsc/CompileClient.scala
index e436d7b..8709f8f 100644
--- a/src/compiler/scala/tools/nsc/CompileClient.scala
+++ b/src/compiler/scala/tools/nsc/CompileClient.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: CompileClient.scala 15427 2008-06-24 12:45:25Z odersky $
+// $Id: CompileClient.scala 16265 2008-10-15 14:18:29Z cunei $
package scala.tools.nsc
@@ -93,26 +93,30 @@ class StandardCompileClient {
}
val socket = if (serverAdr == "") compileSocket.getOrCreateSocket(vmArgs, !shutdown)
else compileSocket.getSocket(serverAdr)
- if (shutdown && (socket==null)) {
- Console.println("[No compilation server running.]")
- return 0
- }
- val out = new PrintWriter(socket.getOutputStream(), true)
- val in = new BufferedReader(new InputStreamReader(socket.getInputStream()))
- out.println(compileSocket.getPassword(socket.getPort()))
- out.println(args.mkString("", "\0", ""))
var sawerror = false
- var fromServer = in.readLine()
- while (fromServer ne null) {
- if (compileSocket.errorPattern.matcher(fromServer).matches)
+ if (socket eq null) {
+ if (shutdown) {
+ Console.println("[No compilation server running.]")
+ } else {
+ Console.println("Compilation failed.")
sawerror = true
- Console.println(fromServer)
- fromServer = in.readLine()
+ }
+ } else {
+ val out = new PrintWriter(socket.getOutputStream(), true)
+ val in = new BufferedReader(new InputStreamReader(socket.getInputStream()))
+ out.println(compileSocket.getPassword(socket.getPort()))
+ out.println(args.mkString("", "\0", ""))
+ var fromServer = in.readLine()
+ while (fromServer ne null) {
+ if (compileSocket.errorPattern.matcher(fromServer).matches)
+ sawerror = true
+ Console.println(fromServer)
+ fromServer = in.readLine()
+ }
+ in.close()
+ out.close()
+ socket.close()
}
- in.close()
- out.close()
- socket.close()
-
if (sawerror) 1 else 0
}
diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala
index a05398e..6ad0aa7 100644
--- a/src/compiler/scala/tools/nsc/CompileServer.scala
+++ b/src/compiler/scala/tools/nsc/CompileServer.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: CompileServer.scala 14416 2008-03-19 01:17:25Z mihaylov $
+// $Id: CompileServer.scala 16313 2008-10-22 09:46:19Z cunei $
package scala.tools.nsc
@@ -35,8 +35,6 @@ class StandardCompileServer extends SocketServer {
var shutDown: Boolean = false
private var compiler: Global = null
- private var inSession: Boolean = false
- private var progress: Boolean = false
private def settingsAreCompatible(s1: Settings, s2: Settings) = s1 == s2
@@ -46,20 +44,6 @@ class StandardCompileServer extends SocketServer {
Predef.exit(code)
}
- private def spawnWatchDog(): Unit = spawn {
- while (true) {
- Thread.sleep(10000)
- if (!compileSocket.portFile(port).exists() && !inSession) {
- progress = false
- spawn {
- Thread.sleep(10000)
- if (!progress)
- fatal("port file no longer exists; exiting")
- }
- }
- }
- }
-
private val runtime = Runtime.getRuntime()
var reporter: ConsoleReporter = _
@@ -71,6 +55,10 @@ class StandardCompileServer extends SocketServer {
override def inform(msg: String) = out.println(msg)
}
+ override def timeout() {
+ if (!compileSocket.portFile(port).exists())
+ fatal("port file no longer exists; skipping cleanup")
+ }
protected def newOfflineCompilerCommand(
arguments: List[String],
@@ -89,74 +77,65 @@ class StandardCompileServer extends SocketServer {
val guessedPassword = in.readLine()
val input = in.readLine()
if ((input ne null) && password == guessedPassword) {
- try {
- inSession = true
- progress = true
- val args = input.split("\0",-1).toList
- if (args contains "-shutdown") {
- out.println("[Compile server exited]")
- shutDown = true
- return
- }
- if (args contains "-reset") {
- out.println("[Compile server was reset]")
- compiler = null
- return
- }
- def error(msg: String) {
- out.println(/*new Position*/ FakePos("fsc"),
- msg + "\n fsc -help gives more information")
- }
- val command = newOfflineCompilerCommand(args, new Settings(error), error, false)
-
- reporter = new ConsoleReporter(command.settings, in, out) {
- // disable prompts, so that compile server cannot block
- override def displayPrompt = ()
- }
-
- if (command.settings.version.value)
- reporter.info(null, versionMsg, true)
- else if (command.settings.help.value || command.settings.Xhelp.value) {
- if (command.settings.help.value) reporter.info(null, command.usageMsg, true)
- if (command.settings.Xhelp.value) reporter.info(null, command.xusageMsg, true)
- }
- else if (command.files.isEmpty)
- reporter.info(null, command.usageMsg, true)
- else {
- try {
- if ((compiler ne null) && settingsAreCompatible(command.settings, compiler.settings)) {
- compiler.settings = command.settings
- compiler.reporter = reporter
- } else {
- if (args contains "-verbose")
- out.println("[Starting new compile server instance]")
- compiler = newGlobal(command.settings, reporter)
- }
- val c = compiler
- val run = new c.Run
- run compile command.files
- } catch {
- case ex @ FatalError(msg) =>
- if (command.settings.debug.value)
- ex.printStackTrace(out);
+ val args = input.split("\0",-1).toList
+ if (args contains "-shutdown") {
+ out.println("[Compile server exited]")
+ shutDown = true
+ return
+ }
+ if (args contains "-reset") {
+ out.println("[Compile server was reset]")
+ compiler = null
+ return
+ }
+ def error(msg: String) {
+ out.println(/*new Position*/ FakePos("fsc"),
+ msg + "\n fsc -help gives more information")
+ }
+ val command = newOfflineCompilerCommand(args, new Settings(error), error, false)
+
+ reporter = new ConsoleReporter(command.settings, in, out) {
+ // disable prompts, so that compile server cannot block
+ override def displayPrompt = ()
+ }
+
+ if (command.shouldStopWithInfo) {
+ reporter.info(null,
+ command.getInfoMessage(newGlobal(command.settings, reporter)), true)
+ } else if (command.files.isEmpty)
+ reporter.info(null, command.usageMsg, true)
+ else {
+ try {
+ if ((compiler ne null) && settingsAreCompatible(command.settings, compiler.settings)) {
+ compiler.settings = command.settings
+ compiler.reporter = reporter
+ } else {
+ if (args contains "-verbose")
+ out.println("[Starting new compile server instance]")
+ compiler = newGlobal(command.settings, reporter)
+ }
+ val c = compiler
+ val run = new c.Run
+ run compile command.files
+ } catch {
+ case ex @ FatalError(msg) =>
+ if (command.settings.debug.value)
+ ex.printStackTrace(out);
reporter.error(null, "fatal error: " + msg)
compiler = null
- case ex: Throwable =>
- ex.printStackTrace(out);
+ case ex: Throwable =>
+ ex.printStackTrace(out);
reporter.error(null, "fatal error (server aborted): " + ex.getMessage())
shutDown = true
+ }
+ reporter.printSummary()
+ runtime.gc()
+ if ((runtime.totalMemory() - runtime.freeMemory()).toDouble /
+ runtime.maxMemory().toDouble > MaxCharge) compiler = null
}
- reporter.printSummary()
- runtime.gc()
- if ((runtime.totalMemory() - runtime.freeMemory()).toDouble /
- runtime.maxMemory().toDouble > MaxCharge) compiler = null
- }
- } finally {
- inSession = false
- }
}
}
-
+
/** A directory holding redirected output */
private val redirectDir = new File(compileSocket.tmpDir, "output-redirects")
redirectDir.mkdirs
@@ -174,7 +153,6 @@ class StandardCompileServer extends SocketServer {
redirect(System.setErr, "scala-compile-server-err.log")
System.err.println("...starting server on socket "+port+"...")
System.err.flush()
- spawnWatchDog()
compileSocket.setPort(port)
run()
compileSocket.deletePort(port)
diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala
index 9cb5082..854a64d 100644
--- a/src/compiler/scala/tools/nsc/CompileSocket.scala
+++ b/src/compiler/scala/tools/nsc/CompileSocket.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: CompileSocket.scala 14416 2008-03-19 01:17:25Z mihaylov $
+// $Id: CompileSocket.scala 16267 2008-10-15 15:05:21Z cunei $
package scala.tools.nsc
@@ -205,9 +205,9 @@ class CompileSocket {
} else {
val port = if(create) getPort(vmArgs) else pollPort()
if(port < 0) return null
- val hostName = InetAddress.getLocalHost().getHostName()
+ val hostAdr = InetAddress.getLocalHost()
try {
- val result = new Socket(hostName, port)
+ val result = new Socket(hostAdr, port)
info("[Connected to compilation daemon at port " + port + "]")
result
} catch {
diff --git a/src/compiler/scala/tools/nsc/CompilerCommand.scala b/src/compiler/scala/tools/nsc/CompilerCommand.scala
index 8512bd4..7e005e2 100644
--- a/src/compiler/scala/tools/nsc/CompilerCommand.scala
+++ b/src/compiler/scala/tools/nsc/CompilerCommand.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: CompilerCommand.scala 15120 2008-05-20 20:31:20Z odersky $
+// $Id: CompilerCommand.scala 16263 2008-10-15 13:58:23Z cunei $
package scala.tools.nsc
@@ -66,6 +66,36 @@ class CompilerCommand(arguments: List[String], val settings: Settings,
"\n")
}
+ // If any of these settings is set, the compiler shouldn't
+ // start; an informative message of some sort
+ // should be printed instead.
+ // (note: do not add "files.isEmpty" do this list)
+ val stopSettings=List[(()=>Boolean,
+ (Global)=>String)](
+ (()=> settings.help.value, compiler =>
+ usageMsg + compiler.pluginOptionsHelp
+ ),
+ (()=> settings.Xhelp.value, compiler =>
+ xusageMsg
+ ),
+ (()=> settings.Yhelp.value, compiler =>
+ yusageMsg
+ ),
+ (()=> settings.showPlugins.value, compiler =>
+ compiler.pluginDescriptions
+ ),
+ (()=> settings.showPhases.value, compiler =>
+ compiler.phaseDescriptions
+ )
+ )
+
+ def shouldStopWithInfo = stopSettings.exists({pair => (pair._1)()})
+ def getInfoMessage(compiler:Global) =
+ stopSettings.find({pair => (pair._1)()}) match {
+ case Some((test,getMessage)) => getMessage(compiler)
+ case None => ""
+ }
+
/** Whether the command was processed okay */
var ok = true
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index c4f3336..ec0a75f 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Global.scala 15897 2008-08-22 15:42:17Z washburn $
+// $Id: Global.scala 16595 2008-11-21 16:50:31Z washburn $
package scala.tools.nsc
@@ -23,7 +23,6 @@ import plugins.Plugins
import ast._
import ast.parser._
import typechecker._
-//import matching.TransMatcher
import transform._
import backend.icode.{ICodes, GenICode, Checkers}
import backend.ScalaPrimitives
@@ -313,10 +312,6 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
val global: Global.this.type = Global.this
} with TailCalls
- //object transMatcher extends {
- // val global: Global.this.type = Global.this
- //} with TransMatcher
-
// object checkDefined extends {
// val global: Global.this.type = Global.this
// } with CheckDefined
@@ -421,14 +416,14 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
explicitOuter, // replace C.this by explicit outer pointers, eliminate pattern matching
// checkDefined,
erasure, // erase generic types to Java 1.4 types, add interfaces for traits
- lazyVals,
+ lazyVals, // transforms local lazy vals into vars and initialized bits
lambdaLift, // move nested functions to top level
// detach,
constructors // move field definitions into constructors
) ::: (
if (forMSIL) List() else List(flatten) // get rid of inner classes
) ::: List(
- mixer, // do mixin composition
+ mixer, // do mixin composition, translate lazy fields
cleanup, // some platform-specific cleanups
genicode, // generate portable intermediate code
@@ -587,11 +582,18 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
if (settings.browse contains globalPhase.name) treeBrowser.browse(units)
informTime(globalPhase.description, startTime)
globalPhase = globalPhase.next
- if (settings.check contains globalPhase.name) {
- phase = globalPhase
- if (globalPhase.id >= icodePhase.id) icodeChecker.checkICodes
- else checker.checkTrees
+
+ if ((settings.check contains globalPhase.prev.name) ||
+ (settings.check contains "all")) {
+ if (globalPhase.prev.checkable) {
+ phase = globalPhase
+ if (globalPhase.id >= icodePhase.id) icodeChecker.checkICodes
+ else checker.checkTrees
+ } else if (!(settings.check contains "all")) {
+ warning("It is not possible to check the result of the "+globalPhase.name+" phase")
+ }
}
+
if (settings.statistics.value) statistics.print(phase)
advancePhase
}
@@ -652,17 +654,19 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
def compile(filenames: List[String]) {
try {
- val scriptMain = settings.script.value
- if (scriptMain != "" && filenames.length != 1)
- error("can only compile one script at a time")
- val sources = filenames map (
- if (scriptMain != "")
- (x => ScriptRunner.wrappedScript(scriptMain, x, getSourceFile _))
- else
- getSourceFile)
- compileSources(sources)
+ val scriptMain = settings.script.value
+ // Are we compiling a script?
+ if (scriptMain != "") {
+ if(filenames.length != 1)
+ error("can only compile one script at a time")
+ val scriptFile =
+ ScriptRunner.wrappedScript(scriptMain, filenames.head, getSourceFile)
+ compileSources(List(scriptFile))
+ // No we are compiling regular source files
+ } else {
+ compileSources(filenames map getSourceFile)
+ }
} catch {
- case ScriptRunner.ScriptException(msg) => error(msg)
case ex: IOException => error(ex.getMessage())
}
}
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 597f5f3..cd12ec4 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Interpreter.scala 16294 2008-10-19 11:55:44Z washburn $
+// $Id: Interpreter.scala 16292 2008-10-18 21:32:45Z washburn $
package scala.tools.nsc
diff --git a/src/compiler/scala/tools/nsc/Main.scala b/src/compiler/scala/tools/nsc/Main.scala
index 96504fe..cd4333c 100644
--- a/src/compiler/scala/tools/nsc/Main.scala
+++ b/src/compiler/scala/tools/nsc/Main.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Main.scala 14268 2008-03-05 13:30:27Z washburn $
+// $Id: Main.scala 16263 2008-10-15 13:58:23Z cunei $
package scala.tools.nsc
@@ -59,25 +59,14 @@ object Main extends AnyRef with EvalLoop {
reporter.flush()
return
}
-
- if (command.settings.help.value || command.settings.Xhelp.value || command.settings.Yhelp.value) {
- if (command.settings.help.value) {
- reporter.info(null, command.usageMsg, true)
- reporter.info(null, compiler.pluginOptionsHelp, true)
- }
- if (command.settings.Xhelp.value)
- reporter.info(null, command.xusageMsg, true)
- if (command.settings.Yhelp.value)
- reporter.info(null, command.yusageMsg, true)
- } else if (command.settings.showPlugins.value)
- reporter.info(null, compiler.pluginDescriptions, true)
- else if (command.settings.showPhases.value)
- reporter.info(null, compiler.phaseDescriptions, true)
- else {
+
+ if (command.shouldStopWithInfo) {
+ reporter.info(null, command.getInfoMessage(compiler), true)
+ } else {
if (command.settings.resident.value)
resident(compiler)
else if (command.files.isEmpty) {
- reporter.info(null, command.usageMsg, true)
+ reporter.info(null, command.usageMsg, true)
reporter.info(null, compiler.pluginOptionsHelp, true)
} else {
val run = new compiler.Run
diff --git a/src/compiler/scala/tools/nsc/MainGenericRunner.scala b/src/compiler/scala/tools/nsc/MainGenericRunner.scala
index a2db842..f8b45d6 100644
--- a/src/compiler/scala/tools/nsc/MainGenericRunner.scala
+++ b/src/compiler/scala/tools/nsc/MainGenericRunner.scala
@@ -3,11 +3,11 @@
* @author Lex Spoon
*/
-// $Id: MainGenericRunner.scala 15196 2008-05-25 15:02:28Z spoon $
+// $Id: MainGenericRunner.scala 16595 2008-11-21 16:50:31Z washburn $
package scala.tools.nsc
-import java.io.File
+import java.io.{File, IOException}
import java.lang.{ClassNotFoundException, NoSuchMethodException}
import java.lang.reflect.InvocationTargetException
import java.net.URL
@@ -29,22 +29,31 @@ object MainGenericRunner {
private def addClasspathExtras(classpath: String): String = {
val scalaHome = Properties.scalaHome
- val extraClassPath =
+ val extraClassPath =
if (scalaHome eq null)
""
else {
- val libdir = new File(new File(scalaHome), "lib")
- if (!libdir.exists || libdir.isFile)
- return classpath
-
- val filesInLib = libdir.listFiles
- val jarsInLib =
- filesInLib.filter(f =>
- f.isFile && f.getName.endsWith(".jar"))
-
- jarsInLib.mkString("", File.pathSeparator, "")
- }
-
+ def listDir(name:String):Array[File] = {
+ val libdir = new File(new File(scalaHome), name)
+ if (!libdir.exists || libdir.isFile)
+ Array()
+ else
+ libdir.listFiles
+ }
+ {
+ val filesInLib = listDir("lib")
+ val jarsInLib =
+ filesInLib.filter(f =>
+ f.isFile && f.getName.endsWith(".jar"))
+ jarsInLib.toList
+ } ::: {
+ val filesInClasses = listDir("classes")
+ val dirsInClasses =
+ filesInClasses.filter(f => f.isDirectory)
+ dirsInClasses.toList
+ }
+ }.mkString("", File.pathSeparator, "")
+
if (classpath == "")
extraClassPath + File.pathSeparator + "."
else
@@ -77,32 +86,14 @@ object MainGenericRunner {
return
}
-
- if (settings.help.value || settings.Xhelp.value || settings.Yhelp.value) {
- if (command.settings.help.value) {
- println(command.usageMsg)
- println(sampleCompiler.pluginOptionsHelp)
- }
-
- if (settings.Xhelp.value)
- println(command.xusageMsg)
-
- if (settings.Yhelp.value)
- println(command.yusageMsg)
-
- return
- }
-
-
- if (settings.showPhases.value) {
- println(sampleCompiler.phaseDescriptions)
- return
- }
-
- if (settings.showPlugins.value) {
- println(sampleCompiler.pluginDescriptions)
+ if (command.shouldStopWithInfo) {
+ Console.println(command.getInfoMessage(sampleCompiler))
return
}
+
+ def exitSuccess : Nothing = exit(0)
+ def exitFailure : Nothing = exit(1)
+ def exitCond(b: Boolean) : Nothing = if(b) exitSuccess else exitFailure
def fileToURL(f: File): Option[URL] =
try { Some(f.toURL) }
@@ -142,9 +133,9 @@ object MainGenericRunner {
case _ if settings.execute.value != "" =>
val fullArgs =
command.thingToRun.toList ::: command.arguments
- ScriptRunner.runCommand(settings,
- settings.execute.value,
- fullArgs)
+ exitCond(ScriptRunner.runCommand(settings,
+ settings.execute.value,
+ fullArgs))
case None =>
(new InterpreterLoop).main(settings)
@@ -159,28 +150,31 @@ object MainGenericRunner {
}
if (isObjectName) {
-
try {
ObjectRunner.run(classpath, thingToRun, command.arguments)
} catch {
case e: ClassNotFoundException =>
Console.println(e)
- exit(1)
+ exitFailure
case e: NoSuchMethodException =>
Console.println(e)
- exit(1)
+ exitFailure
case e: InvocationTargetException =>
e.getCause.printStackTrace
- exit(1)
+ exitFailure
}
-
} else {
try {
- ScriptRunner.runScript(settings, thingToRun, command.arguments)
+ exitCond(ScriptRunner.runScript(settings,
+ thingToRun,
+ command.arguments))
} catch {
+ case e: IOException =>
+ Console.println(e.getMessage())
+ exitFailure
case e: SecurityException =>
Console.println(e)
- exit(1)
+ exitFailure
}
}
}
diff --git a/src/compiler/scala/tools/nsc/Phase.scala b/src/compiler/scala/tools/nsc/Phase.scala
index b3df128..5495d4c 100644
--- a/src/compiler/scala/tools/nsc/Phase.scala
+++ b/src/compiler/scala/tools/nsc/Phase.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Phase.scala 15238 2008-05-30 18:00:25Z odersky $
+// $Id: Phase.scala 16003 2008-09-03 10:07:36Z washburn $
package scala.tools.nsc
@@ -31,6 +31,8 @@ abstract class Phase(val prev: Phase) {
def name: String
def description: String = name
+ // Will running with -Ycheck:name work?
+ def checkable: Boolean = true
def devirtualized: Boolean = false
def erasedTypes: Boolean = false
def flatClasses: Boolean = false
diff --git a/src/compiler/scala/tools/nsc/ScriptRunner.scala b/src/compiler/scala/tools/nsc/ScriptRunner.scala
index 60a9301..66d55ab 100644
--- a/src/compiler/scala/tools/nsc/ScriptRunner.scala
+++ b/src/compiler/scala/tools/nsc/ScriptRunner.scala
@@ -2,13 +2,13 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: ScriptRunner.scala 15897 2008-08-22 15:42:17Z washburn $
+// $Id: ScriptRunner.scala 16595 2008-11-21 16:50:31Z washburn $
package scala.tools.nsc
import java.io.{BufferedReader, File, FileInputStream, FileOutputStream,
FileReader, InputStreamReader, PrintWriter,
- FileWriter}
+ FileWriter, IOException}
import java.lang.reflect.InvocationTargetException
import java.net.URL
import java.util.jar.{JarEntry, JarOutputStream}
@@ -47,9 +47,6 @@ object ScriptRunner {
/** Default name to use for the wrapped script */
val defaultScriptMain = "Main"
- /** Exception used internally */
- case class ScriptException(msg: String) extends Exception
-
/** Pick a main object name from the specified settings */
def scriptMain(settings: Settings) =
if (settings.script.value == "")
@@ -135,9 +132,8 @@ object ScriptRunner {
val matcher =
(Pattern.compile("^(::)?!#.*(\\r|\\n|\\r\\n)", Pattern.MULTILINE)
.matcher(fileContents))
- if (! matcher.find)
- throw ScriptException("script file does not close its header with !# or ::!#")
-
+ if (!matcher.find)
+ throw new IOException("script file does not close its header with !# or ::!#")
return matcher.end
}
@@ -270,12 +266,13 @@ object ScriptRunner {
/** Compile a script and then run the specified closure with
* a classpath for the compiled script.
+ *
+ * @returns true if compilation and the handler succeeds, false otherwise.
*/
private def withCompiledScript
(settings: GenericRunnerSettings, scriptFile: String)
- (handler: String => Unit)
- : Unit =
- {
+ (handler: String => Boolean)
+ : Boolean = {
import Interpreter.deleteRecursively
/* If the script is running on pre-jvm-1.5 JVM,
@@ -344,25 +341,27 @@ object ScriptRunner {
} else {
// jar failed; run directly from the class files
handler(compiledPath.getPath)
- }
- case None => ()
+ }
+ case None => false
}
}
} else {
// don't use a cache jar at all--just use the class files
compile match {
case Some(compiledPath) => handler(compiledPath.getPath)
- case None => ()
+ case None => false
}
}
}
- /** Run a script after it has been compiled */
+ /** Run a script after it has been compiled
+ *
+ * @returns true if execution succeeded, false otherwise
+ */
private def runCompiled(settings: GenericRunnerSettings,
compiledLocation: String,
- scriptArgs: List[String])
- {
+ scriptArgs: List[String]) : Boolean = {
def fileToURL(f: File): Option[URL] =
try { Some(f.toURL) }
catch { case e => Console.err.println(e); None }
@@ -383,44 +382,50 @@ object ScriptRunner {
classpath,
scriptMain(settings),
scriptArgs.toArray)
+ true
} catch {
+ case e: ClassNotFoundException =>
+ Console.println(e)
+ false
+ case e: NoSuchMethodException =>
+ Console.println(e)
+ false
case e:InvocationTargetException =>
e.getCause.printStackTrace
- exit(1)
+ false
}
}
/** Run a script file with the specified arguments and compilation
* settings.
+ *
+ * @returns true if compilation and execution succeeded, false otherwise.
*/
- def runScript(
- settings: GenericRunnerSettings,
- scriptFile: String,
- scriptArgs: List[String])
- {
+ def runScript(settings: GenericRunnerSettings,
+ scriptFile: String,
+ scriptArgs: List[String]) : Boolean = {
val f = new File(scriptFile)
if (!f.isFile) {
- Console.err.println("no such file: " + scriptFile)
- return
- }
-
- try {
- withCompiledScript(settings, scriptFile){compiledLocation =>
- runCompiled(settings, compiledLocation, scriptArgs)
+ throw new IOException("no such file: " + scriptFile)
+ } else {
+ try {
+ withCompiledScript(settings, scriptFile){compiledLocation =>
+ runCompiled(settings, compiledLocation, scriptArgs)
+ }
+ } catch {
+ case e => throw e
}
- } catch {
- case ScriptException(msg) => Console.err.println(msg)
- case e => throw e
}
}
- /** Run a command */
- def runCommand(
- settings: GenericRunnerSettings,
- command: String,
- scriptArgs: List[String])
- {
+ /** Run a command
+ *
+ * @returns true if compilation and execution succeeded, false otherwise.
+ */
+ def runCommand(settings: GenericRunnerSettings,
+ command: String,
+ scriptArgs: List[String]) : Boolean = {
val scriptFile = File.createTempFile("scalacmd", ".scala")
// save the command to the file
@@ -432,14 +437,10 @@ object ScriptRunner {
try {
withCompiledScript(settings, scriptFile.getPath){compiledLocation =>
- scriptFile.delete()
runCompiled(settings, compiledLocation, scriptArgs)
- }
+ }
} catch {
- case ScriptException(msg) => Console.err.println(msg)
case e => throw e
- }
-
- scriptFile.delete() // in case there was a compilation error
+ } finally scriptFile.delete() // in case there was a compilation error
}
}
diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala
index ad67873..d91f045 100644
--- a/src/compiler/scala/tools/nsc/Settings.scala
+++ b/src/compiler/scala/tools/nsc/Settings.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Settings.scala 16445 2008-10-30 18:16:14Z odersky $
+// $Id: Settings.scala 16493 2008-11-04 22:36:38Z DRMacIver $
package scala.tools.nsc
@@ -152,8 +152,6 @@ class Settings(error: String => Unit) {
val Xwarndeadcode = BooleanSetting ("-Ywarn-dead-code", "Emit warnings for dead code")
val Ynogenericsig = BooleanSetting ("-Yno-generic-signatures", "Suppress generation of generic signatures for Java")
- val Xcasetags = ChoiceSetting("-Ycasetags", "test integer tags for case classes", List("on","off"),
- /*default*/"off").hideToIDE
val XnoVarargsConversion = BooleanSetting("-Xno-varargs-conversion", "disable varags conversion")
val selfInAnnots = BooleanSetting ("-Yself-in-annots", "Include a \"self\" identifier inside of annotations")
diff --git a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
index 963e1e8..dd32e69 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: TreeBrowsers.scala 15235 2008-05-30 09:54:49Z rytz $
+// $Id: TreeBrowsers.scala 16315 2008-10-22 12:49:56Z rytz $
package scala.tools.nsc.ast
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
index b55e38c..827f9d5 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: TreeGen.scala 15238 2008-05-30 18:00:25Z odersky $
+// $Id: TreeGen.scala 16168 2008-09-28 07:56:50Z odersky $
package scala.tools.nsc.ast
@@ -301,6 +301,8 @@ abstract class TreeGen {
def mkForwarder(target: Tree, vparamss: List[List[Symbol]]) =
(target /: vparamss)((fn, vparams) => Apply(fn, vparams map paramToArg))
+ /** Used in situations where you need to access value of an expression several times
+ */
def evalOnce(expr: Tree, owner: Symbol, unit: CompilationUnit)(within: (() => Tree) => Tree): Tree =
if (treeInfo.isPureExpr(expr)) {
within(() => expr);
diff --git a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
index e569737..af373e4 100644
--- a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: TreePrinters.scala 15894 2008-08-22 15:24:57Z washburn $
+// $Id: TreePrinters.scala 15893 2008-08-22 15:23:54Z washburn $
package scala.tools.nsc.ast
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index 80f8849..245cf69 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Trees.scala 15799 2008-08-15 18:23:54Z odersky $
+// $Id: Trees.scala 16315 2008-10-22 12:49:56Z rytz $
package scala.tools.nsc.ast
@@ -45,9 +45,14 @@ trait Trees {
// modifiers --------------------------------------------------------
+ /** @param privateWithin the qualifier for a private (a type name)
+ * or nme.EMPTY.toTypeName, if none is given.
+ * @param annotations the annotations for the definition
+ * (i.e things starting with @)
+ */
case class Modifiers(flags: Long, privateWithin: Name, annotations: List[Annotation]) {
- def isCovariant = hasFlag(COVARIANT )
- def isContravariant = hasFlag(CONTRAVARIANT)
+ def isCovariant = hasFlag(COVARIANT ) // marked with `+'
+ def isContravariant = hasFlag(CONTRAVARIANT) // marked with `-'
def isPrivate = hasFlag(PRIVATE )
def isProtected = hasFlag(PROTECTED)
def isVariable = hasFlag(MUTABLE )
@@ -101,7 +106,10 @@ trait Trees {
def pos = rawpos
- var tpe: Type = _
+ private[this] var rawtpe: Type = _
+
+ def tpe = rawtpe
+ def tpe_=(t: Type) = rawtpe = t
def setPos(pos: Position): this.type = { rawpos = pos; this }
def setType(tp: Type): this.type = {
@@ -285,7 +293,9 @@ trait Trees {
/** The empty tree */
case object EmptyTree extends TermTree {
- tpe = NoType
+ super.tpe_=(NoType)
+ override def tpe_=(t: Type) =
+ if (t != NoType) throw new Error("tpe_=("+t+") inapplicable for <empty>")
override def isEmpty = true
}
@@ -327,7 +337,6 @@ trait Trees {
*/
def ClassDef(sym: Symbol, impl: Template): ClassDef =
posAssigner.atPos(sym.pos) {
- var flags = sym.flags
ClassDef(Modifiers(sym.flags),
sym.name,
sym.typeParams map TypeDef,
@@ -500,7 +509,7 @@ trait Trees {
case class Import(expr: Tree, selectors: List[(Name, Name)])
extends SymTree
// The symbol of an Import is an import symbol @see Symbol.newImport
- // It's used primarily as a marker to check thta the import has been typechecked.
+ // It's used primarily as a marker to check that the import has been typechecked.
/** Annotation application (constructor arguments + name-value pairs) */
case class Annotation(constr: Tree, elements: List[Tree])
@@ -537,19 +546,32 @@ trait Trees {
// System.err.println("TEMPLATE: " + parents)
}
- /**
- * @param parents ...
- * @param vparamss ...
- * @param argss ...
- * @param body ...
- * @return ...
+ /** Generates a template with constructor corresponding to
+ *
+ * constrmods (vparams1_) ... (vparams_n) preSuper { presupers }
+ * extends superclass(args_1) ... (args_n) with mixins { self => body }
+ *
+ * This gets translated to
+ *
+ * extends superclass with mixins { self =>
+ * presupers' // presupers without rhs
+ * vparamss // abstract fields corresponding to value parameters
+ * def <init>(vparamss) {
+ * presupers
+ * super.<init>(args)
+ * }
+ * body
+ * }
*/
def Template(parents: List[Tree], self: ValDef, constrMods: Modifiers, vparamss: List[List[ValDef]], argss: List[List[Tree]], body: List[Tree]): Template = {
- /** Add constructor to template */
+ /* Add constructor to template */
+
+ // create parameters for <init>
var vparamss1 =
vparamss map (vps => vps.map { vd =>
- val ret = ValDef(Modifiers(vd.mods.flags & IMPLICIT | PARAM) withAnnotations vd.mods.annotations,
- vd.name, vd.tpt.duplicate, EmptyTree).setPos(vd.pos)
+ val ret = ValDef(
+ Modifiers(vd.mods.flags & IMPLICIT | PARAM) withAnnotations vd.mods.annotations,
+ vd.name, vd.tpt.duplicate, EmptyTree).setPos(vd.pos)
if (inIDE && vd.symbol != NoSymbol)
ret.symbol = vd.symbol
ret
@@ -568,6 +590,7 @@ trait Trees {
else List(
DefDef(NoMods, nme.MIXIN_CONSTRUCTOR, List(), List(List()), TypeTree(), Block(lvdefs, Literal(()))))
} else {
+ // convert (implicit ... ) to ()(implicit ... ) if its the only parameter section
if (vparamss1.isEmpty ||
!vparamss1.head.isEmpty && (vparamss1.head.head.mods.flags & IMPLICIT) != 0)
vparamss1 = List() :: vparamss1;
@@ -838,30 +861,44 @@ trait Trees {
override def equalsStructure0(that: Tree)(f : (Tree,Tree) => Boolean): Boolean = this eq that
}
-/* A standard pattern match
+/* A standard pattern match
case EmptyTree =>
case PackageDef(name, stats) =>
// package name { stats }
case ClassDef(mods, name, tparams, impl) =>
- // mods class name[tparams] impl
+ // mods class name [tparams] impl where impl = extends parents { defs }
case ModuleDef(mods, name, impl) => (eliminated by refcheck)
// mods object name impl where impl = extends parents { defs }
case ValDef(mods, name, tpt, rhs) =>
- // mods val name: tpt = rhs
+ // mods val name: tpt = rhs
+ // note missing type information is expressed by tpt = TypeTree()
case DefDef(mods, name, tparams, vparamss, tpt, rhs) =>
- // mods def name[tparams](vparams): tpt = rhs
+ // mods def name[tparams](vparams_1)...(vparams_n): tpt = rhs
+ // note missing type information is expressed by tpt = TypeTree()
case TypeDef(mods, name, tparams, rhs) => (eliminated by erasure)
// mods type name[tparams] = rhs
+ // mods type name[tparams] >: lo <: hi, where lo, hi are in a TypeBoundsTree,
+ and DEFERRED is set in mods
case LabelDef(name, params, rhs) =>
// used for tailcalls and like
+ // while/do are desugared to label defs as follows:
+ // while (cond) body ==> LabelDef($L, List(), if (cond) { body; L$() } else ())
+ // do body while (cond) ==> LabelDef($L, List(), body; if (cond) L$() else ())
case Import(expr, selectors) => (eliminated by typecheck)
// import expr.{selectors}
+ // Selectors are a list of pairs of names (from, to).
+ // The last (and maybe only name) may be a nme.WILDCARD
+ // for instance
+ // import qual.{x, y => z, _} would be represented as
+ // Import(qual, List(("x", "x"), ("y", "z"), (WILDCARD, null)))
case Annotation(constr, elements) =>
- // @constr(elements) where constr = tp(args), elements = { val x1 = c1, ..., val xn = cn }
+ // @constr(elements) where constr = tp(args), (an instance of Apply)
+ // elements = { val x1 = c1, ..., val xn = cn }
case DocDef(comment, definition) => (eliminated by typecheck)
// /** comment */ definition
case Template(parents, self, body) =>
// extends parents { self => body }
+ // if self is missing it is represented as emptyValDef
case Block(stats, expr) =>
// { stats; expr }
case CaseDef(pat, guard, body) => (eliminated by transmatch/explicitouter)
@@ -878,6 +915,11 @@ trait Trees {
// used for unapply's
case ArrayValue(elemtpt, trees) => (introduced by uncurry)
// used to pass arguments to vararg arguments
+ // for instance, printf("%s%d", foo, 42) is translated to after uncurry to:
+ // Apply(
+ // Ident("printf"),
+ // Literal("%s%d"),
+ // ArrayValue(<Any>, List(Ident("foo"), Literal(42))))
case Function(vparams, body) => (eliminated by lambdaLift)
// vparams => body where vparams:List[ValDef]
case Assign(lhs, rhs) =>
@@ -893,27 +935,30 @@ trait Trees {
case Throw(expr) =>
// throw expr
case New(tpt) =>
- // new tpt always in the context: new tpt.<init>[targs](args)
+ // new tpt always in the context: (new tpt).<init>[targs](args)
case Typed(expr, tpt) => (eliminated by erasure)
// expr: tpt
case TypeApply(fun, args) =>
// fun[args]
case Apply(fun, args) =>
// fun(args)
+ // for instance fun[targs](args) is expressed as Apply(TypeApply(fun, targs), args)
case ApplyDynamic(qual, args) (introduced by erasure, eliminated by cleanup)
// fun(args)
case Super(qual, mix) =>
- // qual.super[mix]
+ // qual.super[mix] if qual and/or mix is empty, ther are nme.EMPTY.toTypeName
case This(qual) =>
// qual.this
case Select(qualifier, selector) =>
// qualifier.selector
case Ident(name) =>
// name
+ // note: type checker converts idents that refer to enclosing fields or methods
+ // to selects; name ==> this.name
case Literal(value) =>
// value
case TypeTree() => (introduced by refcheck)
- // a type that's not written out, but given in the attribute
+ // a type that's not written out, but given in the tpe attribute
case Annotated(annot, arg) => (eliminated by typer)
// arg @annot for types, arg: @annot for exprs
case SingletonTypeTree(ref) => (eliminated by uncurry)
@@ -924,9 +969,10 @@ trait Trees {
// parent1 with ... with parentN { refinement }
case AppliedTypeTree(tpt, args) => (eliminated by uncurry)
// tpt[args]
- case TypeBoundsTree(lo, hi) => (eliminated by uncurry)
+ case TypeBoundsTree(lo, hi) => (eliminated by uncurry)
// >: lo <: hi
- case ExistentialTypeTree(tpt, whereClauses) =>
+ case ExistentialTypeTree(tpt, whereClauses) => (eliminated by uncurry)
+ // tpt forSome { whereClauses }
*/
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index e3e5b36..cdead67 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -2,13 +2,14 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Parsers.scala 15798 2008-08-15 16:27:10Z odersky $
+// $Id: Parsers.scala 16598 2008-11-22 22:35:23Z washburn $
//todo: allow infix type patterns
package scala.tools.nsc.ast.parser
-import scala.tools.nsc.util.{ListBuffer, Position, OffsetPosition, NoPosition, BatchSourceFile}
+import scala.collection.mutable.ListBuffer
+import scala.tools.nsc.util.{Position, OffsetPosition, NoPosition, BatchSourceFile}
import symtab.Flags
import Tokens._
@@ -1056,7 +1057,9 @@ trait Parsers extends NewScanners with MarkupParsers {
t = (t /: annotations(false)) (makeAnnotated)
} else {
t = atPos(pos) {
- val tpt = if (location != Local) compoundType(false) else typ()
+ val tpt =
+ if (location != Local) infixType(false, InfixMode.FirstOp)
+ else typ()
if (isWildcard(t))
(placeholderParams: @unchecked) match {
case (vd @ ValDef(mods, name, _, _)) :: rest =>
@@ -1703,6 +1706,9 @@ trait Parsers extends NewScanners with MarkupParsers {
val vds = new ListBuffer[List[ValDef]]
val pos = inCurrentPos
newLineOptWhenFollowedBy(LPAREN)
+ if (ofCaseClass && inToken != LPAREN)
+ deprecationWarning(in.currentPos, "case classes without a parameter list have been deprecated;\n"+
+ "use either case objects or case classes with `()' as parameter list.")
while (implicitmod == 0 && inToken == LPAREN) {
inNextToken
vds += paramClause()
@@ -2268,7 +2274,7 @@ trait Parsers extends NewScanners with MarkupParsers {
def templateOpt(mods: Modifiers, name: Name, constrMods: Modifiers, vparamss: List[List[ValDef]]): Template = {
val pos = inCurrentPos;
val (parents0, argss, self, body) =
- if (inToken == EXTENDS || settings.Xexperimental.value && (mods hasFlag TRAIT) && inToken == SUBTYPE) {
+ if (inToken == EXTENDS || settings.Xexperimental.value && (mods hasFlag Flags.TRAIT) && inToken == SUBTYPE) {
inNextToken
template(mods hasFlag Flags.TRAIT)
} else {
@@ -2497,7 +2503,7 @@ trait Parsers extends NewScanners with MarkupParsers {
/** CompilationUnit ::= [package QualId semi] TopStatSeq
*/
- def compilationUnit(): Tree = {
+ def compilationUnit(): Tree = checkNoEscapingPlaceholders {
var pos = inCurrentPos;
{
val ts = new ListBuffer[Tree]
@@ -2522,8 +2528,6 @@ trait Parsers extends NewScanners with MarkupParsers {
} else {
ts ++= topStatSeq()
}
- assert(placeholderParams.isEmpty)
- assert(placeholderTypes.isEmpty)
val stats = ts.toList
val usePos = if (stats.isEmpty || stats.head.pos == NoPosition) i2p(pos) else stats.head.pos
atPos(usePos) { stats match {
diff --git a/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala b/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala
index 0bf11b0..338c176 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: SyntaxAnalyzer.scala 15120 2008-05-20 20:31:20Z odersky $
+// $Id: SyntaxAnalyzer.scala 16003 2008-09-03 10:07:36Z washburn $
package scala.tools.nsc.ast.parser
@@ -17,6 +17,7 @@ abstract class SyntaxAnalyzer extends SubComponent with Parsers with MarkupParse
def newPhase(prev: Phase): StdPhase = new ParserPhase(prev)
class ParserPhase(prev: scala.tools.nsc.Phase) extends StdPhase(prev) {
+ override val checkable = false
def apply(unit: global.CompilationUnit) {
global.informProgress("parsing " + unit)
unit.body =
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 0574e75..ef65b41 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: TreeBuilder.scala 15799 2008-08-15 18:23:54Z odersky $
+// $Id: TreeBuilder.scala 16416 2008-10-29 14:55:07Z dragos $
package scala.tools.nsc.ast.parser
@@ -147,7 +147,7 @@ abstract class TreeBuilder {
val x = nme.ANON_CLASS_NAME.toTypeName
Block(
List(ClassDef(
- Modifiers(FINAL | SYNTHETIC), x, List(),
+ Modifiers(FINAL), x, List(),
Template(parents, self, NoMods, List(List()), argss, stats))),
New(Ident(x), List(List())))
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
index 7646522..1d301fb 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
@@ -3,7 +3,7 @@
* @author Martin Odersky
*/
-// $Id: BasicBlocks.scala 16401 2008-10-28 17:58:19Z dragos $
+// $Id: BasicBlocks.scala 16377 2008-10-27 16:25:50Z dragos $
package scala.tools.nsc.backend.icode
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala b/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala
index 3bd74e7..e610b50 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala
@@ -3,7 +3,7 @@
* @author Martin Odersky
*/
-// $Id: Checkers.scala 16401 2008-10-28 17:58:19Z dragos $
+// $Id: Checkers.scala 16377 2008-10-27 16:25:50Z dragos $
package scala.tools.nsc.backend.icode
diff --git a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala
index ba5ee35..7cbca64 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala
@@ -3,7 +3,7 @@
* @author Martin Odersky
*/
-// $Id: ExceptionHandlers.scala 16401 2008-10-28 17:58:19Z dragos $
+// $Id: ExceptionHandlers.scala 16377 2008-10-27 16:25:50Z dragos $
package scala.tools.nsc.backend.icode;
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 8f0e159..f8c7225 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -3,7 +3,7 @@
* @author Martin Odersky
*/
-// $Id: GenICode.scala 16182 2008-10-01 07:02:18Z rytz $
+// $Id: GenICode.scala 16570 2008-11-18 11:20:05Z dragos $
package scala.tools.nsc.backend.icode
@@ -1036,9 +1036,7 @@ abstract class GenICode extends SubComponent {
ctx.bb.emit(CALL_PRIMITIVE(Conversion(from, to)), pos);
}
} else if (from == SCALA_ALL) {
- ctx.bb.emit(DROP(from))
- ctx.bb.emit(getZeroOf(ctx.method.returnType))
- ctx.bb.emit(RETURN(ctx.method.returnType))
+ ctx.bb.emit(THROW())
ctx.bb.enterIgnoreMode
} else if (from == SCALA_ALLREF) {
ctx.bb.emit(DROP(from))
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
index 3531018..d6f6f27 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
@@ -3,7 +3,7 @@
* @author Martin Odersky
*/
-// $Id: Members.scala 16401 2008-10-28 17:58:19Z dragos $
+// $Id: Members.scala 16377 2008-10-27 16:25:50Z dragos $
package scala.tools.nsc.backend.icode
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Printers.scala b/src/compiler/scala/tools/nsc/backend/icode/Printers.scala
index 96621a2..8bb32c5 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Printers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Printers.scala
@@ -1,66 +1,64 @@
/* NSC -- new scala compiler
- * Copyright 2005 LAMP/EPFL
+ * Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Printers.scala 13239 2007-11-13 08:13:05Z dragos $
+// $Id: Printers.scala 16543 2008-11-11 15:46:36Z michelou $
-package scala.tools.nsc.backend.icode;
+package scala.tools.nsc.backend.icode
-import java.io.PrintWriter;
+import java.io.PrintWriter
-import scala.tools.nsc.util.Position;
-import scala.tools.nsc.symtab.Flags;
+import scala.tools.nsc.symtab.Flags
+import scala.tools.nsc.util.Position
trait Printers { self: ICodes =>
- // val global: Global;
- import global._;
- import global.icodes.opcodes._;
- import global.icodes._;
+ import global._
+ import global.icodes.opcodes._
+ import global.icodes._
class TextPrinter(writer: PrintWriter, lin: Linearizer) {
- var margin = 0;
- var out = writer;
+ private var margin = 0
+ private var out = writer
- final val TAB = 2;
+ final val TAB = 2
- def setWriter(w: PrintWriter) = (out = w);
+ def setWriter(w: PrintWriter) { out = w }
- def indent = margin = margin + TAB;
- def undent = margin = margin - TAB;
+ def indent { margin += TAB }
+ def undent { margin -= TAB }
- def print(s: String) = out.print(s);
- def print(o: Any): Unit = print(o.toString());
+ def print(s: String) { out.print(s) }
+ def print(o: Any) { print(o.toString()) }
- def println(s: String): Unit = {
+ def println(s: String) {
print(s);
println
}
- def println = {
- out.println();
- var i = 0;
+ def println {
+ out.println()
+ var i = 0
while (i < margin) {
print(" ");
- i = i + 1;
+ i += 1
}
}
- def printList[a](l: List[a], sep: String): Unit = l match {
- case Nil => ();
- case x :: Nil => print(x);
- case x :: xs => print(x); print(sep); printList(xs, sep);
+ def printList[A](l: List[A], sep: String): Unit = l match {
+ case Nil =>
+ case x :: Nil => print(x)
+ case x :: xs => print(x); print(sep); printList(xs, sep)
}
- def printList[a](pr: a => Unit)(l: List[a], sep: String): Unit = l match {
- case Nil => ();
- case x :: Nil => pr(x);
- case x :: xs => pr(x); print(sep); printList(pr)(xs, sep);
+ def printList[A](pr: A => Unit)(l: List[A], sep: String): Unit = l match {
+ case Nil =>
+ case x :: Nil => pr(x)
+ case x :: xs => pr(x); print(sep); printList(pr)(xs, sep)
}
-
- private var clazz : IClass = _;
- def printClass(cls: IClass): Unit = {
+ private var clazz: IClass = _
+ def printClass(cls: IClass) {
this.clazz = cls;
print(cls.symbol.toString()); print(" extends ");
printList(cls.symbol.info.parents, ", ");
@@ -70,43 +68,43 @@ trait Printers { self: ICodes =>
println("// methods");
cls.methods.foreach(printMethod);
undent; println;
- println("}");
+ println("}")
}
- def printField(f: IField): Unit = {
+ def printField(f: IField) {
print(f.symbol.keyString); print(" ");
print(f.symbol.nameString); print(": ");
println(f.symbol.info.toString());
}
- def printMethod(m: IMethod): Unit = {
+ def printMethod(m: IMethod) {
print("def "); print(m.symbol.name);
- print("("); printList(printParam)(m.params.reverse, ", "); print(")");
- print(": "); print(m.symbol.info.resultType);
-
+ print("("); printList(printParam)(m.params, ", "); print(")");
+ print(": "); print(m.symbol.info.resultType)
+
if (!m.isDeferred) {
- println(" {");
- println("locals: " + m.locals.mkString("", ", ", ""));
- println("startBlock: " + m.code.startBlock);
- println("blocks: " + m.code.blocks.mkString("[", ",", "]"));
- println;
- lin.linearize(m) foreach printBlock;
- println("}");
+ println(" {")
+ println("locals: " + m.locals.mkString("", ", ", ""))
+ println("startBlock: " + m.code.startBlock)
+ println("blocks: " + m.code.blocks.mkString("[", ",", "]"))
+ println
+ lin.linearize(m) foreach printBlock
+ println("}")
- indent;println("Exception handlers: ");
- m.exh foreach printExceptionHandler;
+ indent; println("Exception handlers: ")
+ m.exh foreach printExceptionHandler
- undent;println;
+ undent; println
} else
- println;
+ println
}
- def printParam(p: Local): Unit = {
+ def printParam(p: Local) {
print(p.sym.name); print(": "); print(p.sym.info);
- print(" ("); print(p.kind); print(")");
+ print(" ("); print(p.kind); print(")")
}
- def printExceptionHandler(e: ExceptionHandler) = {
+ def printExceptionHandler(e: ExceptionHandler) {
indent;
println("catch (" + e.cls.simpleName + ") in " + e.covered + " starting at: " + e.startBlock);
println("consisting of blocks: " + e.blocks);
@@ -115,20 +113,20 @@ trait Printers { self: ICodes =>
// linearizer.linearize(e.startBlock) foreach printBlock;
}
- def printBlock(bb: BasicBlock): Unit = {
- print(bb.label);
- if (bb.loopHeader) print("[loop header]");
- print(": "); indent; println;
- bb.toList foreach printInstruction;
- undent; println;
+ def printBlock(bb: BasicBlock) {
+ print(bb.label)
+ if (bb.loopHeader) print("[loop header]")
+ print(": "); indent; println
+ bb.toList foreach printInstruction
+ undent; println
}
- def printInstruction(i: Instruction): Unit = {
+ def printInstruction(i: Instruction) {
// if (settings.Xdce.value)
// print(if (i.useful) " " else " * ");
if (settings.debug.value)
print(i.pos.line.map(_.toString).getOrElse("No line"))
- println(i.toString());
+ println(i.toString())
}
}
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
index c815ea4..23ff34e 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
@@ -3,7 +3,7 @@
* @author Martin Odersky
*/
-// $Id: TypeKinds.scala 16182 2008-10-01 07:02:18Z rytz $
+// $Id: TypeKinds.scala 16180 2008-09-30 20:45:47Z dragos $
package scala.tools.nsc.backend.icode
diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
index db8e116..bf11114 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
@@ -3,7 +3,7 @@
* @author Martin Odersky
*/
-// $Id: CopyPropagation.scala 14803 2008-04-23 17:21:04Z dragos $
+// $Id: CopyPropagation.scala 16511 2008-11-06 17:26:52Z dragos $
package scala.tools.nsc.backend.icode.analysis
@@ -499,12 +499,29 @@ abstract class CopyPropagation {
var values = in.stack.take(1 + ctor.info.paramTypes.length).reverse.drop(1);
val bindings = new HashMap[Symbol, Value];
- if (settings.debug.value) log("getBindings for: " + ctor)
+ if (settings.debug.value) log("getBindings for: " + ctor + " acc: " + paramAccessors)
+
+ var paramTypes = ctor.tpe.paramTypes
+ val diff = paramTypes.length - paramAccessors.length
+ diff match {
+ case 0 => ()
+ case 1 if ctor.tpe.paramTypes.head == ctor.owner.rawowner.tpe =>
+ // it's an unused outer
+ log("considering unused outer at position 0 in " + ctor.tpe.paramTypes)
+ paramTypes = paramTypes.tail
+ values = values.tail
+ case _ =>
+ log("giving up on " + ctor + "(diff: " + diff + ")")
+ return bindings
+ }
+
// this relies on having the same order in paramAccessors and
// the arguments on the stack. It should be the same!
for ((p, i) <- paramAccessors.zipWithIndex) {
-// assert(p.tpe == ctor.tpe.paramTypes(i), "In: " + ctor.fullNameString + " having: " + (paramAccessors map (_.tpe))+ " vs. " + ctor.tpe.paramTypes)
- if (p.tpe == ctor.tpe.paramTypes(i))
+// assert(p.tpe == paramTypes(i), "In: " + ctor.fullNameString
+// + " having acc: " + (paramAccessors map (_.tpe))+ " vs. params" + paramTypes
+// + "\n\t failed at pos " + i + " with " + p.tpe + " == " + paramTypes(i))
+ if (p.tpe == paramTypes(i))
bindings += (p -> values.head);
values = values.tail;
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala
index 28b1735..100c72f 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala
@@ -3,7 +3,7 @@
* @author Martin Odersky
*/
-// $Id: TypeFlowAnalysis.scala 16027 2008-09-04 17:49:37Z dragos $
+// $Id: TypeFlowAnalysis.scala 16026 2008-09-04 17:41:10Z dragos $
package scala.tools.nsc.backend.icode.analysis
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index 6942db2..5ecf7ce 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -3,7 +3,7 @@
* @author Iulian Dragos
*/
-// $Id: GenJVM.scala 16415 2008-10-29 14:26:16Z dragos $
+// $Id: GenJVM.scala 16414 2008-10-29 14:09:23Z dragos $
package scala.tools.nsc.backend.jvm
diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
index 9e8ce70..045e0c6 100644
--- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
+++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
@@ -3,7 +3,7 @@
* @author Nikolay Mihaylov
*/
-// $Id: GenMSIL.scala 16401 2008-10-28 17:58:19Z dragos $
+// $Id: GenMSIL.scala 16377 2008-10-27 16:25:50Z dragos $
package scala.tools.nsc.backend.msil
diff --git a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala
index 1dc2acc..cb7db78 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala
@@ -3,7 +3,7 @@
* @author Iulian Dragos
*/
-// $Id: ClosureElimination.scala 14803 2008-04-23 17:21:04Z dragos $
+// $Id: ClosureElimination.scala 16511 2008-11-06 17:26:52Z dragos $
package scala.tools.nsc.backend.opt;
@@ -99,6 +99,7 @@ abstract class ClosureElimination extends SubComponent {
for (bb <- linearizer.linearize(m)) {
var info = cpp.in(bb)
+ log("Cpp info at entry to block " + bb + ": " + info)
for (i <- bb.toList) {
i match {
diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
index 89448d7..a3daac4 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
@@ -3,7 +3,7 @@
* @author Iulian Dragos
*/
-// $Id: DeadCodeElimination.scala 16459 2008-10-31 11:58:07Z cunei $
+// $Id: DeadCodeElimination.scala 16438 2008-10-30 13:23:19Z dragos $
package scala.tools.nsc.backend.opt
diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
index 70d2b24..76b3061 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
@@ -3,7 +3,7 @@
* @author Iulian Dragos
*/
-// $Id: Inliners.scala 15951 2008-08-28 10:05:24Z dragos $
+// $Id: Inliners.scala 16511 2008-11-06 17:26:52Z dragos $
package scala.tools.nsc.backend.opt
@@ -148,6 +148,9 @@ abstract class Inliners extends SubComponent {
val newInstr = i match {
case THIS(clasz) =>
LOAD_LOCAL(inlinedThis);
+
+ case STORE_THIS(_) =>
+ STORE_LOCAL(inlinedThis)
case JUMP(whereto) =>
JUMP(inlinedBlock(whereto));
@@ -363,7 +366,7 @@ abstract class Inliners extends SubComponent {
m.normalize
} catch {
case e =>
- Console.println("############# Cought exception: " + e + " #################");
+ Console.println("############# Caught exception: " + e + " #################");
Console.println("\nMethod: " + m +
"\nMethod owner: " + m.symbol.owner);
e.printStackTrace();
diff --git a/src/compiler/scala/tools/nsc/doc/script.js b/src/compiler/scala/tools/nsc/doc/script.js
index 4a3cefd..6ccbb00 100644
--- a/src/compiler/scala/tools/nsc/doc/script.js
+++ b/src/compiler/scala/tools/nsc/doc/script.js
@@ -3,7 +3,7 @@
// Copyright 2005-2007 LAMP/EPFL
// @author Stephane Micheloud
-// $Id: script.js 16466 2008-10-31 16:30:32Z cunei $
+// $Id: script.js 16564 2008-11-17 13:32:19Z rytz $
function setWindowTitle(title) {
parent.document.title = title;
@@ -40,11 +40,12 @@ function get_api_root(key) {
return root;
}
-var scala_src_root = 'http://lampsvn.epfl.ch/trac/scala/browser/scala/tags/R_2_7_2_final/';
+var scala_src_root = 'http://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/';
var lib_src_root = scala_src_root + 'src/library/';
var comp_src_root = scala_src_root + 'src/compiler/';
var actors_src_root = scala_src_root + 'src/actors/';
var dbc_src_root = scala_src_root + 'src/dbc/';
+var swing_src_root = scala_src_root + 'src/swing/';
//var liftweb_src_root = 'http://liftweb.googlecode.com/svn/trunk/liftweb/lift/src/main/scala/';
@@ -52,6 +53,7 @@ function get_src_root(key) {
root = null;
if (key.indexOf("scala/actors/") == 0) { root = actors_src_root; }
else if (key.indexOf("scala/dbc/" ) == 0) { root = dbc_src_root; }
+ else if (key.indexOf("scala/swing/" ) == 0) { root = swing_src_root; }
else if (key.indexOf("scala/tools/" ) == 0) { root = comp_src_root; }
else if (key.indexOf("scala/" ) == 0) { root = lib_src_root; }
//else if (key.indexOf("net/liftweb/" ) == 0) { root = liftweb_src_root; }
diff --git a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
index 5160a3c..d3c59b6 100644
--- a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
@@ -1,32 +1,48 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2007 LAMP/EPFL
+ * Copyright 2005-2008 LAMP/EPFL
* @author Stepan Koltsov
*/
-// $Id: InteractiveReader.scala 14416 2008-03-19 01:17:25Z mihaylov $
+// $Id: InteractiveReader.scala 16296 2008-10-20 06:22:42Z michelou $
package scala.tools.nsc.interpreter
/** Reads lines from an input stream */
trait InteractiveReader {
- def readLine(prompt: String): String
+ import InteractiveReader._
+ import java.io.IOException
+
+ protected def readOneLine(prompt: String): String
val interactive: Boolean
+
+ def readLine(prompt: String): String =
+ try {
+ readOneLine(prompt)
+ }
+ catch {
+ case e: IOException if restartSystemCall(e) => readLine(prompt)
+ case e => throw e
+ }
+
+ private def restartSystemCall(e: Exception): Boolean =
+ (vendor startsWith "Apple") && (e.getMessage == msgEINTR)
}
-
object InteractiveReader {
- /** Create an interactive reader. Uses JLine if the
+ // hacks necessary for OSX jvm suspension because read calls are not restarted after SIGTSTP
+ val vendor = System.getProperty("java.vendor", "")
+ val msgEINTR = "Interrupted system call"
+
+ /** Create an interactive reader. Uses <code>JLineReader</code> if the
* library is available, but otherwise uses a
- * SimpleReader. */
- def createDefault(): InteractiveReader = {
+ * <code>SimpleReaderi</code>. */
+ def createDefault(): InteractiveReader =
try {
new JLineReader
} catch {
case e =>
//out.println("jline is not available: " + e) //debug
- new SimpleReader()
+ new SimpleReader()
}
- }
-
-
}
+
diff --git a/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala b/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala
index 5aae56b..e7074a8 100644
--- a/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Stepan Koltsov
*/
-// $Id: JLineReader.scala 15390 2008-06-17 17:44:30Z odersky $
+// $Id: JLineReader.scala 16289 2008-10-18 15:51:30Z washburn $
package scala.tools.nsc.interpreter
@@ -22,7 +22,7 @@ class JLineReader extends InteractiveReader {
r.setBellEnabled(false)
r
}
- def readLine(prompt: String) = consoleReader.readLine(prompt)
+ def readOneLine(prompt: String) = consoleReader.readLine(prompt)
val interactive = true
}
diff --git a/src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala b/src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala
index 265e73d..48dccc8 100644
--- a/src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Stepan Koltsov
*/
-// $Id: SimpleReader.scala 14416 2008-03-19 01:17:25Z mihaylov $
+// $Id: SimpleReader.scala 16289 2008-10-18 15:51:30Z washburn $
package scala.tools.nsc.interpreter
import java.io.{BufferedReader, PrintWriter}
@@ -16,7 +16,7 @@ class SimpleReader(
extends InteractiveReader {
def this() = this(Console.in, new PrintWriter(Console.out), true)
- def readLine(prompt: String) = {
+ def readOneLine(prompt: String) = {
if (interactive) {
out.print(prompt)
out.flush()
diff --git a/src/compiler/scala/tools/nsc/io/AbstractFile.scala b/src/compiler/scala/tools/nsc/io/AbstractFile.scala
index c77d60d..cbec71c 100644
--- a/src/compiler/scala/tools/nsc/io/AbstractFile.scala
+++ b/src/compiler/scala/tools/nsc/io/AbstractFile.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: AbstractFile.scala 14912 2008-05-05 14:09:00Z spoon $
+// $Id: AbstractFile.scala 16266 2008-10-15 14:22:32Z odersky $
package scala.tools.nsc.io
@@ -121,7 +121,7 @@ abstract class AbstractFile extends AnyRef with Iterable[AbstractFile] {
def output: OutputStream
/** size of this file if it is a concrete file. */
- def size: Option[Int] = None
+ def sizeOption: Option[Int] = None
/** returns contents of file (if applicable) in a byte array.
* warning: use <code>Global.getSourceFile()</code> to use the proper
@@ -138,7 +138,7 @@ abstract class AbstractFile extends AnyRef with Iterable[AbstractFile] {
@throws(classOf[IOException])
final def toByteArray: Array[Byte] = {
val in = input
- var rest = size.get
+ var rest = sizeOption.get
val arr = new Array[Byte](rest)
while (rest > 0) {
val res = in.read(arr, arr.length - rest, rest)
diff --git a/src/compiler/scala/tools/nsc/io/PlainFile.scala b/src/compiler/scala/tools/nsc/io/PlainFile.scala
index 1792c8d..dd7daa3 100644
--- a/src/compiler/scala/tools/nsc/io/PlainFile.scala
+++ b/src/compiler/scala/tools/nsc/io/PlainFile.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: PlainFile.scala 14912 2008-05-05 14:09:00Z spoon $
+// $Id: PlainFile.scala 16266 2008-10-15 14:22:32Z odersky $
package scala.tools.nsc.io
@@ -39,7 +39,7 @@ class PlainFile(val file: File) extends AbstractFile {
override def input = new FileInputStream(file)
override def output = new FileOutputStream(file)
- override def size = Some(file.length.toInt)
+ override def sizeOption = Some(file.length.toInt)
override def hashCode(): Int = fpath.hashCode
diff --git a/src/compiler/scala/tools/nsc/io/VirtualFile.scala b/src/compiler/scala/tools/nsc/io/VirtualFile.scala
index 149d6f4..72aa847 100644
--- a/src/compiler/scala/tools/nsc/io/VirtualFile.scala
+++ b/src/compiler/scala/tools/nsc/io/VirtualFile.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: VirtualFile.scala 14912 2008-05-05 14:09:00Z spoon $
+// $Id: VirtualFile.scala 16266 2008-10-15 14:22:32Z odersky $
package scala.tools.nsc.io
@@ -50,7 +50,7 @@ class VirtualFile(val name: String, _path: String) extends AbstractFile {
/** Returns null. */
final def file: File = null
- override def size: Option[Int] = Some(content.size)
+ override def sizeOption: Option[Int] = Some(content.size)
def input : InputStream = new ByteArrayInputStream(content);
diff --git a/src/compiler/scala/tools/nsc/io/ZipArchive.scala b/src/compiler/scala/tools/nsc/io/ZipArchive.scala
index c3ba7c7..80f22e3 100644
--- a/src/compiler/scala/tools/nsc/io/ZipArchive.scala
+++ b/src/compiler/scala/tools/nsc/io/ZipArchive.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: ZipArchive.scala 14912 2008-05-05 14:09:00Z spoon $
+// $Id: ZipArchive.scala 16554 2008-11-13 23:05:51Z washburn $
package scala.tools.nsc.io
@@ -118,8 +118,9 @@ final class ZipArchive(file: File, val archive: ZipFile) extends PlainFile(file)
this.toString() + " - " + path);
if (entry.isDirectory()) {
val dir: DirEntry = getDir(dirs, path)
- assert(dir.entry eq null, this.toString() + " - " + path)
- dir.entry = entry
+ // this assertion causes an unnecessary bomb if a directory is twice listed in the jar
+ // assert(dir.entry eq null, this.toString() + " - " + path)
+ if (dir.entry eq null) dir.entry = entry
} else {
val index = path.lastIndexOf('/')
val name = if (index < 0) path else path.substring(index + 1)
@@ -206,7 +207,7 @@ final class ZipArchive(file: File, val archive: ZipFile) extends PlainFile(file)
def archive = ZipArchive.this.archive
override def lastModified: Long = entry.getTime()
override def input = archive.getInputStream(entry)
- override def size = Some(entry.getSize().toInt)
+ override def sizeOption = Some(entry.getSize().toInt)
}
}
@@ -337,6 +338,6 @@ final class URLZipArchive(url: URL) extends AbstractFile {
extends Entry(name, path) {
override def lastModified: Long = entry.getTime()
override def input = in
- override def size = Some(entry.getSize().toInt)
+ override def sizeOption = Some(entry.getSize().toInt)
}
}
diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
index bb6457e..5dc6f50 100644
--- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
+++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
@@ -686,7 +686,7 @@ trait JavaParsers extends JavaScanners {
javaLangObject()
}
val interfaces = interfacesOpt()
- val (statics, body) = typeBody(CLASS)
+ val (statics, body) = typeBody(CLASS, name)
addCompanionObject(statics, atPos(pos) {
ClassDef(mods, name, tparams, makeTemplate(superclass :: interfaces, body))
})
@@ -704,7 +704,7 @@ trait JavaParsers extends JavaScanners {
} else {
List(javaLangObject)
}
- val (statics, body) = typeBody(INTERFACE)
+ val (statics, body) = typeBody(INTERFACE, name)
addCompanionObject(statics, atPos(pos) {
ClassDef(mods | Flags.TRAIT | Flags.INTERFACE | Flags.ABSTRACT,
name, tparams,
@@ -712,14 +712,14 @@ trait JavaParsers extends JavaScanners {
})
}
- def typeBody(leadingToken: Int): (List[Tree], List[Tree]) = {
+ def typeBody(leadingToken: Int, parentName: Name): (List[Tree], List[Tree]) = {
accept(LBRACE)
- val defs = typeBodyDecls(leadingToken)
+ val defs = typeBodyDecls(leadingToken, parentName)
accept(RBRACE)
defs
}
- def typeBodyDecls(parentToken: Int): (List[Tree], List[Tree]) = {
+ def typeBodyDecls(parentToken: Int, parentName: Name): (List[Tree], List[Tree]) = {
val inInterface = definesInterface(parentToken)
val statics = new ListBuffer[Tree]
val members = new ListBuffer[Tree]
@@ -739,7 +739,18 @@ trait JavaParsers extends JavaScanners {
members) ++= decls
}
}
- (statics.toList, members.toList)
+ def forwarders(sdef: Tree): List[Tree] = sdef match {
+ case ClassDef(mods, name, tparams, _) if (parentToken == INTERFACE) =>
+ val tparams1: List[TypeDef] = tparams map (_.duplicate)
+ var rhs: Tree = Select(Ident(parentName.toTermName), name)
+ if (!tparams1.isEmpty) rhs = AppliedTypeTree(rhs, tparams1 map (tp => Ident(tp.name)))
+ List(TypeDef(Modifiers(Flags.PROTECTED), name, tparams1, rhs))
+ case _ =>
+ List()
+ }
+ val sdefs = statics.toList
+ val idefs = members.toList ::: (sdefs flatMap forwarders)
+ (sdefs, idefs)
}
def annotationDecl(mods: Modifiers): List[Tree] = {
@@ -750,7 +761,7 @@ trait JavaParsers extends JavaScanners {
val parents = List(scalaDot(newTypeName("Annotation")),
Select(javaLangDot(newTermName("annotation")), newTypeName("Annotation")),
scalaDot(newTypeName("ClassfileAnnotation")))
- val (statics, body) = typeBody(AT)
+ val (statics, body) = typeBody(AT, name)
def getValueMethodType(tree: Tree) = tree match {
case DefDef(_, nme.value, _, _, tpt, _) => Some(tpt.duplicate)
case _ => None
@@ -785,7 +796,7 @@ trait JavaParsers extends JavaScanners {
val (statics, body) =
if (in.token == SEMI) {
in.nextToken
- typeBodyDecls(ENUM)
+ typeBodyDecls(ENUM, name)
} else {
(List(), List())
}
diff --git a/src/compiler/scala/tools/nsc/matching/CodeFactory.scala b/src/compiler/scala/tools/nsc/matching/CodeFactory.scala
index 466aa97..801f134 100644
--- a/src/compiler/scala/tools/nsc/matching/CodeFactory.scala
+++ b/src/compiler/scala/tools/nsc/matching/CodeFactory.scala
@@ -2,213 +2,113 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Burak Emir
*/
-// $Id: CodeFactory.scala 15004 2008-05-13 16:37:33Z odersky $
+// $Id: CodeFactory.scala 16553 2008-11-13 22:14:16Z DRMacIver $
package scala.tools.nsc.matching
import scala.tools.nsc.util.Position
-/** contains many helper methods that build trees...some of these currently
- * unused, since were for regexp matching.
+/** Helper methods that build trees for pattern matching.
*
* @author Burak Emir
*/
trait CodeFactory {
self: transform.ExplicitOuter with PatternNodes =>
- import global._
+ import global.{typer => _, _}
+ import analyzer.Typer;
import definitions._ // standard classes and methods
- import typer.typed // methods to type trees
- import posAssigner.atPos // for filling in tree positions
+ import posAssigner.atPos // for filling in tree positions
+ import Code._
- final def mkIdent(sym:Symbol) = Ident(sym) setType sym.tpe
-
- final def typedValDef(x:Symbol, rhs:Tree) = {
- //Console.println("1"+x.tpe)
- x.tpe match {
- case WildcardType => rhs.setType(null); val rhs1 = typed(rhs); x setInfo rhs1.tpe; typed{ValDef(x, rhs)}
- case _ => typed{ValDef(x, typed(rhs, x.tpe))}
+ /** Methods to simplify code generation
+ */
+ object Code {
+ // function application
+ def fn(lhs: Tree, op: Name, args: Tree*) = Apply(Select(lhs, op), args.toList)
+ def fn(lhs: Tree, op: Symbol, args: Tree*) = Apply(Select(lhs, op), args.toList)
+
+ val AND = definitions.Boolean_and
+ val NOT = definitions.Boolean_not
+ val SEQ = definitions.SeqClass
+ val SOME = definitions.SomeClass
+ val TRUE = Const(true)
+ val FALSE = Const(false)
+ val NULL = Const(null)
+
+ object Const {
+ def apply(x: Any) = Literal(Constant(x))
+ def unapply(x: Any) = x match {
+ case Literal(Constant(value)) => Some(value)
+ case _ => None
+ }
}
}
- final def mk_(tpe:Type) = Ident(nme.WILDCARD) setType tpe
-
- final def targetLabel(owner: Symbol, pos: Position, name:String, argtpes:List[Type], resultTpe: Type) =
- owner.newLabel(pos, name).setInfo(new MethodType(argtpes, resultTpe))
-
- final def targetParams(subst:Binding):List[ValDef] = if(subst eq NoBinding) Nil else subst match {
- case Binding(v,t,n) => ValDef(v, {
- //v.setFlag(symtab.Flags.TRANS_FLAG);
- if(t.tpe <:< v.tpe) mkIdent(t)
- else if(v.tpe <:< t.tpe) typed{gen.mkAsInstanceOf(mkIdent(t),v.tpe)} // refinement
- else {
- //Console.println("internal error, types don't match: pattern variable "+v+":"+v.tpe+" temp "+t+":"+t.tpe)
- error("internal error, types don't match: pattern variable "+v+":"+v.tpe+" temp "+t+":"+t.tpe)
- typed{gen.mkAsInstanceOf(mkIdent(t), v.tpe)} // refinement
- }
- })::targetParams(n)
+ final def typedValDef(x: Symbol, rhs: Tree)(implicit typer: Typer) = x.tpe match {
+ case WildcardType =>
+ rhs setType null
+ x setInfo typer.typed(rhs).tpe
+ typer.typed(ValDef(x, rhs))
+ case _ =>
+ typer.typed(ValDef(x, typer.typed(rhs, x.tpe)))
}
- /** returns `List[ Tuple2[ scala.Int, <elemType> ] ]' */
- final def SeqTraceType(elemType: Type): Type =
- appliedType(definitions.ListClass.typeConstructor,
- List(pairType(definitions.IntClass.info,
- elemType)))
-
- final def pairType(left: Type, right: Type) =
- appliedType(definitions.TupleClass(2).typeConstructor,
- List(left,right))
-
- /** returns `Iterator[ elemType ]' */
- final def _seqIterType(elemType: Type): Type =
- appliedType(definitions.IteratorClass.typeConstructor,
- List(elemType))
+ final def mkIdent(sym: Symbol) = Ident(sym) setType sym.tpe
+ final def mk_(tpe: Type) = Ident(nme.WILDCARD) setType tpe
/** returns A for T <: Sequence[ A ]
*/
final def getElemType_Sequence(tpe: Type): Type = {
- //System.err.println("getElemType_Sequence("+tpe.widen()+")")
- val tpe1 = tpe.widen.baseType(definitions.SeqClass)
-
+ val tpe1 = tpe.widen.baseType(SEQ)
if (tpe1 == NoType)
Predef.error("arg " + tpe + " not subtype of Seq[A]")
tpe1.typeArgs(0)
}
- final def emptynessCheck(vsym: Symbol) = {
- if (vsym.tpe.typeSymbol == definitions.SomeClass) // is Some[_]
- Literal(Constant(true))
- else // is Option[_]
- Not(Select(mkIdent(vsym), nme.isEmpty))
- }
-
- /** returns code `<seqObj>.elements' */
- final def newIterator(seqObj: Tree): Tree =
- Apply(Select(seqObj, newTermName("elements")), List())
-
- /** `it.next()' */
- final def _next(iter: Tree) =
- Apply(Select(iter, definitions.Iterator_next), List())
-
- /** `it.hasNext()' */
- final def _hasNext(iter: Tree) =
- Apply(Select(iter, definitions.Iterator_hasNext), List())
-
- /** `!it.hasCur()' */
- final def _not_hasNext(iter: Tree) =
- Apply(Select(_hasNext(iter), definitions.Boolean_not), List())
-
- /** `trace.isEmpty' */
- final def isEmpty( iter: Tree ): Tree =
- Apply(Select(iter, definitions.List_isEmpty), List())
-
- /** `arg.head' */
- final def SeqList_head(arg: Tree) =
- Apply(Select(arg, definitions.List_head), List())
-
- final def Negate(tree: Tree) = tree match {
- case Literal(Constant(value:Boolean))=>
- Literal(Constant(!value))
- case _ =>
- Apply(Select(tree, definitions.Boolean_not), List());
- }
+ // Option fullness check
+ final def nonEmptinessCheck(vsym: Symbol) =
+ if (vsym.tpe.typeSymbol == SOME) TRUE // is Some[_]
+ else Not(Select(mkIdent(vsym), nme.isEmpty)) // is Option[_]
/** for tree of sequence type, returns tree that drops first i elements */
- final def seqDrop(sel:Tree, ix: Int) = if (ix == 0) sel else
- typed { Apply(Select(Select(sel, nme.toList), nme.drop),
- List(Literal(Constant(ix)))) }
+ final def seqDrop(sel:Tree, ix: Int)(implicit typer : Typer) =
+ if (ix == 0) sel else
+ typer.typed(Select(fn(sel, nme.drop, Const(ix)), nme.toSeq))
- /** for tree of sequence type, returns tree that drops first i elements */
- final def seqElement(sel:Tree, ix: Int) =
- typed { Apply(Select(sel, sel.tpe.member(nme.apply)), List(Literal(Constant(ix)))) }
+ /** for tree of sequence type, returns tree that represents element at index i */
+ final def seqElement(sel:Tree, ix: Int)(implicit typer : Typer) =
+ typer.typed(fn(sel, sel.tpe.member(nme.apply), Const(ix)))
- /** for tree of sequence type, returns boolean tree that has length i */
- final def seqHasLength(sel: Tree, ntpe: Type, i: Int) =
- typed(
- Equals(
- Apply(Select(sel, ntpe.member(nme.lengthCompare)), List(Literal(Constant(i)))),
- Literal(Constant(0))
- )
- )/*defs.Seq_length ?*/
+ /** for tree of sequence type, returns boolean tree testing that the sequence has length i */
+ final def seqHasLength(sel: Tree, ntpe: Type, i: Int)(implicit typer : Typer) =
+ typer.typed( Equals(fn(sel, ntpe.member(nme.lengthCompare), Const(i)), Const(0)) ) // defs.Seq_length ?
/** for tree of sequence type sel, returns boolean tree testing that length >= i
*/
- final def seqLongerThan(sel:Tree, tpe:Type, i:Int) =
- GreaterThanOrEquals(
- typed(Apply(Select(sel, tpe.member(nme.lengthCompare)), List(Literal(Constant(i))))),
- typed(Literal(Constant(0))))
- //defs.Seq_length instead of tpe.member ?
-
- final def Not(arg:Tree) = arg match {
- case Literal(Constant(true)) => Literal(Constant(false))
- case Literal(Constant(false)) => Literal(Constant(true))
- case t => Select(arg, definitions.Boolean_not)
- }
- /*protected*/ def And(left: Tree, right: Tree): Tree = left match {
- case Literal(Constant(value: Boolean)) =>
- if (value) right else left
- case _ =>
- right match {
- case Literal(Constant(true)) =>
- left
- case _ =>
- Apply(Select(left, definitions.Boolean_and), List(right))
- }
- }
-
- /*protected*/final def Or(left: Tree, right: Tree): Tree = {
- left match {
-/*
- case If(cond: Tree, thenp: Tree, Literal(Constant(false))) => // little opt, frequent special case
- If(cond, thenp, right)
-*/
- case Literal(Constant(value: Boolean))=>
- if(value) left else right
- case _ =>
- right match {
- case Literal(Constant(false)) =>
- left
- case _ =>
- Apply(Select(left, definitions.Boolean_or), List(right));
- }
- }
+ final def seqLongerThan(sel:Tree, tpe:Type, i:Int)(implicit typer : Typer) = {
+ val cmp = fn(sel, tpe.member(nme.lengthCompare), Const(i))
+ GTE(typer.typed(cmp), typer.typed(Const(0))) // defs.Seq_length instead of tpe.member?
}
- final def Equals(left: Tree, right: Tree): Tree =
- Apply(Select(left, nme.EQ), List(right))
-
- final def Eq(left: Tree, right: Tree): Tree =
- Apply(Select(left, nme.eq), List(right))
-
- final def GreaterThanOrEquals(left: Tree, right: Tree): Tree =
- Apply(Select(left, nme.GE), List(right))
+ final def Equals (left: Tree, right: Tree): Tree = fn(left, nme.EQ, right)
+ final def Eq (left: Tree, right: Tree): Tree = fn(left, nme.eq, right)
+ final def GTE (left: Tree, right: Tree): Tree = fn(left, nme.GE, right) // >=
+ final def And (left: Tree, right: Tree): Tree = fn(left, AND, right)
+ final def Not (arg: Tree): Tree = Select(arg, NOT)
+
+ final def ThrowMatchError(pos: Position, obj: Tree) = atPos(pos) {
+ Throw( New(TypeTree(MatchErrorClass.tpe), List(List(obj))) )
+ }
- final def ThrowMatchError(pos: Position, obj: Tree) =
- atPos(pos) {
- Throw(
- New(
- TypeTree(definitions.MatchErrorClass.tpe),
- List(List(
- obj
- ))))
- }
+ final def NotNull(tree: Tree)(implicit typer : Typer) = typer.typed(fn(tree, nme.ne, NULL))
+ final def Get(tree: Tree) = fn(tree, nme.get)
- final def NotNull(tree:Tree) =
- typed {
- Apply(Select(tree, nme.ne), List(Literal(Constant(null))))
- }
-
- final def IsNull(tree:Tree) =
- typed {
- Apply(Select(tree, nme.eq), List(Literal(Constant(null))))
- }
-
- // statistics
- var nremoved = 0
- var nsubstituted = 0
- var nstatic = 0
+ // statistics
+ var nremoved = 0
+ var nsubstituted = 0
final def squeezedBlock(vds: List[Tree], exp: Tree)(implicit theOwner: Symbol): Tree =
if (settings_squeeze)
@@ -227,9 +127,7 @@ trait CodeFactory {
nref += 1
if(sym.owner == currentOwner) { // oldOwner should match currentOwner
nsafeRef += 1
- } /*else if(nref == 1) {
- Console.println("sym owner: "+sym.owner+" but currentOwner = "+currentOwner)
- }*/
+ }
case LabelDef(_,args,rhs) =>
var args1 = args; while(args1 ne Nil) {
if(args1.head.symbol eq sym) {
@@ -266,14 +164,12 @@ trait CodeFactory {
// recurse
val exp1 = squeezedBlock(rest, exp)
- //Console.println("squeezedBlock for valdef "+vd)
val sym = vd.symbol
val rt = new RefTraverser(sym)
rt.atOwner (theOwner) (rt.traverse(exp1))
- //Console.println("hello, ref count = "+rt.nref+"/"+rt.nsafeRef)
rt.nref match {
case 0 =>
- nremoved = nremoved + 1
+ nremoved += 1
exp1
case 1 if rt.nsafeRef == 1 =>
nsubstituted += 1
@@ -291,47 +187,5 @@ trait CodeFactory {
}
}
}
-
- final def debugStrings(tps:List[Type]):String = tps.foldLeft("[")({ (x:String,y:Type) => x+","+debugString(y) })+"]"
-
- final def debugString(tp:Type):String = tp match {
- case ErrorType => "ErrorType"
- // internal: error
- case WildcardType => "WildcardType"
- // internal: unknown
- case NoType => "NoType"
- case NoPrefix => "NoPrefix"
- case ThisType(sym) => "ThisType("+sym.toString+")"
- // sym.this.type
- case SingleType(pre, sym) => "SingleType("+debugString(pre)+","+sym+")"
- // pre.sym.type
- case ConstantType(value) => "ConstantType("+value+")"
- // int(2)
- case TypeRef(pre, sym, args) => "TypeRef("+debugString(pre)+","+sym.getClass()+"(=="+sym+")"+","+ debugStrings(args)+")"
- // pre.sym[targs]
- case RefinedType(parents, defs) => "RefinedType("+debugStrings(parents)+","+defs+")"
- // parent1 with ... with parentn { defs }
- case AnnotatedType(attribs, tp, selfsym) => "AnnotatedType("+attribs+","+ debugString(tp)+","+ selfsym+")"
- // tp @attribs
- case p:Product => tp.getClass.toString+"(=="+tp.toString+")"+runtime.ScalaRunTime._toString(p)
-
- case _ => tp.getClass.toString+"(=="+tp.toString+")"
- /*
- // the following are non-value types; you cannot write them down in Scala source.
-
- case TypeBounds(lo, hi) =>
- // >: lo <: hi
- case ClassInfoType(parents, defs, clazz) =>
- // same as RefinedType except as body of class
- case MethodType(paramtypes, result) =>
- // (paramtypes)result
- case PolyType(tparams, result) =>
- // [tparams]result where result is a MethodType or ClassInfoType
- // or
- // []T for a eval-by-name type
- case ExistentialType(tparams, result) =>
- // exists[tparams]result
- */
- }
}
diff --git a/src/compiler/scala/tools/nsc/matching/MatchUtil.scala b/src/compiler/scala/tools/nsc/matching/MatchUtil.scala
new file mode 100644
index 0000000..7ebeba4
--- /dev/null
+++ b/src/compiler/scala/tools/nsc/matching/MatchUtil.scala
@@ -0,0 +1,95 @@
+/* NSC -- new Scala compiler
+ */
+
+package scala.tools.nsc.matching
+
+/**
+ * Utility classes, most of which probably belong somewhere else.
+ */
+object MatchUtil
+{
+ import collection.mutable.ListBuffer
+
+ def impossible: Nothing = abort("this never happens")
+ def abort(msg: String): Nothing = throw new RuntimeException(msg)
+
+ // def classifyPatString(pat: Tree) = pat match {
+ // case _: Alternative => "Alternative"
+ // case Typed(Strip2(_: UnApply), _) => "Typed"
+ // case Ident_Or_Empty() => "Ident(_)|EmptyTree"
+ // case _: Ident => "Ident"
+ // case _: Select => "Select"
+ // case UnApply_TypeApply(_, _) => "Unapply(...TypeApply...)"
+ // case UnApply(_: Apply, _) => "Unapply(Apply())"
+ // case Apply_Function(_) => "Apply !isCaseClass"
+ // case Apply_Value(_, _) => "Apply_Value"
+ // case Apply_CaseClass_NoArgs(_) => "Apply_CaseClass_NoArgs"
+ // case Apply_CaseClass_WithArgs() => "Apply_CaseClass_WithArgs"
+ // case _: ArrayValue => "ArrayValue"
+ // case _ => "Unknown!"
+ // }
+
+ object Implicits {
+ implicit def listPlusOps[T](xs: List[T]) = new ListPlus(xs)
+ }
+
+ // object Flags {
+ // import symtab.Flags
+ // import symtab.Symbols
+ // }
+
+ class ListPlus[A](list: List[A]) {
+ /** Returns the list without the element at index <code>n</code>.
+ * If this list has fewer than <code>n</code> elements, the same list is returned.
+ *
+ * @param n the index of the element to drop.
+ * @return the list without the <code>n</code>th element.
+ */
+ def dropIndex(n: Int) = list.take(n) ::: list.drop(n + 1)
+
+ /** Returns a list formed from this list and the specified lists <code>list2</code>
+ * and <code>list3</code> by associating each element of the first list with
+ * the elements at the same positions in the other two.
+ * If any of the lists is shorter than the others, later elements in the other two are ignored.
+ *
+ * @return <code>List((a<sub>0</sub>,b<sub>0</sub>), ...,
+ * (a<sub>min(m,n)</sub>,b<sub>min(m,n)</sub>))</code> when
+ * <code>List(a<sub>0</sub>, ..., a<sub>m</sub>)
+ * zip List(b<sub>0</sub>, ..., b<sub>n</sub>)</code> is invoked.
+ */
+ def zip3[B, C](list2: List[B], list3: List[C]): List[(A, B, C)] = {
+ val b = new ListBuffer[(A, B, C)]
+ var xs1 = list
+ var xs2 = list2
+ var xs3 = list3
+ while (!xs1.isEmpty && !xs2.isEmpty && !xs3.isEmpty) {
+ b += ((xs1.head, xs2.head, xs3.head))
+ xs1 = xs1.tail
+ xs2 = xs2.tail
+ xs3 = xs3.tail
+ }
+ b.toList
+ }
+ }
+
+ object ListPlus {
+ /** Transforms a list of triples into a triple of lists.
+ *
+ * @param xs the list of triples to unzip
+ * @return a triple of lists.
+ */
+ def unzip3[A,B,C](xs: List[(A,B,C)]): (List[A], List[B], List[C]) = {
+ val b1 = new ListBuffer[A]
+ val b2 = new ListBuffer[B]
+ val b3 = new ListBuffer[C]
+ var xc = xs
+ while (!xc.isEmpty) {
+ b1 += xc.head._1
+ b2 += xc.head._2
+ b3 += xc.head._3
+ xc = xc.tail
+ }
+ (b1.toList, b2.toList, b3.toList)
+ }
+ }
+}
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
index d364393..b2cd288 100644
--- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
+++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
@@ -3,12 +3,17 @@
* Copyright 2007 Google Inc. All Rights Reserved.
* Author: bqe at google.com (Burak Emir)
*/
-// $Id: ParallelMatching.scala 15611 2008-07-25 15:28:32Z odersky $
+// $Id: ParallelMatching.scala 16562 2008-11-15 14:11:48Z DRMacIver $
package scala.tools.nsc.matching
-import scala.tools.nsc.util.Position
-import collection.mutable.ListBuffer
+import util.Position
+import collection._
+import mutable.BitSet
+import immutable.IntMap
+import MatchUtil.ListPlus._
+import MatchUtil.Implicits._
+import MatchUtil._
/** Translation of match expressions.
*
@@ -27,96 +32,181 @@ import collection.mutable.ListBuffer
trait ParallelMatching {
self: transform.ExplicitOuter with PatternNodes with CodeFactory =>
- import global._
- import typer.typed
+ import global.{typer => _, _}
+ import analyzer.Typer;
import symtab.Flags
-
- // used as argument to `EqualsPatternClass'
- case class PseudoType(o: Tree) extends SimpleTypeProxy {
- override def underlying: Type = o.tpe
- override def safeToString: String = "PseudoType("+o+")"
+ import Types._
+ import Code.{ fn, Const }
+
+ class Scrutinee(val sym: Symbol) {
+ import definitions._
+
+ def mkList(xs: List[Symbol]) = sym :: xs
+ def mkList(prefix: List[Symbol], suffix: List[Symbol]) = prefix ::: sym :: suffix
+ def isDefined = sym ne NoSymbol
+ def accessors = sym.caseFieldAccessors
+ def id = mkIdent(sym)
+ def tpe = sym.tpe
+ def pos = sym.pos
+ def isChar = tpe.widen.isChar
+ def isSimple = isChar || tpe.widen.isInt
+ lazy val sequenceType = tpe.widen.baseType(SeqClass)
+ lazy val elementType = sequenceType match {
+ case NoType => Predef.error("arg " + tpe + " not subtype of Seq[A]")
+ case _ => tpe.typeArgs(0)
+ }
+ // for propagating "unchecked" to synthetic vars
+ def flags: List[Long] = if (sym hasFlag Flags.TRANS_FLAG) List(Flags.TRANS_FLAG) else Nil
+
+ def assertIsSubtype(other: Type) = assert(isSubType(tpe, other), "problem "+tpe+" not <: "+other)
+ def casted(headType: Type)(implicit theOwner: Symbol) =
+ if (tpe =:= headType) this
+ else new Scrutinee(newVar(pos, headType, flags))
}
-
- /** picks which rewrite rule to apply
- * @precondition: column does not contain alternatives (ensured by initRep)
- */
- def MixtureRule(scrutinee: Symbol, column: List[Tree], rest: Rep)(implicit rep: RepFactory): RuleApplication = {
+
+ case class Pattern(tree: Tree) {
+ implicit def mkPattern(t: Tree) = Pattern(t)
+ import definitions._
+ lazy val sym = tree.symbol
+ lazy val tpe = tree.tpe
+ lazy val symtpe = sym.tpe
+ lazy val prefix = tpe.prefix
+ lazy val stripped = strip2
+ lazy val tpeIfHead = stripped.tree match {
+ case p @ (_:Ident | _:Select) => singleType(stripped.prefix, stripped.sym) //should be singleton object
+ case __UnApply(_,argtpe,_) => argtpe
+ case _ => tpe
+ }
- def isSimpleSwitch: Boolean = {
- (isSameType(scrutinee.tpe.widen, definitions.IntClass.tpe) ||
- isSameType(scrutinee.tpe.widen, definitions.CharClass.tpe)) && {
- var xs = column; while(!xs.isEmpty) { // forall
- val h = xs.head
- if (strip2(h).isInstanceOf[Literal] || isDefaultPattern(h))
- xs = xs.tail
- else
- return false
- }
- return true
- }}
+ // true if this pattern allows for a simple switch statement to be generated
+ lazy val isSimpleSwitchCandidate = stripped.tree match {
+ case Literal(const : Constant) if isNumeric(const.tag) =>
+ const.tag match {
+ case FloatTag | DoubleTag | LongTag => false
+ case _ => true
+ }
+ case _ => false
+ }
- // an unapply for which we don't need a type test
- def isUnapplyHead(): Boolean = column.head match {
- case __UnApply(_,argtpe,_) => scrutinee.tpe <:< argtpe
- case _ => false
+ /** returns if pattern can be considered a no-op test ??for expected type?? */
+ final def isDefault: Boolean = tree match {
+ case Bind(_, t) => t.isDefault
+ case EmptyTree => true // dummy
+ case Ident(nme.WILDCARD) => true
+ case _ => false
+ // -- what about the following? still have to test "ne null" :/
+ // case Typed(nme.WILDCARD,_) => pattern.tpe <:< scrut.tpe
}
-
- // true if pattern type is direct subtype of scrutinee (can't use just <:< cause have to take variance into account)
- def directSubtype(ptpe: Type) =
- (ptpe.parents.exists { x => ((x.typeSymbol eq scrutinee.tpe.typeSymbol) && (x <:< scrutinee.tpe))});
- // true if each pattern type is case and direct subtype of scrutinee
- def isFlatCases(col:List[Tree]): Boolean = (col eq Nil) || {
- strip2(col.head) match {
- case a @ Apply(fn,_) =>
- isCaseClass(a.tpe) && directSubtype( a.tpe ) && isFlatCases(col.tail)
- case t @ Typed(_,tpt) =>
- isCaseClass(tpt.tpe) && directSubtype( t.tpe ) && isFlatCases(col.tail)
- case Ident(nme.WILDCARD) =>
- isFlatCases(col.tail) // treat col.tail specially?
- case p =>
- false
- }
+ final def isEquals = tpe match {
+ case TypeRef(_, sym, _) => sym eq EqualsPatternClass
+ case _ => false
}
- if (isEqualsPattern(column.head.tpe)) {
- return new MixEquals(scrutinee, column, rest)
+
+ final def isAlternative: Boolean = tree match {
+ case Bind(_, t) => t.isAlternative
+ case _: Alternative => true
+ case _ => false
}
- if (column.head.isInstanceOf[ArrayValue]) {
- val av = column.head.asInstanceOf[ArrayValue]
- return if (!isRightIgnoring(av))
- new MixSequence(scrutinee, column, rest)
- else
- new MixSequenceStar(scrutinee, column, rest)
+
+ final def getAlternativeBranches: List[Tree] = {
+ def get_BIND(pctx: Tree => Tree, p: Tree): List[Tree] = p match {
+ case b @ Bind(n, p) => get_BIND((x: Tree) => pctx(copy.Bind(b, n, x) setType x.tpe), p)
+ case Alternative(ps) => ps map pctx
+ }
+ get_BIND(x => x, tree)
}
- if (isSimpleSwitch) {
- return new MixLiterals(scrutinee, column, rest)
+
+ /** returns all variables that are binding the given pattern
+ * @param x a pattern
+ * @return vs variables bound, p pattern proper
+ */
+ final def strip: (immutable.Set[Symbol], Pattern) = tree match {
+ case b @ Bind(_, t) => val (vs, p) = Pattern(t).strip ; (vs + b.symbol, p)
+ case _ => (emptySymbolSet, this)
}
- if (settings_casetags && (column.length > 1) && isFlatCases(column)) {
- return new MixCases(scrutinee, column, rest)
+ final def strip1: Set[Symbol] = strip._1
+ final def strip2: Pattern = strip._2
+
+ final def definedVars: List[Symbol] = {
+ implicit def listToStream[T](xs: List[T]): Stream[T] = xs.toStream
+ def definedVars1(x: Tree): Stream[Symbol] = x match {
+ case Apply(_, args) => definedVars2(args)
+ case b @ Bind(_,p) => Stream.cons(b.symbol, definedVars1(p))
+ case Typed(p,_) => definedVars1(p) // otherwise x @ (_:T)
+ case UnApply(_,args) => definedVars2(args)
+ case ArrayValue(_,xs) => definedVars2(xs)
+ case _ => Nil
+ }
+ def definedVars2(args: Stream[Tree]): Stream[Symbol] = args flatMap definedVars1
+
+ definedVars1(tree).reverse.toList
}
- if (isUnapplyHead()) {
- return new MixUnapply(scrutinee, column, rest)
+
+ /** returns true if pattern tests an object */
+ final def isObjectTest(head: Type) =
+ (sym ne null) && (sym != NoSymbol) && prefix.isStable && (head =:= singleType(prefix, sym))
+ }
+
+ case class Patterns(scrut: Scrutinee, ps: List[Pattern]) {
+ private lazy val column = ps.map(_.tree)
+ lazy val head = ps.head
+ lazy val tail = Patterns(scrut, ps.tail)
+ lazy val last = ps.last
+ lazy val headType = head.tpeIfHead
+ lazy val isCaseHead = headType.isCaseClass
+ lazy val dummies = if (isCaseHead) getDummies(headType.typeSymbol.caseFieldAccessors.length) else Nil
+ lazy val size = ps.length
+
+ def apply(i: Int): Tree = ps(i).tree
+ def zip() = column.zipWithIndex
+ def zip[T](ys: List[T]) = column.zip(ys)
+
+ def isObjectTest(pat: Pattern) = pat.isObjectTest(headType)
+ def isObjectTest(pat: Tree) = Pattern(pat).isObjectTest(headType)
+ // an unapply for which we don't need a type test
+ def isUnapplyHead = head.tree match {
+ case __UnApply(_,argtpe,_) => scrut.tpe <:< argtpe
+ case _ => false
}
- return new MixTypes(scrutinee, column, rest)
+
+ def isSimpleSwitch: Boolean =
+ scrut.isSimple && ps.init.forall(_.isSimpleSwitchCandidate) &&
+ // TODO: This needs to also allow the case that the last is a compatible type pattern.
+ (last.isSimpleSwitchCandidate || last.isDefault)
+
+ def mkRule(rest: Rep)(implicit rep: RepFactory): RuleApplication = head match {
+ case x if x.isEquals => new MixEquals(this, rest)
+ case Pattern(x: ArrayValue) => if (isRightIgnoring(x)) new MixSequenceStar(this, rest)
+ else new MixSequence(this, rest)
+ case _ if isSimpleSwitch => new MixLiterals(this, rest)
+ case _ if isUnapplyHead => new MixUnapply(this, rest)
+ case _ => new MixTypes(this, rest)
+ }
+ }
+
+ case class Guard(tree: Tree) {
+ def isEmpty = tree eq EmptyTree
+ def duplicate = Guard(tree.duplicate)
+
+ def mkIf(thenPart: Tree, elsePart: Tree) = If(tree.duplicate, thenPart, elsePart)
}
+ val NoGuard = Guard(EmptyTree)
+
+ /** picks which rewrite rule to apply
+ * @precondition: column does not contain alternatives (ensured by initRep)
+ */
+ def MixtureRule(scrut: Scrutinee, column: List[Tree], rest: Rep)(implicit rep: RepFactory): RuleApplication =
+ Patterns(scrut, column map Pattern) mkRule rest
sealed abstract class RuleApplication(rep: RepFactory) {
- def scrutinee:Symbol
+ def scrut: Scrutinee
+ implicit def typer = rep.typer
// used in MixEquals and MixSequence
- final protected def repWithoutHead(col: List[Tree],rest: Rep)(implicit theOwner: Symbol): Rep = {
- var fcol = col.tail
- var frow = rest.row.tail
- val nfailrow = new ListBuffer[Row]
- while(fcol ne Nil) {
- val p = fcol.head
- frow.head match {
- case Row(pats, binds, g, bx) => nfailrow += Row(p::pats, binds, g, bx)
- }
- fcol = fcol.tail
- frow = frow.tail
- }
- rep.make(scrutinee::rest.temp, nfailrow.toList)
+ final protected def repWithoutHead(pats: Patterns, rest: Rep)(implicit theOwner: Symbol): Rep = {
+ val nfailrow = List.map2(pats.tail.ps, rest.row.tail)((p, r) => r.insert(p))
+ rep.make(scrut.mkList(rest.temp), nfailrow)
}
/** translate outcome of the rule application into code (possible involving recursive application of rewriting) */
@@ -124,387 +214,194 @@ trait ParallelMatching {
}
case class ErrorRule(implicit rep:RepFactory) extends RuleApplication(rep) {
- def scrutinee:Symbol = throw new RuntimeException("this never happens")
+ def scrut: Scrutinee = impossible
final def tree(implicit theOwner: Symbol, failTree: Tree) = failTree
}
/** {case ... if guard => bx} else {guardedRest} */
- case class VariableRule(subst:Binding, guard: Tree, guardedRest:Rep, bx: Int)(implicit rep:RepFactory) extends RuleApplication(rep) {
- def scrutinee:Symbol = throw new RuntimeException("this never happens")
+ case class VariableRule(subst: Bindings, guard: Guard, guardedRest: Rep, bx: Int)(implicit rep:RepFactory) extends RuleApplication(rep) {
+ def scrut: Scrutinee = impossible
final def tree(implicit theOwner: Symbol, failTree: Tree): Tree = {
- val body = typed { rep.requestBody(bx, subst) }
- if (guard eq EmptyTree)
- return body
- val vdefs = targetParams(subst)
- val typedElse = repToTree(guardedRest)
- val typedIf = typed { If(guard.duplicate, body, typedElse) }
-
- typer.typed { squeezedBlock(vdefs, typedIf) }
+ val body = typer.typed { rep.requestBody(bx, subst) }
+ lazy val vdefs = subst.targetParams
+ lazy val typedElse = repToTree(guardedRest)
+ lazy val typedIf = typer.typed(guard.mkIf(body, typedElse))
+
+ if (guard.isEmpty) body
+ else typer.typed(squeezedBlock(vdefs, typedIf))
}
}
/** superclass of mixture rules for case classes and literals (both translated to switch on an integer)
*/
- abstract class CaseRuleApplication(rep:RepFactory) extends RuleApplication(rep) {
- def column: List[Tree]
- def rest:Rep
+ abstract class CaseRuleApplication(rep: RepFactory) extends RuleApplication(rep) {
+ val pats: Patterns
+ val rest: Rep
- // e.g. (1,1) (1,3) (42,2) for column {case ..1.. => ;; case ..42..=> ;; case ..1.. => }
- protected var defaults: List[Int] = Nil
- var defaultV: collection.immutable.Set[Symbol] = emptySymbolSet
+ // e.g. (1,1) (1,3) (42,2) for column { case ..1.. => ;; case ..42..=> ;; case ..1.. => }
+ var defaultV: immutable.Set[Symbol] = emptySymbolSet
+ var defaultIndexSet = new BitSet(pats.size)
- var theDefaultRows: List[Row] = null
- def getDefaultRows: List[Row] = {
- if (theDefaultRows ne null)
- return theDefaultRows
- var res:List[Row] = Nil
- var ds = defaults; while(ds ne Nil) {
- res = grabRow(ds.head) :: res
- ds = ds.tail
- }
- theDefaultRows = res
- res
- }
-
- // sorted e.g. case _ => 7,5,1
- protected def insertDefault(tag: Int,vs:Set[Symbol]) {
+ def insertDefault(tag: Int, vs: Set[Symbol]) {
+ defaultIndexSet += tag
defaultV = defaultV ++ vs
- defaults = insertSorted(tag, defaults)
}
- protected def haveDefault: Boolean = !defaults.isEmpty
- var tagIndexPairs: TagIndexPair = null
-
- protected def grabTemps: List[Symbol] = rest.temp
- protected def grabRow(index:Int): Row = rest.row(index) match {
- case r @ Row(pats, s, g, bx) => if (defaultV.isEmpty) r else {
- val vs = strip1(column(index)) // get vars
- val nbindings = s.add(vs.elements,scrutinee)
- Row(pats, nbindings, g, bx)
- }
- }
+ def haveDefault: Boolean = !defaultIndexSet.isEmpty
+ def defaultRows: List[Row] = defaultIndexSet.toList reverseMap grabRow
- /** inserts row indices using in to list of tagindexpairs*/
- protected def tagIndicesToReps(implicit theOwner: Symbol) = {
- val defaultRows = getDefaultRows
- var trs: List[(Int,Rep)] = Nil
- var old = tagIndexPairs
- while (tagIndexPairs ne null) { // collect all with same tag
- val tag = tagIndexPairs.tag
- var tagRows = this.grabRow(tagIndexPairs.index)::Nil
- tagIndexPairs = tagIndexPairs.next
- while ((tagIndexPairs ne null) && tagIndexPairs.tag == tag) {
- tagRows = this.grabRow(tagIndexPairs.index)::tagRows
- tagIndexPairs = tagIndexPairs.next
- }
- trs = (tag, rep.make(this.grabTemps, tagRows ::: defaultRows)) :: trs
- }
- tagIndexPairs = old
- trs
+ protected var tagIndices = IntMap.empty[List[Int]]
+ protected def grabRow(index: Int): Row = {
+ val r = rest.row(index)
+ if (defaultV.isEmpty) r
+ else r.insert2(Nil, strip1(pats(index)), scrut.sym) // get vars
}
- protected def defaultsToRep(implicit theOwner: Symbol) = rep.make(rest.temp, getDefaultRows)
+ /** inserts row indices using in to list of tagIndices */
+ protected def tagIndicesToReps(implicit theOwner: Symbol) : List[(Int, Rep)] =
+ tagIndices map { case (k, v) => (k, rep.make(rest.temp, v.reverseMap(grabRow) ::: defaultRows)) } toList
+
+ protected def defaultsToRep(implicit theOwner: Symbol) = rep.make(rest.temp, defaultRows)
- protected def insertTagIndexPair(tag: Int, index: Int) { tagIndexPairs = TagIndexPair.insert(tagIndexPairs, tag, index) }
+ protected def insertTagIndexPair(tag: Int, index: Int) =
+ tagIndices = tagIndices.update(tag, index :: tagIndices.getOrElse(tag, Nil))
/** returns
* @return list of continuations,
* @return variables bound to default continuation,
- * @return optionally, a default continuation,
+ * @return optionally, a default continuation
**/
- def getTransition(implicit theOwner: Symbol): (List[(Int,Rep)],Set[Symbol],Option[Rep]) =
- (tagIndicesToReps, defaultV, {if (haveDefault) Some(defaultsToRep) else None})
- }
-
- /** mixture rule for flat case class (using tags)
- * this rule gets translated to a switch of _.$tag()
- **/
- class MixCases(val scrutinee:Symbol, val column:List[Tree], val rest:Rep)(implicit rep:RepFactory) extends CaseRuleApplication(rep) {
-
- /** insert row indices into list of tagindexpairs */
- {
- var xs = column; var i = 0; while(xs ne Nil) { // forall
- val p = strip2(xs.head)
- if (isDefaultPattern(p))
- insertDefault(i, strip1(xs.head))
- else
- insertTagIndexPair(getCaseTag(p.tpe), i)
- i += 1
- xs = xs.tail
- }
- }
-
- override def grabTemps = scrutinee::rest.temp
-
- override def grabRow(index:Int) = rest.row(tagIndexPairs.index) match {
- case Row(pats, s, g, bx) =>
- val nbindings = s.add(strip1(column(index)).elements, scrutinee)
- Row(column(tagIndexPairs.index)::pats, nbindings, g, bx)
- }
-
- final def tree(implicit theOwner: Symbol, failTree: Tree): Tree = {
- val (branches, defaultV, default) = getTransition // tag body pairs
-
- var ndefault = if (default.isEmpty) failTree else repToTree(default.get)
- var cases = branches map {
- case (tag, r) =>
- CaseDef(Literal(tag),
- EmptyTree,
- {
- val pat = this.column(this.tagIndexPairs.find(tag));
- val ptpe = pat.tpe
- if (this.scrutinee.tpe.typeSymbol.hasFlag(symtab.Flags.SEALED) && strip2(pat).isInstanceOf[Apply]) {
- //cast
- val vtmp = newVar(pat.pos, ptpe)
- squeezedBlock(
- List(typedValDef(vtmp, gen.mkAsInstanceOf(mkIdent(this.scrutinee), ptpe))),
- repToTree(rep.make(vtmp :: r.temp.tail, r.row))
- )
- } else repToTree(r)
- }
- )}
-
- // make first case a default case.
- if (this.scrutinee.tpe.typeSymbol.hasFlag(symtab.Flags.SEALED) && defaultV.isEmpty) {
- ndefault = cases.head.body
- cases = cases.tail
- }
-
- cases.length match {
- case 0 => ndefault
- case 1 => val CaseDef(lit,_,body) = cases.head
- If(Equals(Select(mkIdent(this.scrutinee), nme.tag), lit), body, ndefault)
- case _ => val defCase = CaseDef(mk_(definitions.IntClass.tpe), EmptyTree, ndefault)
- Match(Select(mkIdent(this.scrutinee),nme.tag), cases ::: defCase :: Nil)
- }
- }
+ def getTransition(implicit theOwner: Symbol): (List[(Int,Rep)], Set[Symbol], Option[Rep]) =
+ (tagIndicesToReps, defaultV, if (haveDefault) Some(defaultsToRep) else None)
}
/** mixture rule for literals
*/
- class MixLiterals(val scrutinee:Symbol, val column:List[Tree], val rest:Rep)(implicit rep:RepFactory) extends CaseRuleApplication(rep) {
-
- private var defaultIndexSet: Set64 = if (column.length < 64) new Set64 else null
+ class MixLiterals(val pats: Patterns, val rest:Rep)(implicit rep:RepFactory) extends CaseRuleApplication(rep) {
+ val Patterns(scrut, patterns) = pats
- override def insertDefault(tag: Int, vs: Set[Symbol]): Unit =
- if (defaultIndexSet eq null) super.insertDefault(tag,vs)
- else {
- defaultIndexSet |= tag
- defaultV = defaultV ++ vs
- }
-
- protected override def haveDefault: Boolean =
- if (defaultIndexSet eq null) super.haveDefault else (defaultIndexSet.underlying != 0)
-
- override def getDefaultRows: List[Row] = {
- if (theDefaultRows ne null)
- return theDefaultRows
-
- if (defaultIndexSet eq null)
- super.getDefaultRows
- else {
- var ix = 63
- var res:List[Row] = Nil
- while((ix >= 0) && !defaultIndexSet.contains(ix)) { ix = ix - 1 }
- while(ix >= 0) {
- res = grabRow(ix) :: res
- ix = ix - 1
- while((ix >= 0) && !defaultIndexSet.contains(ix)) { ix = ix - 1 }
- }
- theDefaultRows = res
- res
- }
- }
-
- var varMap: List[(Int,List[Symbol])] = Nil
-
- private def sanity(pos:Position, tag: Int, pvars:List[Symbol]) {
- varMap = (tag,pvars)::varMap
- }
- //lazy
- private def bindVars(Tag:Int, orig: Binding): Binding = {
- def myBindVars(rest:List[(Int,List[Symbol])], bnd: Binding): Binding = rest match {
+ val varMap: List[(Int, List[Symbol])] =
+ (for ((x, i) <- pats.zip) yield strip2(x) match {
+ case p @ Const(c: Int) => insertTagIndexPair(c, i) ; Some(c, definedVars(x))
+ case p @ Const(c: Char) => insertTagIndexPair(c.toInt, i) ; Some(c.toInt, definedVars(x))
+ case p if isDefaultPattern(p) => insertDefault(i, strip1(x)) ; None
+ }) . flatMap(x => x) . reverse
+
+ // lazy
+ private def bindVars(Tag: Int, orig: Bindings): Bindings = {
+ def myBindVars(rest:List[(Int,List[Symbol])], bnd: Bindings): Bindings = rest match {
case Nil => bnd
- case (Tag,vs)::xs => myBindVars(xs, bnd.add(vs.elements, scrutinee))
+ case (Tag,vs)::xs => myBindVars(xs, bnd.add(vs, scrut.sym))
case (_, vs)::xs => myBindVars(xs, bnd)
}
myBindVars(varMap, orig)
}
- /*block*/{
- var xs = column
- var i = 0;
- var last = -1;
- while(xs ne Nil) { // forall
- if (last != -1) {
- cunit.error(xs.head.pos, "unreachable code")
- }
- strip(xs.head) match {
- case (pvars, p @ Literal(Constant(c:Int))) => sanity(p.pos, c , definedVars(xs.head)); insertTagIndexPair(c,i)
- case (pvars, p @ Literal(Constant(c:Char))) => sanity(p.pos, c.toInt, definedVars(xs.head)); insertTagIndexPair(c.toInt,i)
- case (pvars, p ) if isDefaultPattern(p) => insertDefault(i,pvars)
- case (pvars, p ) if isDefaultPattern(p) =>
- if (rest.row(i).guard == EmptyTree) {
- last = i;
- }
- insertDefault(i,pvars)
- }
- i += 1
- xs = xs.tail
- }
- }/*end block*/
-
final def tree(implicit theOwner: Symbol, failTree: Tree): Tree = {
- val (branches, defaultV, defaultRepOpt) = this.getTransition // tag body pairs
- val cases = branches map {
- case (tag, r) =>
- val r2 = rep.make(r.temp, r.row map { case Row(pat, bnd, g, bx) => Row(pat, bindVars(tag, bnd), g, bx) })
- val t2 = repToTree(r2)
- CaseDef(Literal(tag), EmptyTree, t2)
+ val (branches, defaultV, defaultRep) = this.getTransition // tag body pairs
+ val cases = for ((tag, r) <- branches) yield {
+ val r2 = rep.make(r.temp, r.row.map(x => x.rebind(bindVars(tag, x.subst))))
+ CaseDef(Literal(tag), EmptyTree, repToTree(r2))
}
- var ndefault = if (defaultRepOpt.isEmpty) failTree else repToTree(defaultRepOpt.get)
- if (cases.length == 1) {
- val CaseDef(lit,_,body) = cases.head
- If(Equals(mkIdent(this.scrutinee),lit), body, ndefault)
- } else {
- val defCase = CaseDef(mk_(definitions.IntClass.tpe), EmptyTree, ndefault)
-
-
- return if (isSameType(this.scrutinee.tpe.widen, definitions.CharClass.tpe))
- Match(Select(mkIdent(this.scrutinee), nme.toInt), cases ::: defCase :: Nil)
- else
- Match(mkIdent(this.scrutinee), cases ::: defCase :: Nil)
+ lazy val ndefault = defaultRep.map(repToTree) getOrElse failTree
+ lazy val casesWithDefault = cases ::: List(CaseDef(mk_(definitions.IntClass.tpe), EmptyTree, ndefault))
+
+ cases match {
+ case CaseDef(lit,_,body) :: Nil => If(Equals(scrut.id, lit), body, ndefault)
+ case _ if scrut.isChar => Match(Select(scrut.id, nme.toInt), casesWithDefault) // chars to ints
+ case _ => Match(scrut.id, casesWithDefault)
}
}
}
/** mixture rule for unapply pattern
*/
- class MixUnapply(val scrutinee: Symbol, val column: List[Tree], val rest: Rep)(implicit rep: RepFactory) extends RuleApplication(rep) {
+ class MixUnapply(val pats: Patterns, val rest: Rep)(implicit rep: RepFactory)
+ extends RuleApplication(rep) {
+ val Patterns(scrut, patterns) = pats
+ val Strip(vs, unapp) = pats.head.tree
+ lazy val ua @ UnApply(app @ Apply(fxn, appargs), args) = unapp
- def newVarCapture(pos:Position,tpe:Type)(implicit theOwner:Symbol) = {
- val v = newVar(pos,tpe)
- if (scrutinee.hasFlag(symtab.Flags.TRANS_FLAG))
- v.setFlag(symtab.Flags.TRANS_FLAG) // propagate "unchecked"
- v
- }
-
- private def bindToScrutinee(x:Symbol) = typedValDef(x,mkIdent(scrutinee))
-
- val (vs,unapp) = strip(column.head)
+ def newVarCapture(pos: Position,tpe: Type)(implicit theOwner:Symbol) = newVar(pos, tpe, scrut.flags)
/** returns (unapply-call, success-rep, optional fail-rep*/
final def getTransition(implicit theOwner: Symbol): (Tree, List[Tree], Rep, Option[Rep]) = {
- unapp match {
- case ua @ UnApply(app @ Apply(fn, appargs), args) =>
- object sameUnapplyCall {
- def unapply(t:Tree) = t match {
- case UnApply(Apply(fn1,_), differentArgs) if (fn.symbol == fn1.symbol) && fn.equalsStructure(fn1) =>
- Some(differentArgs)
- case _ =>
- None
- }
- }
- val ures = newVarCapture(ua.pos, app.tpe)
- val arg0 = mkIdent(scrutinee)
- val rhs = Apply(fn, arg0 :: appargs.tail) setType ures.tpe
- val uacall = typedValDef(ures, rhs)
+ object sameUnapplyCall {
+ def unapply(t: Tree) = t match {
+ case UnApply(Apply(fn1,_), differentArgs) if (fxn.symbol == fn1.symbol) && fxn.equalsStructure(fn1) =>
+ Some(differentArgs)
+ case _ =>
+ None
+ }
+ }
+ val ures = newVarCapture(ua.pos, app.tpe)
+ val rhs = Apply(fxn, scrut.id :: appargs.tail) setType ures.tpe
+ val uacall = typedValDef(ures, rhs)
+ val zipped = pats.zip(rest.row)
+ val nrowsOther = zipped.tail flatMap
+ { case (Strip2(sameUnapplyCall(_)), _) => Nil ; case (pat, r) => List(r.insert(pat)) }
- val nrowsOther = column.tail.zip(rest.row.tail) flatMap {
- case (pat, Row(ps, subst, g, bx)) =>
- strip2(pat) match {
- case sameUnapplyCall(_) => Nil
- case _ => List(Row(pat::ps, subst, g, bx))
- }}
- val nrepFail = if (nrowsOther.isEmpty)
- None
- else
- Some(rep.make(scrutinee::rest.temp, nrowsOther))
- args.length match {
- case 0 => // special case for unapply(), app.tpe is boolean
- val ntemps = scrutinee :: rest.temp
- val nrows = column.zip(rest.row) map {
- case (pat, Row(ps, subst, g, bx)) =>
- strip2(pat) match {
- case sameUnapplyCall(args) =>
- val nsubst = subst.add(strip1(pat).elements, scrutinee)
- Row(EmptyTree::ps, nsubst, g, bx)
- case _ =>
- Row( pat ::ps, subst, g, bx)
- }}
- (uacall, Nil, rep.make(ntemps, nrows), nrepFail)
-
- case 1 => // special case for unapply(p), app.tpe is Option[T]
- val vtpe = app.tpe.typeArgs(0)
- val vsym = newVarCapture(ua.pos, vtpe)
- val ntemps = vsym :: scrutinee :: rest.temp
- val nrows = column.zip(rest.row) map {
- case (pat, Row(ps, subst, g, bx)) =>
- strip2(pat) match {
- case sameUnapplyCall(args) =>
- val nsubst = subst.add(strip1(pat).elements, scrutinee)
- Row(args(0) :: EmptyTree :: ps, nsubst, g, bx)
- case _ =>
- Row(EmptyTree :: pat :: ps, subst, g, bx)
- }}
- val vdef = typedValDef(vsym, Select(mkIdent(ures), nme.get))
- (uacall, List(vdef), rep.make(ntemps, nrows), nrepFail)
-
- case _ => // app.tpe is Option[? <: ProductN[T1,...,Tn]]
- val uresGet = newVarCapture(ua.pos, app.tpe.typeArgs(0))
- val vdefs = new ListBuffer[Tree]
- vdefs += typedValDef(uresGet, Select(mkIdent(ures), nme.get))
- var ts = definitions.getProductArgs(uresGet.tpe).get
- var i = 1;
- val vsyms = new ListBuffer[Symbol]
- while(ts ne Nil) {
- val vtpe = ts.head
- val vchild = newVarCapture(ua.pos, vtpe)
- val accSym = definitions.productProj(uresGet, i)
- val rhs = typed(Apply(Select(mkIdent(uresGet), accSym), List()))
- vdefs += typedValDef(vchild, rhs)
- vsyms += vchild
- ts = ts.tail
- i += 1
- }
- val ntemps = vsyms.toList ::: scrutinee :: rest.temp
- val dummies = getDummies(i - 1)
- val nrows = column.zip(rest.row) map {
- case (pat, Row(ps, subst, g, bx)) =>
- strip2(pat) match {
- case sameUnapplyCall(args) =>
- val nsubst = subst.add(strip1(pat).elements, scrutinee)
- Row( args::: EmptyTree ::ps, nsubst, g, bx)
- case _ =>
- Row(dummies::: pat ::ps, subst, g, bx)
- }}
-
- (uacall, vdefs.toList, rep.make(ntemps, nrows), nrepFail)
- }}
+ val nrepFail =
+ if (nrowsOther.isEmpty) None
+ else Some(rep.make(scrut.mkList(rest.temp), nrowsOther))
+
+ def mkTransition(vdefs: List[Tree], ntemps: List[Symbol], nrows: List[Row]) =
+ (uacall, vdefs, rep.make(scrut.mkList(ntemps, rest.temp), nrows), nrepFail)
+
+ // Second argument is number of dummies to prepend in the default case
+ def mkNewRows(sameFilter: (List[Tree]) => List[Tree], dum: Int) =
+ for ((pat @ Strip(vs, p), r) <- zipped) yield p match {
+ case sameUnapplyCall(args) => r.insert2(sameFilter(args) ::: List(EmptyTree), vs, scrut.sym)
+ case _ => r.insert(getDummies(dum) ::: List(pat))
+ }
+
+ args.length match {
+ case 0 => // special case for unapply(), app.tpe is boolean
+ mkTransition(Nil, Nil, mkNewRows((xs) => Nil, 0))
+
+ case 1 => // special case for unapply(p), app.tpe is Option[T]
+ val vtpe = app.tpe.typeArgs(0)
+ val vsym = newVarCapture(ua.pos, vtpe)
+ val nrows = mkNewRows((xs) => List(xs.head), 1)
+ val vdef = typedValDef(vsym, Get(mkIdent(ures)))
+ mkTransition(List(vdef), List(vsym), nrows)
+
+ case _ => // app.tpe is Option[? <: ProductN[T1,...,Tn]]
+ val uresGet = newVarCapture(ua.pos, app.tpe.typeArgs(0))
+ val vdefHead = typedValDef(uresGet, Get(mkIdent(ures)))
+ val ts = definitions.getProductArgs(uresGet.tpe).get
+ val nrows = mkNewRows(identity, ts.size)
+ val (vdefs: List[Tree], vsyms: List[Symbol]) = List.unzip(
+ for ((vtpe, i) <- ts.zip((1 to ts.size).toList)) yield {
+ val vchild = newVarCapture(ua.pos, vtpe)
+ val accSym = definitions.productProj(uresGet, i)
+ val rhs = typer.typed(Code.fn(mkIdent(uresGet), accSym))
+
+ (typedValDef(vchild, rhs), vchild)
+ })
+ mkTransition(vdefHead :: vdefs, vsyms, nrows)
+ }
} /* def getTransition(...) */
final def tree(implicit theOwner: Symbol, failTree: Tree) = {
- val (uacall , vdefs,srep,frep) = this.getTransition
+ val (uacall, vdefs, srep, frep) = this.getTransition
val succ = repToTree(srep)
- val fail = if (frep.isEmpty) failTree else repToTree(frep.get)
+ val fail = frep.map(repToTree) getOrElse failTree
val cond =
- if (uacall.symbol.tpe.typeSymbol eq definitions.BooleanClass)
- typed{ mkIdent(uacall.symbol) }
- else
- emptynessCheck(uacall.symbol)
- typed { squeezedBlock(List(rep.handleOuter(uacall)), If(cond,squeezedBlock(vdefs,succ),fail)) }
+ if (uacall.symbol.tpe.isBoolean) typer.typed(mkIdent(uacall.symbol))
+ else nonEmptinessCheck(uacall.symbol)
+
+ typer.typed( squeezedBlock(List(rep.handleOuter(uacall)), If(cond,squeezedBlock(vdefs,succ),fail)) )
}
}
/** handle sequence pattern and ArrayValue (but not star patterns)
*/
- sealed class MixSequence(val scrutinee: Symbol, val column: List[Tree], val rest: Rep)(implicit rep: RepFactory) extends RuleApplication(rep) {
-
- private val sequenceType = scrutinee.tpe.widen.baseType(definitions.SeqClass)
- private val elementType = getElemType_Sequence(scrutinee.tpe)
-
- final def removeStar(xs:List[Tree]):List[Tree] =
- xs.take(xs.length-1) ::: makeBind(strip1(xs.last).toList, mk_(sequenceType)) :: Nil
+ sealed class MixSequence(val pats: Patterns, val rest: Rep)(implicit rep: RepFactory) extends RuleApplication(rep) {
+ val Patterns(scrut, patterns) = pats
+
+ final def removeStar(xs: List[Tree]): List[Tree] =
+ xs.init ::: makeBind(strip1(xs.last).toList, mk_(scrut.sequenceType)) :: Nil
protected def getSubPatterns(len:Int, x:Tree):Option[List[Tree]] = x match {
case av @ ArrayValue(_,xs) if (!isRightIgnoring(av) && xs.length == len) => Some(xs ::: List(EmptyTree))
@@ -513,78 +410,53 @@ trait ParallelMatching {
case _ => None
}
- protected def makeSuccRep(vs:List[Symbol], tail:Symbol, nrows:List[Row])(implicit theOwner: Symbol) =
- rep.make( vs ::: tail :: rest.temp, nrows.toList)
-
- /** returns true if x is more general than y */
- protected def subsumes(x:Tree, y:Tree): Boolean = (x,y) match {
- case (av @ ArrayValue(_,xs), bv @ ArrayValue(_,ys)) =>
- isRightIgnoring(av) && !isRightIgnoring(bv) && xs.length == ys.length+1 // see (*)
- case _ =>
- false
- }
+ protected def makeSuccRep(vs: List[Symbol], tail: Symbol, nrows: List[Row])(implicit theOwner: Symbol) =
+ rep.make(vs ::: tail :: rest.temp, nrows)
+
+ /** True if x must be checked even if y failed to match after passing its length test
+ * (the conditional supplied by getCond)
+ */
+ protected def mustCheck(x:Tree, y:Tree): Boolean =
+ isDefaultPattern(x) || ((x, y) match {
+ case (av @ ArrayValue(_,xs), bv @ ArrayValue(_,ys)) =>
+ // if they are both right-ignoring, x must be more general if it has fewer literals - bug #889
+ if (isRightIgnoring(av) && isRightIgnoring(bv) && xs.length < ys.length) true
+ // otherwise, x is more general only if it is y plus a star
+ else isRightIgnoring(av) && !isRightIgnoring(bv) && xs.length == ys.length+1 // see (*)
+ case _ =>
+ false
+ })
// context (to be used in IF), success and failure Rep
def getTransition(implicit theOwner: Symbol): (Tree => Tree => Tree, Rep, Rep) = {
-
- assert(isSubType(scrutinee.tpe, column.head.tpe), "problem "+scrutinee.tpe+" not <: "+column.head.tpe)
-
- val treeAsSeq =
- if (!isSubType(scrutinee.tpe, column.head.tpe))
- typed(gen.mkAsInstanceOf(mkIdent(scrutinee), column.head.tpe, true))
- else
- mkIdent(scrutinee)
-
- column.head match {
- case av @ ArrayValue(_, xs) =>
-
- var childpats = new ListBuffer[Tree]
- var bindings = new ListBuffer[Tree]
- var vs = new ListBuffer[Symbol]
- var ix = 0
-
- // build new temps on which we will match subpatterns
-
- // if is right ignoring, don't want last one
- var ys = if (isRightIgnoring(av)) xs.take(xs.length-1) else xs;
- while(ys ne Nil) {
- val p = strip2(ys.head)
- childpats += p
- val temp = newVar(p.pos, elementType)
- vs += temp
- bindings += typedValDef(temp, seqElement(treeAsSeq.duplicate, ix))
- ix += 1
- ys = ys.tail
- }
- val tail = newVar(scrutinee.pos, sequenceType)
- bindings += typedValDef(tail, {if (ix > 0) seqDrop(treeAsSeq.duplicate, ix) else mkIdent(scrutinee)})
-
-
- val nrows = new ListBuffer[Row]
- val frows = new ListBuffer[Row]
- var cs = column; var rw = rest.row; while (cs ne Nil) {
- (getSubPatterns(ix, cs.head),rw.head) match {
- case (Some(ps), Row(pats,subst,g,b)) =>
- nrows += Row( ps ::: pats, subst, g, b)
- if (isDefaultPattern(cs.head) || subsumes(cs.head, av))
- frows += Row( cs.head :: pats, subst, g, b)
- case ( None , Row(pats,subst,g,b) ) =>
- frows += Row( cs.head :: pats, subst, g, b)
- }
- cs = cs.tail
- rw = rw.tail
- }
-
- val succRep = makeSuccRep(vs.toList, tail, nrows.toList)
- val failRep = rep.make( scrutinee :: rest.temp, frows.toList)
- // fixed length
- val cond = getCond(treeAsSeq, xs.length)
- return ({thenp:Tree => {elsep:Tree =>
- If(cond, squeezedBlock(bindings.toList, thenp), elsep)}}, succRep, failRep)
- }
+ scrut.assertIsSubtype(pats.head.tpe)
+ val treeAsSeq = scrut.id // scrut.tpe <:< column.head.tpe confirmed by assertion
+ val av @ ArrayValue(_, xs) = pats.head.tree
+ val ys = if (isRightIgnoring(av)) xs.init else xs
+ val vs = ys map(y => newVar(strip2(y).pos, scrut.elementType))
+
+ lazy val tail = newVar(scrut.pos, scrut.sequenceType)
+ lazy val lastBinding = if (ys.size > 0) seqDrop(treeAsSeq.duplicate, ys.size) else scrut.id
+ val bindings =
+ (for ((v, i) <- vs.zipWithIndex) yield typedValDef(v, seqElement(treeAsSeq.duplicate, i))) :::
+ List(typedValDef(tail, lastBinding))
+
+ val (nrows, frows) = List.unzip(
+ for ((c, row) <- pats.zip(rest.row)) yield getSubPatterns(ys.size, c) match {
+ case Some(ps) => (Some(row.insert(ps)), if (mustCheck(c, av)) Some(row.insert(c)) else None)
+ case None => (None, Some(row.insert(c)))
+ })
+
+ val succRep = makeSuccRep(vs, tail, nrows.flatMap(x => x))
+ val failRep = rep.make(scrut.mkList(rest.temp), frows.flatMap(x => x))
+
+ // fixed length
+ val cond = getCond(treeAsSeq, xs.length)
+ return ({thenp:Tree => {elsep:Tree =>
+ If(cond, squeezedBlock(bindings, thenp), elsep)}}, succRep, failRep)
}
// lengthArg is exact length
- protected def getCond(tree:Tree, lengthArg:Int) = seqHasLength(tree.duplicate, column.head.tpe, lengthArg)
+ protected def getCond(tree:Tree, lengthArg:Int) = seqHasLength(tree.duplicate, pats.head.tpe, lengthArg)
final def tree(implicit theOwner: Symbol, failTree: Tree) = {
val (cx,srep,frep) = this.getTransition
@@ -594,13 +466,13 @@ trait ParallelMatching {
}
}
- /** handle sequence pattern and ArrayValue (but not star patterns)
+ /** handle sequence pattern and ArrayValue with star patterns
*/
- final class MixSequenceStar(scrutinee:Symbol, column:List[Tree], rest:Rep)(implicit rep:RepFactory) extends MixSequence(scrutinee,column,rest) {
+ final class MixSequenceStar(pats: Patterns, rest:Rep)(implicit rep:RepFactory) extends MixSequence(pats, rest) {
// in principle, we could optimize more, but variable binding gets complicated (@todo use finite state methods instead)
override def getSubPatterns(minlen:Int, x:Tree) = x match {
case av @ ArrayValue(_,xs) if (!isRightIgnoring(av) && xs.length == minlen) => // Seq(p1,...,pN)
- Some(xs ::: gen.mkAttributedRef(definitions.NilModule) :: EmptyTree :: Nil)
+ Some(xs ::: gen.mkNil :: EmptyTree :: Nil)
case av @ ArrayValue(_,xs) if ( isRightIgnoring(av) && xs.length-1 == minlen) => // Seq(p1,...,pN,_*)
Some( removeStar(xs) ::: EmptyTree :: Nil)
case av @ ArrayValue(_,xs) if ( isRightIgnoring(av) && xs.length-1 < minlen) => // Seq(p1..,pJ,_*) J < N
@@ -613,793 +485,539 @@ trait ParallelMatching {
}
override protected def makeSuccRep(vs:List[Symbol], tail:Symbol, nrows:List[Row])(implicit theOwner: Symbol) =
- rep.make( vs ::: tail :: scrutinee :: rest.temp, nrows)
+ rep.make(scrut.mkList(vs ::: List(tail), rest.temp), nrows)
// lengthArg is minimal length
- override protected def getCond(tree:Tree, lengthArg:Int) = seqLongerThan(tree.duplicate, column.head.tpe, lengthArg - 1)
+ override protected def getCond(tree:Tree, lengthArg:Int) = seqLongerThan(tree.duplicate, pats.head.tpe, lengthArg - 1)
}
// @todo: equals test for same constant
- class MixEquals(val scrutinee: Symbol, val column: List[Tree], val rest: Rep)(implicit rep: RepFactory) extends RuleApplication(rep) {
+ class MixEquals(val pats: Patterns, val rest: Rep)(implicit rep: RepFactory) extends RuleApplication(rep) {
+ val Patterns(scrut, patterns) = pats
+ val head = pats.head
+
/** condition (to be used in IF), success and failure Rep */
final def getTransition(implicit theOwner: Symbol): (Tree, Rep, Symbol, Rep) = {
- val nmatrix = rest
- val vlue = (column.head.tpe: @unchecked) match {
- case TypeRef(_,_,List(SingleType(pre,sym))) =>
- gen.mkAttributedRef(pre,sym)
- case TypeRef(_,_,List(PseudoType(o))) =>
- o.duplicate
+ val vlue = (head.tpe: @unchecked) match {
+ case TypeRef(_,_,List(SingleType(pre,sym))) => gen.mkAttributedRef(pre,sym)
+ case TypeRef(_,_,List(PseudoType(o))) => o.duplicate
}
assert(vlue.tpe ne null, "value tpe is null")
- val vs = strip1(column.head)
- val nsuccFst = rest.row.head match { case Row(pats,bnd,g,b) => Row(EmptyTree::pats, bnd.add(vs.elements, scrutinee),g,b) }
- val fLabel = theOwner.newLabel(scrutinee.pos, cunit.fresh.newName(scrutinee.pos, "failCont%")) // warning, untyped
- val sx = rep.shortCut(fLabel) // register shortcut
- val nsuccRow = nsuccFst :: Row(getDummies( 1 /*scrutinee*/ + rest.temp.length), NoBinding, EmptyTree, sx) :: Nil
+ val vs = head.strip1.toList
+ val nsuccFst = rest.row.head.insert2(List(EmptyTree), vs, scrut.sym)
+ val fLabel = theOwner.newLabel(scrut.pos, cunit.fresh.newName(scrut.pos, "failCont%")) // warning, untyped
+ val sx = rep.shortCut(fLabel) // register shortcut
+ val nsuccRow = nsuccFst :: Row(getDummies( 1 /* scrutinee */ + rest.temp.length), NoBinding, NoGuard, sx) :: Nil
// todo: optimize if no guard, and no further tests
- val nsucc = rep.make(scrutinee :: rest.temp, nsuccRow)
- val nfail = repWithoutHead(column, rest)
- return (typed{ Equals(mkIdent(scrutinee) setType scrutinee.tpe, vlue) }, nsucc, fLabel, nfail)
+ val nsucc = rep.make(scrut.mkList(rest.temp), nsuccRow)
+ val nfail = repWithoutHead(pats, rest)
+
+ (typer.typed(Equals(scrut.id, vlue)), nsucc, fLabel, nfail)
}
final def tree(implicit theOwner: Symbol, failTree: Tree) = {
val (cond, srep, fLabel, frep) = this.getTransition
- val cond2 = typed { rep.handleOuter(cond) }
- val fail = typed { repToTree(frep) }
- fLabel setInfo (new MethodType(Nil, fail.tpe))
- val succ = repToTree(srep)
- try {
- typed{ If(cond2, succ, LabelDef(fLabel, Nil, fail)) }
- } catch {
- case e =>
- Console.println("failed to type-check If")
- Console.println("cond2: "+cond2)
- throw e
- }
+ val cond2 = typer.typed( rep.handleOuter(cond) )
+ val fail = typer.typed( repToTree(frep) )
+ fLabel setInfo MethodType(Nil, fail.tpe)
+
+ typer.typed( If(cond2, repToTree(srep), LabelDef(fLabel, Nil, fail)) )
}
}
/** mixture rule for type tests
**/
- class MixTypes(val scrutinee: Symbol, val column: List[Tree], val rest: Rep)(implicit rep: RepFactory) extends RuleApplication(rep) {
-
- var casted: Symbol = null
- var moreSpecific: List[Tree] = Nil
- var subsumed: List[(Int,List[Tree])] = Nil // row index and subpatterns
- var remaining: List[(Int,Tree)] = Nil // row index and pattern
-
- val isExhaustive = !scrutinee.tpe.typeSymbol.hasFlag(symtab.Flags.SEALED) || {
- val tpes = column.map {x => x.tpe.typeSymbol}
- scrutinee.tpe.typeSymbol.children.forall { sym => tpes.contains(sym) }
- }
-
- private val headPatternType = strip2(column.head) match {
- case p @ (_:Ident | _:Select) => singleType(p.symbol.tpe.prefix, p.symbol) //should be singleton object
- case __UnApply(_,argtpe,_) => argtpe
- case _ => column.head.tpe
- }
-
- private val isCaseHead = isCaseClass(headPatternType)
- private val dummies = if (!isCaseHead) Nil else getDummies(headPatternType.typeSymbol.caseFieldAccessors.length)
+ class MixTypes(val pats: Patterns, val rest: Rep)(implicit rep: RepFactory) extends RuleApplication(rep) {
+ val Patterns(scrut, patterns) = pats
- private def subpatterns(pat:Tree): List[Tree] = {
- pat match {
- case Bind(_,p) =>
- subpatterns(p)
- case app @ Apply(fn, pats) if isCaseClass(app.tpe) && fn.isType =>
- if (isCaseHead) pats else dummies
- case Apply(fn,xs) => assert((xs.isEmpty) && (!fn.isType), "strange Apply"); dummies // named constant
- case _: UnApply =>
- dummies
- case pat =>
- dummies
- }
- }
-
- /** an approximation of _tp1 <:< tp2 that ignores _ types. this code is wrong,
- * ideally there is a better way to do it, and ideally defined in Types.scala
- */
- def subsumes_erased(_tp1:Type, tp2:Type) = {
- val tp1 = patternType_wrtEquals(_tp1)
- tp1.isInstanceOf[TypeRef] && tp2.isInstanceOf[TypeRef] &&
- ((tp1.prefix =:= tp2.prefix) &&
- ((tp1.typeSymbol eq tp2.typeSymbol) &&
- (tp1.typeSymbol ne definitions.ArrayClass)) ||
- tp1.parents.exists(_.typeSymbol eq tp2.typeSymbol))
- // rather: tp1.baseTypes.exists...?
- }
-
- /** returns true if pattern tests an object */
- final def objectPattern(pat:Tree): Boolean = try {
- (pat.symbol ne null) &&
- (pat.symbol != NoSymbol) &&
- pat.symbol.tpe.prefix.isStable &&
- headPatternType =:= singleType(pat.symbol.tpe.prefix, pat.symbol)
- } catch {
- case e =>
- Console.println("object pattern test throws "+e.getMessage())
- throw e
- }
- /*init block*/ {
- var sr = (moreSpecific,subsumed,remaining)
- var j = 0; var pats = column; while(pats ne Nil) {
- val (ms,ss,rs) = sr // more specific, more general(subsuming current), remaining patterns
- val pat = pats.head
- val strippedPattern = strip2(pat)
- val patternType = strippedPattern.tpe
- sr = strippedPattern match {
- case Literal(Constant(null)) if !(headPatternType =:= patternType) => // special case for constant null pattern
- (ms,ss,(j,pat)::rs);
- case _ if objectPattern(pat) =>
- (EmptyTree::ms, (j,dummies)::ss, rs); // matching an object
-
- case Typed(p, _) if (strip2(p).isInstanceOf[UnApply] && (patternType /*is never <equals>*/ <:< headPatternType)) =>
- (p::ms, (j, dummies)::ss, rs);
-
- case q @ Typed(pp,_) if (patternType_wrtEquals(patternType) <:< headPatternType) =>
- ({if (pat.tpe =:= headPatternType /*never true for <equals>*/) pp else q}::ms, (j, dummies)::ss, rs);
-
- case z:UnApply =>
- (ms,ss,(j,pat)::rs)
-
- case qq if subsumes_erased(patternType, headPatternType) || (patternType_wrtEquals(patternType) <:< headPatternType) && !isDefaultPattern(pat) =>
- ({if (pat.tpe =:= headPatternType /*never true for <equals>*/) EmptyTree else pat}::ms, (j,subpatterns(pat))::ss, rs);
-
- case _ if subsumes_erased(headPatternType, patternType) || (headPatternType <:< patternType /*never true for <equals>*/) || isDefaultPattern(pat) =>
- (EmptyTree::ms, (j, dummies)::ss, (j,pat)::rs) // subsuming (matched *and* remaining pattern)
-
- case _ =>
- (ms,ss,(j,pat)::rs)
- }
- j += 1
- pats = pats.tail
- }
- this.moreSpecific = sr._1.reverse
- this.subsumed = sr._2.reverse
- this.remaining = sr._3.reverse
- sr = null
- } /* init block */
+ private def subpatterns(p: Tree): List[Tree] = p match {
+ case Bind(_, p) => subpatterns(p)
+ case app @ Apply(fn, ps) if app.tpe.isCaseClass && fn.isType => if (pats.isCaseHead) ps else pats.dummies
+ case Apply(fn, xs) if !xs.isEmpty || fn.isType => abort("strange Apply")
+ case _ => pats.dummies
+ }
+
+ // moreSpecific: more specific patterns
+ // subsumed: more general patterns (subsuming current), row index and subpatterns
+ // remaining: remaining, row index and pattern
+ def join[T](xs: List[Option[T]]): List[T] = xs.flatMap(x => x)
+ val (moreSpecific, subsumed, remaining) : (List[Tree], List[(Int, List[Tree])], List[(Int, Tree)]) = unzip3(
+ for ((pat @ Strip2(spat), j) <- pats.zip) yield {
+ def eqHead(tpe: Type) = pats.headType =:= tpe
+ def alts(yes: Tree, no: Tree) = if (eqHead(pat.tpe)) yes else no
+
+ lazy val isDef = isDefaultPattern(pat)
+ lazy val cmp: TypeComparison = spat.tpe.cmp(pats.headType) // contains type info about pattern's type vs. head pattern
+ lazy val dummy = (j, pats.dummies)
+ lazy val pass = (j, pat)
+ lazy val subs = (j, subpatterns(pat))
+
+ import cmp._ // imports xIsaY, etc.
+
+ // each pattern will yield a triple of options corresponding to the three lists,
+ // which will be flattened down to the values
+ implicit def mkOpt[T](x: T): Option[T] = Some(x) // limits noise from Some(value)
+ (spat match {
+ case Const(null) if !eqHead(spat.tpe) => (None, None, pass) // special case for constant null
+ case _ if pats.isObjectTest(pat) => (EmptyTree, dummy, None) // matching an object
+ case Typed(p @ Strip2(_: UnApply), _) if xIsaY => (p, dummy, None) // <:< is never <equals>
+ case q @ Typed(pp, _) if xIsaY => (alts(pp, q), dummy, None) // never =:= for <equals>
+ case z: UnApply => (None, None, pass)
+ case _ if erased.xIsaY || xIsaY && !isDef => (alts(EmptyTree, pat), subs, None) // never =:= for <equals>
+ case _ if erased.yIsaX || yIsaX || isDef => (EmptyTree, dummy, pass) // subsuming (matched *and* remaining pattern)
+ case _ => (None, None, pass)
+ }) : (Option[Tree], Option[(Int, List[Tree])], Option[(Int, Tree)])
+ }
+ ) match { case (x,y,z) => (join(x), join(y), join(z)) }
override def toString = {
- "MixTypes("+scrutinee+":"+scrutinee.tpe+") {\n moreSpecific:"+moreSpecific+"\n subsumed:"+subsumed+"\n remaining"+remaining+"\n}"
+ "MixTypes("+scrut+":"+scrut.tpe+") {\n moreSpecific:"+moreSpecific+"\n subsumed:"+subsumed+"\n remaining"+remaining+"\n}"
}
-
+
/** returns casted symbol, success matrix and optionally fail matrix for type test on the top of this column */
- final def getTransition(implicit theOwner: Symbol): (Symbol, Rep, Option[Rep]) = {
- casted = if (scrutinee.tpe =:= headPatternType) scrutinee else newVar(scrutinee.pos, headPatternType)
- if (scrutinee.hasFlag(symtab.Flags.TRANS_FLAG))
- casted.setFlag(symtab.Flags.TRANS_FLAG)
+ final def getTransition(implicit theOwner: Symbol): (Scrutinee, Rep, Option[Rep]) = {
+ val casted = scrut.casted(pats.headType)
+
// succeeding => transition to translate(subsumed) (taking into account more specific)
val nmatrix = {
- var ntemps = if (!isCaseHead) Nil else casted.caseFieldAccessors map {
- meth =>
- val ctemp = newVar(scrutinee.pos, casted.tpe.memberType(meth).resultType)
- if (scrutinee.hasFlag(symtab.Flags.TRANS_FLAG))
- ctemp.setFlag(symtab.Flags.TRANS_FLAG)
- ctemp
- } // (***) flag needed later
- var subtests = subsumed
- if (moreSpecific.exists { x => x != EmptyTree }) {
- ntemps = casted::ntemps
- subtests = moreSpecific.zip(subsumed) map {
- case (mspat, (j,pats)) => (j,mspat::pats)
- }
- }
- ntemps = ntemps ::: rest.temp
- val ntriples = subtests map {
- case (j,pats) =>
- val (vs,thePat) = strip(column(j))
- val Row(opats, osubst, og, bx) = rest.row(j)
- val nsubst = osubst.add(vs.elements, casted)
- Row(pats ::: opats, nsubst, og, bx)
+ val ms = moreSpecific.exists(_ != EmptyTree)
+ val accessorTemps =
+ if (!pats.isCaseHead) Nil
+ else casted.accessors.map(meth => newVar(scrut.pos, casted.tpe.memberType(meth).resultType, scrut.flags))
+ val subtestTemps = if (!ms) Nil else List(casted.sym)
+ val subtests =
+ if (!ms) subsumed
+ else moreSpecific.zip(subsumed) map { case (mspat, (j, pats)) => (j, mspat::pats) }
+ val ntriples = for ((j, ps) <- subtests) yield {
+ val (vs, thePat) = strip(pats(j))
+ rest.row(j).insert2(ps, vs, casted.sym)
}
- rep.make(ntemps, ntriples)
+ rep.make(subtestTemps ::: accessorTemps ::: rest.temp, ntriples)
}
+
// fails => transition to translate(remaining)
val nmatrixFail: Option[Rep] = {
- val ntemps = scrutinee :: rest.temp
- val ntriples = remaining map {
- case (j, pat) => val r = rest.row(j); Row(pat :: r.pat, r.subst, r.guard, r.bx)
- }
+ val ntemps = scrut.mkList(rest.temp)
+ val ntriples = for ((j, pat) <- remaining) yield rest.row(j).insert(pat)
if (ntriples.isEmpty) None else Some(rep.make(ntemps, ntriples))
}
+
(casted, nmatrix, nmatrixFail)
}
final def tree(implicit theOwner: Symbol, failTree: Tree): Tree = {
- val (casted,srep,frep) = this.getTransition
- val condUntyped = condition(casted.tpe, this.scrutinee)
- var cond = rep.handleOuter(typed { condUntyped })
- if (needsOuterTest(casted.tpe, this.scrutinee.tpe, theOwner)) { // @todo merge into def condition
- cond = addOuterCondition(cond, casted.tpe, mkIdent(this.scrutinee), rep.handleOuter)
- }
+ val (casted, srep, frep) = this.getTransition
+ val cond = condition(casted.tpe, scrut)
val succ = repToTree(srep)
-
- val fail = if (frep.isEmpty) failTree else repToTree(frep.get)
+ val fail = frep.map(repToTree) getOrElse failTree
// dig out case field accessors that were buried in (***)
- val cfa = if (!isCaseHead) Nil else casted.caseFieldAccessors
- val caseTemps = (if (!srep.temp.isEmpty && srep.temp.head == casted) srep.temp.tail else srep.temp).zip(cfa)
-
- try{
- var vdefs = caseTemps map {
- p =>
- val tmp = p._1;
- val accessorMethod = p._2
- val untypedAccess = Apply(Select(mkIdent(casted), accessorMethod),List())
- val typedAccess = typed { untypedAccess }
- typedValDef(tmp, typedAccess)
- }
+ val cfa = if (!pats.isCaseHead) Nil else casted.accessors
+ val caseTemps = srep.temp match { case x :: xs if x == casted.sym => xs ; case x => x }
+
+ var vdefs = for ((tmp, accessorMethod) <- caseTemps.zip(cfa)) yield {
+ val untypedAccess = Code.fn(casted.id, accessorMethod)
+ val typedAccess = typer.typed(untypedAccess)
+ typedValDef(tmp, typedAccess)
+ }
- if (casted ne this.scrutinee)
- vdefs = ValDef(casted, gen.mkAsInstanceOf(mkIdent(this.scrutinee), casted.tpe)) :: vdefs
+ if (casted.sym ne scrut.sym)
+ vdefs = ValDef(casted.sym, gen.mkAsInstanceOf(scrut.id, casted.tpe)) :: vdefs
- return typed { If(cond, squeezedBlock(vdefs, succ), fail) }
- } catch {
- case e =>
- throw new FatalError("EXCEPTION:"+e.getMessage())
- }
+ typer.typed( If(cond, squeezedBlock(vdefs, succ), fail) )
}
}
/** converts given rep to a tree - performs recursive call to translation in the process to get sub reps
*/
- final def repToTree(r: Rep)(implicit theOwner: Symbol, failTree: Tree, rep: RepFactory): Tree = {
+ final def repToTree(r: Rep)(implicit theOwner: Symbol, failTree: Tree, rep: RepFactory): Tree =
r.applyRule.tree
- }
-
- case class Row(pat:List[Tree], subst:Binding, guard:Tree, bx:Int)
-
- object Rep {
- type RepType = Product2[List[Symbol], List[Row]]
- final def unapply(x:Rep)(implicit rep:RepFactory):Option[RepType] =
- if (x.isInstanceOf[rep.RepImpl]) Some(x.asInstanceOf[RepType]) else None
- }
- class RepFactory(val handleOuter: Tree => Tree) {
- case class RepImpl(val temp:List[Symbol], val row:List[Row]) extends Rep with Rep.RepType {
- (row.find { case Row(pats, _, _, _) => temp.length != pats.length }) match {
- case Some(row) => assert(false, "temp == "+temp+" row.pats == "+row.pat);
- case _ =>
- }
- def _1 = temp
- def _2 = row
- }
- var vss: List[SymList] = _
- var labels: Array[Symbol] = new Array[Symbol](4)
- var targets: List[Tree] = _
- var reached64: Set64 = _
- var reached: List[Int] = Nil
- var shortCuts: List[Symbol] = Nil;
-
- final def make(temp:List[Symbol], row:List[Row], targets: List[Tree], vss:List[SymList])(implicit theOwner: Symbol): Rep = {
- // ensured that labels(i) eq null for all i, cleanup() has to be called after translation
- this.targets = targets
- if (targets.length > labels.length)
- this.labels = new Array[Symbol](targets.length)
- this.vss = vss
- this.reached64 = if (targets.length < 64) new Set64 else null
- return make(temp, row)
- }
-
- final def shortCut(theLabel:Symbol): Int = {
- this.shortCuts = shortCuts:::theLabel::Nil;
- return -shortCuts.length
- }
-
- final def cleanup(tree: Tree)(implicit theOwner: Symbol): Tree = {
- object lxtt extends Transformer {
- override def transform(tree:Tree): Tree = tree match {
- case blck @ Block(vdefs, ld @ LabelDef(name,params,body)) =>
- val bx = labelIndex(ld.symbol)
- if ((bx >= 0) && !isReachedTwice(bx)) {
- squeezedBlock(vdefs,body)
- }
- else
- blck
-
- case If(cond, Literal(Constant(true)), Literal(Constant(false))) =>
- super.transform(cond)
- case If(cond1, If(cond2, thenp, elsep1), elsep2) if (elsep1 equalsStructure elsep2) =>
- super.transform(If(And(cond1,cond2), thenp, elsep1))
- case If(cond1, If(cond2, thenp, Apply(jmp,List())), ld:LabelDef) if (jmp.symbol eq ld.symbol) =>
- super.transform(If(And(cond1,cond2), thenp, ld))
+ case class Row(pat: List[Tree], subst: Bindings, guard: Guard, bx: Int) {
+ def insert(h: Tree) = Row(h :: pat, subst, guard, bx)
+ def insert(hs: List[Tree]) = Row(hs ::: pat, subst, guard, bx) // prepends supplied tree
+ def replace(hs: List[Tree]) = Row(hs, subst, guard, bx) // substitutes for patterns
+ def rebind(b: Bindings) = Row(pat, b, guard, bx) // substitutes for bindings
+ def insert2(hs: List[Tree], vs: Iterable[Symbol], temp: Symbol) = // prepends and prepends
+ Row(hs ::: pat, subst.add(vs, temp), guard, bx)
+
+ def insert(p: Pattern) = Row(p.tree :: pat, subst, guard, bx) // transitioning to patterns
+
+ /** returns true if the patterns in this row cover a type symbols "combination" and there is no guard
+ * @param comb pairs of (column index, type symbol)
+ */
+ def covers(comb: List[(Int, Symbol)]) = {
+ lazy val results = for ((i, sym) <- comb ; val p = strip2(pat(i))) yield p match {
+ case _ if isDefaultPattern(p) => true
+ case _: UnApply | _: ArrayValue => true
+ case _ => p.tpe.coversSym(sym)
+ }
+
+ guard.isEmpty && results.forall(_ == true)
+ }
- case t => super.transform(t)
+ // returns this row with alternatives expanded
+ def expand(classifyPat: (Tree, Int) => Tree): List[Row] = {
+ def isAlternative(p: Tree): Boolean = p match {
+ case Bind(_,p) => isAlternative(p)
+ case Alternative(ps) => true
+ case _ => false
+ }
+ def getAlternativeBranches(p: Tree): List[Tree] = {
+ def get_BIND(pctx:Tree => Tree, p:Tree): List[Tree] = p match {
+ case b @ Bind(n,p) => get_BIND((x: Tree) => pctx(copy.Bind(b, n, x) setType x.tpe), p)
+ case Alternative(ps) => ps map pctx
+ }
+ get_BIND(x => x, p)
}
+
+ val indexOfAlternative = pat findIndexOf isAlternative
+ val pats: List[Tree] = List.map2(pat, pat.indices)(classifyPat)
+ lazy val (prefix, alts :: suffix) = pats.splitAt(indexOfAlternative)
+ lazy val alternativeBranches = getAlternativeBranches(alts) map { p => replace(prefix ::: p :: suffix) }
+
+ if (indexOfAlternative == -1) List(replace(pats)) else alternativeBranches
}
- val res = lxtt.transform(tree)
- cleanup()
- res
}
- final def cleanup() {
- var i = targets.length;
- while (i>0) { i-=1; labels(i) = null; };
- reached = Nil
- shortCuts = Nil
- }
- final def isReached(bx:Int) = { labels(bx) ne null }
- final def markReachedTwice(bx:Int) = if (reached64 ne null) { reached64 |= bx } else { reached = insertSorted(bx, reached) }
- /** @pre bx < 0 || labelIndex(bx) != -1 */
- final def isReachedTwice(bx:Int) = (bx < 0) || (if (reached64 ne null) { reached64 contains bx } else { findSorted(bx,reached) })
- /* @returns bx such that labels(bx) eq label, -1 if no such bx exists */
- final def labelIndex(label:Symbol): Int = {
- var bx = 0; while((bx < labels.length) && (labels(bx) ne label)) { bx += 1 }
- if (bx >= targets.length) bx = -1
- return bx
- }
- /** first time bx is requested, a LabelDef is returned. next time, a jump.
- * the function takes care of binding
- */
- final def requestBody(bx:Int, subst:Binding)(implicit theOwner: Symbol): Tree = {
- if (bx < 0) { // is shortcut
- val jlabel = shortCuts(-bx-1)
- val jump = Apply(mkIdent(jlabel), Nil)
- return jump
- }
- if (!isReached(bx)) { // first time this bx is requested
- val argts = new ListBuffer[Type] // types of
- var vrev: List[Symbol] = Nil
- var vdefs:List[Tree] = Nil
- val it = vss(bx).elements; while(it.hasNext) {
- val v = it.next
- val substv = subst(v)
- if (substv ne null) { // might be bound elsewhere ( see `x @ unapply' )
- vrev = v :: vrev
- argts += v.tpe
- vdefs = typedValDef(v, substv)::vdefs
- }
- }
- val body = targets(bx)
- // @bug: typer is not able to digest a body of type Nothing being assigned result type Unit
- val tpe = if (body.tpe.typeSymbol eq definitions.NothingClass) body.tpe else resultType
- val label = theOwner.newLabel(body.pos, "body%"+bx).setInfo(new MethodType(argts.toList, tpe))
- labels(bx) = label
-
- if (body.isInstanceOf[Throw] || body.isInstanceOf[Literal]) {
- return squeezedBlock(vdefs.reverse, body.duplicate setType tpe)
+ case class Columns(cols: Column*)
+ case class Column(pat: Tree, index: Int)
+
+ class RepFactory(val handleOuter: Tree => Tree)(implicit val typer : Typer) {
+ var vss: List[List[Symbol]] = _
+ var labels: Array[Symbol] = new Array[Symbol](4)
+ var targets: List[Tree] = _
+ var reached: BitSet = _
+ var shortCuts: List[Symbol] = Nil
+
+ final def make(temp:List[Symbol], row:List[Row], targets: List[Tree], vss:List[List[Symbol]])(implicit theOwner: Symbol): Rep = {
+ // ensured that labels(i) eq null for all i, cleanup() has to be called after translation
+ this.targets = targets
+ if (targets.length > labels.length)
+ this.labels = new Array[Symbol](targets.length)
+ this.vss = vss
+ this.reached = new BitSet(targets.length)
+ make(temp, row)
+ }
+
+ final def shortCut(theLabel:Symbol): Int = {
+ shortCuts = shortCuts ::: List(theLabel)
+ -shortCuts.length
+ }
+
+ final def cleanup(tree: Tree)(implicit theOwner: Symbol): Tree = {
+ object lxtt extends Transformer {
+ override def transform(tree:Tree): Tree = tree match {
+ case blck @ Block(vdefs, ld @ LabelDef(name,params,body)) =>
+ val bx = labelIndex(ld.symbol)
+ if (bx >= 0 && !isReachedTwice(bx)) squeezedBlock(vdefs,body)
+ else blck
+
+ case If(cond, Const(true), Const(false)) =>
+ super.transform(cond)
+ case If(cond1, If(cond2, thenp, elsep1), elsep2) if (elsep1 equalsStructure elsep2) =>
+ super.transform(If(And(cond1,cond2), thenp, elsep1))
+ case If(cond1, If(cond2, thenp, Apply(jmp,List())), ld:LabelDef) if (jmp.symbol eq ld.symbol) =>
+ super.transform(If(And(cond1,cond2), thenp, ld))
+
+ case t => super.transform(t)
+ }
}
- return squeezedBlock(vdefs, LabelDef(label, vrev.reverse, body setType tpe))
- }
-
- // jump
- markReachedTwice(bx) // if some bx is not reached twice, its LabelDef
- val args = new ListBuffer[Ident] // is replaced with body itself
- var vs = vss(bx).elements; while(vs.hasNext) {
- val v = vs.next
- val substv = subst(v)
- assert(substv ne null, "subst("+v+") is null"+cunit.toString) // if sharing takes place, then 'binding elsewhere' is not allowed
- args += substv
+ val res = lxtt.transform(tree)
+ cleanup()
+ res
}
- val label = labels(bx)
- label.tpe match {
- case MethodType(fmls,_) =>
- if (fmls.length != args.length) { // sanity check
- cunit.error(targets(bx).pos, "consistency problem in target generation ! I have args "+args+" and need to jump to a label with fmls "+fmls)
- throw FatalError("consistency problem")
- }
- for((f,a) <- fmls.zip(args.toList)) {
- if (!(a.tpe <:< f)) {
- cunit.error(targets(bx).pos, "consistency problem ! "+a.tpe+" "+f)
- throw FatalError("consistency problem")
- }
+
+ final def cleanup() {
+ for (i <- 0 until targets.length) labels(i) = null
+ reached = null
+ shortCuts = Nil
+ }
+ final def isReached(bx:Int) = labels(bx) ne null
+ final def markReachedTwice(bx:Int) { reached += bx }
+ /** @pre bx < 0 || labelIndex(bx) != -1 */
+ final def isReachedTwice(bx: Int) = (bx < 0) || reached(bx)
+ /* @returns bx such that labels(bx) eq label, -1 if no such bx exists */
+ final def labelIndex(label: Symbol): Int = labels.findIndexOf(_ eq label)
+
+ /** first time bx is requested, a LabelDef is returned. next time, a jump.
+ * the function takes care of binding
+ */
+ final def requestBody(bx: Int, subst: Bindings)(implicit theOwner: Symbol): Tree = {
+ if (bx < 0) { // is shortcut
+ val jlabel = shortCuts(-bx-1)
+ return Apply(mkIdent(jlabel), Nil)
+ }
+ if (!isReached(bx)) { // first time this bx is requested
+ // might be bound elsewhere ( see `x @ unapply' ) <-- this comment refers to null check
+ val (vsyms, argts, vdefs) : (List[Symbol], List[Type], List[Tree]) = unzip3(
+ for (v <- vss(bx) ; substv <- subst(v)) yield
+ (v, v.tpe, typedValDef(v, substv))
+ )
+
+ val body = targets(bx)
+ // @bug: typer is not able to digest a body of type Nothing being assigned result type Unit
+ val tpe = if (body.tpe.isNothing) body.tpe else resultType
+ val label = theOwner.newLabel(body.pos, "body%"+bx) setInfo MethodType(argts, tpe)
+ // TODO - newLabel doesn't get a fresh name, is that okay? or should it be more like this:
+ // val label = theOwner.newLabel(body.pos, cunit.fresh.newName(body.pos, "body%"+bx)) setInfo MethodType(argts, tpe)
+ labels(bx) = label
+
+ return body match {
+ case _: Throw | _: Literal => squeezedBlock(vdefs, body.duplicate setType tpe)
+ case _ => squeezedBlock(vdefs.reverse, LabelDef(label, vsyms, body setType tpe))
}
- }
- val body = targets(bx)
- if (body.isInstanceOf[Throw] || body.isInstanceOf[Literal]) {
- val vdefs = new ListBuffer[Tree]
- val it = vss(bx).elements; while(it.hasNext) {
- val v = it.next
- val substv = subst(v)
- if (substv ne null) { // might be bound elsewhere ( see `x @ unapply' )
- vdefs += typedValDef(v, substv)
- }
}
- return squeezedBlock(vdefs.toList, body.duplicate setType resultType)
- }
-
-
- return Apply(mkIdent(label),args.toList)
- }
-
- /** the injection here handles alternatives and unapply type tests */
- final def make(temp:List[Symbol], row1:List[Row])(implicit theOwner: Symbol): Rep = {
- var unchanged: Boolean = true
- val row = row1 flatMap {
- xx =>
- def isAlternative(p: Tree): Boolean = p match {
- case Bind(_,p) => isAlternative(p)
- case Alternative(ps) => true
- case _ => false
+
+ // if some bx is not reached twice, its LabelDef is replaced with body itself
+ markReachedTwice(bx)
+ val args: List[Ident] = vss(bx).flatMap(subst(_))
+ val label = labels(bx)
+ val body = targets(bx)
+ val MethodType(fmls, _) = label.tpe
+
+ // sanity checks
+ if (fmls.length != args.length) {
+ cunit.error(body.pos, "consistency problem in target generation ! I have args "+
+ args+" and need to jump to a label with fmls "+fmls)
+ throw FatalError("consistency problem")
+ }
+ fmls.zip(args).find(x => !(x._2.tpe <:< x._1)) match {
+ case Some(Tuple2(f, a)) => cunit.error(body.pos, "consistency problem ! "+a.tpe+" "+f) ; throw FatalError("consistency problem")
+ case None =>
+ }
+
+ body match {
+ case _: Throw | _: Literal => // might be bound elsewhere (see `x @ unapply')
+ val vdefs = for (v <- vss(bx) ; substv <- subst(v)) yield typedValDef(v, substv)
+ squeezedBlock(vdefs, body.duplicate setType resultType)
+ case _ =>
+ Apply(mkIdent(label),args)
+ }
+ }
+
+ /** the injection here handles alternatives and unapply type tests */
+ final def make(temp: List[Symbol], row1: List[Row])(implicit theOwner: Symbol): Rep = {
+ // equals check: call singleType(NoPrefix, o.symbol) `stpe'. Then we could also return
+ // `typeRef(definitions.ScalaPackageClass.tpe, definitions.EqualsPatternClass, List(stpe))'
+ // and force an equality check. However, exhaustivity checking would not work anymore.
+ // so first, extend exhaustivity check to equalspattern
+ def sType(o: Tree) = singleType(o.tpe.prefix, o.symbol)
+ def equalsCheck(o: Tree) = if (o.symbol.isValue) singleType(NoPrefix, o.symbol) else sType(o)
+ def isModule(o: Tree) = o.symbol.isModule || o.tpe.termSymbol.isModule
+ def applyType(o: Tree, fn: Tree): Type = fn match {
+ case _ if isModule(o) => sType(o)
+ case Select(path, sym) => (path, path.tpe) match {
+ case (_, t: ThisType) => singleType(t, o.symbol) // cases 2/3 are e.g. `case Some(p._2)' in s.c.jcl.Map
+ case (_: Apply, _) => PseudoType(o) // outer-matching: test/files/pos/t154.scala
+ case (_, _) => singleType(sType(path), o.symbol) // old
}
- def getAlternativeBranches(p:Tree): List[Tree] = {
- def get_BIND(pctx:Tree => Tree, p:Tree):List[Tree] = p match {
- case b @ Bind(n,p) => get_BIND({ x:Tree => pctx(copy.Bind(b, n, x) setType x.tpe) }, p)
- case Alternative(ps) => ps map pctx
- }
- get_BIND({x=>x}, p)
+ case o: Ident => equalsCheck(o)
+ }
+
+ def classifyPat(opat: Tree, j: Int): Tree = {
+ val (vs, strippedPat) = strip(opat) match { case (vset, pat) => (vset.toList, pat) }
+ // @todo: rewrite UnApply(Apply(fn, _), _) case, using __UnApply instead of UnApply like so:
+ // case ua @ __UnApply(_,argtpe,_) =>
+ // val ua = prepat
+ // val npat = (if (temp(j).tpe <:< argtpe) ua else Typed(ua,TypeTree(argtpe)).setType(argtpe))
+ // pats = (makeBind(vs, npat) setType argtpe)::pats
+
+ strippedPat match {
+ case _: Alternative => opat
+ case Typed(p @ Strip2(_: UnApply), tpt) => if (temp(j).tpe <:< tpt.tpe) makeBind(vs, p)
+ else opat
+ // case Ident_Or_Empty() => opat // this doesn't work - see notes in PatternNode
+ case Ident(nme.WILDCARD) | EmptyTree => opat
+ case _: Literal | _: Typed => opat
+ case o: Ident => mkTypedBind(vs, equalsCheck(o)) // Ident(_) != nme.WILDCARD
+ case o: Select => mkTypedBind(vs, equalsCheck(o))
+ // @pre for UnApply_TypeApply: is not right-ignoring (no star pattern) ; no exhaustivity check
+ case UnApply_TypeApply(tptArg, xs) => temp(j) setFlag Flags.TRANS_FLAG
+ makeBind(vs, normalizedListPattern(xs, tptArg.tpe))
+ case ua @ UnApply(Apply(fn, _), _) => val MethodType(List(argtpe, _*), _) = fn.tpe
+ val npat = if (temp(j).tpe <:< argtpe) ua
+ else Typed(ua, TypeTree(argtpe)) setType argtpe
+ makeBind(vs, npat) setType argtpe
+ case o @ Apply_Function(fn) => val stpe = applyType(o, fn)
+ val ttst = mkEqualsRef(List(stpe))
+ makeBind(vs, Typed(mk_(ttst), TypeTree(stpe)) setType ttst)
+ case Apply_Value(pre, sym) => mkEmptyTreeBind(vs, mkEqualsRef(List(singleType(pre, sym))))
+ case Apply_CaseClass_NoArgs(tpe) => mkEmptyTreeBind(vs, tpe)
+ case Apply_CaseClass_WithArgs() => opat
+ case _: ArrayValue => opat
+ case x => throw new Exception("Unexpected pattern: " + x.getClass + " => " + x)
}
- val Row(opatso, subst, g, bx) = xx
- var opats = opatso
- var pats:List[Tree] = Nil
- var indexOfAlternative = -1
- var j = 0; while(opats ne Nil) {
- var opat = opats.head // original pattern
- val (vars, strippedPat) = strip(opat)
- val vs = vars.toList
- (strippedPat: @unchecked) match {
-
- case p @ Alternative(ps) =>
- DBG("Alternative")
- if (indexOfAlternative == -1) {
- unchanged = false
- indexOfAlternative = j
- }
- pats = opat :: pats
-
- case typat @ Typed(p,tpt) if strip2(p).isInstanceOf[UnApply]=>
- DBG("Typed")
- pats = (if (temp(j).tpe <:< tpt.tpe) makeBind(vs, p) else opat)::pats
+ }
- case Ident(nme.WILDCARD) | EmptyTree | _:Literal | _:Typed =>
- DBG("Ident(_)|EmptyTree")
- pats = opat :: pats
-
- case o @ Ident(n) => // n != nme.WILDCARD
- DBG("Ident")
- val tpe =
- if (!o.symbol.isValue) {
- singleType(o.tpe.prefix, o.symbol)
- } else {
- singleType(NoPrefix, o.symbol) // equals-check
- // call the above `stpe'. Then we could also return
- // `typeRef(definitions.ScalaPackageClass.tpe, definitions.EqualsPatternClass, List(stpe))'
- // and force an equality check. However, exhaustivity checking would not work anymore.
- // so first, extend exhaustivity check to equalspattern
- }
- val p = Ident(nme.WILDCARD) setType tpe
- val q = Typed(p, TypeTree(tpe)) setType tpe
- pats = (makeBind( vs, q) setType tpe) :: pats
-
-
- case o @ Select(stor,_) =>
- DBG("Select")
- val stpe =
- if (!o.symbol.isValue) {
- singleType(o.tpe.prefix, o.symbol)
- } else {
- singleType(NoPrefix, o.symbol) // equals-check
- }
- val p = Ident(nme.WILDCARD) setType stpe
- val q = makeBind(vs,Typed(p, TypeTree(stpe)) setType stpe) setType stpe
- pats = q::pats
-
- case UnApply(Apply(TypeApply(sel @ Select(stor, nme.unapplySeq),List(tptArg)),_),ArrayValue(_,xs)::Nil) if (stor.symbol eq definitions.ListModule) =>
- DBG("Unapply(...TypeApply...)")
- //@pre: is not right-ignoring (no star pattern)
- // no exhaustivity check, please
- temp(j).setFlag(symtab.Flags.TRANS_FLAG)
- val listType = typeRef(mkThisType(definitions.ScalaPackage), definitions.ListClass, List(tptArg.tpe))
- val nmlzdPat = normalizedListPattern(xs, tptArg.tpe)
- pats = makeBind(vs, nmlzdPat) :: pats
-
- //@todo: rewrite, using __UnApply instead of UnApply like so:
- //case ua @ __UnApply(_,argtpe,_) =>
- //val ua = prepat
- // val npat = (if (temp(j).tpe <:< argtpe) ua else Typed(ua,TypeTree(argtpe)).setType(argtpe))
- // pats = (makeBind(vs, npat) setType argtpe)::pats
-
-
- case ua @ UnApply(Apply(fn, _), _) =>
- DBG("Unapply(Apply())")
- fn.tpe match {
- case MethodType(List(argtpe,_*),_) =>
- val npat = (if (temp(j).tpe <:< argtpe) ua else Typed(ua,TypeTree(argtpe)).setType(argtpe))
- pats = (makeBind(vs, npat) setType argtpe)::pats
- }
-
- case o @ Apply(fn, List()) if !isCaseClass(o.tpe) || /*see t301*/ !Apply_Value.unapply(o).isEmpty =>
- DBG("Apply !isCaseClass")
- val stpe: Type = fn match {
- case _ if (o.symbol.isModule) =>
- singleType(o.tpe.prefix, o.symbol)
- case _ if (o.tpe.termSymbol.isModule) =>
- singleType(o.tpe.prefix, o.symbol)
- case Select(path,sym) =>
- path.tpe match {
- case ThisType(sym) =>
- singleType(path.tpe, o.symbol)
-
- case _ => // e.g. `case Some(p._2)' in scala.collection.jcl.Map
- if (path.isInstanceOf[Apply])
- new PseudoType(o) // outer-matching, see test/files/pos/t154.scala
- else
- singleType(singleType(path.tpe.prefix, path.symbol), o.symbol) // old
-
- }
- case o @ Ident(_) =>
- if (!o.symbol.isValue)
- singleType(o.tpe.prefix, o.symbol)
- else
- singleType(NoPrefix, o.symbol)
- }
- val ttst = typeRef(NoPrefix, definitions.EqualsPatternClass, List(stpe))
- val p = Ident(nme.WILDCARD) setType ttst
- val q = makeBind(vs,Typed(p, TypeTree(stpe)) setType ttst)
- pats = q::pats
-
- case Apply_Value(pre, sym) =>
- DBG("Apply_Value")
- val tpe = typeRef(NoPrefix, definitions.EqualsPatternClass, singleType(pre, sym)::Nil)
- val q = makeBind(vs,Typed(EmptyTree, TypeTree(tpe)) setType tpe)
- pats = q :: pats
-
- case Apply_CaseClass_NoArgs(tpe) => // no-args case class pattern
- DBG("Apply_CaseClass_NoArgs")
- val q = makeBind(vs, Typed(EmptyTree, TypeTree(tpe)) setType tpe)
- pats = q :: pats
-
- case Apply_CaseClass_WithArgs() => // case class pattern with args
- DBG("Apply_CaseClass_WithArgs")
- pats = opat :: pats
-
- case ArrayValue(_,xs) =>
- DBG("ArrayValue")
- pats = opat :: pats
-
- }
- opats = opats.tail
- j += 1
- }
- pats = pats.reverse
- if (indexOfAlternative == -1) {
- val res = List(Row(pats, subst, g, bx))
- DBG("finished: result "/*+res*/)
- res
- }
- else {
- val prefix = pats.take( indexOfAlternative )
- val alts = getAlternativeBranches(pats( indexOfAlternative ))
- val suffix = pats.drop(indexOfAlternative + 1)
- val intermediary_result = alts map { p => Row(prefix ::: p :: suffix, subst, g, bx) }
- DBG("not finished: intermediary_result = "/*+intermediary_result*/)
- intermediary_result
- }
- }
- if (unchanged) {
- val ri = RepImpl(temp,row).init
- ri
- } else {
- this.make(temp,row) // recursive call
+ val row = row1 flatMap { _.expand(classifyPat) }
+ if (row.length != row1.length) make(temp, row) // recursive call if any change
+ else Rep(temp, row).init
}
}
-}
- abstract class Rep {
- val temp:List[Symbol]
- val row:List[Row]
- var sealedCols = List[Int]()
- var sealedComb = List[Set[Symbol]]()
-
- final def init: this.type = {
- temp.zipWithIndex.foreach {
- case (sym,i) =>
- if (sym.hasFlag(symtab.Flags.MUTABLE) && // indicates that have not yet checked exhaustivity
- !sym.hasFlag(symtab.Flags.TRANS_FLAG) && // indicates @unchecked
- sym.tpe.typeSymbol.hasFlag(symtab.Flags.SEALED)) {
-
- sym.resetFlag(symtab.Flags.MUTABLE)
- sealedCols = i::sealedCols
- // this should enumerate all cases... however, also the superclass is taken if it is not abstract
- def candidates(tpesym: Symbol): SymSet =
- if (!tpesym.hasFlag(symtab.Flags.SEALED)) emptySymbolSet else
- tpesym.children.flatMap { x =>
- val z = candidates(x)
- if (x.hasFlag(symtab.Flags.ABSTRACT)) z else z + x
- }
- val cases = candidates(sym.tpe.typeSymbol)
- sealedComb = cases::sealedComb
- }
- }
- // computes cartesian product, keeps indices available
- def combine(colcom: List[(Int,Set[Symbol])]): List[List[(Int,Symbol)]] = colcom match {
- case Nil => Nil
- case (i,syms)::Nil => syms.toList.map { sym => List((i,sym)) }
- case (i,syms)::cs => for (s <- syms.toList; rest <- combine(cs)) yield (i,s) :: rest
- }
+ case class Rep(val temp: List[Symbol], val row: List[Row]) {
+ private def setsToCombine: List[(Int, immutable.Set[Symbol])] = for {
+ (sym, i) <- temp.zipWithIndex
+ if sym hasFlag Flags.MUTABLE // indicates that have not yet checked exhaustivity
+ if !(sym hasFlag Flags.TRANS_FLAG) // indicates @unchecked
+ if sym.tpe.typeSymbol hasFlag Flags.SEALED
+ } yield {
+ sym resetFlag Flags.MUTABLE
+ // this should enumerate all cases... however, also the superclass is taken if it is not abstract
+ def candidates(tpesym: Symbol): immutable.Set[Symbol] = {
+ def countCandidates(x: Symbol) = if (x hasFlag Flags.ABSTRACT) candidates(x) else candidates(x) + x
+ if (tpesym hasFlag Flags.SEALED) tpesym.children.flatMap(countCandidates)
+ else emptySymbolSet
+ }
+ (i, candidates(sym.tpe.typeSymbol))
+ }
+
+ // computes cartesian product, keeps indices available
+ private def combine(colcom: List[(Int, Set[Symbol])]): List[List[(Int, Symbol)]] = colcom match {
+ case Nil => Nil
+ case (i,syms)::Nil => syms.toList.map { sym => List((i,sym)) }
+ case (i,syms)::cs => for (s <- syms.toList; rest <- combine(cs)) yield (i,s) :: rest
+ }
+
+ private def comboCovers(combo: List[(Int, Symbol)]) = row exists { r => r.covers(combo) }
+
+ def init: this.type = {
+ val allcomb = combine(setsToCombine)
+ if (allcomb forall comboCovers) return this
- if (!sealedCols.isEmpty) {
- val allcomb = combine(sealedCols zip sealedComb)
- /** returns true if pattern vector pats covers a type symbols "combination"
- * @param pats pattern vector
- * @param comb pairs of (column index, type symbol)
- */
- def covers(pats: List[Tree], comb:List[(Int,Symbol)]) =
- comb forall {
- case (i,sym) =>
- val p = strip2(pats(i));
- val res =
- isDefaultPattern(p) || p.isInstanceOf[UnApply] || p.isInstanceOf[ArrayValue] || {
- val ptpe = patternType_wrtEquals(p.tpe)
- val symtpe = if (sym.hasFlag(symtab.Flags.MODULE) && (sym.linkedModuleOfClass ne NoSymbol)) {
- singleType(sym.tpe.prefix, sym.linkedModuleOfClass) // e.g. None, Nil
- } else sym.tpe
- (ptpe.typeSymbol == sym) || (symtpe <:< ptpe) ||
- (symtpe.parents.exists(_.typeSymbol eq ptpe.typeSymbol)) || // e.g. Some[Int] <: Option[&b]
- /* outer, see scala.util.parsing.combinator.lexical.Scanner */
- (ptpe.prefix.memberType(sym) <:< ptpe)
- }
- res
- }
-
- val coversAll = allcomb forall { combination => row exists { r => (r.guard eq EmptyTree) && covers(r.pat, combination)}}
- if (!coversAll) {
- val sb = new StringBuilder()
- sb.append("match is not exhaustive!\n")
- for (open <- allcomb if !(row exists { r => covers(r.pat, open)})) {
- sb.append("missing combination ")
- val NPAD = 15
- def pad(s:String) = { 1.until(NPAD - s.length).foreach { x => sb.append(" ") }; sb.append(s) }
- List.range(0, temp.length) foreach {
- i => open.find { case (j,sym) => j==i } match {
- case None => pad("*")
- case Some((_,sym)) => pad(sym.name.toString)
- }
- }
- sb.append('\n')
- }
- cunit.warning(temp.head.pos, sb.toString)
- }
+ // if we reach here, patterns were not exhaustive
+ def mkPad(xs: List[(Int, Symbol)], i: Int): String = xs match {
+ case Nil => pad("*")
+ case (j, sym) :: rest => if (j == i) pad(sym.name.toString) else mkPad(rest, i)
}
- return this
+ def mkMissingStr(open: List[(Int, Symbol)]) =
+ "missing combination " + temp.indices.map(mkPad(open, _)).mkString + "\n"
+
+ val missingCombos = allcomb
+ . filter(open => row.forall(!_.covers(open)))
+ . map(mkMissingStr)
+ . mkString
+
+ cunit.warning(temp.head.pos, "match is not exhaustive!\n" + missingCombos)
+ this
}
-
+
/* internal representation is (temp:List[Symbol], row:List[Row])
*
* tmp1 tmp_m
*/
final def applyRule(implicit theOwner: Symbol, rep: RepFactory): RuleApplication = row match {
- case Nil =>
- ErrorRule()
- case Row(pats, subst, g, bx)::xs =>
- var px = 0; var rpats = pats; var bnd = subst; var temps = temp; while((bnd ne null) && (rpats ne Nil)) {
- val (vs,p) = strip(rpats.head);
- if (!isDefaultPattern(p)) { /*break*/ bnd = null; } else {
- bnd = bnd.add(vs.elements,temps.head)
- rpats = rpats.tail
- temps = temps.tail
- px += 1 // pattern index
+ case Nil => ErrorRule()
+ case Row(pats, subst, g, bx) :: xs =>
+ var bnd = subst
+ for (((rpat, t), px) <- pats.zip(temp).zipWithIndex) {
+ val (vs, p) = strip(rpat)
+ if (isDefaultPattern(p)) bnd = bnd.add(vs, t)
+ else {
+ // Row( _ ... _ p_1i ... p_1n g_m b_m ) :: rows
+ // cut out column px that contains the non-default pattern
+ val column = rpat :: row.tail.map(_.pat(px))
+ val restTemp = temp.dropIndex(px)
+ val restRows = row.map(r => r.replace(r.pat.dropIndex(px)))
+ val mr = MixtureRule(new Scrutinee(t), column, rep.make(restTemp, restRows))
+ DBG("\n---\nmixture rule is = " + mr.getClass)
+ return mr
}
}
- /* Row( _ ... _ g_1 b_1 ) :: rows it's all default patterns
- */
- if (bnd ne null) { // all default patterns
- val rest = if (g eq EmptyTree) null else rep.make(temp, xs)
- DBG("\n---\nmixture rule is = VariableRule")
- return VariableRule (bnd, g, rest, bx)
- }
-
- /* Row( _ ... _ p_1i ... p_1n g_m b_m ) :: rows
- */
- // cut out column px that contains the non-default pattern
- val column = rpats.head :: (row.tail map { case Row(pats,_,_,_) => pats(px) })
- val restTemp = temp.take(px) ::: temp.drop(px+1)
- val restRows = row map { case Row(pats, subst, g, bx) => Row(pats.take(px) ::: pats.drop(px+1), subst, g, bx) }
- val mr = MixtureRule(temps.head, column, rep.make(restTemp,restRows))
- DBG("\n---\nmixture rule is = "/*+mr.getClass.toString*/)
- mr
+ // Row( _ ... _ g_1 b_1 ) :: rows it's all default patterns
+ val rest = if (g.isEmpty) null else rep.make(temp, xs) // TODO - why null?
+ DBG("\n---\nmixture rule is = VariableRule")
+ VariableRule (bnd, g, rest, bx)
}
// a fancy toString method for debugging
override final def toString = {
- val sb = new StringBuilder
- val NPAD = 15
- def pad(s:String) = { 1.until(NPAD - s.length).foreach { x => sb.append(" ") }; sb.append(s) }
- for (tmp <- temp) pad(tmp.name.toString)
- sb.append('\n')
- for ((r,i) <- row.zipWithIndex) {
- for (c <- r.pat ::: List(r.subst, r.guard, r.bx)) {
- pad(c.toString)
- }
- sb.append('\n')
- }
- sb.toString
- } /* def toString */
- } /* class Rep */
+ val tempStr = temp.map(t => pad(t.name)).mkString + "\n"
+ val rowStr = row.map(r => (r.pat ::: List(r.subst, r.guard, r.bx)).map(pad).mkString + "\n").mkString
+ tempStr + rowStr
+ }
+
+ private val NPAD = 15
+ private def pad(s: Any): String = pad(s.toString)
+ private def pad(s: String): String = List.make(NPAD - s.length - 1, " ").mkString + s
+ }
/** creates initial clause matrix
*/
- final def initRep(roots: List[Symbol], cases: List[Tree], rep:RepFactory)(implicit theOwner: Symbol) = {
+ final def initRep(roots: List[Symbol], cases: List[Tree], rep: RepFactory)(implicit theOwner: Symbol) = {
// communicate whether exhaustiveness-checking is enabled via some flag
- var bx = 0;
- val targets = new ListBuffer[Tree]
- val vss = new ListBuffer[SymList]
- val row = new ListBuffer[Row]
-
- var cs = cases; while (cs ne Nil) cs.head match { // stash away pvars and bodies for later
- case CaseDef(pat,g,b) =>
- vss += definedVars(pat)
- targets += b
- if (roots.length > 1) pat match {
- case Apply(fn, pargs) =>
- row += Row(pargs, NoBinding, g, bx)
- case Ident(nme.WILDCARD) =>
- row += Row(getDummies(roots.length), NoBinding, g, bx)
- } else
- row += Row(List(pat), NoBinding, g, bx)
- bx += 1
- cs = cs.tail
- }
- rep.make(roots, row.toList, targets.toList, vss.toList)
+ val (rows, targets, vss): (List[Option[Row]], List[Tree], List[List[Symbol]]) = unzip3(
+ for ((CaseDef(pat, g, b), bx) <- cases.zipWithIndex) yield { // stash away pvars and bodies for later
+ def rowForPat: Option[Row] = pat match {
+ case _ if roots.length <= 1 => Some(Row(List(pat), NoBinding, Guard(g), bx))
+ case Apply(fn, pargs) => Some(Row(pargs, NoBinding, Guard(g), bx))
+ case Ident(nme.WILDCARD) => Some(Row(getDummies(roots.length), NoBinding, Guard(g), bx))
+ case _ => None
+ }
+ (rowForPat, b, definedVars(pat))
+ }
+ )
+
+ // flatMap the list of options yields the list of values
+ rep.make(roots, rows.flatMap(x => x), targets, vss)
}
- final def newVar(pos: Position, name: Name, tpe: Type)(implicit theOwner: Symbol): Symbol = {
- if (tpe eq null) assert(tpe ne null, "newVar("+name+", null)")
+ final def newVar(pos: Position, name: Name, tpe: Type, flags: List[Long])(implicit theOwner: Symbol): Symbol = {
+ assert(tpe ne null, "newVar("+name+", null)")
val sym = theOwner.newVariable(pos, name) // careful: pos has special meaning
sym setInfo tpe
- sym
+ sym setFlag flags.foldLeft(Flags.SYNTHETIC.toLong)(_|_)
}
+ final def newVar(pos: Position, tpe: Type, flags: List[Long])(implicit theOwner: Symbol): Symbol =
+ newVar(pos, cunit.fresh.newName(pos, "temp"), tpe, flags)
+
final def newVar(pos: Position, tpe: Type)(implicit theOwner: Symbol): Symbol =
- newVar(pos, cunit.fresh.newName(pos, "temp"), tpe) setFlag symtab.Flags.SYNTHETIC
-
+ newVar(pos, tpe, Nil)
+
/** returns the condition in "if (cond) k1 else k2"
*/
- final def condition(tpe: Type, scrut: Symbol): Tree = {
- assert(scrut ne NoSymbol)
- condition(tpe, mkIdent(scrut))
+ final def condition(tpe: Type, scrut: Scrutinee)(implicit typer: Typer, theOwner: Symbol, rep: RepFactory): Tree = {
+ assert(scrut.isDefined)
+ val cond = rep.handleOuter(typer.typed(condition(tpe, scrut.id)))
+
+ if (!needsOuterTest(tpe, scrut.tpe, theOwner)) cond
+ else addOuterCondition(cond, tpe, scrut.id, rep.handleOuter)
}
- final def condition(tpe: Type, scrutineeTree: Tree): Tree = {
- assert(tpe ne NoType)
- assert(scrutineeTree.tpe ne NoType)
- if (tpe.isInstanceOf[SingletonType] && !tpe.isInstanceOf[ConstantType]) {
- if (tpe.termSymbol.isModule) {// object
- //if (scrutineeTree.tpe <:< definitions.AnyRefClass.tpe)
- // Eq(gen.mkAttributedRef(tpe.termSymbol), scrutineeTree) // object
- //else
- Equals(gen.mkAttributedRef(tpe.termSymbol), scrutineeTree) // object
- } else {
- val x =
- if (tpe.prefix ne NoPrefix) gen.mkIsInstanceOf(scrutineeTree, tpe)
- else
- Equals(gen.mkAttributedRef(tpe.termSymbol), scrutineeTree)
- typed { x }
- }
- } else if (tpe.isInstanceOf[ConstantType]) {
- val value = tpe.asInstanceOf[ConstantType].value
- if (value == Constant(null) && scrutineeTree.tpe <:< definitions.AnyRefClass.tpe)
- Eq(scrutineeTree, Literal(value)) // constant
- else
- Equals(scrutineeTree, Literal(value)) // constant
- } else if (scrutineeTree.tpe <:< tpe && tpe <:< definitions.AnyRefClass.tpe) {
- NotNull(scrutineeTree)
- } else {
- gen.mkIsInstanceOf(scrutineeTree, tpe)
+ final def condition(tpe: Type, scrutTree: Tree)(implicit typer : Typer): Tree = {
+ assert((tpe ne NoType) && (scrutTree.tpe ne NoType))
+ lazy val equalsRef = Equals(gen.mkAttributedRef(tpe.termSymbol), scrutTree)
+ lazy val isInst = gen.mkIsInstanceOf(scrutTree, tpe)
+
+ tpe match {
+ case _: SingletonType if !tpe.isInstanceOf[ConstantType] =>
+ if (tpe.termSymbol.isModule) equalsRef // object
+ else if (tpe.prefix ne NoPrefix) typer.typed(isInst)
+ else typer.typed(equalsRef)
+ case ct: ConstantType => ct.value match { // constant
+ case v @ Constant(null) if scrutTree.tpe.isAnyRef => Eq(scrutTree, Literal(v))
+ case v => Equals(scrutTree, Literal(v))
+ }
+ case _ if scrutTree.tpe <:< tpe && tpe.isAnyRef => NotNull(scrutTree)
+ case _ => gen.mkIsInstanceOf(scrutTree, tpe)
}
}
/** adds a test comparing the dynamic outer to the static outer */
- final def addOuterCondition(cond:Tree, tpe2test: Type, scrutinee: Tree, handleOuter: Tree=>Tree) = {
- val TypeRef(prefix,_,_) = tpe2test
- assert(prefix ne NoPrefix)
- var theRef = prefix match {
- case ThisType(clazz) => gen.mkAttributedThis(clazz)
- case _ => gen.mkAttributedRef(prefix.prefix, prefix.termSymbol)
- }
- // needs explicitouter treatment
- theRef = handleOuter(theRef)
+ final def addOuterCondition(cond: Tree, tpe2test: Type, scrut: Tree, handleOuter: Tree=>Tree) = {
+ val theRef = handleOuter(tpe2test match {
+ case TypeRef(NoPrefix, _, _) => abort("assertion failed: NoPrefix")
+ case TypeRef(ThisType(clazz), _, _) => gen.mkAttributedThis(clazz)
+ case TypeRef(prefix, _, _) => gen.mkAttributedRef(prefix.prefix, prefix.termSymbol)
+ })
- val outerAcc = outerAccessor(tpe2test.typeSymbol)
- if (outerAcc == NoSymbol) {
- if (settings_debug) cunit.warning(scrutinee.pos, "no outer acc for "+tpe2test.typeSymbol)
- cond
- } else
- And(cond,
- Eq(Apply(Select(
- gen.mkAsInstanceOf(scrutinee, tpe2test, true), outerAcc),List()), theRef))
+ outerAccessor(tpe2test.typeSymbol) match {
+ case NoSymbol => if (settings.debug.value) cunit.warning(scrut.pos, "no outer acc for "+tpe2test.typeSymbol) ; cond
+ case outerAcc => And(cond, Eq(Code.fn(gen.mkAsInstanceOf(scrut, tpe2test, true), outerAcc), theRef))
+ }
}
}
diff --git a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala
index 89e2120..06da4c3 100644
--- a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala
+++ b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Burak Emir
*/
-// $Id: PatternNodes.scala 14520 2008-04-07 04:10:08Z emir $
+// $Id: PatternNodes.scala 16553 2008-11-13 22:14:16Z DRMacIver $
package scala.tools.nsc.matching
@@ -11,60 +11,115 @@ import scala.tools.nsc.util.{Position, NoPosition}
/**
* @author Burak Emir
*/
-trait PatternNodes { self: transform.ExplicitOuter =>
-
- import global._
-
- object TagIndexPair {
- /** inserts tag and index, maintaining relative order of tags */
- def insert(current: TagIndexPair, tag: Int, index: Int): TagIndexPair = {
- if (current eq null)
- new TagIndexPair(tag, index, null)
- else if (tag > current.tag)
- new TagIndexPair(current.tag, current.index, insert(current.next, tag, index))
- else
- new TagIndexPair(tag, index, current)
+trait PatternNodes {
+ self: transform.ExplicitOuter =>
+
+ import global.{ typer => _, _ }
+ import analyzer.Typer
+ import symtab.Flags
+ import Types._
+
+ case class TypeComparison(x: Type, y: Type) {
+ def xIsaY = x <:< y
+ def yIsaX = y <:< x
+ def xEqY = y =:= x
+ def xIgnY = !xIsaY && !yIsaX && !xEqY
+ def eqSymbol = cmpSymbols(x, y)
+ def eqPrefix = x.prefix =:= y.prefix
+
+ private def cmpSymbols(t1: Type, t2: Type) = t1.typeSymbol eq t2.typeSymbol
+ // true if t2 is a parent of t1. Should this be rather: tpe.baseTypes.exists...?
+ private def parenthood(t1: Type, t2: Type) = t1.parents.exists(p => cmpSymbols(p, t2))
+ // true if t1 is direct subtype of t2 (can't use just <:< cause have to take variance into account)
+ private def subtypehood(t1: Type, t2: Type) = t1.parents.exists(p => cmpSymbols(p, t2) && p <:< t2)
+
+ def yParentsX = parenthood(x, y)
+ def xParentsY = parenthood(y, x)
+ def xExtendsY = subtypehood(x, y)
+ def yExtendsX = subtypehood(y, x)
+
+ object erased {
+ import Types._
+ /** an approximation of _tp1 <:< tp2 that ignores _ types. this code is wrong,
+ * ideally there is a better way to do it, and ideally defined in Types.scala
+ */
+ private def cmpErased(t1: Type, t2: Type) = (t1, t2) match {
+ case (_: TypeRef, _: TypeRef) => (eqPrefix && eqSymbol && !t1.isArray) || parenthood(t1, t2)
+ case _ => false
+ }
+
+ def xIsaY = cmpErased(x, y)
+ def yIsaX = cmpErased(y, x)
}
- }
-
- /** sorted, null-terminated list of (int,int) pairs */
- class TagIndexPair(val tag: Int, val index: Int, val next: TagIndexPair) {
-
- def find(tag: Int): Int =
- if (this.tag == tag) index
- else next.find(tag) // assumes argument can always be found
-
}
- // --- misc methods
-
- private val dummy1 = EmptyTree :: Nil
- private val dummy2 = EmptyTree :: dummy1
- private val dummy3 = EmptyTree :: dummy2
- private val dummy4 = EmptyTree :: dummy3
- private val dummy5 = EmptyTree :: dummy4
- private val dummy6 = EmptyTree :: dummy5
- private val dummy7 = EmptyTree :: dummy6
-
- final def getDummies(i:Int): List[Tree] = i match {
- case 0 => Nil
- case 1 => dummy1
- case 2 => dummy2
- case 3 => dummy3
- case 4 => dummy4
- case 5 => dummy5
- case 6 => dummy6
- case 7 => dummy7
- case n => EmptyTree::getDummies(i-1)
+ object Types {
+ import definitions._
+ implicit def enrichType(_tpe: Type): RichType = new RichType(_tpe)
+
+ class RichType(_tpe: Type) {
+ /* equality checks for named constant patterns like "Foo()" are encoded as "_:<equals>[Foo().type]"
+ * and later compiled to "if(Foo() == scrutinee) ...". This method extracts type information from
+ * such an encoded type, which is used in optimization. If the argument is not an encoded equals
+ * test, it is returned as is.
+ */
+ private def tpeWRTEquality(t: Type) = t match {
+ case TypeRef(_, sym, arg::Nil) if sym eq EqualsPatternClass => arg
+ case _ => t
+ }
+ lazy val tpe = tpeWRTEquality(_tpe)
+
+ // The several different logics in these tests are intentionally grouped here to
+ // draw attention to them. To the extent that the differences are intentional,
+ // the thinking behind the distinctions needs to be documented.
+ def isInt = tpe =:= IntClass.tpe
+ def isChar = tpe =:= CharClass.tpe
+ def isAnyRef = tpe <:< AnyRefClass.tpe
+ def isBoolean = tpe.typeSymbol eq BooleanClass
+ def isArray = tpe.typeSymbol eq ArrayClass
+ def isNothing = tpe.typeSymbol eq NothingClass
+ def isCaseClass = tpe.typeSymbol hasFlag Flags.CASE
+
+ def cmp(other: Type): TypeComparison = TypeComparison(tpe, tpeWRTEquality(other))
+
+ def coversSym(sym: Symbol) = {
+ val symtpe =
+ if ((sym hasFlag Flags.MODULE) && (sym.linkedModuleOfClass ne NoSymbol))
+ singleType(sym.tpe.prefix, sym.linkedModuleOfClass) // e.g. None, Nil
+ else sym.tpe
+
+ (tpe.typeSymbol == sym) ||
+ (symtpe <:< tpe) ||
+ (symtpe.parents.exists(_.typeSymbol eq tpe.typeSymbol)) || // e.g. Some[Int] <: Option[&b]
+ (tpe.prefix.memberType(sym) <:< tpe) // outer, see combinator.lexical.Scanner
+ }
+ }
+
+ // used as argument to `EqualsPatternClass'
+ case class PseudoType(o: Tree) extends SimpleTypeProxy {
+ override def underlying: Type = o.tpe
+ override def safeToString: String = "PseudoType("+o+")"
+ }
}
- def makeBind(vs:SymList, pat:Tree): Tree =
- if(vs eq Nil) pat else Bind(vs.head, makeBind(vs.tail, pat)) setType pat.tpe
+ final def DBG(x: => String) = if (settings.debug.value) Console.println(x)
+
+ final def getDummies(i: Int): List[Tree] = List.make(i, EmptyTree)
+
+ def makeBind(vs:List[Symbol], pat:Tree): Tree =
+ if (vs eq Nil) pat else Bind(vs.head, makeBind(vs.tail, pat)) setType pat.tpe
+
+ def mkTypedBind(vs: List[Symbol], tpe: Type) =
+ makeBind(vs, Typed(mk_(tpe), TypeTree(tpe)) setType tpe)
+
+ def mkEmptyTreeBind(vs: List[Symbol], tpe: Type) =
+ makeBind(vs, Typed(EmptyTree, TypeTree(tpe)) setType tpe)
+
+ def mkEqualsRef(xs: List[Type]) = typeRef(NoPrefix, definitions.EqualsPatternClass, xs)
def normalizedListPattern(pats:List[Tree], tptArg:Type): Tree = pats match {
- case Nil => gen.mkAttributedRef(definitions.NilModule)
- case sp::xs if strip2(sp).isInstanceOf[Star] =>
- makeBind(definedVars(sp), Ident(nme.WILDCARD) setType sp.tpe)
+ case Nil => gen.mkNil
+ case (sp @ Strip(_, _: Star)) :: xs => makeBind(definedVars(sp), mk_(sp.tpe))
case x::xs =>
var resType: Type = null;
val consType: Type = definitions.ConsClass.primaryConstructor.tpe match {
@@ -74,171 +129,118 @@ trait PatternNodes { self: transform.ExplicitOuter =>
MethodType(List(tptArg, listType), resType)
}
- Apply(TypeTree(consType),List(x,normalizedListPattern(xs,tptArg))).setType(resType)
+ Apply(TypeTree(consType), List(x,normalizedListPattern(xs,tptArg))) setType resType
}
object Apply_Value {
- def unapply(x:Apply) = if (!x.fun.isType && x.args.isEmpty) Some(x.tpe.prefix, x.symbol) else None
+ def unapply(x: Apply) = if (!x.fun.isType && x.args.isEmpty) Some(x.tpe.prefix, x.symbol) else None
+ }
+
+ object Apply_Function {
+ def isApplyFunction(o: Apply) = !o.tpe.isCaseClass || !Apply_Value.unapply(o).isEmpty /*see t301*/
+ def unapply(x: Apply) = if (x.args.isEmpty && isApplyFunction(x)) Some(x.fun) else None
}
object Apply_CaseClass_NoArgs {
- def unapply(x:Apply) = if (x.fun.isType && x.args.isEmpty) Some(x.tpe) else None
+ def unapply(x: Apply) = if (x.fun.isType && x.args.isEmpty) Some(x.tpe) else None
}
object Apply_CaseClass_WithArgs {
- def unapply(x:Apply) = x.fun.isType
+ def unapply(x: Apply) = x.fun.isType
+ }
+
+ // TODO - this doesn't work! For some reason this sometimes returns false when encapsulated
+ // in an object like this, when it returns true if the same logic is applied literally in
+ // the classifyPat match in ParallelMatching. I couldn't figure out why, and it concerns
+ // me - if this isn't working maybe other unapply objects aren't working right either. The big
+ // problem with using unapply and type matching is that if something's amiss, it will simply fail
+ // silently, with the bug most likely manifesting at some unknown later point.
+ object Ident_Or_Empty {
+ def unapply(x: Any) = x match {
+ case Ident(nme.WILDCARD) | EmptyTree | _: Typed | _: Literal => true
+ // this returns false, and then a line identical the one above will match
+ // back in PM.scala.
+ case _ => false
+ }
}
- object __UnApply {
- def unapply(x:Tree) = strip(x) match {
- case (vs, UnApply(Apply(fn, _), args)) =>
- val argtpe = fn.tpe.asInstanceOf[MethodType].paramTypes.head
- Some(Tuple3(vs,argtpe,args))
- case _ => None
+ object UnApply_TypeApply {
+ def unapply(x: UnApply) = x match {
+ case UnApply(Apply(TypeApply(sel @ Select(stor, nme.unapplySeq), List(tptArg)), _), ArrayValue(_, xs)::Nil)
+ if (stor.symbol eq definitions.ListModule) => Some(tptArg, xs)
+ case _ => None
}
}
-/*
- object ArrayValueFixed {
- def unapply(x:Tree):Option[List[Tree]] = x match {
- case ArrayValue(_,xs) => if(isDefaultPattern(xs.last)) Some(xs) else None
+
+ object __UnApply {
+ private def paramType(fn: Tree) = fn.tpe match { case m: MethodType => m.paramTypes.head }
+ def unapply(x: Tree) = x match {
+ case Strip(vs, UnApply(Apply(fn, _), args)) => Some(vs, paramType(fn), args)
+ case _ => None
}
}
- object ArrayValueStar {
- def unapply(x:Tree): Option[(List[Tree],Tree)] = x match {
- case ArrayValue(_,xs) =>
- val ys = xs.drop(xs.length-1)
- val p = xs.last
- if(!isDefaultPattern(p)) Some(ys,p) else None
- }
- }*/
- /* equality checks for named constant patterns like "Foo()" are encoded as "_:<equals>[Foo().type]"
- * and later compiled to "if(Foo() == scrutinee) ...". This method extracts type information from
- * such an encoded type, which is used in optimization. If the argument is not an encoded equals
- * test, it is returned as is.
- */
- def patternType_wrtEquals(pattpe:Type) = pattpe match {
- case TypeRef(_,sym,arg::Nil) if sym eq definitions.EqualsPatternClass =>
- arg
- case x => x
- }
/** returns if pattern can be considered a no-op test ??for expected type?? */
- final def isDefaultPattern(pattern:Tree): Boolean = pattern match {
+ final def isDefaultPattern(pattern: Tree): Boolean = pattern match {
case Bind(_, p) => isDefaultPattern(p)
case EmptyTree => true // dummy
case Ident(nme.WILDCARD) => true
case _ => false
// -- what about the following? still have to test "ne null" :/
-// case Typed(nme.WILDCARD,_) => pattern.tpe <:< scrutinee.tpe
+// case Typed(nme.WILDCARD,_) => pattern.tpe <:< scrut.tpe
}
- final def DBG(x:String) { if (settings_debug) Console.println(x) }
-
/** returns all variables that are binding the given pattern
* @param x a pattern
* @return vs variables bound, p pattern proper
*/
final def strip(x: Tree): (Set[Symbol], Tree) = x match {
case b @ Bind(_,pat) => val (vs, p) = strip(pat); (vs + b.symbol, p)
- case z => (emptySymbolSet,z)
- }
-
- final def strip1(x: Tree): Set[Symbol] = x match { // same as strip(x)._1
- case b @ Bind(_,pat) => strip1(pat) + b.symbol
- case z => emptySymbolSet
- }
- final def strip2(x: Tree): Tree = x match { // same as strip(x)._2
- case Bind(_,pat) => strip2(pat)
- case z => z
- }
-
- final def isCaseClass(tpe: Type): Boolean =
- tpe match {
- case TypeRef(_, sym, _) =>
- if(!sym.isAliasType)
- sym.hasFlag(symtab.Flags.CASE)
- else
- tpe.normalize.typeSymbol.hasFlag(symtab.Flags.CASE)
- case _ => false
- }
-
- final def isEqualsPattern(tpe: Type): Boolean =
- tpe match {
- case TypeRef(_, sym, _) => sym eq definitions.EqualsPatternClass
- case _ => false
- }
-
-
- // this method obtains tag method in a defensive way
- final def getCaseTag(x:Type): Int = { x.typeSymbol.tag }
-
- final def definedVars(x:Tree): SymList = {
- var vs = new collection.mutable.ListBuffer[Symbol]
- def definedVars1(x:Tree): Unit = x match {
- case Alternative(bs) => ; // must not have any variables
- case Apply(_, args) => definedVars2(args)
- case b @ Bind(_,p) => vs += b.symbol; definedVars1(p)
- case Ident(_) => ;
- case Literal(_) => ;
- case Select(_,_) => ;
- case Typed(p,_) => definedVars1(p) //otherwise x @ (_:T)
- case UnApply(_,args) => definedVars2(args)
-
- // regexp specific
- case ArrayValue(_,xs)=> definedVars2(xs)
- case Star(p) => ; // must not have variables
- }
- def definedVars2(args:List[Tree]): Unit = {
- var xs = args; while(xs ne Nil) { definedVars1(xs.head); xs = xs.tail };
+ case _ => (emptySymbolSet, x)
+ }
+ final def strip1(x: Tree): Set[Symbol] = strip(x)._1
+ final def strip2(x: Tree): Tree = strip(x)._2;
+
+ object Strip { def unapply(x: Tree): Option[(Set[Symbol], Tree)] = Some(strip(x)) }
+ object Strip1 { def unapply(x: Tree): Option[Set[Symbol]] = Some(strip1(x)) }
+ object Strip2 { def unapply(x: Tree): Option[Tree] = Some(strip2(x)) }
+
+ final def definedVars(x: Tree): List[Symbol] = {
+ implicit def listToStream[T](xs: List[T]): Stream[T] = xs.toStream
+ def definedVars1(x: Tree): Stream[Symbol] = x match {
+ case Apply(_, args) => definedVars2(args)
+ case b @ Bind(_,p) => Stream.cons(b.symbol, definedVars1(p))
+ case Typed(p,_) => definedVars1(p) // otherwise x @ (_:T)
+ case UnApply(_,args) => definedVars2(args)
+ case ArrayValue(_,xs) => definedVars2(xs)
+ case _ => Nil
}
- definedVars1(x);
- vs.toList
+ def definedVars2(args: Stream[Tree]): Stream[Symbol] = args flatMap definedVars1
+
+ definedVars1(x).reverse.toList
}
-
- // insert in sorted list, larger items first
- final def insertSorted(tag: Int, xs:List[Int]):List[Int] = xs match {
- case y::ys if y > tag => y::insertSorted(tag, ys)
- case ys => tag :: ys
- }
-
- // find taag in sorted list
- final def findSorted(Tag: Int, xs:List[Int]): Boolean = xs match {
- case Tag::_ => true
- case y::ys if y > Tag => findSorted(Tag,ys)
- case _ => false
- }
-
+
/** pvar: the symbol of the pattern variable
* temp: the temp variable that holds the actual value
- * next: next binding
*/
- case class Binding(pvar:Symbol, temp:Symbol, next: Binding) {
- def add(vs:Iterator[Symbol], temp:Symbol): Binding = {
- var b = this; while(vs.hasNext){
- b = Binding(vs.next, temp, b)
- }
- return b
- }
- /** this is just to produce debug output, ListBuffer needs an equals method?! */
- override def equals(x:Any) = {
- x match {
- case NoBinding => false
- case Binding(pv2,tmp2,next2) => (pvar eq pv2) && (temp eq tmp2) && (next==next2)
- }
+ case class Binding(pvar: Symbol, temp: Symbol)
+
+ case class Bindings(bindings: Binding*) extends Function1[Symbol, Option[Ident]] {
+ def add(vs: Iterable[Symbol], temp: Symbol): Bindings =
+ Bindings(vs.toList.map(Binding(_, temp)) ++ bindings : _*)
+
+ def apply(v: Symbol): Option[Ident] = bindings.find(_.pvar eq v) match {
+ case Some(b) => Some(Ident(b.temp) setType v.tpe)
+ case None => None // abort("Symbol " + v + " has no binding in " + bindings)
}
- def apply(v:Symbol): Ident = {
- //Console.println(this.toString()+" apply ("+v+"), eq?"+(v eq pvar))
- if(v eq pvar) {Ident(temp).setType(v.tpe)} else next(v)
- }
- }
- object NoBinding extends Binding(null,null,null) {
- override def apply(v:Symbol) = null // not found, means bound elsewhere (x @ unapply-call)
- override def toString = "."
- override def equals(x:Any) = x.isInstanceOf[Binding] && (x.asInstanceOf[Binding] eq this)
- }
- // misc methods END ---
-
- type SymSet = collection.immutable.Set[Symbol]
- type SymList = List[Symbol]
+ /**
+ * The corresponding list of value definitions.
+ */
+ final def targetParams(implicit typer: Typer): List[ValDef] =
+ bindings.toList.map{ case Binding(v, t) => ValDef(v,
+ typer.typed{if(t.tpe <:< v.tpe) mkIdent(t)
+ else gen.mkAsInstanceOf(mkIdent(t), v.tpe)})}
+ }
+ val NoBinding: Bindings = Bindings()
}
diff --git a/src/compiler/scala/tools/nsc/matching/Set64.scala b/src/compiler/scala/tools/nsc/matching/Set64.scala
deleted file mode 100644
index 228a279..0000000
--- a/src/compiler/scala/tools/nsc/matching/Set64.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2006-2007 LAMP/EPFL
- * @author Burak Emir
- */
-// $Id: Set64.scala 12502 2007-08-09 15:02:34Z emir $
-
-package scala.tools.nsc.matching
-
-/** An enumeration bit set that can handle enumeration values with ids up
- * to 63 in a <code>Long</code>. copied, pasted and mutabilitized from
- * Sean's Enumeration.
- */
-class Set64 {
-
- var underlying: Long = 0
-
- final def contains(value: Int) = (underlying & (1L << value)) != 0
-
-// def |=( set: IntSet64) { underlying = underlying | set.underlying }
- final def |=(value: Int) { underlying = underlying | (1L << value) }
-// def &~=(value: Value) { underlying = underlying & (~(1L << value) }
-// def &=(set: Set64) { underlying = underlying & set.underlying) }
-
-}
diff --git a/src/compiler/scala/tools/nsc/matching/TransMatcher.scala b/src/compiler/scala/tools/nsc/matching/TransMatcher.scala
index 324bbe4..114f2f4 100644
--- a/src/compiler/scala/tools/nsc/matching/TransMatcher.scala
+++ b/src/compiler/scala/tools/nsc/matching/TransMatcher.scala
@@ -3,7 +3,7 @@
* Copyright 2007 Google Inc. All Rights Reserved.
* Author: bqe at google.com (Burak Emir)
*/
-// $Id: TransMatcher.scala 15798 2008-08-15 16:27:10Z odersky $
+// $Id: TransMatcher.scala 16553 2008-11-13 22:14:16Z DRMacIver $
package scala.tools.nsc.matching
@@ -13,244 +13,90 @@ package scala.tools.nsc.matching
*/
trait TransMatcher { self: transform.ExplicitOuter with PatternNodes with ParallelMatching with CodeFactory =>
- import global._
+ import global.{ typer => _, _ }
+ import analyzer.Typer;
import definitions._
- import posAssigner.atPos
import symtab.Flags
- import typer.typed
- import collection.mutable.ListBuffer
-
- var cunit: CompilationUnit = _ // memory leak?
- def fresh = cunit.fresh
- var nPatterns = 0
+ var cunit: CompilationUnit = _ // memory leak?
var resultType: Type = _
// cache these
final val settings_debug = settings.debug.value
final val settings_squeeze = settings.Xsqueeze.value == "on"
- final val settings_casetags = settings.Xcasetags.value == "on"
-
- final def hasRegularPattern(pats1: List[Tree]): Boolean = {
- var pats = pats1; while(pats ne Nil) {
- if(isRegularPattern(pats.head)) { return true; } else { pats = pats.tail }
- }
- return false
- }
-
- final def isRegularPattern(pat: Tree): Boolean = {
- pat match {
- case Alternative(trees) => hasRegularPattern(trees)
- case Star(t) => true
- case Ident(_) => false
- case Bind(n, pat1) => isRegularPattern(pat1)
- case Sequence(trees) => true // cause there are ArrayValues now
- case ArrayValue(tt, trees) => hasRegularPattern(trees)
- case Apply(fn, trees) => hasRegularPattern(trees)
- case Literal(_) => false
- case Select(_, _) => false
- case Typed(_, _) => false
- case UnApply(_,trees) => hasRegularPattern(trees)
- }
- }
- // @todo: this should be isNotRegular :-/ premature opt src of all evil
- // check special case Seq(p1,...,pk,_*) where pi not regular
+ // check special case Seq(p1,...,pk,_*)
protected def isRightIgnoring(p: ArrayValue): Boolean = {
- def isDefaultStar(p: Tree): Boolean = p match {
+ def isDefaultStar(tree: Tree): Boolean = tree match {
case Bind(_, q) => isDefaultStar(q)
case Star(Ident(nme.WILDCARD)) => true
case _ => false
}
- p match {
- case ArrayValue(s, trees) =>
- var ts = trees
- var c: Tree = null
- while ((ts ne Nil) && {c = ts.head; ts = ts.tail; !isRegularPattern(c)}) {}
- (ts eq Nil) && isDefaultStar(c)
- }
+
+ !p.elems.isEmpty && isDefaultStar(p.elems.last)
}
- /** a casedef with sequence subpatterns like
- *
- * case ..x @ ().. => body
- *
- * should be replaced straight away with
- *
- * case .. () .. => val x = Nil; body
+ /** handles all translation of pattern matching
*/
- def isRegular(pats: List[CaseDef]): (List[CaseDef],Boolean) = {
- var existsReg = false
- var isReg = false
- var nilVars: List[Symbol] = null
-
- def isRegular1(pat: Tree): Tree = pat match {
- case Alternative(trees) =>
- copy.Alternative(pat, trees map { isRegular1 })
-
- case Star(t) =>
- isReg = true; copy.Star(pat, isRegular1(t))
-
- case Ident(_) =>
- pat
-
- case Bind(id, empt @ Sequence(List())) =>
- nilVars = pat.symbol :: nilVars
- empt
-
- case Bind(n, pat1) =>
- copy.Bind(pat, n, isRegular1(pat1))
-
- case Sequence(trees) =>
- isReg = true
- copy.Sequence(pat, trees map { isRegular1 })
-
- case UnApply(fn, args) => copy.UnApply(pat, fn, args map { isRegular1 })
+ def handlePattern(selector: Tree, cases: List[CaseDef], doCheckExhaustive: Boolean, owner: Symbol, handleOuter: Tree => Tree)(implicit typer : Typer): Tree = {
+ DBG("****")
+ DBG("**** initalize, selector = "+selector+" selector.tpe = "+selector.tpe)
+ DBG("**** doCheckExhaustive == "+doCheckExhaustive)
- case app @ Apply(fn, List(pat2@ ArrayValue( tt, List(b @ Bind(id, Star(wc @ Ident(nme.WILDCARD))))))) if (app.tpe.typeSymbol.flags & Flags.CASE) == 0 =>
- val tpe1:Type = pat2.tpe.widen.baseType( definitions.SeqClass ).typeArgs(0)
- val tpe = appliedType(definitions.SeqClass.typeConstructor, List(tpe1))
- b.symbol.setInfo(tpe)
- b.setType(tpe)
- copy.Bind(b, id, wc)
+ implicit val theOwner = owner
+ implicit val rep = new RepFactory(handleOuter)
+ val flags = if (doCheckExhaustive) Nil else List(Flags.TRANS_FLAG)
- case app @ Apply(fn, List(pat2@ ArrayValue( tt, List(b @ Bind(id, Star(wc @ Ident(nme.WILDCARD))))))) => // a pattern of the form MyCaseConstructor(foo at _*)
- val tpe1:Type = pat2.tpe.widen.baseType( definitions.SeqClass ).typeArgs(0)
- val tpe = appliedType(definitions.SeqClass.typeConstructor, List(tpe1))
- b.symbol.setInfo(tpe)
- b.setType(tpe)
- copy.Apply(pat, fn, List(copy.Bind(b, id, wc)))
-
- case av @ ArrayValue(s, trees) =>
- if (isRightIgnoring(av)) pat
- else copy.ArrayValue(pat, s, (trees map { isRegular1 }))
-
- case Apply(fn, List(Sequence(List()))) =>
- pat
-
- case Apply(fn, trees) =>
- copy.Apply(pat, fn, (trees map { isRegular1 }))
-
- case Literal(_) =>
- pat
-
- case Select(_, _) =>
- pat
-
- case Typed(_, _) =>
- pat
-
- case This(_) =>
- val stpe = mkThisType(pat.tpe.typeSymbol)
- Typed(Ident(nme.WILDCARD) setType stpe, TypeTree(stpe))
+ def caseIsOk(c: CaseDef) = c match {
+ case CaseDef(_: Apply, _, _) => true
+ case CaseDef(Ident(nme.WILDCARD), _, _) => true
+ case _ => false
}
+ def doApply(fn: Tree) = (fn.symbol eq selector.tpe.decls.lookup(nme.CONSTRUCTOR)) && (cases forall caseIsOk)
- var res = new ListBuffer[CaseDef]
- val it = pats.elements; while (it.hasNext) {
- nilVars = Nil
- val cdef = it.next
- val newt = isRegular1(cdef.pat)
- existsReg = existsReg || isReg
-
- val nbody = if (nilVars.isEmpty) cdef.body else
- atPos(cdef.body.pos)(
- Block(nilVars map {
- x => ValDef(x, Ident(definitions.NilModule))
- }, cdef.body)
- )
-
- res += copy.CaseDef(cdef, newt, cdef.guard, nbody)
+ def processApply(app: Apply): (List[Symbol], List[Tree], Tree) = {
+ val Apply(fn, args) = app
+ val (tmps, vds) = List.unzip(
+ for ((ti, i) <- args.zipWithIndex) yield {
+ // These type parameter vars were not being set as synthetic.
+ // Temporarily noted on the off chance it was intentional.
+ val v = newVar(ti.pos, cunit.fresh.newName(ti.pos, "tp"), selector.tpe.typeArgs(i), flags)
+ (v, typedValDef(v, ti))
+ }
+ )
+ (tmps, vds, ThrowMatchError(selector.pos, copy.Apply(app, fn, tmps map mkIdent)))
}
- (res.toList, existsReg)
- }
-
- /** handles all translation of pattern matching
- */
- def handlePattern(selector: Tree, ocases: List[CaseDef], doCheckExhaustive: Boolean, owner: Symbol, handleOuter: Tree => Tree): Tree = {
- val (cases, containsReg) = isRegular(ocases)
- // @todo: remove unused variables
- if (containsReg) {
- cunit.error(selector.pos, "regular expressions not yet implemented")
- //sel
- EmptyTree
- } else {
- implicit val theOwner = owner
- if (settings_debug) {
- Console.println("****")
- Console.println("**** initalize, selector = "+selector+" selector.tpe = "+selector.tpe)
- Console.println("**** doCheckExhaustive == "+doCheckExhaustive)
- }
- implicit val rep = new RepFactory(handleOuter)
- try {
- val tmps = new ListBuffer[Symbol]
- val vds = new ListBuffer[Tree]
- var root:Symbol = newVar(selector.pos, selector.tpe)
- if (!doCheckExhaustive)
- root.setFlag(symtab.Flags.TRANS_FLAG)
-
- var vdef:Tree = typed{ValDef(root, selector)}
- var theFailTree:Tree = ThrowMatchError(selector.pos, mkIdent(root))
-
- if (definitions.isTupleType(selector.tpe)) selector match {
- case app @ Apply(fn, args)
- if (fn.symbol eq selector.tpe.decls.lookup(nme.CONSTRUCTOR)) &&
- (cases forall { x => x match {
- case CaseDef(Apply(fn, pargs),_,_) => true ;
- case CaseDef(Ident(nme.WILDCARD),_,_) => true ;
- case _ => false
- }}) =>
- var i = 0
- var as = args
- while(as ne Nil) {
- val ti = as.head
- val v = newVar(ti.pos, cunit.fresh.newName(ti.pos, "tp"), selector.tpe.typeArgs(i))
- if (!doCheckExhaustive)
- v.setFlag(symtab.Flags.TRANS_FLAG)
- vds += typedValDef(v, ti)
- tmps += v
- i = i + 1
- as = as.tail
- }
- theFailTree = ThrowMatchError(selector.pos, copy.Apply(app, fn, tmps.toList map mkIdent))
- case _ =>
- tmps += root
- vds += vdef
- } else {
- tmps += root
- vds += vdef
- }
- val irep = initRep(tmps.toList, cases, rep)
-
- implicit val fail: Tree = theFailTree
-
- val mch = typed{ repToTree(irep)}
- var dfatree = typed{Block(vds.toList, mch)}
- // cannot use squeezedBlock because of side-effects, see t275
- //DEBUG("**** finished\n"+dfatree.toString)
- var bx = 0; var cs = cases; while(cs ne Nil) {
- if (!rep.isReached(bx)) {
- cunit.error(cs.head.asInstanceOf[CaseDef].body.pos, "unreachable code")
- }
- cs = cs.tail
- bx += 1
- }
- dfatree = rep.cleanup(dfatree)
- resetTrav.traverse(dfatree)
- dfatree
- } catch {
- case ex: FatalError => ex.printStackTrace(); throw ex
- }
+ // sets temporaries, variable declarations, and the fail tree
+ val (tmps, vds, theFailTree) = selector match {
+ case app @ Apply(fn, _) if isTupleType(selector.tpe) && doApply(fn) => processApply(app)
+ case _ =>
+ val root: Symbol = newVar(selector.pos, selector.tpe, flags)
+ val vdef: Tree = typer.typed(ValDef(root, selector))
+ val failTree: Tree = ThrowMatchError(selector.pos, mkIdent(root))
+ (List(root), List(vdef), failTree)
}
+
+ implicit val fail: Tree = theFailTree
+ val irep = initRep(tmps, cases, rep)
+ val mch = typer.typed(repToTree(irep))
+ var dfatree = typer.typed(Block(vds, mch))
+
+ // cannot use squeezedBlock because of side-effects, see t275
+ for ((cs, bx) <- cases.zipWithIndex)
+ if (!rep.isReached(bx)) cunit.error(cs.body.pos, "unreachable code")
+
+ dfatree = rep.cleanup(dfatree)
+ resetTrav.traverse(dfatree)
+ dfatree
}
object resetTrav extends Traverser {
override def traverse(x: Tree): Unit = x match {
- case vd @ ValDef(_, _, _, _) =>
- if (vd.symbol hasFlag symtab.Flags.SYNTHETIC) {
- vd.symbol resetFlag symtab.Flags.TRANS_FLAG
- vd.symbol resetFlag symtab.Flags.MUTABLE
- }
+ case (vd: ValDef) => if (vd.symbol hasFlag Flags.SYNTHETIC) {
+ vd.symbol resetFlag Flags.TRANS_FLAG
+ vd.symbol resetFlag Flags.MUTABLE
+ }
case _ =>
super.traverse(x)
}
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index d82a291..f835ee3 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Definitions.scala 16401 2008-10-28 17:58:19Z dragos $
+// $Id: Definitions.scala 16328 2008-10-24 13:53:16Z dragos $
package scala.tools.nsc.symtab
@@ -44,6 +44,7 @@ trait Definitions {
var NullClass: Symbol = _
var NothingClass: Symbol = _
var SingletonClass: Symbol = _
+ lazy val uncheckedStableClass = getClass("scala.uncheckedStable")
lazy val ClassClass: Symbol = getClass(sn.Class)
lazy val StringClass: Symbol = getClass(sn.String)
@@ -659,9 +660,9 @@ trait Definitions {
RootClass.info.decls.enter(RootPackage)
AnyClass = newClass(ScalaPackageClass, nme.Any, List()).setFlag(ABSTRACT)
- val anyparam = List(AnyClass.typeConstructor)
+ val any = List(AnyClass.typeConstructor)
- AnyValClass = newClass(ScalaPackageClass, nme.AnyVal, anyparam)
+ AnyValClass = newClass(ScalaPackageClass, nme.AnyVal, any)
.setFlag(FINAL | SEALED)
AnyRefClass =
newAlias(ScalaPackageClass, nme.AnyRef, ObjectClass.typeConstructor)
@@ -669,10 +670,10 @@ trait Definitions {
NullClass = newClass(ScalaPackageClass, nme.Null, anyrefparam)
.setFlag(ABSTRACT | TRAIT | FINAL)
- NothingClass = newClass(ScalaPackageClass, nme.Nothing, anyparam)
+ NothingClass = newClass(ScalaPackageClass, nme.Nothing, any)
.setFlag(ABSTRACT | TRAIT | FINAL)
- SingletonClass = newClass(ScalaPackageClass, nme.Singleton, anyparam)
+ SingletonClass = newClass(ScalaPackageClass, nme.Singleton, any)
.setFlag(ABSTRACT | TRAIT | FINAL)
UnitClass =
@@ -725,9 +726,9 @@ trait Definitions {
val booltype = BooleanClass.typeConstructor
// members of class scala.Any
- Any_== = newMethod(AnyClass, nme.EQ, anyparam, booltype) setFlag FINAL
- Any_!= = newMethod(AnyClass, nme.NE, anyparam, booltype) setFlag FINAL
- Any_equals = newMethod(AnyClass, nme.equals_, anyparam, booltype)
+ Any_== = newMethod(AnyClass, nme.EQ, any, booltype) setFlag FINAL
+ Any_!= = newMethod(AnyClass, nme.NE, any, booltype) setFlag FINAL
+ Any_equals = newMethod(AnyClass, nme.equals_, any, booltype)
Any_hashCode = newMethod(
AnyClass, nme.hashCode_, List(), IntClass.typeConstructor)
Any_toString = newMethod(
@@ -758,7 +759,7 @@ trait Definitions {
ObjectClass, "$asInstanceOf",
tparam => MethodType(List(), tparam.typeConstructor)) setFlag FINAL
String_+ = newMethod(
- StringClass, "+", anyparam, StringClass.typeConstructor) setFlag FINAL
+ StringClass, "+", any, StringClass.typeConstructor) setFlag FINAL
PatternWildcard = NoSymbol.newValue(NoPosition, "_").setInfo(NothingClass.typeConstructor)
diff --git a/src/compiler/scala/tools/nsc/symtab/IdeSupport.scala b/src/compiler/scala/tools/nsc/symtab/IdeSupport.scala
index 64fef18..9e5cc9a 100644
--- a/src/compiler/scala/tools/nsc/symtab/IdeSupport.scala
+++ b/src/compiler/scala/tools/nsc/symtab/IdeSupport.scala
@@ -161,6 +161,8 @@ trait IdeSupport extends SymbolTable { // added to global, not analyzers.
case Some(symbols) => symbols.foreach{sym =>
def f(sym : Symbol) = sym.owner.info.decls match {
case scope : PersistentScope => reuse(scope, (sym))
+ case scope =>
+ check(false, scope + " is not persistent")
}
if (sym.isModuleClass) {
if (check(sym.name.isTypeName,"") && sym.hasRawInfo)
@@ -626,6 +628,11 @@ trait IdeSupport extends SymbolTable { // added to global, not analyzers.
}
override def notifyImport(what : Name, container : Type, from : Name, to : Name) : Unit = {
super.notifyImport(what, container, from, to)
+ // sanity checking.
+ if ((container eq null) ||
+ (what eq null) ||
+ (from eq null) ||
+ (currentClient eq null)) return
val from0 = if (what.isTypeName) from.toTypeName else from.toTermName
val result = container.member(from0)
if (result != NoSymbol)
diff --git a/src/compiler/scala/tools/nsc/symtab/StdNames.scala b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
index 982a2b2..57b132a 100644
--- a/src/compiler/scala/tools/nsc/symtab/StdNames.scala
+++ b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: StdNames.scala 16027 2008-09-04 17:49:37Z dragos $
+// $Id: StdNames.scala 16344 2008-10-26 12:52:21Z DRMacIver $
package scala.tools.nsc.symtab
@@ -354,6 +354,7 @@ trait StdNames {
val tag = newTermName("$tag")
val tail = newTermName("tail")
val toList = newTermName("toList")
+ val toSeq = newTermName("toSeq")
val toString_ = newTermName("toString")
val clone_ = newTermName("clone")
val that = newTermName("that")
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index 1a99fc7..2ed3100 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -2,11 +2,12 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Symbols.scala 15700 2008-08-05 12:08:02Z odersky $
+// $Id: Symbols.scala 16048 2008-09-06 11:41:37Z odersky $
package scala.tools.nsc.symtab
import scala.collection.mutable.ListBuffer
+import scala.collection.immutable.Map
import scala.tools.nsc.io.AbstractFile
import scala.tools.nsc.util.{Position, NoPosition, BatchSourceFile}
import Flags._
@@ -26,6 +27,11 @@ trait Symbols {
val emptySymbolArray = new Array[Symbol](0)
val emptySymbolSet = Set.empty[Symbol]
+
+
+ /** Used to keep track of the recursion depth on locked symbols */
+ private var recursionTable = Map.empty[Symbol, Int]
+
/*
type Position;
def NoPos : Position;
@@ -181,6 +187,44 @@ trait Symbols {
final def newErrorSymbol(name: Name): Symbol =
if (name.isTypeName) newErrorClass(name) else newErrorValue(name)
+// Locking and unlocking ------------------------------------------------------
+
+ // True if the symbol is unlocked.
+ // True if the symbol is locked but still below the allowed recursion depth.
+ // False otherwise
+ def lockOK: Boolean = {
+ ((rawflags & LOCKED) == 0) ||
+ ((settings.Yrecursion.value != 0) &&
+ (recursionTable get this match {
+ case Some(n) => (n <= settings.Yrecursion.value)
+ case None => true }))
+ }
+
+ // Lock a symbol, using the handler if the recursion depth becomes too great.
+ def lock(handler: => Unit) = {
+ if ((rawflags & LOCKED) != 0) {
+ if (settings.Yrecursion.value != 0) {
+ recursionTable get this match {
+ case Some(n) =>
+ if (n > settings.Yrecursion.value) {
+ handler
+ } else {
+ recursionTable += (this -> (n + 1))
+ }
+ case None =>
+ recursionTable += (this -> 1)
+ }
+ } else { handler }
+ } else { rawflags |= LOCKED }
+ }
+
+ // Unlock a symbol
+ def unlock() = {
+ rawflags = rawflags & ~LOCKED
+ if (settings.Yrecursion.value != 0)
+ recursionTable -= this
+ }
+
// Tests ----------------------------------------------------------------------
def isTerm = false //to be overridden
@@ -268,7 +312,10 @@ trait Symbols {
/** Does this symbol denote a stable value? */
final def isStable =
- isTerm && !hasFlag(MUTABLE) && (!hasFlag(METHOD | BYNAMEPARAM) || hasFlag(STABLE))
+ isTerm &&
+ !hasFlag(MUTABLE) &&
+ (!hasFlag(METHOD | BYNAMEPARAM) || hasFlag(STABLE)) &&
+ !(tpe.isVolatile && getAttributes(uncheckedStableClass).isEmpty)
def isDeferred =
hasFlag(DEFERRED) && !isClass
@@ -499,17 +546,16 @@ trait Symbols {
assert(infos.prev eq null, this.name)
val tp = infos.info
//if (settings.debug.value) System.out.println("completing " + this.rawname + tp.getClass());//debug
- if ((rawflags & LOCKED) != 0) {
+ lock {
setInfo(ErrorType)
throw CyclicReference(this, tp)
}
- rawflags = rawflags | LOCKED
val current = phase
try {
phase = phaseOf(infos.validFrom)
tp.complete(this)
// if (settings.debug.value && runId(validTo) == currentRunId) System.out.println("completed " + this/* + ":" + info*/);//DEBUG
- rawflags = rawflags & ~LOCKED
+ unlock()
} finally {
phase = current
}
@@ -531,10 +577,10 @@ trait Symbols {
assert(info ne null)
infos = TypeHistory(currentPeriod, info, null)
if (info.isComplete) {
- rawflags = rawflags & ~LOCKED
+ unlock()
validTo = currentPeriod
} else {
- rawflags = rawflags & ~LOCKED
+ unlock()
validTo = NoPeriod
}
this
@@ -1597,7 +1643,7 @@ trait Symbols {
privateWithin = this
override def setInfo(info: Type): this.type = {
infos = TypeHistory(1, NoType, null)
- rawflags = rawflags & ~ LOCKED
+ unlock()
validTo = currentPeriod
this
}
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index f4a1d8e..89baa33 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -63,7 +63,7 @@ trait Types {
self: SymbolTable =>
import definitions._
-
+
//statistics
var singletonBaseTypeSeqCount = 0
var compoundBaseTypeSeqCount = 0
@@ -143,6 +143,7 @@ trait Types {
override def isError = underlying.isError
override def isErroneous = underlying.isErroneous
override def isStable: Boolean = underlying.isStable
+ override def isVolatile = underlying.isVolatile
override def finalResultType = underlying.finalResultType
override def paramSectionCount = underlying.paramSectionCount
override def paramTypes = underlying.paramTypes
@@ -210,6 +211,14 @@ trait Types {
/** Does this type denote a stable reference (i.e. singleton type)? */
def isStable: Boolean = false
+ /** Is this type dangerous (i.e. it might contain conflicting
+ * type information when empty, so that it can be constructed
+ * so that type unsoundness results.) A dangerous type has an underlying
+ * type of the form T_1 with T_n { decls }, where one of the
+ * T_i (i > 1) is an abstract type.
+ */
+ def isVolatile: Boolean = false
+
/** Is this type guaranteed not to have `null' as a value? */
def isNotNull: Boolean = false
@@ -368,6 +377,10 @@ trait Types {
def implicitMembers: List[Symbol] =
findMember(nme.ANYNAME, BRIDGE, IMPLICIT, false)(NoSymbol).alternatives
+ /** A list of all deferred symbols of this type (defined or inherited) */
+ def deferredMembers: List[Symbol] =
+ findMember(nme.ANYNAME, BRIDGE, DEFERRED, false)(NoSymbol).alternatives
+
/** The member with given name,
* an OverloadedSymbol if several exist, NoSymbol if none exist */
def member(name: Name): Symbol = findMember(name, BRIDGE, 0, false)(NoSymbol)
@@ -841,6 +854,7 @@ trait Types {
def supertype = underlying
override def isTrivial = false
override def isStable = true
+ override def isVolatile = underlying.isVolatile
override def widen: Type = underlying.widen
override def baseTypeSeq: BaseTypeSeq = {
if (util.Statistics.enabled) singletonBaseTypeSeqCount += 1
@@ -915,6 +929,7 @@ trait Types {
override def isNotNull = true
override def typeSymbol = sym
override def underlying: Type = sym.typeOfThis
+ override def isVolatile = false
override def prefixString =
if (settings.debug.value) sym.nameString + ".this."
else if (sym.isRoot || sym.isEmptyPackageClass || sym.isInterpreterWrapper || sym.isScalaPackageClass) ""
@@ -934,6 +949,7 @@ trait Types {
override def isStable = true
override def safeToString = "<param "+level+"."+paramId+">"
override def kind = "DeBruijnIndex"
+ // todo: this should be a subtype, which forwards to underlying
}
/** A class for singleton types of the form <prefix>.<sym.name>.type.
@@ -959,6 +975,7 @@ trait Types {
assert(underlyingCache ne this, this)
underlyingCache
}
+
/*
override def narrow: Type = {
if (phase.erasedTypes) this
@@ -1148,6 +1165,32 @@ trait Types {
decls))
else super.normalize
+ /** A refined type P1 with ... with Pn { decls } is volatile if
+ * one of the parent types Pi is an abstract type, and
+ * either i > 1, or decls or a following parent Pj, j > 1, contributes
+ * an abstract member.
+ * A type contributes an abstract member if it has an abstract member which
+ * is also a member of the whole refined type. A scope `decls' contributes
+ * an abstract member if it has an abstract definition which is also
+ * a member of the whole type.
+ */
+ override def isVolatile = {
+ def isVisible(m: Symbol) =
+ this.nonPrivateMember(m.name).alternatives contains m
+ def contributesAbstractMembers(p: Type) =
+ p.deferredMembers exists isVisible
+
+ (parents exists (_.isVolatile)) ||
+ (parents dropWhile (! _.typeSymbol.isAbstractType) match {
+ case ps @ (_ :: ps1) =>
+ (ps ne parents) ||
+ (ps1 exists contributesAbstractMembers) ||
+ (decls.elements exists (m => m.isDeferred && isVisible(m)))
+ case _ =>
+ false
+ })
+ }
+
override def kind = "RefinedType"
}
@@ -1334,9 +1377,14 @@ trait Types {
override def isStable: Boolean = {
sym == SingletonClass ||
- sym.isAbstractType && (sym.info.bounds.hi.typeSymbol isSubClass SingletonClass)
+ sym.isAliasType && normalize.isStable ||
+ sym.isAbstractType && (bounds.hi.typeSymbol isSubClass SingletonClass)
}
+ override def isVolatile: Boolean =
+ sym.isAliasType && normalize.isVolatile ||
+ sym.isAbstractType && bounds.hi.isVolatile
+
override val isTrivial: Boolean =
pre.isTrivial && !sym.isTypeParameter && args.forall(_.isTrivial)
@@ -1375,7 +1423,7 @@ A type's typeSymbol should never be inspected directly.
*/
override def bounds: TypeBounds =
- if (sym.isAbstractType) transform(thisInfo.bounds).asInstanceOf[TypeBounds]
+ if (sym.isAbstractType) transform(thisInfo.bounds).asInstanceOf[TypeBounds] // ??? seems to be doing asSeenFrom twice
else super.bounds
override def parents: List[Type] = {
@@ -1437,7 +1485,7 @@ A type's typeSymbol should never be inspected directly.
val xform = transform(sym.info.resultType)
assert(xform ne this, this)
xform.normalize // cycles have been checked in typeRef
- } else PolyType(typeParams, transform(sym.info.resultType).normalize) // eta-expand
+ } else PolyType(typeParams, transform(sym.info.resultType).normalize) // eta-expand
// @M TODO: should not use PolyType, as that's the type of a polymorphic value -- we really want a type *function*
} else if (isHigherKinded) {
// @M TODO: should not use PolyType, as that's the type of a polymorphic value -- we really want a type *function*
@@ -1512,8 +1560,8 @@ A type's typeSymbol should never be inspected directly.
return "=> " + args(0).toString
if (isFunctionType(this))
return normalize.typeArgs.init.mkString("(", ", ", ")") + " => " + normalize.typeArgs.last
- if (isTupleType(this))
- return args.mkString("(", ", ", if (args.length == 1) ",)" else ")")
+ if (isTupleType(this))
+ return normalize.typeArgs.mkString("(", ", ", if (normalize.typeArgs.length == 1) ",)" else ")")
if (sym.isAliasType && (prefixChain exists (_.termSymbol hasFlag SYNTHETIC))) {
val normed = normalize;
if (normed ne this) return normed.toString
@@ -1621,6 +1669,7 @@ A type's typeSymbol should never be inspected directly.
override def baseClasses: List[Symbol] = resultType.baseClasses
override def baseType(clazz: Symbol): Type = resultType.baseType(clazz)
override def narrow: Type = resultType.narrow
+ override def isVolatile = resultType.isVolatile
override def deconst =
if (inIDE) PolyType(typeParams, resultType.deconst)
@@ -1798,6 +1847,7 @@ A type's typeSymbol should never be inspected directly.
else constr.inst.toString
}
override def isStable = origin.isStable
+ override def isVolatile = origin.isVolatile
override def kind = "TypeVar"
}
@@ -1853,6 +1903,15 @@ A type's typeSymbol should never be inspected directly.
}
}
+ // ** Replace formal type parameter symbols with actual type arguments. * /
+ override def instantiateTypeParams(formals: List[Symbol], actuals: List[Type]) = {
+ val attributes1 = attributes.map(info => AnnotationInfo(info.atp.instantiateTypeParams(
+ formals, actuals), info.args, info.assocs))
+ val underlying1 = underlying.instantiateTypeParams(formals, actuals)
+ if ((attributes1 eq attributes) && (underlying1 eq underlying)) this
+ else AnnotatedType(attributes1, underlying1, selfsym)
+ }
+
/** Return the base type sequence of tp, dropping the annotations, unless the base type sequence of tp
* is precisely tp itself. */
override def baseTypeSeq: BaseTypeSeq = {
@@ -2010,12 +2069,12 @@ A type's typeSymbol should never be inspected directly.
if (sym1.isAliasType && sym1.info.typeParams.length == args.length) {
// note: we require that object is initialized,
// that's why we use info.typeParams instead of typeParams.
- if (sym1.hasFlag(LOCKED))
+ sym1.lock {
throw new TypeError("illegal cyclic reference involving " + sym1)
- sym1.setFlag(LOCKED)
- transform(sym1.info) // check there are no cycles
- sym1.resetFlag(LOCKED)
-
+ }
+ transform(sym1.info) // check there are no cycles
+ sym1.unlock()
+
rawTypeRef(pre, sym1, args) // don't expand type alias (cycles checked above)
} else {
val pre1 = removeSuper(pre, sym1)
@@ -2571,6 +2630,10 @@ A type's typeSymbol should never be inspected directly.
}
}
+ def singletonBounds(hi: Type) = {
+ mkTypeBounds(NothingClass.tpe, intersectionType(List(hi, SingletonClass.tpe)))
+ }
+
/** A map to compute the asSeenFrom method */
class AsSeenFromMap(pre: Type, clazz: Symbol) extends TypeMap {
override val dropNonConstraintAnnotations = true
@@ -2611,8 +2674,7 @@ A type's typeSymbol should never be inspected directly.
def stabilize(pre: Type, clazz: Symbol): Type = {
capturedPre get clazz match {
case None =>
- val qvar = makeFreshExistential(".type", clazz,
- mkTypeBounds(NothingClass.tpe, intersectionType(List(pre, SingletonClass.tpe))))
+ val qvar = makeFreshExistential(".type", clazz, singletonBounds(pre))
capturedPre += (clazz -> qvar)
capturedParams = qvar :: capturedParams
qvar
@@ -2647,7 +2709,6 @@ A type's typeSymbol should never be inspected directly.
if (!(pre1.isStable ||
pre1.typeSymbol.isPackageClass ||
pre1.typeSymbol.isModuleClass && pre1.typeSymbol.isStatic)) {
-// throw new MalformedType("non-stable type "+pre1+" replacing a stable reference "+tp)
stabilize(pre1, sym)
} else {
pre1
@@ -2887,11 +2948,6 @@ A type's typeSymbol should never be inspected directly.
private var existSyms = immutable.Map.empty[Int, Symbol]
def existentialsNeeded: List[Symbol] = existSyms.values.toList
- private def boundFor(actualIdx: Int) =
- mkTypeBounds(
- NothingClass.tpe,
- intersectionType(List(actuals(actualIdx), SingletonClass.tpe)))
-
/* Return the type symbol for referencing a parameter index
* inside the existential quantifier. */
def existSymFor(actualIdx: Int, oldSym: Symbol) =
@@ -2899,11 +2955,10 @@ A type's typeSymbol should never be inspected directly.
existSyms(actualIdx)
else {
val symowner = oldSym.owner // what should be used??
- val bound = boundFor(actualIdx)
+ val bound = singletonBounds(actuals(actualIdx))
val sym =
- symowner.newAbstractType(
- oldSym.pos, oldSym.name+".type")
+ symowner.newAbstractType(oldSym.pos, oldSym.name+".type")
sym.setInfo(bound)
sym.setFlag(oldSym.flags)
@@ -3369,6 +3424,17 @@ A type's typeSymbol should never be inspected directly.
case _ => tp.normalize
}
+ /*
+ todo: change to:
+ def normalizePlus(tp: Type) = tp match {
+ case TypeRef(pre, sym, List()) =>
+ if (!sym.isInitialized) sym.rawInfo.load(sym)
+ if (sym.hasFlag(JAVA) && !sym.typeParams.isEmpty) rawToExistential(tp)
+ else tp.normalize
+ case _ => tp.normalize
+ }
+ */
+
private def isSameType0(tp1: Type, tp2: Type): Boolean =
((tp1, tp2) match {
case (ErrorType, _) => true
@@ -3543,9 +3609,9 @@ A type's typeSymbol should never be inspected directly.
case (_, WildcardType) => true
case (NoType, _) => false
- case (NoPrefix, _) => tp2.typeSymbol.isPackageClass
+ case (NoPrefix, _) => tp2 == NoPrefix || tp2.typeSymbol.isPackageClass
case (_, NoType) => false
- case (_, NoPrefix) => tp1.typeSymbol.isPackageClass
+ case (_, NoPrefix) => tp1 == NoPrefix || tp1.typeSymbol.isPackageClass
case (ThisType(_), ThisType(_)) => tp1 =:= tp2
case (ThisType(_), SingleType(_, _)) => tp1 =:= tp2
@@ -3581,9 +3647,15 @@ A type's typeSymbol should never be inspected directly.
||
sym1 == NothingClass
||
- // Console.println("last chance " + sym1 + " " + sym2 + " " + sym2.isClass + " " (sym2 isSubClass ObjectClass))
+ //{ Console.println("last chance " + sym1 + " " + sym2 + " " + sym2.isClass + " " + (sym2 isSubClass ObjectClass)); true } &&
sym1 == NullClass &&
- sym2.isClass && (sym2 isNonBottomSubClass ObjectClass) && (!(tp2.normalize.typeSymbol isNonBottomSubClass NotNullClass)))
+ sym2.isClass && (sym2 isNonBottomSubClass ObjectClass) && (!(tp2.normalize.typeSymbol isNonBottomSubClass NotNullClass))
+ ||
+ {
+ val tp1n = normalizePlus(tp1)
+ val tp2n = normalizePlus(tp2)
+ ((tp1n ne tp1) || (tp2n ne tp2)) && isSubType(tp1n, tp2n, depth)
+ })
case (MethodType(pts1, res1), MethodType(pts2, res2)) =>
(pts1.length == pts2.length &&
matchingParams(pts1, pts2, tp1.isInstanceOf[JavaMethodType], tp2.isInstanceOf[JavaMethodType]) &&
@@ -3625,9 +3697,11 @@ A type's typeSymbol should never be inspected directly.
if (sym2 == SingletonClass && tp1.isStable) =>
true
case (_, RefinedType(parents2, ref2)) =>
- (parents2 forall (tp2 => tp1 <:< tp2 || tp2.typeSymbol == NotNullClass && tp1.isNotNull)) &&
- (ref2.toList forall tp1.specializes) &&
- (!parents2.exists(_.typeSymbol.isAbstractType) || tp1.typeSymbol != NullClass)
+ (parents2 forall (tp2 => tp1 <:< tp2)) &&
+ (ref2.toList forall tp1.specializes) /* &&
+ removed, replaced by stricter condition on stable values.
+ (tp1.typeSymbol != NullClass || !parents2.exists(_.typeSymbol.isAbstractType))
+*/
case (ExistentialType(_, _), _) =>
try {
skolemizationLevel += 1
@@ -3919,7 +3993,6 @@ A type's typeSymbol should never be inspected directly.
def elimSub0(ts: List[Type]): List[Type] = ts match {
case List() => List()
case t :: ts1 =>
- assert(depth != AnyDepth)
val rest = elimSub0(ts1 filter (t1 => !isSubType(t1, t, decr(depth))))
if (rest exists (t1 => isSubType(t, t1, decr(depth)))) rest else t :: rest
}
@@ -4041,6 +4114,15 @@ A type's typeSymbol should never be inspected directly.
val GlbFailure = new Throwable
+ /** A global counter for glb calls in the `specializes' query connected to the `addMembers'
+ * call in `glb'. There's a possible inifinite recursion when `specializes' calls
+ * memberType, which calls baseTypeSeq, which calls mergePrefixAndArgs, which calls glb.
+ * The counter breaks this recursion after two calls.
+ * If the recursion is broken, no member is added to the glb.
+ */
+ private var globalGlbDepth = 0
+ private final val globalGlbLimit = 2
+
def glb(ts: List[Type]): Type = glb(ts, lubDepth(ts))
/** The greatest lower bound wrt <:< of a list of types */
@@ -4065,6 +4147,12 @@ A type's typeSymbol should never be inspected directly.
case RefinedType(ps, _) => ps flatMap refinedToParents
case _ => List(t)
}
+ def refinedToDecls(t: Type): List[Scope] = t match {
+ case RefinedType(ps, decls) =>
+ val dss = ps flatMap refinedToDecls
+ if (decls.isEmpty) dss else decls :: dss
+ case _ => List()
+ }
val ts1 = ts flatMap refinedToParents
val glbBase = intersectionType(ts1, glbOwner)
val glbType =
@@ -4105,13 +4193,20 @@ A type's typeSymbol should never be inspected directly.
result
})
}
- for (t <- ts; val sym <- t.nonPrivateMembers)
- if (!sym.isClass && !sym.isConstructor && !(glbThisType specializes sym))
- try {
- addMember(glbThisType, glbRefined, glbsym(sym))
- } catch {
- case ex: NoCommonType =>
- }
+ if (globalGlbDepth < globalGlbLimit)
+ try {
+ globalGlbDepth += 1
+ val dss = ts flatMap refinedToDecls
+ for (ds <- dss; val sym <- ds.elements)
+ if (globalGlbDepth < globalGlbLimit && !(glbThisType specializes sym))
+ try {
+ addMember(glbThisType, glbRefined, glbsym(sym))
+ } catch {
+ case ex: NoCommonType =>
+ }
+ } finally {
+ globalGlbDepth -= 1
+ }
if (glbRefined.decls.isEmpty) glbBase else glbRefined
}
existentialAbstraction(tparams, glbType)
@@ -4295,14 +4390,20 @@ A type's typeSymbol should never be inspected directly.
/** If option `explaintypes' is set, print a subtype trace for
* `found <:< required'.
- *
- * @param found ...
- * @param required ...
*/
def explainTypes(found: Type, required: Type) {
if (settings.explaintypes.value) withTypesExplained(found <:< required)
}
+ /** If option `explaintypes' is set, print a subtype trace for
+ * `op(found, required)'.
+ */
+ def explainTypes(op: (Type, Type) => Any, found: Type, required: Type) {
+ if (settings.explaintypes.value) withTypesExplained(op(found, required))
+ }
+
+ /** Execute `op' while printing a trace of the operations on types executed.
+ */
def withTypesExplained[A](op: => A): A = {
val s = explainSwitch
try { explainSwitch = true; op } finally { explainSwitch = s }
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 8f9d418..2e8b34d 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: ClassfileParser.scala 16401 2008-10-28 17:58:19Z dragos $
+// $Id: ClassfileParser.scala 16328 2008-10-24 13:53:16Z dragos $
package scala.tools.nsc.symtab.classfile
@@ -770,8 +770,7 @@ abstract class ClassfileParser {
val t = pool.getType(index)
val n = pool.getName(in.nextChar)
val s = t.typeSymbol.linkedModuleOfClass.info.decls.lookup(n)
- //assert (s != NoSymbol, "while processing " + in.file + ": " + t + "." + n + ": " + t.decls)
- assert(s != NoSymbol, t) // avoid string concatenation!
+ assert(s != NoSymbol, t)
Constant(s)
case ARRAY_TAG =>
val arr = new ArrayBuffer[Constant]()
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
index 4e0fd8c..84def44 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Iulian Dragos
*/
-// $Id: ICodeReader.scala 16401 2008-10-28 17:58:19Z dragos $
+// $Id: ICodeReader.scala 16328 2008-10-24 13:53:16Z dragos $
package scala.tools.nsc.symtab.classfile
@@ -135,11 +135,11 @@ abstract class ICodeReader extends ClassfileParser {
import ch.epfl.lamp.fjbg.JAccessFlags._
var res = 0L
- if ((flags & ACC_PRIVATE) == 1) res |= Flags.PRIVATE
- if ((flags & ACC_PROTECTED) == 1) res |= Flags.PROTECTED
- if ((flags & ACC_FINAL) == 1) res |= Flags.FINAL
- if ((flags & ACC_ABSTRACT) == 1) res |= Flags.DEFERRED
- if ((flags & ACC_SYNTHETIC) == 1) res |= Flags.SYNTHETIC
+ if ((flags & ACC_PRIVATE) != 0) res |= Flags.PRIVATE
+ if ((flags & ACC_PROTECTED) != 0) res |= Flags.PROTECTED
+ if ((flags & ACC_FINAL) != 0) res |= Flags.FINAL
+ if ((flags & ACC_ABSTRACT) != 0) res |= Flags.DEFERRED
+ if ((flags & ACC_SYNTHETIC) != 0) res |= Flags.SYNTHETIC
res
}
diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala
index acfd4c2..5a35653 100644
--- a/src/compiler/scala/tools/nsc/transform/Constructors.scala
+++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author
*/
-// $Id: Constructors.scala 15660 2008-07-31 22:01:37Z dragos $
+// $Id: Constructors.scala 16246 2008-10-11 14:03:30Z washburn $
package scala.tools.nsc.transform
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 07a6a66..e969b43 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Erasure.scala 16455 2008-10-31 11:33:20Z odersky $
+// $Id: Erasure.scala 16456 2008-10-31 11:33:57Z odersky $
package scala.tools.nsc.transform
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index a363955..05b5e32 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: ExplicitOuter.scala 15029 2008-05-14 16:50:54Z odersky $
+// $Id: ExplicitOuter.scala 16487 2008-11-04 00:42:23Z DRMacIver $
package scala.tools.nsc.transform
@@ -415,24 +415,10 @@ abstract class ExplicitOuter extends InfoTransform with TransMatcher with Patter
q
} else null
- /*
- cases match {
- //if ((cases.length > 1) && ...(cases(0)))
- //can't use treeInfo.isDefaultCase, because that diagnoses a Bind
- case CaseDef(Ident(nme.WILDCARD), EmptyTree, _)::xs if !xs.isEmpty =>
- // a hack to detect when explicit outer does not work correctly
- // still needed?
- assert(false,"transforming too much, " + tid)
- // no!
- case _ =>
- }
- */
-
+
var nselector = transform(selector)
- //assert(nselector.tpe =:= selector.tpe)
- //val ncases = transformCaseDefs(cases)
- def makeGuardDef(vs:SymList, guard:Tree) = {
+ def makeGuardDef(vs:List[Symbol], guard:Tree) = {
import symtab.Flags._
val gdname = cunit.fresh.newName(guard.pos, "gd")
val fmls = new ListBuffer[Type]
@@ -482,34 +468,16 @@ abstract class ExplicitOuter extends InfoTransform with TransMatcher with Patter
}
ExplicitOuter.this.resultType = tree.tpe
- //Console.println("TransMatcher currentOwner ="+currentOwner+")")
- //Console.println("TransMatcher selector.tpe ="+selector.tpe+")")
- //Console.println("TransMatcher resultType ="+resultType+")")
-
- //println("handle pattern = "+nselector+"/"+ncases.toList+"/"+currentOwner+"/"+tree.tpe)
- val t_untyped = handlePattern(nselector, ncases.toList, checkExhaustive, currentOwner, transform)
- //println("t_untyped = "+t_untyped)
- try {
- //Console.println("t_untyped "+t_untyped.toString())
- val t = atPos(tree.pos) { localTyper.typed(t_untyped, resultType) }
- //println("t_typed = "+t)
-
- //t = transform(t)
- //val t = atPos(tree.pos) { typed(t_untyped, resultType) }
- //val t = atPos(tree.pos) { typed(t_untyped) }
- //Console.println("t typed "+t.toString())
- if (settings.debug.value)
- Console.println("finished translation of " + tid)
-
- if(nguard.isEmpty) {t} else Block(nguard.toList, t) setType t.tpe
- } catch {
- case e =>
- e.printStackTrace()
- //treeBrowser.browse(Seq.single(unit).elements)
- Console.println("[died while typechecking the translated pattern match:]")
- Console.println(t_untyped)
- null
- }
+
+ val t = atPos(tree.pos) {
+ val t_untyped = handlePattern(nselector, ncases.toList, checkExhaustive, currentOwner, transform)(localTyper)
+ localTyper.typed(t_untyped, resultType)
+ }
+
+ if (settings.debug.value)
+ Console.println("finished translation of " + tid)
+
+ if(nguard.isEmpty) {t} else Block(nguard.toList, t) setType t.tpe
case _ =>
val x = super.transform(tree)
@@ -524,4 +492,11 @@ abstract class ExplicitOuter extends InfoTransform with TransMatcher with Patter
atPhase(phase.next) { super.transformUnit(unit) }
}
}
+
+ override def newPhase(prev: scala.tools.nsc.Phase): StdPhase =
+ new Phase(prev)
+
+ class Phase(prev: scala.tools.nsc.Phase) extends super.Phase(prev) {
+ override val checkable = false
+ }
}
diff --git a/src/compiler/scala/tools/nsc/transform/InfoTransform.scala b/src/compiler/scala/tools/nsc/transform/InfoTransform.scala
index 7927325..8114672 100644
--- a/src/compiler/scala/tools/nsc/transform/InfoTransform.scala
+++ b/src/compiler/scala/tools/nsc/transform/InfoTransform.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2006 LAMP/EPFL
* @author
*/
-// $Id: InfoTransform.scala 15298 2008-06-09 13:32:38Z rytz $
+// $Id: InfoTransform.scala 16315 2008-10-22 12:49:56Z rytz $
package scala.tools.nsc.transform
diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
index e24f29c..dc18e17 100644
--- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
+++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author
*/
-// $Id: LambdaLift.scala 15080 2008-05-19 14:55:51Z odersky $
+// $Id: LambdaLift.scala 16315 2008-10-22 12:49:56Z rytz $
package scala.tools.nsc.transform
diff --git a/src/compiler/scala/tools/nsc/transform/LiftCode.scala b/src/compiler/scala/tools/nsc/transform/LiftCode.scala
index 1f8828a..204ed8a 100644
--- a/src/compiler/scala/tools/nsc/transform/LiftCode.scala
+++ b/src/compiler/scala/tools/nsc/transform/LiftCode.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Gilles Dubochet
*/
-// $Id: LiftCode.scala 14416 2008-03-19 01:17:25Z mihaylov $
+// $Id: LiftCode.scala 16246 2008-10-11 14:03:30Z washburn $
package scala.tools.nsc.transform
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index 386b4a8..4fdc929 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Mixin.scala 16401 2008-10-28 17:58:19Z dragos $
+// $Id: Mixin.scala 16328 2008-10-24 13:53:16Z dragos $
package scala.tools.nsc.transform
@@ -960,6 +960,10 @@ abstract class Mixin extends InfoTransform {
// assign to fields in some implementation class via an abstract
// setter in the interface.
localTyper.typed {
+ // println(lhs.symbol)
+ // println(lhs.symbol.owner.info.decls)
+ // println(needsExpandedSetterName(lhs.symbol))
+ // util.trace("generating tree: ") {
atPos(tree.pos) {
Apply(
Select(
@@ -969,7 +973,7 @@ abstract class Mixin extends InfoTransform {
needsExpandedSetterName(lhs.symbol))) setPos lhs.pos,
List(rhs))
}
- }
+ } //}
case _ =>
tree
}
diff --git a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
index 9b984bb..5672064 100644
--- a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
+++ b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: OverridingPairs.scala 13220 2007-11-09 15:03:13Z odersky $
+// $Id: OverridingPairs.scala 16246 2008-10-11 14:03:30Z washburn $
package scala.tools.nsc.transform
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 3ace93f..23df48b 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author
*/
-// $Id: UnCurry.scala 15266 2008-06-04 12:55:06Z dragos $
+// $Id: UnCurry.scala 16315 2008-10-22 12:49:56Z rytz $
package scala.tools.nsc.transform
@@ -256,7 +256,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
// ------ Transforming anonymous functions and by-name-arguments ----------------
- /** Undo eta expansion for parameterless and nullaray methods */
+ /** Undo eta expansion for parameterless and nullary methods */
def deEta(fun: Function): Tree = fun match {
case Function(List(), Apply(expr, List())) if treeInfo.isPureExpr(expr) =>
if (expr.hasSymbol && expr.symbol.hasFlag(LAZY))
@@ -316,6 +316,16 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
def applyMethodDef(body: Tree) =
DefDef(Modifiers(FINAL), nme.apply, List(), List(fun.vparams), TypeTree(restpe), body)
.setSymbol(applyMethod)
+/*
+ def toStringMethodDefs = fun match {
+ case etaExpansion(_, fn, _) if (fn.hasSymbol) =>
+ List(
+ DefDef(Modifiers(FINAL | OVERRIDE), nme.toString_, List(), List(List()), TypeTree(StringClass.tpe),
+ Literal(fn.symbol.name)))
+ case _ =>
+ List()
+ }
+*/
def mkUnchecked(tree: Tree) = tree match {
case Match(selector, cases) =>
atPos(tree.pos) {
@@ -326,7 +336,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
case _ =>
tree
}
- val members =
+ val members = {
if (fun.tpe.typeSymbol == PartialFunctionClass) {
val isDefinedAtMethod = anonClass.newMethod(fun.pos, nme.isDefinedAt)
.setFlag(FINAL).setInfo(MethodType(formals, BooleanClass.tpe))
@@ -349,7 +359,8 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
DefDef(isDefinedAtMethod, vparamss => mkUnchecked(idbody(vparamss.head.head))))
} else {
List(applyMethodDef(fun.body))
- }
+ }
+ } /* ::: toStringMethodDefs */
localTyper.typed {
atPos(fun.pos) {
Block(
diff --git a/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala b/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
index f303124..0a27fb1 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Analyzer.scala 15267 2008-06-04 13:08:18Z mcdirmid $
+// $Id: Analyzer.scala 16003 2008-09-03 10:07:36Z washburn $
package scala.tools.nsc.typechecker
@@ -25,6 +25,7 @@ trait Analyzer extends AnyRef
val global: Analyzer.this.global.type = Analyzer.this.global
val phaseName = "namer"
def newPhase(_prev: Phase): StdPhase = new StdPhase(_prev) {
+ override val checkable = false
def apply(unit: CompilationUnit) {
newNamer(rootContext(unit)).enterSym(unit.body)
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 81b6af9..2c81c67 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Contexts.scala 15798 2008-08-15 16:27:10Z odersky $
+// $Id: Contexts.scala 16183 2008-10-01 09:46:08Z odersky $
package scala.tools.nsc.typechecker
@@ -157,7 +157,7 @@ trait Contexts { self: Analyzer =>
assert(inIDE)
def eq[T](x : T, y : T) = x == y
val a0 = {
- if (tree ne null) tree.setType(null)
+ if ((tree ne null) && (tree ne EmptyTree)) tree.setType(null)
if ((tree eq null) || (that.tree eq null)) tree == that.tree else
tree equalsStructure that.tree;
}
@@ -346,7 +346,7 @@ trait Contexts { self: Analyzer =>
}
def error(pos: Position, msg: String) {
- if (reportGeneralErrors || inIDE)
+ if (reportGeneralErrors)
unit.error(pos, if (checking) "**** ERROR DURING INTERNAL CHECKING ****\n" + msg else msg)
else
throw new TypeError(pos, msg)
@@ -355,7 +355,7 @@ trait Contexts { self: Analyzer =>
def warning(pos: Position, msg: String) {
if (reportGeneralErrors) unit.warning(pos, msg)
}
-
+
/**
* @param pos ...
* @param pre ...
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 52b3a36..640ad7b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Infer.scala 15821 2008-08-18 14:53:44Z odersky $
+// $Id: Infer.scala 15973 2008-08-31 03:01:18Z mcdirmid $
package scala.tools.nsc.typechecker
import scala.tools.nsc.util.{Position, NoPosition}
@@ -459,7 +459,16 @@ trait Infer {
val tvars = tparams map freshVar
if (isCompatible(restpe.instantiateTypeParams(tparams, tvars), pt)) {
try {
- solvedTypes(tvars, tparams, tparams map varianceInType(restpe),
+ // If the restpe is an implicit method, and the expected type is fully defined
+ // optimze type varianbles wrt to the implicit formals only; ignore the result type.
+ // See test pos/jesper.scala
+ val varianceType = restpe match {
+ case mt: ImplicitMethodType if isFullyDefined(pt) =>
+ MethodType(mt.paramTypes, AnyClass.tpe)
+ case _ =>
+ restpe
+ }
+ solvedTypes(tvars, tparams, tparams map varianceInType(varianceType),
false, lubDepth(List(restpe, pt)))
} catch {
case ex: NoInstance => null
@@ -922,10 +931,12 @@ trait Infer {
*/
def inferExprInstance(tree: Tree, undetparams: List[Symbol], pt: Type) {
if (inferInfo)
- println("infer expr instance "+tree+"\n"+
+ println("infer expr instance "+tree+":"+tree.tpe+"\n"+
" undetparams = "+undetparams+"\n"+
" pt = "+pt)
substExpr(tree, undetparams, exprTypeArgs(undetparams, tree.tpe, pt), pt)
+ if (inferInfo)
+ println("inferred expr instance "+tree)
}
/** Substitite free type variables `undetparams' of polymorphic argument
@@ -1260,7 +1271,7 @@ trait Infer {
}
def checkDead(tree: Tree): Tree = {
- if (settings.Xwarndeadcode.value && tree.tpe.typeSymbol == NothingClass)
+ if (settings.Xwarndeadcode.value && tree.tpe != null && tree.tpe.typeSymbol == NothingClass)
context.warning (tree.pos, "dead code following this construct")
tree
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index e9de1f4..f34bf47 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: RefChecks.scala 16023 2008-09-04 15:08:57Z DRMacIver $
+// $Id: RefChecks.scala 16491 2008-11-04 16:04:30Z washburn $
package scala.tools.nsc.typechecker
@@ -72,7 +72,7 @@ abstract class RefChecks extends InfoTransform {
* 1.1. M must have the same or stronger access privileges as O.
* 1.2. O must not be final.
* 1.3. O is deferred, or M has `override' modifier.
- * 1.4. If O is an immutable value, then so is M.
+ * 1.4. If O is stable, then so is M.
* // @M: LIFTED 1.5. Neither M nor O are a parameterized type alias
* 1.6. If O is a type alias, then M is an alias of O.
* 1.7. If O is an abstract type then
@@ -198,7 +198,7 @@ abstract class RefChecks extends InfoTransform {
(other hasFlag ACCESSOR) && other.accessed.isVariable && !other.accessed.hasFlag(LAZY)) {
overrideError("cannot override a mutable variable")
} else if (other.isStable && !member.isStable) { // (1.4)
- overrideError("needs to be an immutable value")
+ overrideError("is not stable")
} else if (member.isValue && (member hasFlag LAZY) &&
other.isValue && !other.isSourceMethod && !other.isDeferred && !(other hasFlag LAZY)) {
overrideError("cannot override a concrete non-lazy value")
@@ -218,9 +218,10 @@ abstract class RefChecks extends InfoTransform {
//if (!member.typeParams.isEmpty) // (1.7) @MAT
// overrideError("may not be parameterized");
var memberTp = self.memberType(member)
-
- if (!(self.memberInfo(other).bounds containsType memberTp)) { // (1.7.1) {
+ val otherTp = self.memberInfo(other)
+ if (!(otherTp.bounds containsType memberTp)) { // (1.7.1) {
overrideTypeError(); // todo: do an explaintypes with bounds here
+ explainTypes(_.bounds containsType _, otherTp, memberTp)
}
// check overriding (abstract type --> abstract type or abstract type --> concrete type member (a type alias))
@@ -371,6 +372,8 @@ abstract class RefChecks extends InfoTransform {
unit.error(clazz.pos, "illegal inheritance;\n " + clazz +
" inherits different type instances of " + baseClass +
":\n" + tp1 + " and " + tp2);
+ explainTypes(tp1, tp2)
+ explainTypes(tp2, tp1)
}
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index 92c00e9..2cb570e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: SyntheticMethods.scala 15390 2008-06-17 17:44:30Z odersky $
+// $Id: SyntheticMethods.scala 16308 2008-10-22 07:45:47Z rytz $
package scala.tools.nsc.typechecker
@@ -261,20 +261,24 @@ trait SyntheticMethods { self: Analyzer =>
def addBeanGetterMethod(sym: Symbol) = {
val getter = beanSetterOrGetter(sym)
- if (getter != NoSymbol)
+ if (getter != NoSymbol) {
+ clazz.info.decls.enter(getter)
ts += typer.typed(DefDef(
getter,
vparamss => if (sym hasFlag DEFERRED) EmptyTree else gen.mkAttributedRef(sym)))
+ }
}
def addBeanSetterMethod(sym: Symbol) = {
val setter = beanSetterOrGetter(sym)
- if (setter != NoSymbol)
+ if (setter != NoSymbol) {
+ clazz.info.decls.enter(setter)
ts += typer.typed(DefDef(
setter,
vparamss =>
if (sym hasFlag DEFERRED) EmptyTree
else Apply(gen.mkAttributedRef(sym), List(Ident(vparamss.head.head)))))
+ }
}
def isPublic(sym: Symbol) =
diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
index efde0b1..26cf433 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: TreeCheckers.scala 13819 2008-01-28 18:43:24Z odersky $
+// $Id: TreeCheckers.scala 16039 2008-09-05 15:22:09Z washburn $
package scala.tools.nsc.typechecker
@@ -16,7 +16,8 @@ abstract class TreeCheckers extends Analyzer {
val tpeOfTree = new scala.collection.mutable.HashMap[Tree, Type]
def checkTrees {
- Console.println("[consistency check at start of phase " + phase + "]")
+ if (settings.verbose.value)
+ Console.println("[consistency check at the beginning of phase " + phase + "]")
for (unit <- currentRun.units) check(unit)
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 6a44b59..2b2fa77 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Typers.scala 15830 2008-08-19 08:25:20Z washburn $
+// $Id: Typers.scala 16309 2008-10-22 07:52:41Z rytz $
//todo: rewrite or disllow new T where T is a mixin (currently: <init> not a member of T)
//todo: use inherited type info also for vars and values
@@ -253,7 +253,32 @@ trait Typers { self: Analyzer =>
*/
def checkStable(tree: Tree): Tree =
if (treeInfo.isPureExpr(tree)) tree
- else errorTree(tree, "stable identifier required, but " + tree + " found.")
+ else errorTree(
+ tree,
+ "stable identifier required, but "+tree+" found."+
+ (if (isStableExceptVolatile(tree)) {
+ val tpe = tree.symbol.tpe match {
+ case PolyType(_, rtpe) => rtpe
+ case t => t
+ }
+ "\n Note that "+tree.symbol+" is not stable because its type, "+tree.tpe+", is volatile."
+ } else ""))
+
+ /** Would tree be a stable (i.e. a pure expression) if the type
+ * of its symbol was not volatile?
+ */
+ private def isStableExceptVolatile(tree: Tree) = {
+ tree.hasSymbol && tree.symbol != NoSymbol && tree.tpe.isVolatile &&
+ { val savedTpe = tree.symbol.info
+ val savedSTABLE = tree.symbol getFlag STABLE
+ tree.symbol setInfo AnyRefClass.tpe
+ tree.symbol setFlag STABLE
+ val result = treeInfo.isPureExpr(tree)
+ tree.symbol setInfo savedTpe
+ tree.symbol setFlag savedSTABLE
+ result
+ }
+ }
/** Check that `tpt' refers to a non-refinement class type */
def checkClassType(tpt: Tree, existentialOK: Boolean) {
@@ -262,6 +287,7 @@ trait Typers { self: Analyzer =>
case ErrorType => ;
case PolyType(_, restpe) => check(restpe)
case ExistentialType(_, restpe) if existentialOK => check(restpe)
+ case AnnotatedType(_, underlying, _) => check(underlying)
case t => error(tpt.pos, "class type required but "+t+" found")
}
check(tpt.tpe)
@@ -276,9 +302,7 @@ trait Typers { self: Analyzer =>
def checkNonCyclic(pos: Position, tp: Type): Boolean = {
def checkNotLocked(sym: Symbol): Boolean = {
sym.initialize
- if (sym hasFlag LOCKED) {
- error(pos, "cyclic aliasing or subtyping involving "+sym); false
- } else true
+ sym.lockOK || {error(pos, "cyclic aliasing or subtyping involving "+sym); false}
}
tp match {
case TypeRef(pre, sym, args) =>
@@ -307,9 +331,11 @@ trait Typers { self: Analyzer =>
}
def checkNonCyclic(pos: Position, tp: Type, lockedSym: Symbol): Boolean = {
- lockedSym.setFlag(LOCKED)
+ lockedSym.lock {
+ throw new TypeError("illegal cyclic reference involving " + lockedSym)
+ }
val result = checkNonCyclic(pos, tp)
- lockedSym.resetFlag(LOCKED)
+ lockedSym.unlock()
result
}
@@ -671,7 +697,9 @@ trait Typers { self: Analyzer =>
(pt <:< functionType(mt.paramTypes map (t => WildcardType), WildcardType)))*/ { // (4.2)
if (settings.debug.value) log("eta-expanding "+tree+":"+tree.tpe+" to "+pt)
checkParamsConvertible(tree.pos, tree.tpe)
- typed(etaExpand(context.unit, tree), mode, pt)
+ val tree1 = etaExpand(context.unit, tree)
+// println("eta "+tree+" ---> "+tree1+":"+tree1.tpe)
+ typed(tree1, mode, pt)
} else if (!meth.isConstructor && mt.paramTypes.isEmpty) { // (4.3)
adapt(typed(Apply(tree, List()) setPos tree.pos), mode, pt)
} else if (context.implicitsEnabled) {
@@ -2113,7 +2141,11 @@ trait Typers { self: Analyzer =>
def apply(tp: Type): Type = tp match {
case TypeRef(pre, sym, args) =>
if (sym.isAliasType && containsLocal(tp)) apply(tp.normalize)
- else mapOver(tp)
+ else {
+ if (pre.isVolatile)
+ context.error(tree.pos, "Inferred type "+tree.tpe+" contains type selection from volatile type "+pre)
+ mapOver(tp)
+ }
case _ =>
mapOver(tp)
}
@@ -2213,6 +2245,9 @@ trait Typers { self: Analyzer =>
if (wc.symbol == NoSymbol) { namer.enterSym(wc); wc.symbol setFlag EXISTENTIAL }
else context.scope enter wc.symbol
val whereClauses1 = typedStats(tree.whereClauses, context.owner)
+ for (vd @ ValDef(_, _, _, _) <- tree.whereClauses)
+ if (vd.symbol.tpe.isVolatile)
+ error(vd.pos, "illegal abstraction from value with volatile type "+vd.symbol.tpe)
val tpt1 = typedType(tree.tpt, mode)
val (typeParams, tpe) = existentialTransform(tree.whereClauses map (_.symbol), tpt1.tpe)
//println(tpe + ": " + tpe.getClass )
@@ -2430,17 +2465,18 @@ trait Typers { self: Analyzer =>
.setOriginal(tpt1) /* .setPos(tpt1.pos) */
.setType(appliedType(tpt1.tpe, context.undetparams map (_.tpe)))
}
+ /** If current tree <tree> appears in <val x(: T)? = <tree>>
+ * return `tp with x.type' else return `tp'.
+ */
def narrowRhs(tp: Type) = {
var sym = context.tree.symbol
if (sym != null && sym != NoSymbol && sym.owner.isClass && sym.getter(sym.owner) != NoSymbol)
sym = sym.getter(sym.owner)
context.tree match {
- case ValDef(_, _, _, Apply(Select(`tree`, _), _)) if (sym.isStable) =>
-// println("narrowing...")
+ case ValDef(mods, _, _, Apply(Select(`tree`, _), _)) if !(mods hasFlag MUTABLE) =>
val pre = if (sym.owner.isClass) sym.owner.thisType else NoPrefix
intersectionType(List(tp, singleType(pre, sym)))
case _ =>
-// println("no narrow: "+sym+" "+sym.isStable+" "+context.tree+"//"+tree)
tp
}
}
@@ -2525,10 +2561,16 @@ trait Typers { self: Analyzer =>
fun.symbol == Any_isInstanceOf && !targs.isEmpty)
checkCheckable(tree.pos, targs.head, "")
val resultpe0 = restpe.instantiateTypeParams(tparams, targs)
+ //println("instantiating type params "+restpe+" "+tparams+" "+targs+" = "+resultpe0)
//@M TODO -- probably ok
//@M example why asSeenFrom is necessary: class Foo[a] { def foo[m[x]]: m[a] } (new Foo[Int]).foo[List] : List[Int]
//@M however, asSeenFrom widens a singleton type, thus cannot use it for those types
- val resultpe = if (resultpe0.isInstanceOf[SingletonType]) resultpe0 else resultpe0.asSeenFrom(prefixType(fun), fun.symbol.owner)
+ // Martin to Adriaan: This is a mess in need of cleanup. For now I have simply speacial treated HK types, bit this is still wrong.
+ val resultpe =
+ if (resultpe0.isInstanceOf[SingletonType] || !targs.exists(_.isHigherKinded))
+ resultpe0
+ else
+ resultpe0.asSeenFrom(prefixType(fun), fun.symbol.owner)
copy.TypeApply(tree, fun, args) setType resultpe
}
} else {
@@ -3262,11 +3304,8 @@ trait Typers { self: Analyzer =>
tree setType ref1.tpe.resultType
case SelectFromTypeTree(qual, selector) =>
-/* maybe need to do this:
- val res = typedSelect(typedType(qual, mode), selector)
- tree setType res.tpe setSymbol res.symbol
- res
-*/
+ val qual1 = typedType(qual, mode)
+ if (qual1.tpe.isVolatile) error(tree.pos, "illegal type selection from volatile type "+qual.tpe)
typedSelect(typedType(qual, mode), selector)
case CompoundTypeTree(templ) =>
@@ -3399,7 +3438,7 @@ trait Typers { self: Analyzer =>
/** Types a higher-kinded type tree -- pt denotes the expected kind*/
def typedHigherKindedType(tree: Tree, mode: Int, pt: Type): Tree =
if (pt.typeParams.isEmpty) typedType(tree, mode) // kind is known and it's *
- else typed(tree, HKmode, pt)//!!!
+ else typed(tree, HKmode, pt)
def typedHigherKindedType(tree: Tree, mode: Int): Tree =
typed(tree, HKmode, WildcardType)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Variances.scala b/src/compiler/scala/tools/nsc/typechecker/Variances.scala
index 015065f..69d8d99 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Variances.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Variances.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Variances.scala 13367 2007-11-28 05:17:14Z spoon $
+// $Id: Variances.scala 16540 2008-11-10 20:31:12Z rompf $
package scala.tools.nsc.typechecker
@@ -64,6 +64,18 @@ trait Variances {
v
}
+ /** Compute variance of type parameter `tparam' in all type annotations `attribs'. */
+ def varianceInAttribs(attribs: List[AnnotationInfo])(tparam: Symbol): Int = {
+ (VARIANCES /: attribs) ((v, attrib) => v & varianceInAttrib(attrib)(tparam))
+ }
+
+ /** Compute variance of type parameter `tparam' in type annotation `attrib'. */
+ def varianceInAttrib(attrib: AnnotationInfo)(tparam: Symbol): Int = {
+ varianceInType(attrib.atp)(tparam)
+ }
+
+
+
/** Compute variance of type parameter <code>tparam</code> in type <code>tp</code>. */
def varianceInType(tp: Type)(tparam: Symbol): Int = tp match {
case ErrorType | WildcardType | NoType | NoPrefix | ThisType(_) | ConstantType(_) =>
@@ -84,6 +96,6 @@ trait Variances {
case ExistentialType(tparams, restpe) =>
varianceInSyms(tparams)(tparam) & varianceInType(restpe)(tparam)
case AnnotatedType(attribs, tp, _) =>
- varianceInType(tp)(tparam)
+ varianceInAttribs(attribs)(tparam) & varianceInType(tp)(tparam)
}
}
diff --git a/src/compiler/scala/tools/nsc/util/BitSet.scala b/src/compiler/scala/tools/nsc/util/BitSet.scala
deleted file mode 100644
index 1ea876e..0000000
--- a/src/compiler/scala/tools/nsc/util/BitSet.scala
+++ /dev/null
@@ -1,158 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2007 LAMP/EPFL
- * @author Martin Odersky
- */
-// $Id: Set.scala 12005 2007-06-13 12:28:07Z michelou $
-
-package scala.tools.nsc.util
-
-object BitSet {
-
- final val WordSize = 64
- private final val WordMask = WordSize - 1
-
- val empty: BitSet = new Single(0)
- def apply(elems: Int*): BitSet = empty ++ elems
-
- private def wordIterator(elems: Long, adjust: Int) = new Iterator[Int] {
- private var rest = elems
- private var i = 0
- def hasNext = rest != 0
- def next() = {
- if (rest == 0)
- throw new NoSuchElementException("next on empty iterator")
- while ((rest & 1) == 0) {
- rest >>>= 1
- i += 1
- }
- rest >>>= 1
- i += 1
- i - 1 + adjust
- }
- }
-
- private class Single(elems: Long) extends BitSet {
-
- def contains(i: Int): Boolean =
- 0 <= i && i < WordSize && (elems & (1L << i)) != 0
-
- def elements: Iterator[Int] =
- wordIterator(elems, 0)
-
- def +(i: Int): BitSet = {
- require(0 <= i)
- if (i < WordSize) new Single(elems | (1L << i))
- else if (i < 2 * WordSize) new Double(elems, 1L << i)
- else new Multiple(Array(elems)) + i
- }
-
- def -(i: Int): BitSet = {
- require(0 <= i)
- if (i < WordSize) new Single(elems & ~(1L << i))
- else this
- }
- }
-
- private class Double(elems1: Long, elems2: Long) extends BitSet {
-
- def contains(i: Int): Boolean =
- 0 <= i &&
- (i < WordSize && (elems1 & (1L << i)) != 0 ||
- i < 2 * WordSize && (elems2 & (1L << i)) != 0)
-
- def elements: Iterator[Int] =
- wordIterator(elems1, 0) ++ wordIterator(elems2, WordSize)
-
- def +(i: Int): BitSet = {
- require(0 <= i)
- if (i < WordSize) new Double(elems1 | (1L << i), elems2)
- else if (i < 2 * WordSize) new Double(elems1, elems2 | (1L << i))
- else new Multiple(Array(elems1, elems2)) + i
- }
-
- def -(i: Int): BitSet = {
- require(0 <= i)
- if (i < WordSize) new Double(elems1 & ~(1L << i), elems2)
- else if (i < 2 * WordSize) new Double(elems1, elems2 & ~(1L << i))
- else this
- }
- }
-
- private class Multiple(elems: Array[Long]) extends BitSet {
-
- def contains(i: Int): Boolean = {
- val index = i / WordSize
- 0 <= i && index < elems.length && (elems(index) & (1L << i)) != 0
- }
-
- def elements: Iterator[Int] =
- Iterator.range(0, elems.length) flatMap (i => wordIterator(elems(i), i * WordSize))
-
- def +(i: Int): BitSet = {
- require(0 <= i)
- val index = i / WordSize
- val elems1 = new Array[Long](elems.length max (index + 1))
- Array.copy(elems, 0, elems1, 0, elems.length)
- elems1(index) = elems1(index) | (1L << i)
- new Multiple(elems1)
- }
-
- def -(i: Int): BitSet = {
- require(0 <= i)
- val index = i / WordSize
- if (index < elems.length && (elems(index) & (1L << i)) != 0) {
- val elems1 = new Array[Long](elems.length)
- Array.copy(elems, 0, elems1, 0, elems.length)
- elems1(index) = elems1(index) & ~(1L << i)
- new Multiple(elems1)
- } else this
- }
- }
-}
-
-import BitSet._
-
-abstract class BitSet extends (Int => Boolean) {
-
- def contains(i: Int): Boolean
-
- def apply(i: Int): Boolean = contains(i)
-
- def elements: Iterator[Int]
-
- def +(i: Int): BitSet
-
- def -(i: Int): BitSet
-
- def + (elem1: Int, elem2: Int, elems: Int*): BitSet =
- this + elem1 + elem2 ++ elems
-
- def ++(elems: Iterator[Int]): BitSet =
- (this /: elems) (_ + _)
-
- def ++ (elems: Iterable[Int]): BitSet =
- this ++ elems.elements
-
- def - (elem1: Int, elem2: Int, elems: Int*): BitSet =
- this - elem1 - elem2 -- elems
-
- def -- (elems: Iterator[Int]): BitSet =
- (this /: elems) (_ - _)
-
- def -- (elems: Iterable[Int]): BitSet =
- this -- elems.elements
-
- def ** (that: BitSet): BitSet = filter(that.contains)
-
- def map(f: Int => Int): BitSet =
- (empty /: (elements map f)) (_ + _)
-
- def flatMap(f: Int => Iterable[Int]): BitSet =
- (empty /: (elements map f)) (_ ++ _)
-
- def filter(p: Int => Boolean): BitSet =
- (this /: elements) ((set, elem) => if (p(elem)) set else set - elem)
-
- override def toString: String = elements.mkString("BitSet(", ", ", ")")
-}
-
diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala
index 016d75d..5131cc1 100644
--- a/src/compiler/scala/tools/nsc/util/ClassPath.scala
+++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala
@@ -3,7 +3,7 @@
* @author Martin Odersky
*/
-// $Id: ClassPath.scala 15820 2008-08-18 14:45:26Z dragos $
+// $Id: ClassPath.scala 16185 2008-10-01 14:27:48Z washburn $
package scala.tools.nsc.util
@@ -42,7 +42,7 @@ object ClassPath {
/** Split path using platform-dependent path separator */
def splitPath(path: String): List[String] = {
val strtok = new StringTokenizer(path, File.pathSeparator)
- val buf = new ListBuffer[String]
+ val buf = new collection.mutable.ListBuffer[String]
while (strtok.hasMoreTokens()) {
buf + strtok.nextToken()
}
diff --git a/src/compiler/scala/tools/nsc/util/LinkedList.scala b/src/compiler/scala/tools/nsc/util/LinkedList.scala
deleted file mode 100644
index d04d184..0000000
--- a/src/compiler/scala/tools/nsc/util/LinkedList.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2006 LAMP/EPFL
- * @author Martin Odersky
- */
-// $Id: LinkedList.scala 8770 2006-09-26 14:16:35Z michelou $
-
-package scala.tools.nsc.util
-
-class LinkedList[T] {
- var next: LinkedList[T] = null
- var elem: T = _
-}
diff --git a/src/compiler/scala/tools/nsc/util/ListBuffer.scala b/src/compiler/scala/tools/nsc/util/ListBuffer.scala
deleted file mode 100644
index d5a0651..0000000
--- a/src/compiler/scala/tools/nsc/util/ListBuffer.scala
+++ /dev/null
@@ -1,61 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2007 LAMP/EPFL
- * @author Martin Odersky
- */
-// $Id: ListBuffer.scala 12005 2007-06-13 12:28:07Z michelou $
-
-package scala.tools.nsc.util
-
-class ListBuffer[T] extends Iterator[T] {
-
- private var first = new LinkedList[T]
- private var limit = first
-
- def +=(x: T) {
- limit.elem = x
- limit.next = new LinkedList[T]
- limit = limit.next
- }
-
- def ++=(xs: Iterable[T]) {
- for (x <- xs.elements) +=(x)
- }
-
- def +(x: T): ListBuffer[T] = { +=(x); this }
- def ++(xs: Iterable[T]): ListBuffer[T] = { ++=(xs); this }
-
- def hasNext: Boolean =
- first != limit
-
- def next: T = {
- assert(hasNext)
- val x = first.elem
- first = first.next
- x
- }
-
- def elements: Iterator[T] = new Iterator[T] {
- var first = ListBuffer.this.first
-
- def hasNext: Boolean =
- first != limit
-
- def next: T = {
- assert(hasNext)
- val x = first.elem
- first = first.next
- x
- }
- }
-
- def clear { first = limit }
-
- /** override for efficiency */
- override def toList: List[T] = {
- def mkList(p: LinkedList[T]): List[T] =
- if (p == limit) List() else p.elem :: mkList(p.next)
- mkList(first)
- }
-
- override def toString(): String = toList.mkString("", ",", "")
-}
diff --git a/src/compiler/scala/tools/nsc/util/NameTransformer.scala b/src/compiler/scala/tools/nsc/util/NameTransformer.scala
index b01f1c3..693f81b 100644
--- a/src/compiler/scala/tools/nsc/util/NameTransformer.scala
+++ b/src/compiler/scala/tools/nsc/util/NameTransformer.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: NameTransformer.scala 16188 2008-10-01 16:08:46Z washburn $
+// $Id: NameTransformer.scala 16187 2008-10-01 16:06:25Z washburn $
package scala.tools.nsc.util
diff --git a/src/compiler/scala/tools/nsc/util/Position.scala b/src/compiler/scala/tools/nsc/util/Position.scala
index b1dde53..b685c3f 100644
--- a/src/compiler/scala/tools/nsc/util/Position.scala
+++ b/src/compiler/scala/tools/nsc/util/Position.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: Position.scala 15799 2008-08-15 18:23:54Z odersky $
+// $Id: Position.scala 16263 2008-10-15 13:58:23Z cunei $
package scala.tools.nsc.util
@@ -71,7 +71,9 @@ trait Position {
}
case object NoPosition extends Position
-case class FakePos(msg: String) extends Position
+case class FakePos(msg: String) extends Position {
+ override def toString=msg
+}
case class LinePosition(source0: SourceFile, line0: Int) extends Position {
assert(line0 >= 1)
diff --git a/src/compiler/scala/tools/nsc/util/SourceFile.scala b/src/compiler/scala/tools/nsc/util/SourceFile.scala
index 516792a..00b7711 100644
--- a/src/compiler/scala/tools/nsc/util/SourceFile.scala
+++ b/src/compiler/scala/tools/nsc/util/SourceFile.scala
@@ -3,16 +3,22 @@
* @author Martin Odersky
*/
-// $Id: SourceFile.scala 16222 2008-10-09 12:06:37Z milessabin $
+// $Id: SourceFile.scala 16407 2008-10-29 00:52:55Z DRMacIver $
package scala.tools.nsc.util
import scala.tools.nsc.io.{AbstractFile, VirtualFile}
object SourceFile {
- val LF: Char = 0x0A
- val FF: Char = 0x0C
- val CR: Char = 0x0D
- val SU: Char = 0x1A
+ // Be very careful touching these.
+ // Apparently trivial changes to the way you write these constants
+ // will cause Scanners.scala to go from a nice efficient switch to
+ // a ghastly nested if statement which will bring the type checker
+ // to its knees. See ticket #1456
+ final val LF = '\u000A'
+ final val FF = '\u000C'
+ final val CR = '\u000D'
+ final val SU = '\u001A'
+
def isLineBreak(c: Int) = c match {
case LF|FF|CR|SU => true
case _ => false
@@ -61,23 +67,22 @@ class BatchSourceFile(val file : AbstractFile, _content : Array[Char]) extends S
val content = _content // don't sweat it...
override val length = content.length
+
override def identifier(pos : Position, compiler : scala.tools.nsc.Global) = pos match {
- case OffsetPosition(source,offset) if source == this =>
- import java.lang.Character
- var i = offset + 1
- while (i < content.length &&
- (compiler.syntaxAnalyzer.isOperatorPart(content(i)) ||
- compiler.syntaxAnalyzer.isIdentifierPart(content(i)))) i = i + 1
+ case OffsetPosition(source,offset) if source == this && offset != -1 =>
+ import java.lang.Character
+ var i = offset + 1
+ while (i < content.length &&
+ (compiler.syntaxAnalyzer.isOperatorPart(content(i)) ||
+ compiler.syntaxAnalyzer.isIdentifierPart(content(i)))) i = i + 1
- assert(i > offset)
- if (i <= content.length && offset >= 0)
- Some(new String(content, offset, i - offset))
- else None
+ assert(i > offset)
+ if (i <= content.length && offset >= 0)
+ Some(new String(content, offset, i - offset))
+ else None
case _ => super.identifier(pos, compiler)
}
-
-
def isLineBreak(idx: Int) =
if (idx >= content.length) false
else if (!SourceFile.isLineBreak(content(idx))) false
diff --git a/src/compiler/scala/tools/nsc/util/TreeSet.scala b/src/compiler/scala/tools/nsc/util/TreeSet.scala
index c5eb18a..54ff5e2 100644
--- a/src/compiler/scala/tools/nsc/util/TreeSet.scala
+++ b/src/compiler/scala/tools/nsc/util/TreeSet.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
-// $Id: TreeSet.scala 12005 2007-06-13 12:28:07Z michelou $
+// $Id$
package scala.tools.nsc.util
diff --git a/src/compiler/scala/tools/util/SocketServer.scala b/src/compiler/scala/tools/util/SocketServer.scala
index b3aaf1a..d202413 100644
--- a/src/compiler/scala/tools/util/SocketServer.scala
+++ b/src/compiler/scala/tools/util/SocketServer.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: SocketServer.scala 14416 2008-03-19 01:17:25Z mihaylov $
+// $Id: SocketServer.scala 16313 2008-10-22 09:46:19Z cunei $
package scala.tools.util
@@ -15,7 +15,7 @@ import java.io.PrintWriter
import java.io.BufferedOutputStream
import java.io.{BufferedReader, InputStreamReader}
import java.io.IOException
-import java.net.ServerSocket
+import java.net.{ServerSocket, SocketException, SocketTimeoutException}
/** The abstract class <code>SocketServer</code> implements the server
* communication for the fast Scala compiler.
@@ -36,46 +36,60 @@ abstract class SocketServer {
exit(1)
}
- val port: Int = try {
- val s = new ServerSocket(0) // a port of 0 creates a socket on any free port.
- val p = s.getLocalPort()
- s.close()
- p
+ private def warn(msg: String) {
+ System.err.println(msg)
+ }
+
+ // called after a timeout is detected,
+ // for SocketServer subclasses to perform
+ // some cleanup, if any
+ def timeout() {}
+
+ val serverSocket = try {
+ new ServerSocket(0)
} catch {
case e: IOException =>
fatal("Could not listen on any port; exiting.")
}
+ val port: Int = serverSocket.getLocalPort()
def run() {
- while (!shutDown) {
- val serverSocket = try {
- new ServerSocket(port)
- } catch {
- case e: IOException =>
- fatal("Could not listen on port: " + port + "; exiting.")
- }
- val clientSocket = try {
- serverSocket.accept()
- } catch {
- case e: IOException =>
- fatal("Accept on port " + port + " failed; exiting.")
- }
-
- out = new PrintWriter(clientSocket.getOutputStream(), true)
- in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()))
- val bufout = new BufferedOutputStream(clientSocket.getOutputStream, 10240)
-
- scala.Console.withOut(bufout) {
- session()
+ try {
+ // After 30 idle minutes, politely exit.
+ // Should the port file disappear, and the clients
+ // therefore unable to contact this server instance,
+ // the process will just eventually terminate by itself.
+ serverSocket.setSoTimeout(1800000)
+ } catch {
+ case e: SocketException =>
+ fatal("Could not set timeout on port: " + port + "; exiting.")
+ }
+ try {
+ while (!shutDown) {
+ val clientSocket = try {
+ serverSocket.accept()
+ } catch {
+ case e: IOException =>
+ fatal("Accept on port " + port + " failed; exiting.")
+ }
+
+ out = new PrintWriter(clientSocket.getOutputStream(), true)
+ in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()))
+ val bufout = new BufferedOutputStream(clientSocket.getOutputStream, 10240)
+
+ scala.Console.withOut(bufout) {
+ session()
+ }
+ bufout.close()
+ out.close()
+ in.close()
+ clientSocket.close()
}
-
- bufout.close()
- out.close()
- in.close()
- clientSocket.close()
- serverSocket.close()
+ } catch {
+ case e: SocketTimeoutException =>
+ warn("Timeout elapsed with no requests from clients on port " + port + "; exiting")
+ timeout()
}
+ serverSocket.close()
}
-
}
-
diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala
index 21bc8c6..8221ad9 100644
--- a/src/library/scala/Array.scala
+++ b/src/library/scala/Array.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Array.scala 14727 2008-04-21 10:26:54Z odersky $
+// $Id: Array.scala 16178 2008-09-30 10:42:43Z michelou $
package scala
@@ -42,7 +42,40 @@ object Array {
case xs: runtime.BoxedArray =>
xs.copyFrom(src, srcPos, destPos, length)
case _ =>
- arraycopy(src, srcPos, dest, destPos, length)
+ def fillDest[T](da: Array[T], sa: Int=>T) {
+ var d = destPos
+ for (s <- srcPos to srcPos+length-1) {
+ da(d) = sa(s); d += 1
+ }
+ }
+ if (dest.isInstanceOf[Array[Any]]) {
+ def fill(sa: Int=>Any) = fillDest(dest.asInstanceOf[Array[Any]], sa)
+ src match {
+ case sa:Array[Int] => fill(s=>Int.box(sa(s)))
+ case sa:Array[Long] => fill(s=>Long.box(sa(s)))
+ case sa:Array[Char] => fill(s=>Char.box(sa(s)))
+ case sa:Array[Boolean] => fill(s=>Boolean.box(sa(s)))
+ case sa:Array[Byte] => fill(s=>Byte.box(sa(s)))
+ case sa:Array[Short] => fill(s=>Short.box(sa(s)))
+ case sa:Array[Double] => fill(s=>Double.box(sa(s)))
+ case sa:Array[Float] => fill(s=>Float.box(sa(s)))
+ case _ => arraycopy(src, srcPos, dest, destPos, length)
+ }
+ } else if (dest.isInstanceOf[Array[AnyVal]]) {
+ def fill(sa: Int=>AnyVal) = fillDest(dest.asInstanceOf[Array[AnyVal]], sa)
+ src match {
+ case sa:Array[Int] => fill(sa(_))
+ case sa:Array[Long] => fill(sa(_))
+ case sa:Array[Char] => fill(sa(_))
+ case sa:Array[Boolean] => fill(sa(_))
+ case sa:Array[Byte] => fill(sa(_))
+ case sa:Array[Short] => fill(sa(_))
+ case sa:Array[Double] => fill(sa(_))
+ case sa:Array[Float] => fill(sa(_))
+ case _ => arraycopy(src, srcPos, dest, destPos, length)
+ }
+ } else
+ arraycopy(src, srcPos, dest, destPos, length)
}
}
}
diff --git a/src/library/scala/BigDecimal.scala b/src/library/scala/BigDecimal.scala
index 62f8e2e..939c162 100644
--- a/src/library/scala/BigDecimal.scala
+++ b/src/library/scala/BigDecimal.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: BigDecimal.scala 16019 2008-09-04 14:13:16Z rytz $
+// $Id: BigDecimal.scala 15937 2008-08-26 13:48:19Z michelou $
package scala
diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala
index 3cd9923..1ea1529 100644
--- a/src/library/scala/Enumeration.scala
+++ b/src/library/scala/Enumeration.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Enumeration.scala 16019 2008-09-04 14:13:16Z rytz $
+// $Id: Enumeration.scala 16575 2008-11-18 15:41:08Z washburn $
package scala
@@ -130,6 +130,21 @@ abstract class Enumeration(initial: Int, names: String*) {
override def toString(): String = updateCache.mkString("{", ", ", "}")
+ /** Returns a Value from this Enumeration whose name matches
+ * the argument <var>s</var>.
+ * You must pass a String* set of names to the constructor,
+ * or initialize each Enumeration with Value(String),
+ * for valueOf to work.
+ * @param s an enumeration name
+ * @return <tt>Some(Value)</tt> if an enumeration's name matches <var>s</var>,
+ * else <tt>None</tt>
+ */
+ def valueOf(s:String) = {
+ var v: Option[Value] = None
+ for( e <- elements ) if (s == e.toString()) v = Some(e)
+ v
+ }
+
/** Creates a fresh value, part of this enumeration. */
protected final def Value: Value =
new Val(nextId, if (nextName.hasNext) nextName.next else null)
diff --git a/src/library/scala/Iterator.scala b/src/library/scala/Iterator.scala
index fa27cab..2351a2e 100644
--- a/src/library/scala/Iterator.scala
+++ b/src/library/scala/Iterator.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Iterator.scala 15611 2008-07-25 15:28:32Z odersky $
+// $Id: Iterator.scala 15939 2008-08-26 14:33:17Z stepancheg $
package scala
@@ -351,6 +351,8 @@ trait Iterator[+A] {
* all elements of the result satisfy the predicate <code>p</code>.
* The order of the elements is preserved.
*
+ * The behavior of <code>this</code> iterator is undefined after this method invocation.
+ *
* @param p the predicate used to filter the iterator.
* @return the longest prefix of this iterator satisfying <code>p</code>.
*/
@@ -359,6 +361,8 @@ trait Iterator[+A] {
/** Skips longest sequence of elements of this iterator which satisfy given
* predicate <code>p</code>, and returns an iterator of the remaining elements.
*
+ * The behavior of <code>this</code> iterator is undefined after this method invocation.
+ *
* @param p the predicate used to skip elements.
* @return an iterator consisting of the remaining elements
*/
diff --git a/src/library/scala/List.scala b/src/library/scala/List.scala
index 653c0c6..71edf18 100644
--- a/src/library/scala/List.scala
+++ b/src/library/scala/List.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: List.scala 15799 2008-08-15 18:23:54Z odersky $
+// $Id: List.scala 16279 2008-10-16 16:35:43Z stepancheg $
package scala
@@ -705,7 +705,7 @@ sealed abstract class List[+A] extends Seq[A] with Product {
/** Returns the list wihout its rightmost <code>n</code> elements.
*
* @param n the number of elements to take
- * @return the suffix of length <code>n</code> of the list
+ * @return the list without its rightmost <code>n</code> elements
*/
def dropRight(n: Int): List[A] = {
def loop(lead: List[A], lag: List[A]): List[A] = lead match {
diff --git a/src/library/scala/NotNull.scala b/src/library/scala/NotNull.scala
index b6c80b6..8fdda21 100644
--- a/src/library/scala/NotNull.scala
+++ b/src/library/scala/NotNull.scala
@@ -7,5 +7,6 @@
\* */
package scala
-/** A marker thread for things that are not allowed to be null */
+/** A marker trait for things that are not allowed to be null
+ */
trait NotNull {}
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index 6a648ae..e3461f8 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Predef.scala 15327 2008-06-10 13:53:56Z washburn $
+// $Id: Predef.scala 16048 2008-09-06 11:41:37Z odersky $
package scala
diff --git a/src/library/scala/Random.scala b/src/library/scala/Random.scala
index 85d0440..cad9f42 100644
--- a/src/library/scala/Random.scala
+++ b/src/library/scala/Random.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Random.scala 15622 2008-07-29 13:19:54Z michelou $
+// $Id: Random.scala 16012 2008-09-04 07:22:31Z lorch $
package scala
@@ -14,7 +14,7 @@ package scala
/**
* @author Stephane Micheloud
*
- * Use class <code>scala.util.Random</code> instead.
+ * @deprecated Use class <code>scala.util.Random</code> instead.
*/
@deprecated
class Random(val self: java.util.Random) {
diff --git a/src/library/scala/Range.scala b/src/library/scala/Range.scala
index 3788e4c..3e20be5 100644
--- a/src/library/scala/Range.scala
+++ b/src/library/scala/Range.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Range.scala 16002 2008-09-03 10:02:27Z phaller $
+// $Id: Range.scala 15954 2008-08-28 16:37:38Z phaller $
package scala
diff --git a/src/library/scala/Seq.scala b/src/library/scala/Seq.scala
index da31981..0202f0c 100644
--- a/src/library/scala/Seq.scala
+++ b/src/library/scala/Seq.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Seq.scala 16060 2008-09-08 13:09:30Z washburn $
+// $Id: Seq.scala 16059 2008-09-08 13:07:31Z washburn $
package scala
diff --git a/src/library/scala/Stream.scala b/src/library/scala/Stream.scala
index 0106f88..8679eba 100644
--- a/src/library/scala/Stream.scala
+++ b/src/library/scala/Stream.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Stream.scala 15229 2008-05-29 13:10:23Z stepancheg $
+// $Id: Stream.scala 16278 2008-10-16 14:11:39Z rytz $
package scala
@@ -440,17 +440,20 @@ abstract class Stream[+A] extends Seq.Projection[A] {
* this stream is <code>[a<sub>0</sub>, ..., a<sub>n</sub>]</code>.
*/
override def flatMap[B](f: A => Iterable[B]): Stream[B] = {
- // optimization: drop A's for which f yields no B
- val fstream = dropWhile(a => f(a) isEmpty)
- if (fstream isEmpty) Stream.empty
- else {
- val s: Stream[B] = f(fstream.head) match {
- case x: Stream[_] => x
- case y: List[_] => y.toStream
- case z => z.toList.toStream
+ // drops A's for which f yields an empty Iterable[B]
+ def loop(s: Stream[A]): Stream[B] = {
+ if (s.isEmpty)
+ Stream.empty
+ else {
+ val i = f(s.head)
+ if (i isEmpty)
+ loop(s.tail)
+ else
+ i.toStream append loop(s.tail)
}
- s append (fstream.tail flatMap f)
}
+
+ loop(this)
}
override def toStream = this
diff --git a/src/library/scala/collection/immutable/IntMap.scala b/src/library/scala/collection/immutable/IntMap.scala
index f51b89a..217d6c0 100644
--- a/src/library/scala/collection/immutable/IntMap.scala
+++ b/src/library/scala/collection/immutable/IntMap.scala
@@ -369,5 +369,24 @@ sealed abstract class IntMap[+T] extends scala.collection.immutable.Map[Int, T]{
case (that : IntMap[_]) => this.unionWith[S](that.asInstanceOf[IntMap[S]], (key, x, y) => y);
case that => that.foldLeft(this : IntMap[S])({case (m, (x, y)) => m.update(x, y)});
}
+
+
+ /**
+ * The entry with the lowest key value considered in unsigned order.
+ */
+ final def firstKey : Int = this match {
+ case Bin(_, _, l, r) => l.firstKey;
+ case Tip(k, v) => k;
+ case Nil => error("Empty set")
+ }
+
+ /**
+ * The entry with the highest key value considered in unsigned order.
+ */
+ final def lastKey : Int = this match {
+ case Bin(_, _, l, r) => r.lastKey;
+ case Tip(k, v) => k;
+ case Nil => error("Empty set")
+ }
}
diff --git a/src/library/scala/collection/immutable/Queue.scala b/src/library/scala/collection/immutable/Queue.scala
index 13e9787..9817e90 100644
--- a/src/library/scala/collection/immutable/Queue.scala
+++ b/src/library/scala/collection/immutable/Queue.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Queue.scala 16285 2008-10-18 10:18:39Z odersky $
+// $Id: Queue.scala 16113 2008-09-16 19:38:07Z spoon $
package scala.collection.immutable
diff --git a/src/library/scala/collection/mutable/ArrayStack.scala b/src/library/scala/collection/mutable/ArrayStack.scala
index e826c07..e5ceac8 100644
--- a/src/library/scala/collection/mutable/ArrayStack.scala
+++ b/src/library/scala/collection/mutable/ArrayStack.scala
@@ -1,3 +1,14 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: ArrayStack.scala 16056 2008-09-08 12:45:27Z lorch $
+
+
package scala.collection.mutable;
private object Utils{
diff --git a/src/library/scala/collection/mutable/OpenHashMap.scala b/src/library/scala/collection/mutable/OpenHashMap.scala
index 23965d3..7ac72ea 100644
--- a/src/library/scala/collection/mutable/OpenHashMap.scala
+++ b/src/library/scala/collection/mutable/OpenHashMap.scala
@@ -1,3 +1,14 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2008, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id: OpenHashMap.scala 16055 2008-09-08 12:42:50Z lorch $
+
+
package scala.collection.mutable;
object OpenHashMap{
diff --git a/src/library/scala/concurrent/jolib.scala b/src/library/scala/concurrent/jolib.scala
index 89609893..7d722cd 100644
--- a/src/library/scala/concurrent/jolib.scala
+++ b/src/library/scala/concurrent/jolib.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: jolib.scala 11950 2007-06-08 12:08:26Z michelou $
+// $Id: jolib.scala 16497 2008-11-05 21:28:07Z washburn $
package scala.concurrent
@@ -18,7 +18,7 @@ package scala.concurrent
* @author Vincent Cremet
* @version 1.0, 17/10/2003
*/
-object jolib {
+ at deprecated object jolib {
type Pattern = List[Signal]
diff --git a/src/library/scala/runtime/BoxedArray.scala b/src/library/scala/runtime/BoxedArray.scala
index 931283c..c718e8c 100644
--- a/src/library/scala/runtime/BoxedArray.scala
+++ b/src/library/scala/runtime/BoxedArray.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: BoxedArray.scala 16294 2008-10-19 11:55:44Z washburn $
+// $Id: BoxedArray.scala 16558 2008-11-14 22:17:56Z washburn $
package scala.runtime
@@ -131,7 +131,7 @@ abstract class BoxedArray extends Array.Array0[Any] {
case a: AnyRef if ScalaRunTime.isArray(a) =>
ScalaRunTime.boxArray(a).deepMkString(start, sep, end)
case _ =>
- x.toString
+ ScalaRunTime.stringOf(x)
}
val buf = new StringBuilder()
buf.append(start)
diff --git a/src/library/scala/runtime/Nothing$.scala b/src/library/scala/runtime/Nothing$.scala
index 0e335d3..3aade47 100644
--- a/src/library/scala/runtime/Nothing$.scala
+++ b/src/library/scala/runtime/Nothing$.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Nothing$.scala 14416 2008-03-19 01:17:25Z mihaylov $
+// $Id: Nothing$.scala 16570 2008-11-18 11:20:05Z dragos $
package scala.runtime
@@ -18,4 +18,4 @@ package scala.runtime
* signatures, it is erased to this one.
*/
-sealed abstract class Nothing$
+sealed abstract class Nothing$ extends Throwable
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala
index 4eea36c..820514b 100644
--- a/src/library/scala/runtime/ScalaRunTime.scala
+++ b/src/library/scala/runtime/ScalaRunTime.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: ScalaRunTime.scala 16294 2008-10-19 11:55:44Z washburn $
+// $Id: ScalaRunTime.scala 16292 2008-10-18 21:32:45Z washburn $
package scala.runtime
diff --git a/src/library/scala/NotNull.scala b/src/library/scala/uncheckedStable.scala
similarity index 76%
copy from src/library/scala/NotNull.scala
copy to src/library/scala/uncheckedStable.scala
index b6c80b6..4eb8cdd 100644
--- a/src/library/scala/NotNull.scala
+++ b/src/library/scala/uncheckedStable.scala
@@ -7,5 +7,7 @@
\* */
package scala
-/** A marker thread for things that are not allowed to be null */
-trait NotNull {}
+/** An annotation for values that are assumed to be stable even though their
+ * types are volatile.
+ */
+final class uncheckedStable extends StaticAnnotation {}
diff --git a/src/library/scala/util/matching/Regex.scala b/src/library/scala/util/matching/Regex.scala
index afc15b2..03c6f34 100644
--- a/src/library/scala/util/matching/Regex.scala
+++ b/src/library/scala/util/matching/Regex.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Regex.scala 15612 2008-07-28 10:00:31Z odersky $
+// $Id: Regex.scala 16090 2008-09-11 10:39:02Z stepancheg $
package scala.util.matching
@@ -16,6 +16,12 @@ import java.util.regex.{Pattern, Matcher}
/** This class provides methods for creating and using regular expressions.
* It is based on the regular expressions of the JDK since 1.4.
*
+ * <p>
+ * You can use special pattern syntax construct <code>(?idmsux-idmsux)</code> to switch
+ * various regex compilation options like <code>CASE_INSENSITIVE</code> or <code>UNICODE_CASE</code>.
+ * See <code>java.util.regex.Pattern</code> javadoc for details.
+ * </p>
+ *
* @author Thibaud Hottelier
* @author Philipp Haller
* @author Martin Odersky
diff --git a/src/library/scala/util/parsing/combinator/RegexParsers.scala b/src/library/scala/util/parsing/combinator/RegexParsers.scala
index 22474e3..e376da8 100644
--- a/src/library/scala/util/parsing/combinator/RegexParsers.scala
+++ b/src/library/scala/util/parsing/combinator/RegexParsers.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: RegexParsers.scala 16184 2008-10-01 10:09:11Z odersky $
+// $Id: RegexParsers.scala 16157 2008-09-24 14:52:09Z odersky $
package scala.util.parsing.combinator
diff --git a/src/manual/scala/man1/Command.scala b/src/manual/scala/man1/Command.scala
index 55363cc..ed3dad4 100644
--- a/src/manual/scala/man1/Command.scala
+++ b/src/manual/scala/man1/Command.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Stephane Micheloud
*/
-//$Id: Command.scala 10730 2007-04-18 14:10:07Z michelou $
+//$Id: Command.scala 15979 2008-09-01 09:15:17Z lorch $
package scala.man1
@@ -36,7 +36,7 @@ trait Command {
def authors = Section("AUTHOR",
"Written by Martin Odersky and other members of the " &
- Link("Scala team", "http://scala-lang.org/community/") & ".")
+ Link("Scala team", "http://www.scala-lang.org/node/89") & ".")
def copyright = Section("COPYRIGHT",
diff --git a/src/manual/scala/man1/fsc.scala b/src/manual/scala/man1/fsc.scala
index 863f45c..cd89a18 100644
--- a/src/manual/scala/man1/fsc.scala
+++ b/src/manual/scala/man1/fsc.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Stephane Micheloud
*/
-//$Id: fsc.scala 16015 2008-09-04 10:59:23Z rytz $
+//$Id: fsc.scala 16014 2008-09-04 10:57:31Z rytz $
package scala.man1
diff --git a/src/manual/scala/man1/sbaz.scala b/src/manual/scala/man1/sbaz.scala
index 4005250..59ad068 100644
--- a/src/manual/scala/man1/sbaz.scala
+++ b/src/manual/scala/man1/sbaz.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Stephane Micheloud
*/
-//$Id: sbaz.scala 15902 2008-08-22 16:43:47Z rytz $
+//$Id: sbaz.scala 15895 2008-08-22 15:35:21Z rytz $
package scala.man1
diff --git a/src/manual/scala/man1/scala.scala b/src/manual/scala/man1/scala.scala
index 0bece6e..4b4c825 100644
--- a/src/manual/scala/man1/scala.scala
+++ b/src/manual/scala/man1/scala.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Stephane Micheloud
*/
-//$Id: scala.scala 15902 2008-08-22 16:43:47Z rytz $
+//$Id: scala.scala 15895 2008-08-22 15:35:21Z rytz $
package scala.man1
diff --git a/src/manual/scala/man1/scalac.scala b/src/manual/scala/man1/scalac.scala
index 4e8dc27..7169495 100644
--- a/src/manual/scala/man1/scalac.scala
+++ b/src/manual/scala/man1/scalac.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2008 LAMP/EPFL
* @author Stephane Micheloud
*/
-//$Id: scalac.scala 15902 2008-08-22 16:43:47Z rytz $
+//$Id: scalac.scala 15895 2008-08-22 15:35:21Z rytz $
package scala.man1
diff --git a/src/manual/scala/man1/scaladoc.scala b/src/manual/scala/man1/scaladoc.scala
index 81c8548..abc3e9c 100644
--- a/src/manual/scala/man1/scaladoc.scala
+++ b/src/manual/scala/man1/scaladoc.scala
@@ -2,7 +2,7 @@
* Copyright 2005-2007 LAMP/EPFL
* @author Stephane Micheloud
*/
-//$Id: scaladoc.scala 15902 2008-08-22 16:43:47Z rytz $
+//$Id: scaladoc.scala 15895 2008-08-22 15:35:21Z rytz $
package scala.man1
diff --git a/src/partest/scala/tools/partest/PartestTask.scala b/src/partest/scala/tools/partest/PartestTask.scala
index 583f1df..fdfa467 100644
--- a/src/partest/scala/tools/partest/PartestTask.scala
+++ b/src/partest/scala/tools/partest/PartestTask.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: PartestTask.scala 16457 2008-10-31 11:54:42Z phaller $
+// $Id: PartestTask.scala 16512 2008-11-06 17:28:08Z dragos $
package scala.tools.partest
@@ -32,6 +32,9 @@ class PartestTask extends Task {
def addConfiguredRunTests(input: FileSet): Unit =
runFiles = Some(input)
+ def addConfiguredJvm5Tests(input: FileSet): Unit =
+ jvm5Files = Some(input)
+
def addConfiguredResidentTests(input: FileSet): Unit =
residentFiles = Some(input)
@@ -86,6 +89,7 @@ class PartestTask extends Task {
private var pos5Files: Option[FileSet] = None
private var negFiles: Option[FileSet] = None
private var runFiles: Option[FileSet] = None
+ private var jvm5Files: Option[FileSet] = None
private var residentFiles: Option[FileSet] = None
private var scriptFiles: Option[FileSet] = None
private var shootoutFiles: Option[FileSet] = None
@@ -115,7 +119,7 @@ class PartestTask extends Task {
private def getPos5Files: Array[File] =
getFilesAndDirs(pos5Files)
-
+
private def getNegFiles: Array[File] =
if (!negFiles.isEmpty) {
val files = negFiles.get
@@ -132,6 +136,9 @@ class PartestTask extends Task {
else
Array()
+ private def getJvm5Files: Array[File] =
+ getFilesAndDirs(jvm5Files)
+
private def getResidentFiles: Array[File] =
if (!residentFiles.isEmpty) {
val files = residentFiles.get
@@ -165,7 +172,7 @@ class PartestTask extends Task {
(classpath.get.list map { fs => new File(fs) }) find { f =>
f.getName match {
case "scala-library.jar" => true
- case "classes" if (f.getParentFile.getName == "library") => true
+ case "library" if (f.getParentFile.getName == "classes") => true
case _ => false
}
}
@@ -244,6 +251,13 @@ class PartestTask extends Task {
allSucesses += successes
allFailures += failures
}
+
+ if (getJvm5Files.size > 0) {
+ log("Compiling and running files")
+ val (successes, failures) = runTestsForFiles(getJvm5Files, "jvm5")
+ allSucesses += successes
+ allFailures += failures
+ }
if (getResidentFiles.size > 0) {
log("Running resident compiler scenarii")
diff --git a/src/partest/scala/tools/partest/nest/AntRunner.scala b/src/partest/scala/tools/partest/nest/AntRunner.scala
index fddbb44..e964c56 100644
--- a/src/partest/scala/tools/partest/nest/AntRunner.scala
+++ b/src/partest/scala/tools/partest/nest/AntRunner.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: AntRunner.scala 16457 2008-10-31 11:54:42Z phaller $
+// $Id: AntRunner.scala 16307 2008-10-21 19:04:52Z phaller $
package scala.tools.partest.nest
diff --git a/src/partest/scala/tools/partest/nest/CompileManager.scala b/src/partest/scala/tools/partest/nest/CompileManager.scala
index db0dcda..c06c80a 100644
--- a/src/partest/scala/tools/partest/nest/CompileManager.scala
+++ b/src/partest/scala/tools/partest/nest/CompileManager.scala
@@ -3,7 +3,7 @@
* @author Philipp Haller
*/
-// $Id: CompileManager.scala 16457 2008-10-31 11:54:42Z phaller $
+// $Id: CompileManager.scala 16551 2008-11-13 18:03:56Z phaller $
package scala.tools.partest.nest
@@ -36,7 +36,7 @@ class DirectCompiler(val fileManager: FileManager) extends SimpleCompiler {
new Global(settings, reporter)
def newGlobal(settings: Settings, logWriter: FileWriter): Global = {
- val rep = new ExtConsoleReporter(new TestSettings(fileManager),
+ val rep = new ExtConsoleReporter(settings,
Console.in,
new PrintWriter(logWriter))
rep.shortname = true
@@ -89,11 +89,11 @@ class DirectCompiler(val fileManager: FileManager) extends SimpleCompiler {
case "scalacheck" =>
ScalaCheckTestFile(files(0), fileManager, out.isEmpty)
}
- test.defineSettings(testSettings)
+ test.defineSettings(command.settings)
out match {
case Some(outDir) =>
- testSettings.outdir.value = outDir.getAbsolutePath
- testSettings.classpath.value = testSettings.classpath.value+
+ command.settings.outdir.value = outDir.getAbsolutePath
+ command.settings.classpath.value = command.settings.classpath.value+
File.pathSeparator+outDir.getAbsolutePath
case None =>
// do nothing
@@ -120,38 +120,6 @@ class DirectCompiler(val fileManager: FileManager) extends SimpleCompiler {
}
!testRep.hasErrors
}
-
-/*
- def compile(file: File, kind: String): Boolean = {
- val testSettings = newSettings
- val testRep = newReporter(testSettings)
- val args = List.fromArray(fileManager.SCALAC_OPTS.split("\\s"))
- val command = new CompilerCommand(args, testSettings, x => {}, false)
- val global = newGlobal(command.settings, testRep)
-
- val test: TestFile = kind match {
- case "pos" => PosTestFile(file, fileManager)
- case "neg" => NegTestFile(file, fileManager)
- case "run" => RunTestFile(file, fileManager)
- case "jvm" => JvmTestFile(file, fileManager)
- case "jvm5" => Jvm5TestFile(file, fileManager)
- case "shootout" => ShootoutTestFile(file, fileManager)
- }
- test.defineSettings(testSettings)
-
- val toCompile = List(file.getPath)
- try {
- (new global.Run) compile toCompile
- testRep.printSummary
- testRep.writer.flush
- testRep.writer.close
- } catch {
- case e: Exception =>
- e.printStackTrace()
- return false
- }
- !testRep.hasErrors
- }*/
}
class ReflectiveCompiler(val fileManager: ConsoleFileManager) extends SimpleCompiler {
diff --git a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
index 8c58587..7611ad7 100644
--- a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
+++ b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala
@@ -3,7 +3,7 @@
* @author Philipp Haller
*/
-// $Id: ConsoleFileManager.scala 16457 2008-10-31 11:54:42Z phaller $
+// $Id: ConsoleFileManager.scala 16307 2008-10-21 19:04:52Z phaller $
package scala.tools.partest.nest
diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala
index 65c49c2..f5424cd 100644
--- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala
+++ b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala
@@ -3,7 +3,7 @@
* @author Philipp Haller
*/
-// $Id: ConsoleRunner.scala 16470 2008-11-01 11:36:15Z phaller $
+// $Id: ConsoleRunner.scala 16472 2008-11-01 13:12:19Z phaller $
package scala.tools.partest.nest
@@ -33,7 +33,7 @@ class ConsoleRunner extends DirectRunner with RunnerUtils {
"Testing resident compiler"),
TestSet("shootout", fileFilter, "shootout", "Testing shootout tests"),
TestSet("script", fileFilter, "script", "Testing script tests"),
- /*TestSet("scalacheck", fileFilter, "scalacheck", "Testing ScalaCheck tests")*/)
+ TestSet("scalacheck", fileFilter, "scalacheck", "Testing ScalaCheck tests"))
}
var fileManager: ConsoleFileManager = _
diff --git a/src/partest/scala/tools/partest/nest/FileManager.scala b/src/partest/scala/tools/partest/nest/FileManager.scala
index 9b3394e..d633f35 100644
--- a/src/partest/scala/tools/partest/nest/FileManager.scala
+++ b/src/partest/scala/tools/partest/nest/FileManager.scala
@@ -3,7 +3,7 @@
* @author Philipp Haller
*/
-// $Id: FileManager.scala 16457 2008-10-31 11:54:42Z phaller $
+// $Id: FileManager.scala 16307 2008-10-21 19:04:52Z phaller $
package scala.tools.partest.nest
diff --git a/src/partest/scala/tools/partest/nest/NestUI.scala b/src/partest/scala/tools/partest/nest/NestUI.scala
index e8ab424..b7a3724 100644
--- a/src/partest/scala/tools/partest/nest/NestUI.scala
+++ b/src/partest/scala/tools/partest/nest/NestUI.scala
@@ -2,7 +2,7 @@
* @author Philipp Haller
*/
-// $Id: NestUI.scala 16457 2008-10-31 11:54:42Z phaller $
+// $Id: NestUI.scala 16103 2008-09-15 17:43:28Z phaller $
package scala.tools.partest.nest
diff --git a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
index 1623794..1b6960f 100644
--- a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
+++ b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala
@@ -3,7 +3,7 @@
* @author Philipp Haller
*/
-// $Id: ReflectiveRunner.scala 16457 2008-10-31 11:54:42Z phaller $
+// $Id: ReflectiveRunner.scala 16332 2008-10-24 18:39:21Z phaller $
package scala.tools.partest.nest
diff --git a/src/partest/scala/tools/partest/nest/TestFile.scala b/src/partest/scala/tools/partest/nest/TestFile.scala
index a57f161..a292e20 100644
--- a/src/partest/scala/tools/partest/nest/TestFile.scala
+++ b/src/partest/scala/tools/partest/nest/TestFile.scala
@@ -3,7 +3,7 @@
* @author Philipp Haller
*/
-// $Id: TestFile.scala 16457 2008-10-31 11:54:42Z phaller $
+// $Id: TestFile.scala 16551 2008-11-13 18:03:56Z phaller $
package scala.tools.partest.nest
@@ -17,7 +17,8 @@ class TestFile(kind: String, val file: File, val fileManager: FileManager, creat
// @mutates settings
protected def baseSettings(settings: Settings) {
- settings.classpath.value = dirpath
+ settings.classpath.value = settings.classpath.value+
+ File.pathSeparator+dirpath
if (createOutDir)
settings.outdir.value = {
val outDir = new File(dir, fileBase + "-" + kind + ".obj")
@@ -51,55 +52,57 @@ class TestFile(kind: String, val file: File, val fileManager: FileManager, creat
case class PosTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("pos", file, fileManager, createOutDir) {
override def defineSettings(settings: Settings) {
baseSettings(settings)
- settings.classpath.value = fileManager.CLASSPATH
- //println("settings.classpath.value="+settings.classpath.value)
+ settings.classpath.value = settings.classpath.value+
+ File.pathSeparator+fileManager.CLASSPATH
}
}
case class NegTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("neg", file, fileManager, createOutDir) {
override def defineSettings(settings: Settings) {
baseSettings(settings)
- settings.classpath.value = fileManager.CLASSPATH
- //println("settings.classpath.value="+settings.classpath.value)
+ settings.classpath.value = settings.classpath.value+
+ File.pathSeparator+fileManager.CLASSPATH
}
}
case class RunTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("run", file, fileManager, createOutDir) {
override def defineSettings(settings: Settings) {
baseSettings(settings)
- settings.classpath.value = fileManager.CLASSPATH
+ settings.classpath.value = settings.classpath.value+
+ File.pathSeparator+fileManager.CLASSPATH
}
}
case class ScalaCheckTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("scalacheck", file, fileManager, createOutDir) {
override def defineSettings(settings: Settings) {
baseSettings(settings)
- settings.classpath.value = fileManager.CLASSPATH
+ settings.classpath.value = settings.classpath.value+
+ File.pathSeparator+fileManager.CLASSPATH
}
}
case class JvmTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("jvm", file, fileManager, createOutDir) {
override def defineSettings(settings: Settings) {
baseSettings(settings)
- settings.classpath.value = fileManager.CLASSPATH
- //println("settings.classpath.value="+settings.classpath.value)
+ settings.classpath.value = settings.classpath.value+
+ File.pathSeparator+fileManager.CLASSPATH
}
}
case class Jvm5TestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("jvm5", file, fileManager, createOutDir) {
override def defineSettings(settings: Settings) {
baseSettings(settings)
- settings.classpath.value = fileManager.CLASSPATH
+ settings.classpath.value = settings.classpath.value+
+ File.pathSeparator+fileManager.CLASSPATH
settings.target.value = "jvm-1.5"
- //println("settings.classpath.value="+settings.classpath.value)
}
}
case class ShootoutTestFile(override val file: File, override val fileManager: FileManager, createOutDir: Boolean) extends TestFile("shootout", file, fileManager, createOutDir) {
override def defineSettings(settings: Settings) {
baseSettings(settings)
- settings.classpath.value = fileManager.CLASSPATH
- //println("settings.classpath.value="+settings.classpath.value)
+ settings.classpath.value = settings.classpath.value+
+ File.pathSeparator+fileManager.CLASSPATH
settings.outdir.value = file.getParent
}
}
diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala
index 53a08df..792c35b 100644
--- a/src/partest/scala/tools/partest/nest/Worker.scala
+++ b/src/partest/scala/tools/partest/nest/Worker.scala
@@ -2,7 +2,7 @@
* @author Philipp Haller
*/
-// $Id: Worker.scala 16457 2008-10-31 11:54:42Z phaller $
+// $Id: Worker.scala 16473 2008-11-01 20:01:29Z michelou $
package scala.tools.partest.nest
@@ -774,6 +774,7 @@ class Worker(val fileManager: FileManager) extends Actor {
}
}
case "script" => {
+ val osName = System.getProperty("os.name", "")
for (file <- files) {
// when option "--failed" is provided
// execute test only if log file is present
@@ -800,7 +801,14 @@ class Worker(val fileManager: FileManager) extends Actor {
} else ""
try {
- val proc = Runtime.getRuntime.exec(file.getAbsolutePath+argString)
+ val cmdString =
+ if (osName startsWith "Windows") {
+ val batchFile = new File(file.getParentFile, fileBase+".bat")
+ NestUI.verbose("batchFile: "+batchFile)
+ batchFile.getAbsolutePath
+ }
+ else file.getAbsolutePath
+ val proc = Runtime.getRuntime.exec(cmdString+argString)
val in = proc.getInputStream
val err = proc.getErrorStream
val writer = new PrintWriter(new FileWriter(logFile), true)
diff --git a/src/swing/scala/swing/Frame.scala b/src/swing/scala/swing/Frame.scala
index 6e7b249..3e37f28 100644
--- a/src/swing/scala/swing/Frame.scala
+++ b/src/swing/scala/swing/Frame.scala
@@ -1,5 +1,6 @@
package scala.swing
+import java.awt.{Image, Point}
import javax.swing._
import event._
@@ -34,6 +35,10 @@ class Frame extends UIElement with RootPanel with Publisher {
def menuBar_=(m: MenuBar) = peer.setJMenuBar(m.peer)
def setLocationRelativeTo(c: UIElement) { peer.setLocationRelativeTo(c.peer) }
+ def location_=(p: Point) { peer.setLocation(p) }
+
+ def iconImage: Image = peer.getIconImage
+ def iconImage_=(i: Image) { peer.setIconImage(i) }
peer.addWindowListener(new java.awt.event.WindowListener {
def windowActivated(e: java.awt.event.WindowEvent) { publish(WindowActivated(Frame.this)) }
diff --git a/src/swing/scala/swing/Swing.scala b/src/swing/scala/swing/Swing.scala
index a24fd39..baeae09 100644
--- a/src/swing/scala/swing/Swing.scala
+++ b/src/swing/scala/swing/Swing.scala
@@ -2,7 +2,7 @@ package scala.swing
import java.awt.event._
import javax.swing.event._
-import java.awt.{Color, Dimension}
+import java.awt.{Color, Dimension, Point}
import javax.swing.border._
import javax.swing.{JComponent, Icon, BorderFactory}
@@ -16,6 +16,12 @@ object Swing {
protected[swing] def toNoIcon(i: Icon): Icon = if(i == null) EmptyIcon else i
protected[swing] def toNullIcon(i: Icon): Icon = if(i == EmptyIcon) null else i
+ implicit def pair2Dimension(p: (Int, Int)): Dimension = new Dimension(p._1, p._2)
+ implicit def pair2Point(p: (Int, Int)): Point = new Point(p._1, p._2)
+
+ /**
+ * Allows one to use blocks as runnables.
+ */
implicit def block2Runnable(block: =>Unit): Runnable = new Runnable {
override def run = block
}
diff --git a/test/files/jvm/mkLibNatives.bat b/test/files/jvm/mkLibNatives.bat
index 660dcc3..d58d021 100644
--- a/test/files/jvm/mkLibNatives.bat
+++ b/test/files/jvm/mkLibNatives.bat
@@ -2,7 +2,7 @@
rem ##########################################################################
rem # Author : Stephane Micheloud
-rem # Revision: $Id: mkLibNatives.bat 12000 2007-06-13 09:38:45Z michelou $
+rem # Revision: $Id: mkLibNatives.bat 16473 2008-11-01 20:01:29Z michelou $
rem ##########################################################################
rem ##########################################################################
@@ -16,7 +16,7 @@ set STDOUT=NUL
if %DEBUG%==1 set STDOUT=CON
set CLASS_NAME=Test$
-set CLASS_DIR=natives-jvm
+set CLASS_DIR=.
set OBJ_NAME=natives
set LIB_NAME=natives-32
diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check
index 863857d..7125d4b 100644
--- a/test/files/jvm/serialization.check
+++ b/test/files/jvm/serialization.check
@@ -51,6 +51,8 @@ x10 equals y10: true - y10 equals x10: true
x9 eq x10: false - x10 eq x9: false
x9 equals x10: false - x10 equals x9: false
+x9 eq y10: false - y10 eq x9: false
+x9 equals y10: false - y10 equals x9: false
x = List((buffers,20), (layers,2), (title,3))
y = List((buffers,20), (layers,2), (title,3))
diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala
index d95d2e8..609210e 100644
--- a/test/files/jvm/serialization.scala
+++ b/test/files/jvm/serialization.scala
@@ -35,7 +35,6 @@ object Serialize {
//############################################################################
// Test classes in package "scala"
- at serializable
object Test1_scala {
private def arrayToString[A](arr: Array[A]): String =
@@ -130,6 +129,8 @@ object Test1_scala {
println()
println("x9 eq x10: " + (x9 eq x10) + " - x10 eq x9: " + (x10 eq x9))
println("x9 equals x10: " + (x9 equals x10) + " - x10 equals x9: " + (x10 equals x9))
+ println("x9 eq y10: " + (x9 eq y10) + " - y10 eq x9: " + (y10 eq x9))
+ println("x9 equals y10: " + (x9 equals y10) + " - y10 equals x9: " + (y10 equals x9))
println()
}
catch {
diff --git a/test/files/jvm5/genericNest.scala b/test/files/jvm5/genericNest.scala
new file mode 100644
index 0000000..c1b0210
--- /dev/null
+++ b/test/files/jvm5/genericNest.scala
@@ -0,0 +1,13 @@
+/** found in genericNest.jar, compiled from OuterTParams.java */
+import nestpkg._;
+
+// bug #695
+object ForceParse extends OuterTParams[AnyRef] {
+ // Force import of HarderToParse<A>.InnerClass,
+ // which has confusing method signature.
+ var field: InnerClass = null
+}
+
+object Test extends Application {
+ ForceParse
+}
diff --git a/test/files/run/interpreter.check b/test/files/jvm5/interpreter.check
similarity index 98%
rename from test/files/run/interpreter.check
rename to test/files/jvm5/interpreter.check
index 722a8d1..aa2776f 100644
--- a/test/files/run/interpreter.check
+++ b/test/files/jvm5/interpreter.check
@@ -34,6 +34,9 @@ scala> hello
scala>
scala>
+scala> t1513: Array[Null] = Array(null)
+
+scala>
scala> atom: scala.xml.Atom[Unit] = ()
scala>
diff --git a/test/files/run/interpreter.scala b/test/files/jvm5/interpreter.scala
similarity index 98%
rename from test/files/run/interpreter.scala
rename to test/files/jvm5/interpreter.scala
index c2209d9..1c3a98a 100644
--- a/test/files/run/interpreter.scala
+++ b/test/files/jvm5/interpreter.scala
@@ -22,6 +22,8 @@ trait PointlessTrait
val (x,y) = (2,3)
println("hello")
+// ticket #1513
+val t1513 = Array(null)
// ambiguous toString problem from #547
val atom = new scala.xml.Atom()
// overriding toString problem from #1404
diff --git a/test/files/jvm5/t1464.check b/test/files/jvm5/t1464.check
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/test/files/jvm5/t1464.check
@@ -0,0 +1 @@
+false
diff --git a/test/files/jvm5/t1464/MyTrait.scala b/test/files/jvm5/t1464/MyTrait.scala
new file mode 100644
index 0000000..014ddf8
--- /dev/null
+++ b/test/files/jvm5/t1464/MyTrait.scala
@@ -0,0 +1,5 @@
+trait MyTrait {
+ type K
+ def findChildByClass[T <: K with MyTrait]: Unit
+
+}
diff --git a/test/files/jvm5/t1464/Test.java b/test/files/jvm5/t1464/Test.java
new file mode 100644
index 0000000..235848b
--- /dev/null
+++ b/test/files/jvm5/t1464/Test.java
@@ -0,0 +1,6 @@
+public class Test {
+ public static void main(String[] args) {
+ Object o = new Object();
+ System.out.println(o instanceof MyTrait);
+ }
+}
diff --git a/test/files/lib/ScalaCheck.jar b/test/files/lib/ScalaCheck.jar
new file mode 100644
index 0000000..4789417
Binary files /dev/null and b/test/files/lib/ScalaCheck.jar differ
diff --git a/test/files/lib/genericNest.jar b/test/files/lib/genericNest.jar
new file mode 100644
index 0000000..bc08c1e
Binary files /dev/null and b/test/files/lib/genericNest.jar differ
diff --git a/test/files/neg/bug412.check b/test/files/neg/bug412.check
index e275c5d..f25ad6f 100644
--- a/test/files/neg/bug412.check
+++ b/test/files/neg/bug412.check
@@ -1,6 +1,5 @@
-bug412.scala:9: error: type mismatch;
- found : Null(null)
- required: A.this.CX with A.this.C2
- val c: CX with C2 = null;
- ^
+bug412.scala:11: error: stable identifier required, but A.this.c found.
+ Note that value c is not stable because its type, A.this.CX with A.this.C2, is volatile.
+ def castA(x: c.T): T2 = x;
+ ^
one error found
diff --git a/test/files/neg/bug414.check b/test/files/neg/bug414.check
index ec23e26..c0f039a 100644
--- a/test/files/neg/bug414.check
+++ b/test/files/neg/bug414.check
@@ -1,3 +1,7 @@
+bug414.scala:1: warning: case classes without a parameter list have been deprecated;
+use either case objects or case classes with `()' as parameter list.
+case class Empty[a] extends IntMap[a];
+ ^
bug414.scala:5: error: pattern type is incompatible with expected type;
found : object Empty
required: IntMap[a]
@@ -8,4 +12,5 @@ bug414.scala:7: error: type mismatch;
required: a
case _ =>
^
+one warning found
two errors found
diff --git a/test/files/neg/bug521.check b/test/files/neg/bug521.check
index 1b05aca..b85e266 100644
--- a/test/files/neg/bug521.check
+++ b/test/files/neg/bug521.check
@@ -9,7 +9,7 @@ bug521.scala:13: error: class ZipArchive needs to be abstract, since method path
final class ZipArchive(val file : File, archive : ZipFile) extends PlainFile(file) {
^
bug521.scala:15: error: error overriding value path in class VirtualFile of type String;
- method path needs to be an immutable value
+ method path is not stable
override def path = "";
^
four errors found
diff --git a/test/files/neg/bug692.check b/test/files/neg/bug692.check
index 308048b..099a261 100644
--- a/test/files/neg/bug692.check
+++ b/test/files/neg/bug692.check
@@ -1,19 +1,19 @@
bug692.scala:3: error: not found: type T
- trait Type[T0] extends Type0[T];
+ trait Type[T0] extends Type0[T];
^
bug692.scala:10: error: class Foo takes type parameters
- case class FooType extends ClassType[Foo,AnyRef](ObjectType());
- ^
+ case class FooType() extends ClassType[Foo,AnyRef](ObjectType());
+ ^
bug692.scala:13: error: class Foo takes type parameters
- case class BarType[T3 <: Foo](tpeT : RefType[T3]) extends ClassType[Bar[T3],Foo](FooType);
+ case class BarType[T3 <: Foo](tpeT : RefType[T3]) extends ClassType[Bar[T3],Foo](FooType);
^
bug692.scala:13: error: class Foo takes type parameters
- case class BarType[T3 <: Foo](tpeT : RefType[T3]) extends ClassType[Bar[T3],Foo](FooType);
+ case class BarType[T3 <: Foo](tpeT : RefType[T3]) extends ClassType[Bar[T3],Foo](FooType);
^
bug692.scala:19: error: class Foo takes type parameters
- class Bar[A <: Foo](implicit tpeA : Type[A]) extends Foo;
+ class Bar[A <: Foo](implicit tpeA : Type[A]) extends Foo;
^
bug692.scala:14: error: class Foo takes type parameters
- implicit def typeOfBar[T4 <: Foo](implicit elem : RefType[T4]) : RefType[Bar[T4]] =
+ implicit def typeOfBar[T4 <: Foo](implicit elem : RefType[T4]) : RefType[Bar[T4]] =
^
6 errors found
diff --git a/test/files/neg/bug692.scala b/test/files/neg/bug692.scala
index 22615c4..f230a6b 100644
--- a/test/files/neg/bug692.scala
+++ b/test/files/neg/bug692.scala
@@ -3,11 +3,11 @@ abstract class test3 {
trait Type[T0] extends Type0[T];
trait ClassType0[+C <: AnyRef] extends Type0[C];
abstract class RefType[C <: AnyRef] extends Type[C];
- case class ObjectType extends RefType[AnyRef];
+ case class ObjectType() extends RefType[AnyRef];
abstract class ClassType[C <: Z, Z <: AnyRef](zuper : RefType[Z]) extends RefType[C];
- case class FooType extends ClassType[Foo,AnyRef](ObjectType());
+ case class FooType() extends ClassType[Foo,AnyRef](ObjectType());
implicit def typeOfFoo = FooType();
case class BarType[T3 <: Foo](tpeT : RefType[T3]) extends ClassType[Bar[T3],Foo](FooType);
diff --git a/test/files/neg/bug961.check b/test/files/neg/bug961.check
index 794acf5..33bb055 100644
--- a/test/files/neg/bug961.check
+++ b/test/files/neg/bug961.check
@@ -1,4 +1,9 @@
+bug961.scala:4: warning: case classes without a parameter list have been deprecated;
+use either case objects or case classes with `()' as parameter list.
+ private case class B_inner extends A
+ ^
bug961.scala:11: error: Temp.this.B of type object Temp.B does not take parameters
- B() match {
+ B() match {
^
+one warning found
one error found
diff --git a/test/files/neg/null-unsoundness.check b/test/files/neg/null-unsoundness.check
new file mode 100644
index 0000000..bc0b5c9
--- /dev/null
+++ b/test/files/neg/null-unsoundness.check
@@ -0,0 +1,5 @@
+null-unsoundness.scala:8: error: stable identifier required, but A.this.x found.
+ Note that value x is not stable because its type, A.this.A with A.this.D, is volatile.
+ var y: x.T = new C("abc")
+ ^
+one error found
diff --git a/test/files/neg/null-unsoundness.scala b/test/files/neg/null-unsoundness.scala
new file mode 100644
index 0000000..f4ba859
--- /dev/null
+++ b/test/files/neg/null-unsoundness.scala
@@ -0,0 +1,15 @@
+class B
+class C(x: String) extends B
+
+class A {
+ type A >: Null
+ class D { type T >: C <: B }
+ val x: A with D = null
+ var y: x.T = new C("abc")
+}
+object Test extends A with Application {
+ class C { type T = Int; val x = 1 }
+ type A = C
+ y = 42
+}
+
diff --git a/test/files/neg/patmatexhaust.check b/test/files/neg/patmatexhaust.check
index 2011e4a..66b0f3c 100644
--- a/test/files/neg/patmatexhaust.check
+++ b/test/files/neg/patmatexhaust.check
@@ -21,6 +21,7 @@ missing combination Gp
def ma4(x:Deep) = x match { // missing cases: Gu, Gp
^
patmatexhaust.scala:53: warning: match is not exhaustive!
+missing combination Gp
def ma5(x:Deep) = x match { // Gp
^
diff --git a/test/files/neg/t1371.check b/test/files/neg/t1371.check
new file mode 100644
index 0000000..f2e9ffe
--- /dev/null
+++ b/test/files/neg/t1371.check
@@ -0,0 +1,4 @@
+t1371.scala:1: error: unbound wildcard type
+trait A[T <: (_)]
+ ^
+one error found
diff --git a/test/files/neg/t1371.scala b/test/files/neg/t1371.scala
new file mode 100644
index 0000000..4ad84a9
--- /dev/null
+++ b/test/files/neg/t1371.scala
@@ -0,0 +1,2 @@
+trait A[T <: (_)]
+
diff --git a/test/files/neg/unreachablechar.check b/test/files/neg/unreachablechar.check
new file mode 100644
index 0000000..7442e11
--- /dev/null
+++ b/test/files/neg/unreachablechar.check
@@ -0,0 +1,4 @@
+unreachablechar.scala:5: error: unreachable code
+ case 'f' => println("not stuff?");
+ ^
+one error found
diff --git a/test/files/neg/unreachablechar.scala b/test/files/neg/unreachablechar.scala
new file mode 100644
index 0000000..94438ce
--- /dev/null
+++ b/test/files/neg/unreachablechar.scala
@@ -0,0 +1,8 @@
+object Foo extends Application{
+ 'f' match {
+ case 'o'|'c'|'b' => println("Oooo");
+ case _ => println("stuff");
+ case 'f' => println("not stuff?");
+ }
+
+}
diff --git a/test/files/neg/volatile-intersection.check b/test/files/neg/volatile-intersection.check
new file mode 100644
index 0000000..ef98399
--- /dev/null
+++ b/test/files/neg/volatile-intersection.check
@@ -0,0 +1,4 @@
+volatile-intersection.scala:8: error: illegal type selection from volatile type C.this.D with C.this.U
+ val y: (D with U)#T = new B { }
+ ^
+one error found
diff --git a/test/files/neg/volatile-intersection.scala b/test/files/neg/volatile-intersection.scala
new file mode 100644
index 0000000..086c474
--- /dev/null
+++ b/test/files/neg/volatile-intersection.scala
@@ -0,0 +1,21 @@
+object Test extends Application {
+ trait A
+ trait B extends A
+
+ trait C {
+ type U
+ trait D { type T >: B <: A }
+ val y: (D with U)#T = new B { }
+ }
+
+ class D extends C {
+ trait E
+ trait F { type T = E }
+ type U = F
+ def frob(arg : E) : E = arg
+ frob(y)
+ }
+
+ new D
+}
+
diff --git a/test/files/neg/volatile.check b/test/files/neg/volatile.check
new file mode 100644
index 0000000..b904284
--- /dev/null
+++ b/test/files/neg/volatile.check
@@ -0,0 +1,7 @@
+volatile.scala:11: error: Inferred type C.this.D with C.this.E#T contains type selection from volatile type C.this.D with C.this.E
+ var sneak = { () => y.x }
+ ^
+volatile.scala:11: error: Inferred type () => C.this.D with C.this.E#T contains type selection from volatile type C.this.D with C.this.E
+ var sneak = { () => y.x }
+ ^
+two errors found
diff --git a/test/files/neg/volatile.scala b/test/files/neg/volatile.scala
new file mode 100644
index 0000000..11f6eb5
--- /dev/null
+++ b/test/files/neg/volatile.scala
@@ -0,0 +1,24 @@
+object Test extends Application {
+ trait A
+ trait B extends A
+
+ class C {
+ type D
+ trait E { type T >: B <: A; val x : T }
+ // This is currently correctly disallowed
+ // val y : (D with E)#T = y
+ val y : D with E = y
+ var sneak = { () => y.x }
+ sneak = { () => new B { } }
+ }
+
+ class F extends C {
+ trait G
+ trait H { type T = G }
+ type D = H
+ def frob(arg : G) : G = arg
+ frob(sneak())
+ }
+
+ new F
+}
diff --git a/test/files/pos/annotations.scala b/test/files/pos/annotations.scala
index d96c8e0..4e2bc6a 100644
--- a/test/files/pos/annotations.scala
+++ b/test/files/pos/annotations.scala
@@ -9,4 +9,17 @@ object Test {
def c: Int @ann(x) = 1
def d: String @ann({val z = 0; z - 1}) = "2"
+
+ //bug #1214
+ val y = new (Integer @ann(0))(2)
+
+ import scala.reflect.BeanProperty
+
+ // bug #637
+ trait S { def getField(): Int }
+ class O extends S { @BeanProperty val field = 0 }
+
+ // bug #1070
+ trait T { @BeanProperty var field = 1 }
}
+
diff --git a/test/files/pos/comp-rec-test.flags b/test/files/pos/comp-rec-test.flags
new file mode 100644
index 0000000..ad928f5
--- /dev/null
+++ b/test/files/pos/comp-rec-test.flags
@@ -0,0 +1 @@
+-Yrecursion 1
diff --git a/test/files/pos/comp-rec-test.scala b/test/files/pos/comp-rec-test.scala
new file mode 100644
index 0000000..eaf1294
--- /dev/null
+++ b/test/files/pos/comp-rec-test.scala
@@ -0,0 +1,24 @@
+object Comp extends Application {
+
+ trait Family {
+ type T
+ }
+
+ object Trivial extends Family {
+ type T = Unit
+ }
+
+ trait Wrap extends Family {
+ val v : Family
+ type T = v.T
+ }
+
+ object WrapTrivial extends Wrap {
+ val v = Trivial
+ }
+
+ object WrapWrapTrivial extends Wrap {
+ val v = WrapTrivial
+ }
+
+}
diff --git a/test/files/pos/inferbroadtype.scala b/test/files/pos/inferbroadtype.scala
new file mode 100644
index 0000000..467bd0f
--- /dev/null
+++ b/test/files/pos/inferbroadtype.scala
@@ -0,0 +1,8 @@
+object Test {
+ abstract class Base { val changesBaseClasses: Boolean }
+ class Concrete extends Base { val changesBaseClasses = true }
+ def getBase : Base = new Concrete
+
+ var c = new Base { val changesBaseClasses = true }
+ c = getBase
+}
diff --git a/test/files/pos/jesper.scala b/test/files/pos/jesper.scala
new file mode 100644
index 0000000..b2a027b
--- /dev/null
+++ b/test/files/pos/jesper.scala
@@ -0,0 +1,30 @@
+object Pair {
+ sealed trait Pair {
+ type First
+ type Second <: Pair
+ }
+
+ case class End extends Pair {
+ type First = Nothing
+ type Second = End
+
+ def ::[T](v : T) : Cons[T, End] = Cons(v, this)
+ }
+
+ case object End extends End
+
+ final case class Cons[T1, T2 <: Pair](_1 : T1, _2 : T2) extends Pair {
+ type First = T1
+ type Second = T2
+
+ def ::[T](v : T) : Cons[T, Cons[T1, T2]] = Cons(v, this)
+ def find[T](implicit finder : Cons[T1, T2] => T) = finder(this)
+ }
+
+ implicit def findFirst[T1, T2 <: Pair] : Cons[T1, T2] => T1 = (p : Cons[T1, T2]) => p._1
+ implicit def findSecond[T, T1, T2 <: Pair](implicit finder : T2 => T) : Cons[T1, T2] => T = (p : Cons[T1, T2]) => finder(p._2)
+
+ val p : Cons[Int, Cons[Boolean, End]] = 10 :: false :: End
+// val x : Boolean = p.find[Boolean](findSecond(findFirst))
+ val x2 : Boolean = p.find[Boolean] // Doesn't compile
+}
diff --git a/test/files/pos/largecasetest.scala b/test/files/pos/largecasetest.scala
new file mode 100644
index 0000000..1f580b5
--- /dev/null
+++ b/test/files/pos/largecasetest.scala
@@ -0,0 +1,6 @@
+object Test{
+def foo(x : Int) = x match {
+ case 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 => 128
+ case _ => -1
+ }
+}
diff --git a/test/files/pos/looping-jsig.scala b/test/files/pos/looping-jsig.scala
new file mode 100644
index 0000000..4bf0ba8
--- /dev/null
+++ b/test/files/pos/looping-jsig.scala
@@ -0,0 +1,18 @@
+import scala.collection.mutable._
+
+trait BugTrack {
+ trait B[+T]
+ val cache : HashMap[A[_], B[_]] = HashMap.empty
+
+ def A[T](f: Int => B[T]): A[T]
+ = new A[T]{def apply(in: Int) = f(in)}
+
+ abstract class A[+T] extends (Int => B[T]) {
+ def giveMeSame = this
+ }
+
+ def amethod[T](p: =>A[T]): A[T] = A(in => cache.get(p) match {
+ case Some(res) => res
+ case None => p(in)
+ }).giveMeSame
+}
diff --git a/test/files/pos/needstypeearly.scala b/test/files/pos/needstypeearly.scala
new file mode 100644
index 0000000..bd93b5c
--- /dev/null
+++ b/test/files/pos/needstypeearly.scala
@@ -0,0 +1,4 @@
+abstract class NeedsXEarly {
+ val x: Int
+}
+class Foo extends { val x = 1 } with NeedsXEarly
diff --git a/test/files/pos/proj-rec-test.flags b/test/files/pos/proj-rec-test.flags
new file mode 100644
index 0000000..ad928f5
--- /dev/null
+++ b/test/files/pos/proj-rec-test.flags
@@ -0,0 +1 @@
+-Yrecursion 1
diff --git a/test/files/pos/proj-rec-test.scala b/test/files/pos/proj-rec-test.scala
new file mode 100644
index 0000000..b7efcf3
--- /dev/null
+++ b/test/files/pos/proj-rec-test.scala
@@ -0,0 +1,13 @@
+object ProjTest {
+ trait MInt { type Type }
+ trait _0 extends MInt { type Type = Boolean }
+ trait Succ[Pre <: MInt] extends MInt { type Type = Pre#Type }
+
+ type _1 = Succ[_0]
+ type _2 = Succ[_1]
+
+ type X1 = _0#Type // Ok
+ type X2 = _1#Type // Ok
+ type X3 = _2#Type // Compiler error, illegal cyclic reference involving type Type
+}
+
diff --git a/test/pending/pos/t0288/Foo.scala b/test/files/pos/t0288/Foo.scala
similarity index 100%
rename from test/pending/pos/t0288/Foo.scala
rename to test/files/pos/t0288/Foo.scala
diff --git a/test/pending/pos/t0288/Outer.java b/test/files/pos/t0288/Outer.java
similarity index 100%
rename from test/pending/pos/t0288/Outer.java
rename to test/files/pos/t0288/Outer.java
diff --git a/test/files/pos/t0453.scala b/test/files/pos/t0453.scala
new file mode 100644
index 0000000..d59a3d2
--- /dev/null
+++ b/test/files/pos/t0453.scala
@@ -0,0 +1,6 @@
+object Test {
+ val foo = new {
+ trait Bar
+ def l () : Bar = { new Bar {} }
+ }
+}
diff --git a/test/pending/pos/t0591.scala b/test/files/pos/t0591.scala
similarity index 100%
rename from test/pending/pos/t0591.scala
rename to test/files/pos/t0591.scala
diff --git a/test/pending/pos/t0774/deathname.scala b/test/files/pos/t0774/deathname.scala
similarity index 100%
rename from test/pending/pos/t0774/deathname.scala
rename to test/files/pos/t0774/deathname.scala
diff --git a/test/pending/pos/t0774/unrelated.scala b/test/files/pos/t0774/unrelated.scala
similarity index 100%
rename from test/pending/pos/t0774/unrelated.scala
rename to test/files/pos/t0774/unrelated.scala
diff --git a/test/files/pos/t1087.scala b/test/files/pos/t1087.scala
new file mode 100644
index 0000000..bb0d701
--- /dev/null
+++ b/test/files/pos/t1087.scala
@@ -0,0 +1,3 @@
+case class Foo
+case class Prd (pred : Char => Boolean) extends Foo
+
diff --git a/test/pending/pos/t1131.scala b/test/files/pos/t1131.scala
similarity index 100%
rename from test/pending/pos/t1131.scala
rename to test/files/pos/t1131.scala
diff --git a/test/files/pos/t1280.scala b/test/files/pos/t1280.scala
new file mode 100644
index 0000000..39406b2
--- /dev/null
+++ b/test/files/pos/t1280.scala
@@ -0,0 +1 @@
+trait X { x => type T >: Null; new X { type T = Any with x.T } }
diff --git a/test/files/pos/t1380.flags b/test/files/pos/t1380.flags
new file mode 100644
index 0000000..f0b0ef7
--- /dev/null
+++ b/test/files/pos/t1380.flags
@@ -0,0 +1 @@
+-cp pending/pos/t1380/gnujaxp.jar
diff --git a/test/files/pos/t1380/gnujaxp.jar b/test/files/pos/t1380/gnujaxp.jar
new file mode 100644
index 0000000..573f8fe
Binary files /dev/null and b/test/files/pos/t1380/gnujaxp.jar differ
diff --git a/test/files/pos/t1380/hallo.scala b/test/files/pos/t1380/hallo.scala
new file mode 100644
index 0000000..bb8fff2
--- /dev/null
+++ b/test/files/pos/t1380/hallo.scala
@@ -0,0 +1,3 @@
+object hallo {
+ def main(args:Array[String]) = println("hallo")
+}
diff --git a/test/files/pos/t1391.scala b/test/files/pos/t1391.scala
new file mode 100644
index 0000000..8133da5
--- /dev/null
+++ b/test/files/pos/t1391.scala
@@ -0,0 +1,43 @@
+package sandbox
+
+ class hierarOverload {
+
+ /*
+ * Template structure - using abstract types.
+ */
+ trait AB {
+ type TA <: A
+ type TB <: B
+
+ protected trait A {
+ val entities : List[TB]
+ }
+
+ protected trait B {
+ var group : TA
+ }
+ }
+
+ /*
+ * Template instantiation in an object to ease use and globally define
+ abstract types
+ */
+ object NAnB extends AB {
+ type TB = nB
+ type TA = nA
+
+ class nA extends A {
+ val entities = List[nB]()
+ }
+
+ class nB extends B {
+ var group = new nA
+ }
+ }
+
+ def foo () {
+ val t = new NAnB.nA
+ println(t)
+ }
+
+ }
diff --git a/test/files/pos/t1409/AbstractImpl.java b/test/files/pos/t1409/AbstractImpl.java
new file mode 100644
index 0000000..b22a94f
--- /dev/null
+++ b/test/files/pos/t1409/AbstractImpl.java
@@ -0,0 +1,3 @@
+public abstract class AbstractImpl implements OuterInterface {
+ public abstract InnerInterface create();
+ }
diff --git a/test/files/pos/t1409/ConcreteImpl.scala b/test/files/pos/t1409/ConcreteImpl.scala
new file mode 100644
index 0000000..d427e95
--- /dev/null
+++ b/test/files/pos/t1409/ConcreteImpl.scala
@@ -0,0 +1,3 @@
+class ConcreteImpl extends AbstractImpl {
+ def create : OuterInterface.InnerInterface = null
+ }
diff --git a/test/files/pos/t1409/OuterInterface.java b/test/files/pos/t1409/OuterInterface.java
new file mode 100644
index 0000000..dd288ce
--- /dev/null
+++ b/test/files/pos/t1409/OuterInterface.java
@@ -0,0 +1,5 @@
+public interface OuterInterface {
+ public interface InnerInterface {
+ public void foo();
+ }
+ }
diff --git a/test/files/pos/t1480.scala b/test/files/pos/t1480.scala
new file mode 100644
index 0000000..3dc3062
--- /dev/null
+++ b/test/files/pos/t1480.scala
@@ -0,0 +1,6 @@
+class Foo{
+ def compare(newP : Any, oldP : Any) : Boolean = (newP,oldP) match {
+ case (newP : AnyRef, oldP : AnyRef) if newP == oldP => newP == oldP
+ case (newS : Symbol, oldS: Symbol) if newS == oldS => newS == oldS
+ }
+}
diff --git a/test/files/pos/typesafecons.scala b/test/files/pos/typesafecons.scala
new file mode 100644
index 0000000..b2a027b
--- /dev/null
+++ b/test/files/pos/typesafecons.scala
@@ -0,0 +1,30 @@
+object Pair {
+ sealed trait Pair {
+ type First
+ type Second <: Pair
+ }
+
+ case class End extends Pair {
+ type First = Nothing
+ type Second = End
+
+ def ::[T](v : T) : Cons[T, End] = Cons(v, this)
+ }
+
+ case object End extends End
+
+ final case class Cons[T1, T2 <: Pair](_1 : T1, _2 : T2) extends Pair {
+ type First = T1
+ type Second = T2
+
+ def ::[T](v : T) : Cons[T, Cons[T1, T2]] = Cons(v, this)
+ def find[T](implicit finder : Cons[T1, T2] => T) = finder(this)
+ }
+
+ implicit def findFirst[T1, T2 <: Pair] : Cons[T1, T2] => T1 = (p : Cons[T1, T2]) => p._1
+ implicit def findSecond[T, T1, T2 <: Pair](implicit finder : T2 => T) : Cons[T1, T2] => T = (p : Cons[T1, T2]) => finder(p._2)
+
+ val p : Cons[Int, Cons[Boolean, End]] = 10 :: false :: End
+// val x : Boolean = p.find[Boolean](findSecond(findFirst))
+ val x2 : Boolean = p.find[Boolean] // Doesn't compile
+}
diff --git a/test/files/pos5/ilya2/A.scala b/test/files/pos5/ilya2/A.scala
new file mode 100644
index 0000000..923b50f
--- /dev/null
+++ b/test/files/pos5/ilya2/A.scala
@@ -0,0 +1,3 @@
+class A {
+ def foo = new B().bar(null)
+}
diff --git a/test/files/pos5/ilya2/B.java b/test/files/pos5/ilya2/B.java
new file mode 100644
index 0000000..4771493
--- /dev/null
+++ b/test/files/pos5/ilya2/B.java
@@ -0,0 +1,6 @@
+public class B {
+ public int bar(@Nullable final Object o) {
+ return 42;
+ }
+
+}
diff --git a/test/files/pos5/ilya2/Nullable.java b/test/files/pos5/ilya2/Nullable.java
new file mode 100644
index 0000000..ebbb013
--- /dev/null
+++ b/test/files/pos5/ilya2/Nullable.java
@@ -0,0 +1,7 @@
+import java.lang.annotation.*;
+
+ at Retention(RetentionPolicy.CLASS)
+ at Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
+public @interface Nullable {
+ String value() default "";
+}
diff --git a/test/pending/pos/t0695/JavaClass.java b/test/files/pos5/t0695/JavaClass.java
similarity index 100%
rename from test/pending/pos/t0695/JavaClass.java
rename to test/files/pos5/t0695/JavaClass.java
diff --git a/test/pending/pos/t0695/Test.scala b/test/files/pos5/t0695/Test.scala
similarity index 100%
rename from test/pending/pos/t0695/Test.scala
rename to test/files/pos5/t0695/Test.scala
diff --git a/test/pending/pos/t1232/J.java b/test/files/pos5/t1232/J.java
similarity index 100%
rename from test/pending/pos/t1232/J.java
rename to test/files/pos5/t1232/J.java
diff --git a/test/pending/pos/t1232/J2.java b/test/files/pos5/t1232/J2.java
similarity index 100%
rename from test/pending/pos/t1232/J2.java
rename to test/files/pos5/t1232/J2.java
diff --git a/test/pending/pos/t1232/S.scala b/test/files/pos5/t1232/S.scala
similarity index 100%
rename from test/pending/pos/t1232/S.scala
rename to test/files/pos5/t1232/S.scala
diff --git a/test/files/run/bug889.check b/test/files/run/bug889.check
new file mode 100644
index 0000000..67ca2bf
--- /dev/null
+++ b/test/files/run/bug889.check
@@ -0,0 +1 @@
+first: a, rest: List()
diff --git a/test/pending/run/t0889.scala b/test/files/run/bug889.scala
similarity index 100%
rename from test/pending/run/t0889.scala
rename to test/files/run/bug889.scala
diff --git a/test/files/run/checked.check b/test/files/run/checked.check
index 6b85ae3..258e93e 100644
--- a/test/files/run/checked.check
+++ b/test/files/run/checked.check
@@ -1,7 +1,7 @@
sum = 12
-[OK] Cought UFE: Uninitialized field: checked.scala: 42
+[OK] Caught UFE: Uninitialized field: checked.scala: 42
2
-[OK] Cought UFE: Uninitialized field: checked.scala: 73
+[OK] Caught UFE: Uninitialized field: checked.scala: 73
x = 10
y = 11
lz1 = 1
diff --git a/test/files/run/checked.scala b/test/files/run/checked.scala
index cd134ef..4a79aa2 100644
--- a/test/files/run/checked.scala
+++ b/test/files/run/checked.scala
@@ -97,7 +97,7 @@ object Test extends Application {
println("[FAIL]: No UFE thrown")
} catch {
case UninitializedFieldError(msg) =>
- println("[OK] Cought UFE: " + msg)
+ println("[OK] Caught UFE: " + msg)
}
diff --git a/test/files/run/exceptions-2.check b/test/files/run/exceptions-2.check
index 86fc91b..9a3044c 100644
--- a/test/files/run/exceptions-2.check
+++ b/test/files/run/exceptions-2.check
@@ -17,7 +17,7 @@ method2:
10
Exception occurred
method3:
-Cought an NPE
+Caught an NPE
tryFinallyTry:
Silently ignore exception in finally
valInFinally:
diff --git a/test/files/run/exceptions-2.scala b/test/files/run/exceptions-2.scala
index 08d3b6c..52120a6 100644
--- a/test/files/run/exceptions-2.scala
+++ b/test/files/run/exceptions-2.scala
@@ -1,7 +1,7 @@
/*
* Try exception handling and finally blocks.
*
- * $Id: exceptions-2.scala 14133 2008-02-26 08:12:56Z dragos $
+ * $Id: exceptions-2.scala 15975 2008-08-31 11:40:19Z cunei $
*/
trait Tree extends Exception;
@@ -110,7 +110,7 @@ object Test {
}
} catch {
case npe: NullPointerException =>
- Console.println("Cought an NPE");
+ Console.println("Caught an NPE");
}
def withValue1: Unit = {
diff --git a/test/files/run/infiniteloop.check b/test/files/run/infiniteloop.check
new file mode 100644
index 0000000..be0b143
--- /dev/null
+++ b/test/files/run/infiniteloop.check
@@ -0,0 +1 @@
+Stream(512, ?)
diff --git a/test/files/run/infiniteloop.scala b/test/files/run/infiniteloop.scala
new file mode 100644
index 0000000..f15674a
--- /dev/null
+++ b/test/files/run/infiniteloop.scala
@@ -0,0 +1,13 @@
+/** Tests the optimiser (not to loop on 'reverse'). */
+
+object Test extends Application {
+ def foo {
+ val s3 = Stream.range(1, 1000) //100000 (ticket #153: Stackoverflow)
+
+ // ticket #153
+ def powers(x: Int) = if ((x&(x-1)) == 0) Some(x) else None
+ println(s3.flatMap(powers).reverse)
+ }
+
+ foo
+}
diff --git a/test/files/run/intgetorelse.scala b/test/files/run/intgetorelse.scala
deleted file mode 100644
index c5ef188..0000000
--- a/test/files/run/intgetorelse.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-object Test extends Application{
- import scala.collection.immutable.{IntMap, LongMap}
-
-
- val t1 = IntMap(1 -> 2, 2 -> 3, 3 -> 4, 5 -> 7);
- assert(t1.getOrElse(1, 3) == 2)
- assert(t1.getOrElse(9, 3) == 3)
-
-
- val t2 = LongMap(1L -> 2, 2L -> 3, 3L -> 4, 5L -> 7);
- assert(t2.getOrElse(1, 3L) == 2L)
- assert(t2.getOrElse(9, 3L) == 3L)
-
-
-}
diff --git a/test/files/run/intgetorelse.check b/test/files/run/intmap.check
similarity index 100%
rename from test/files/run/intgetorelse.check
rename to test/files/run/intmap.check
diff --git a/test/files/run/intmap.scala b/test/files/run/intmap.scala
new file mode 100644
index 0000000..8c3e0b2
--- /dev/null
+++ b/test/files/run/intmap.scala
@@ -0,0 +1,8 @@
+object Test extends Application{
+ import scala.collection.immutable.IntMap;
+
+ val it = IntMap(8 -> 2, 11 -> 3, 1 -> 2, 7 -> 13);
+
+ assert(it.firstKey == 1);
+ assert(it.lastKey == 11);
+}
diff --git a/test/files/run/iq.scala b/test/files/run/iq.scala
index d2b1158..d2e7d43 100644
--- a/test/files/run/iq.scala
+++ b/test/files/run/iq.scala
@@ -1,4 +1,4 @@
-/* $Id: iq.scala 16316 2008-10-22 14:01:55Z cunei $
+/* $Id: iq.scala 16113 2008-09-16 19:38:07Z spoon $
* Test file for immutable queues.
*/
diff --git a/test/files/run/matcharraytail.check b/test/files/run/matcharraytail.check
new file mode 100644
index 0000000..049db39
--- /dev/null
+++ b/test/files/run/matcharraytail.check
@@ -0,0 +1,2 @@
+Array(foo, bar, baz)
+Array(bar, baz)
diff --git a/test/files/run/matcharraytail.scala b/test/files/run/matcharraytail.scala
new file mode 100644
index 0000000..cdd79ac
--- /dev/null
+++ b/test/files/run/matcharraytail.scala
@@ -0,0 +1,7 @@
+object Test extends Application{
+ Array("foo", "bar", "baz") match {
+ case x at Array("foo", bar @_*) => println(x.toString); println(bar.toString);
+ case Array(x, y, z) => println("shouldn't have fallen through");
+ case _ => println("default case?!");
+ }
+}
diff --git a/test/files/run/matchbytes.check b/test/files/run/matchbytes.check
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/files/run/matchbytes.check
@@ -0,0 +1 @@
+1
diff --git a/test/files/run/matchbytes.scala b/test/files/run/matchbytes.scala
new file mode 100644
index 0000000..e776f0b
--- /dev/null
+++ b/test/files/run/matchbytes.scala
@@ -0,0 +1,7 @@
+object Test extends Application{
+ val x = (1 : Byte) match {
+ case 2 => println(2);
+ case 1 => println(1);
+ case _ => println("????");
+ }
+}
diff --git a/test/files/run/matchemptyarray.check b/test/files/run/matchemptyarray.check
new file mode 100644
index 0000000..815225f
--- /dev/null
+++ b/test/files/run/matchemptyarray.check
@@ -0,0 +1 @@
+Array()
diff --git a/test/files/run/matchemptyarray.scala b/test/files/run/matchemptyarray.scala
new file mode 100644
index 0000000..63abf74
--- /dev/null
+++ b/test/files/run/matchemptyarray.scala
@@ -0,0 +1,5 @@
+object Test extends Application{
+ Array[String]() match {
+ case x at Array() => println(x.toString());
+ }
+}
diff --git a/test/files/run/matchintasany.check b/test/files/run/matchintasany.check
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/files/run/matchintasany.check
@@ -0,0 +1 @@
+1
diff --git a/test/files/run/matchintasany.scala b/test/files/run/matchintasany.scala
new file mode 100644
index 0000000..e21dce9
--- /dev/null
+++ b/test/files/run/matchintasany.scala
@@ -0,0 +1,8 @@
+object Test extends Application{
+ val x = (1 : Any) match {
+ case 0xFFFFFFFF00000001L => println("Oops, overflow!");
+ case 2L => println(2);
+ case 1L => println(1);
+ case _ => println("????");
+ }
+}
diff --git a/test/files/run/matchonstream.check b/test/files/run/matchonstream.check
new file mode 100644
index 0000000..3dc3aa5
--- /dev/null
+++ b/test/files/run/matchonstream.check
@@ -0,0 +1 @@
+It worked!
diff --git a/test/files/run/matchonstream.scala b/test/files/run/matchonstream.scala
new file mode 100644
index 0000000..d38d81d
--- /dev/null
+++ b/test/files/run/matchonstream.scala
@@ -0,0 +1,3 @@
+object Test extends Application{
+ Stream.from(1) match { case Stream(1, 2, x @_*) => println("It worked!") }
+}
diff --git a/test/files/run/missingparams.check b/test/files/run/missingparams.check
new file mode 100644
index 0000000..b0047fa
--- /dev/null
+++ b/test/files/run/missingparams.check
@@ -0,0 +1 @@
+None
diff --git a/test/files/run/missingparams.scala b/test/files/run/missingparams.scala
new file mode 100644
index 0000000..0b79fa1
--- /dev/null
+++ b/test/files/run/missingparams.scala
@@ -0,0 +1,21 @@
+/** Tests the optimiser. */
+
+final class Foo(val x: Int) {
+ def filter(p: Int => Boolean) =
+ if (p(x)) Some(x) else None
+
+ // test that the closure elimination is not wrongly replacing
+ // 'that' by 'this'
+ def intersect(that: Foo) =
+ filter { dummy =>
+// x // dummy
+ that.x > 0
+ }
+}
+
+object Test extends Application {
+ val foo1 = new Foo(42)
+ val foo2 = new Foo(-42)
+
+ println(foo1 intersect foo2)
+}
diff --git a/test/files/run/t1423.check b/test/files/run/t1423.check
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/files/run/t1423.check
@@ -0,0 +1 @@
+1
diff --git a/test/files/run/t1423.scala b/test/files/run/t1423.scala
new file mode 100644
index 0000000..4f2c911
--- /dev/null
+++ b/test/files/run/t1423.scala
@@ -0,0 +1,8 @@
+object Test extends Application{
+ val x = 1 match {
+ case 0xFFFFFFFF00000001L => println("Oops, overflow!");
+ case 2L => println(2);
+ case 1L => println(1);
+ case _ => println("????");
+ }
+}
diff --git a/test/files/run/t1500.check b/test/files/run/t1500.check
new file mode 100644
index 0000000..b4e94e9
--- /dev/null
+++ b/test/files/run/t1500.check
@@ -0,0 +1,3 @@
+defined class posingAs
+resolve: [A,B](A @posingAs[B])B
+x: Any = 7
diff --git a/test/files/run/t1500.scala b/test/files/run/t1500.scala
new file mode 100644
index 0000000..dd39c64
--- /dev/null
+++ b/test/files/run/t1500.scala
@@ -0,0 +1,44 @@
+import scala.tools.nsc._
+
+object Test {
+
+ /**
+ * Type inference overlooks constraints posed by type parameters in annotations on types.
+ */
+
+ val testCode = <code>
+
+ class posingAs[A] extends TypeConstraint
+
+ def resolve[A,B](x: A @posingAs[B]): B = x.asInstanceOf[B]
+
+ val x = resolve(7: @posingAs[Any])
+
+ </code>.text
+
+ def main(args: Array[String]) = {
+
+ val tool = new Interpreter(new Settings())
+ val global = tool.compiler
+
+ import global._
+ import definitions._
+
+ object checker extends AnnotationChecker {
+
+ /** Check annotations to decide whether tpe1 <:< tpe2 */
+ def annotationsConform(tpe1: Type, tpe2: Type): Boolean = {
+
+ tpe1.attributes.forall(a1 => tpe2.attributes.forall(a2 => a1.atp <:< a2.atp))
+
+ }
+ }
+
+ global.addAnnotationChecker(checker)
+
+ tool.interpret(testCode)
+
+ }
+
+}
+
diff --git a/test/files/run/t1501.check b/test/files/run/t1501.check
new file mode 100644
index 0000000..7ec1495
--- /dev/null
+++ b/test/files/run/t1501.check
@@ -0,0 +1,3 @@
+defined class xyz
+loopWhile: [T](=> Boolean)(=> Unit @xyz[T])Unit @xyz[T]
+test: ()Unit @xyz[Int]
diff --git a/test/files/run/t1501.scala b/test/files/run/t1501.scala
new file mode 100644
index 0000000..887f47f
--- /dev/null
+++ b/test/files/run/t1501.scala
@@ -0,0 +1,55 @@
+import scala.tools.nsc._
+
+object Test {
+
+ /**
+ * ...
+ */
+
+ val testCode = <code>
+
+ class xyz[A] extends TypeConstraint
+
+ def loopWhile[T](cond: =>Boolean)(body: =>(Unit @xyz[T])): Unit @ xyz[T] = {{
+ if (cond) {{
+ body
+ loopWhile[T](cond)(body)
+ }}
+ }}
+
+ def test() = {{
+ var x = 7
+ loopWhile(x != 0) {{
+ x = x - 1
+ (): @xyz[Int]
+ }}
+ }}
+
+ </code>.text
+
+ def main(args: Array[String]) = {
+
+ val tool = new Interpreter(new Settings())
+ val global = tool.compiler
+
+ import global._
+ import definitions._
+
+ object checker extends AnnotationChecker {
+
+ /** Check annotations to decide whether tpe1 <:< tpe2 */
+ def annotationsConform(tpe1: Type, tpe2: Type): Boolean = {
+
+ tpe1.attributes.forall(a1 => tpe2.attributes.forall(a2 => a1.atp <:< a2.atp))
+
+ }
+ }
+
+ global.addAnnotationChecker(checker)
+
+ tool.interpret(testCode)
+
+ }
+
+}
+
diff --git a/test/files/run/t1505.scala b/test/files/run/t1505.scala
new file mode 100644
index 0000000..25c1a91
--- /dev/null
+++ b/test/files/run/t1505.scala
@@ -0,0 +1,25 @@
+object P extends Enumeration(0, "A", "B", "C") { val A, B, C = Value }
+
+object Q extends Enumeration {
+ val A = Value("A")
+ val B = Value("B")
+ val C = Value("C")
+}
+
+object R extends Enumeration {
+ val A, B, C = Value
+}
+
+object Test extends Application {
+ assert(Some(P(0)) == P.valueOf("A"))
+ assert(Some(P.C) == P.valueOf("C"))
+ assert(None == P.valueOf("Q"))
+
+ assert(Some(Q(0)) == Q.valueOf("A"))
+ assert(Some(Q.C) == Q.valueOf("C"))
+ assert(None == Q.valueOf("Q"))
+
+ assert(None == R.valueOf("A"))
+ assert(None == R.valueOf("C"))
+ assert(None == R.valueOf("Q"))
+}
diff --git a/test/files/run/verify-ctor.check b/test/files/run/verify-ctor.check
new file mode 100644
index 0000000..8baef1b
--- /dev/null
+++ b/test/files/run/verify-ctor.check
@@ -0,0 +1 @@
+abc
diff --git a/test/files/run/verify-ctor.scala b/test/files/run/verify-ctor.scala
new file mode 100644
index 0000000..17e4f71
--- /dev/null
+++ b/test/files/run/verify-ctor.scala
@@ -0,0 +1,13 @@
+class Foo(val str: String) {
+ def this(arr: Array[Char]) = this({
+ if (arr.length == 0) exit(1)
+ new String(arr)
+ })
+}
+
+object Test {
+ def main(args: Array[String]) = {
+ val t = new Foo(Array('a', 'b', 'c'))
+ println(t.str)
+ }
+}
diff --git a/test/files/scalacheck/list.scala b/test/files/scalacheck/list.scala
new file mode 100644
index 0000000..b3396bc
--- /dev/null
+++ b/test/files/scalacheck/list.scala
@@ -0,0 +1,10 @@
+import org.scalacheck._
+import Prop._
+
+object Test {
+ val prop_ConcatLists =
+ property((l1: List[Int], l2: List[Int]) => (l1.size + l2.size) == (l1 ::: l2).size)
+
+ val tests = List(("ConcatLists", prop_ConcatLists))
+}
+
diff --git a/test/files/script/fact.bat b/test/files/script/fact.bat
new file mode 100644
index 0000000..bee0ba2
--- /dev/null
+++ b/test/files/script/fact.bat
@@ -0,0 +1,17 @@
+::#!
+:: fact - A simple Scala batch file that prints out the factorial
+:: of the argument specified on the command line.
+
+ at echo off
+call scala -nocompdaemon %0 %*
+goto :eof
+::!#
+
+
+val x = argv(0).toInt
+
+def fact(x: Int):Int =
+ if(x==0) 1
+ else x*fact(x-1)
+
+Console.println("fact(" + x + ") = " + fact(x))
diff --git a/test/files/script/second.bat b/test/files/script/second.bat
new file mode 100644
index 0000000..222372d
--- /dev/null
+++ b/test/files/script/second.bat
@@ -0,0 +1,3 @@
+ at echo off
+
+scala -nocompdaemon -e "println(\"My second argument is \" + args(1))" arg1 arg2
diff --git a/test/files/script/t1015.bat b/test/files/script/t1015.bat
new file mode 100644
index 0000000..7475313
--- /dev/null
+++ b/test/files/script/t1015.bat
@@ -0,0 +1,12 @@
+::#!
+:: t1015 - <description>.
+
+ at echo off
+call scala -nocompdaemon %0 %*
+goto :eof
+::!#
+
+case class Test(one : Int, two : Int)
+object Test{
+ def apply(one : Int): Test = Test(one, 2);
+}
diff --git a/test/files/script/t1017.bat b/test/files/script/t1017.bat
new file mode 100644
index 0000000..369dbd2
--- /dev/null
+++ b/test/files/script/t1017.bat
@@ -0,0 +1,15 @@
+::#!
+::# t1017 - <description>.
+
+ at echo off
+call scala -nocompdaemon %0 %*
+goto :eof
+::!#
+
+def foo = {
+ bar
+}
+
+var x = 1
+
+def bar = 1
diff --git a/test/files/script/utf8.bat b/test/files/script/utf8.bat
new file mode 100644
index 0000000..8bc5c88
--- /dev/null
+++ b/test/files/script/utf8.bat
@@ -0,0 +1,11 @@
+::#!
+:: utf8 - <description>.
+
+ at echo off
+call scala -nocompdaemon %0 %*
+goto :eof
+::!#
+
+/*Comment Комментарий*/
+Console.println("QWERTY");
+Console.println("ЙЦУКЕН");
diff --git a/test/files/shootout/knucleotide.scala-3.scala b/test/files/shootout/knucleotide.scala-3.scala
index 2c11817..723f04b 100644
--- a/test/files/shootout/knucleotide.scala-3.scala
+++ b/test/files/shootout/knucleotide.scala-3.scala
@@ -1,7 +1,8 @@
-/* The Computer Language Shootout
+/* The Computer Language Benchmarks Game
http://shootout.alioth.debian.org/
contributed by Isaac Gouy
fixed by Iulian Dragos
+ fixed by Meiko Rachimow
*/
import java.io._
diff --git a/test/partest b/test/partest
index 6c7d229..339f1fe 100644
--- a/test/partest
+++ b/test/partest
@@ -74,4 +74,4 @@ fi
[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms16M"
[ -n "$SCALAC_OPTS" ] || SCALAC_OPTS="-deprecation"
-${JAVACMD:=java} $JAVA_OPTS -cp "$EXT_CLASSPATH" -Dscala.home="${SCALA_HOME}" -Dscalatest.javacmd="${JAVACMD}" -Dscalatest.java_options="${JAVA_OPTS}" -Dscalatest.scalac_options="${SCALAC_OPTS}" scala.tools.partest.nest.NestRunner "$@"
+${JAVACMD:=java} $JAVA_OPTS -cp "$EXT_CLASSPATH" -Dpartest.debug="${PARTEST_DEBUG}" -Dscala.home="${SCALA_HOME}" -Dscalatest.javacmd="${JAVACMD}" -Dscalatest.java_opts="${JAVA_OPTS}" -Dscalatest.scalac_opts="${SCALAC_OPTS}" -Dscalatest.javac_cmd="${JAVA_HOME}/bin/javac" scala.tools.partest.nest.NestRunner "$@"
diff --git a/test/partest.bat b/test/partest.bat
index 8b01e03..098553f 100644
--- a/test/partest.bat
+++ b/test/partest.bat
@@ -53,7 +53,7 @@ if "%_EXTENSION_CLASSPATH%"=="" (
)
)
-set _PROPS=-Dscala.home="%_SCALA_HOME%" -Dscalatest.javacmd="%_JAVACMD%" -Dscalatest.java_options="%_JAVA_OPTS%" -Dscalatest.scalac_options="%_SCALAC_OPTS%"
+set _PROPS=-Dscala.home="%_SCALA_HOME%" -Dscalatest.javacmd="%_JAVACMD%" -Dscalatest.java_options="%_JAVA_OPTS%" -Dscalatest.scalac_options="%_SCALAC_OPTS%" -Dscalatest.javac_cmd="%JAVA_HOME%\bin\javac"
rem echo %_JAVACMD% %_JAVA_OPTS% %_PROPS% -cp "%_EXTENSION_CLASSPATH%" scala.tools.partest.nest.NestRunner %_ARGS%
%_JAVACMD% %_JAVA_OPTS% %_PROPS% -cp "%_EXTENSION_CLASSPATH%" scala.tools.partest.nest.NestRunner %_ARGS%
diff --git a/test/files/jvm/inner.scala b/test/pending/jvm/inner.scala
similarity index 98%
rename from test/files/jvm/inner.scala
rename to test/pending/jvm/inner.scala
index 7ad0801..d33cc47 100644
--- a/test/files/jvm/inner.scala
+++ b/test/pending/jvm/inner.scala
@@ -1,7 +1,7 @@
//############################################################################
// Test Java interaction with scala inner classes
//############################################################################
-// $Id: inner.scala 14842 2008-04-29 18:10:11Z dubochet $
+// $Id: inner.scala 15964 2008-08-29 13:50:04Z cunei $
import java.io.{BufferedReader, File, FileWriter, InputStreamReader}
diff --git a/test/pending/jvm/timeout.check b/test/pending/jvm/timeout.check
new file mode 100644
index 0000000..d86bac9
--- /dev/null
+++ b/test/pending/jvm/timeout.check
@@ -0,0 +1 @@
+OK
diff --git a/test/pending/jvm/timeout.scala b/test/pending/jvm/timeout.scala
new file mode 100644
index 0000000..8161faa
--- /dev/null
+++ b/test/pending/jvm/timeout.scala
@@ -0,0 +1,33 @@
+
+import scala.actors.Actor._
+import scala.actors.TIMEOUT
+
+object Test extends Application {
+ case class Timing(time: Long)
+
+ actor {
+ val a = actor {
+ react {
+ case 'doTiming =>
+ val s = sender
+ reactWithin(500) {
+ case TIMEOUT =>
+ s ! Timing(System.currentTimeMillis)
+ }
+ }
+ }
+
+ val start = System.currentTimeMillis
+ (a !? 'doTiming) match {
+ case Timing(end) =>
+ val delay = end - start
+
+ if (delay > 100 && delay < 900)
+ println("OK")
+ else {
+ println("EXPECTED: 100 < x < 900")
+ println("ACTUAL: "+delay)
+ }
+ }
+ }
+}
diff --git a/test/pending/jvm5/t1464.check b/test/pending/jvm5/t1464.check
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/test/pending/jvm5/t1464.check
@@ -0,0 +1 @@
+false
diff --git a/test/pending/neg/t0699/A.scala b/test/pending/pos/t0699/A.scala
similarity index 100%
rename from test/pending/neg/t0699/A.scala
rename to test/pending/pos/t0699/A.scala
diff --git a/test/pending/neg/t0699/B.scala b/test/pending/pos/t0699/B.scala
similarity index 100%
rename from test/pending/neg/t0699/B.scala
rename to test/pending/pos/t0699/B.scala
diff --git a/test/pending/pos/t1035.scala b/test/pending/pos/t1035.scala
new file mode 100644
index 0000000..ede3ce2
--- /dev/null
+++ b/test/pending/pos/t1035.scala
@@ -0,0 +1,32 @@
+//A fatal error or Scala compiler
+// Scala compiler version 2.7.1-final -- (c) 2002-2007 LAMP/EPFL
+// Carlos Loria cloria at artinsoft.com
+// 7/10/2008
+
+class A {
+ var name:String = _
+ def getName() = name
+ def this(name:String, age:Int){this();this.name=name}
+
+}
+
+class B(name:String) extends A(name,0){
+}
+
+class D {
+
+ object A {
+ def unapply(p:A) = Some(p.getName)
+ }
+
+ object B {
+ def unapply(p:B) = Some(p.getName)
+ }
+ def foo(p:Any) = p match {
+ case B(n) => println("B")
+ case A(n) => println("A")
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/test/pending/pos/t1107/Object.scala b/test/pending/pos/t1107/Object.scala
new file mode 100644
index 0000000..0fd0469
--- /dev/null
+++ b/test/pending/pos/t1107/Object.scala
@@ -0,0 +1,10 @@
+object O
+{
+ def d(t: Top) =
+ t match
+ {
+ case s: Sub => true
+ case _ => false
+ }
+}
+
diff --git a/test/pending/pos/t1107/Trait.scala b/test/pending/pos/t1107/Trait.scala
new file mode 100644
index 0000000..cd213f9
--- /dev/null
+++ b/test/pending/pos/t1107/Trait.scala
@@ -0,0 +1,9 @@
+sealed trait Top
+sealed trait Sub extends Top
+
+trait C
+{
+ private object P extends Sub
+}
+
+
diff --git a/test/pending/pos/t1164.scala b/test/pending/pos/t1164.scala
new file mode 100644
index 0000000..6b1e313
--- /dev/null
+++ b/test/pending/pos/t1164.scala
@@ -0,0 +1,29 @@
+
+
+object test {
+
+ class Foo[a](val arg : a)
+
+ object Foo {
+ def apply [a](arg : a, right :a) = new Foo[a](arg)
+ def unapply [a](m : Foo[a]) = Some (m.arg)
+ }
+
+ def matchAndGetArgFromFoo[a]( e:Foo[a]):a = {e match { case Foo(x) => x }}
+
+
+ // Try the same thing as above but use function as arguemnt to Bar
+ // constructor
+
+ type FunIntToA [a] = (int) => a
+ class Bar[a] (var f: FunIntToA[a])
+
+ object Bar {
+ def apply[a](f: FunIntToA[a]) = new Bar[a](f)
+ def unapply[a](m: Bar[a]) = Some (m.f)
+ }
+
+ def matchAndGetFunFromBar[a](b:Bar[a]) : FunIntToA[a] = { b match { case Bar(x) => x}}
+
+
+}
diff --git a/test/pending/pos/t1260.scala b/test/pending/pos/t1260.scala
new file mode 100644
index 0000000..775571d
--- /dev/null
+++ b/test/pending/pos/t1260.scala
@@ -0,0 +1,17 @@
+case class Foo(a: String, b: String)
+
+object Bar {
+ def unapply(s: String): Option[Long] =
+ try { Some(s.toLong) } catch { case _ => None }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ val f = Foo("1", "2")
+ f match {
+ case Foo(Bar(1), Bar(2)) => ()
+ case Foo(Bar(i), Bar(j)) if i >= 0 => ()
+ }
+ }
+}
+
diff --git a/test/pending/pos/t1438.scala b/test/pending/pos/t1438.scala
new file mode 100644
index 0000000..221c343
--- /dev/null
+++ b/test/pending/pos/t1438.scala
@@ -0,0 +1,10 @@
+class C[A] {
+ type CC[B] <: C[B]
+ def aio[T]: T = aio[T]
+}
+class D[A] extends C[A] {
+ protected def nv[B](elems: Iterator[B]): CC[B] = {
+ val x = new D[B]
+ x.aio[CC[B]]
+ }
+}
diff --git a/test/pending/pos/t1439.scala b/test/pending/pos/t1439.scala
new file mode 100644
index 0000000..ae1fdd1
--- /dev/null
+++ b/test/pending/pos/t1439.scala
@@ -0,0 +1,7 @@
+class View[C[A]] {}
+
+object Test {
+ null match {
+ case v: View[_] =>
+ }
+}
diff --git a/test/pending/pos/t425.scala b/test/pending/pos/t425.scala
new file mode 100644
index 0000000..e50c50a
--- /dev/null
+++ b/test/pending/pos/t425.scala
@@ -0,0 +1,11 @@
+object Temp{
+ case class A(x: Int)
+ case class B(override val x: Int, y: Double) extends A(x)
+
+ val b: A = B(5, 3.3)
+ b match {
+ case B(x, y) => Console.println(y)
+ case A(x) => Console.println(x)
+ }
+}
+
diff --git a/test/pending/pos/t425variant.scala b/test/pending/pos/t425variant.scala
new file mode 100644
index 0000000..458f3b9
--- /dev/null
+++ b/test/pending/pos/t425variant.scala
@@ -0,0 +1,10 @@
+object Temp{
+ case class A(x: Int)
+ case class B(override val x: Int, y: Double) extends A(x)
+
+ B(5, 3.3) match {
+ case B(x, y) => Console.println(y)
+ case A(x) => Console.println(x)
+ }
+}
+
diff --git a/test/pending/pos/t796.scala b/test/pending/pos/t796.scala
new file mode 100644
index 0000000..c013f49
--- /dev/null
+++ b/test/pending/pos/t796.scala
@@ -0,0 +1,20 @@
+case class CaseClass( value: Int );
+
+object PatternMatchBug {
+ def matcher( a: AnyRef, b: Any ) {
+ (a, b) match {
+ case ( instance: CaseClass, instance.value ) =>
+ System.out.println( "Match succeeded!" );
+ case _ =>
+ System.out.println( "Match failed!" );
+ }
+ }
+
+ def main( args : Array[String] ) {
+ val caseClassInstance = CaseClass( 42 )
+
+ matcher( caseClassInstance, 13 )
+ matcher( caseClassInstance, 42 )
+ }
+}
+
diff --git a/test/pending/pos5/misc/A.java b/test/pending/pos5/misc/A.java
new file mode 100644
index 0000000..bc8ea48
--- /dev/null
+++ b/test/pending/pos5/misc/A.java
@@ -0,0 +1,13 @@
+package test;
+
+import static test.A.STATE.UNDEF;
+
+class A {
+
+ public STATE state = UNDEF;
+
+ protected static enum STATE {
+ UNDEF
+ }
+
+}
\ No newline at end of file
diff --git a/test/pending/pos5/misc/B.scala b/test/pending/pos5/misc/B.scala
new file mode 100644
index 0000000..7524f35
--- /dev/null
+++ b/test/pending/pos5/misc/B.scala
@@ -0,0 +1,7 @@
+package test
+
+class B {
+
+ def myA = new A()
+
+}
\ No newline at end of file
diff --git a/test/pending/pos5/misc/J.java b/test/pending/pos5/misc/J.java
new file mode 100644
index 0000000..abaad86
--- /dev/null
+++ b/test/pending/pos5/misc/J.java
@@ -0,0 +1,4 @@
+class J {
+ void f (@Override{ name = value } int x) {}
+ void g (String ... x) {}
+}
diff --git a/test/pending/pos5/misc/S.scala b/test/pending/pos5/misc/S.scala
new file mode 100644
index 0000000..af99333
--- /dev/null
+++ b/test/pending/pos5/misc/S.scala
@@ -0,0 +1,4 @@
+object Test extends J {
+ def h(xs: String*) {}
+ g("a", "b", "c")
+}
diff --git a/test/pending/run/castsingleton.check b/test/pending/run/castsingleton.check
new file mode 100644
index 0000000..4974228
--- /dev/null
+++ b/test/pending/run/castsingleton.check
@@ -0,0 +1,2 @@
+L()
+L()
diff --git a/test/pending/run/castsingleton.scala b/test/pending/run/castsingleton.scala
new file mode 100644
index 0000000..59c912e
--- /dev/null
+++ b/test/pending/run/castsingleton.scala
@@ -0,0 +1,10 @@
+object Test extends Application {
+ case class L();
+ object N extends L();
+
+ def empty(xs : L) : Unit = xs match {
+ case x at N => println(x); println(x);
+ }
+
+ empty(L())
+}
diff --git a/test/pending/run/complicatedmatch.check b/test/pending/run/complicatedmatch.check
new file mode 100644
index 0000000..501b7a3
--- /dev/null
+++ b/test/pending/run/complicatedmatch.check
@@ -0,0 +1,6 @@
+1
+42
+42
+11
+7
+13
diff --git a/test/pending/run/complicatedmatch.scala b/test/pending/run/complicatedmatch.scala
new file mode 100644
index 0000000..c837c32
--- /dev/null
+++ b/test/pending/run/complicatedmatch.scala
@@ -0,0 +1,31 @@
+object Bar{
+ def unapply(x : String) = x == "bar";
+}
+
+object Even{
+ def unapply(x : Int) = if (x % 2 == 0) Some(x / 2) else None;
+}
+
+object Test extends Application{
+ val LongWord = "supercalifragilisticexpialadocious";
+
+ def foo(x : Int, y : String) : Int = (x, y) match {
+ case (Even(i), "bar") => 1
+ case (1 | 2 | 3, "foo") => 42;
+ case (x, y) if y.length < x => 11;
+ case (1 | 2 | 3, Bar()) => 7;
+ case (1 | 2 | 3, "bar") => 8
+ case (Even(Even(3)), Bar()) => 13;
+ case (Even(Even(3)), LongWord) => 13;
+ case _ => 0;
+ }
+
+ List(
+ 2 -> "bar",
+ 2 -> "foo",
+ 3 -> "foo",
+ 7 -> "flob",
+ 3 -> "bar",
+ 12 -> LongWord
+ ).foreach({case (x, y) => println(foo(x, y))});
+}
diff --git a/test/pending/run/mixins.scala b/test/pending/run/mixins.scala
new file mode 100644
index 0000000..c7926c9
--- /dev/null
+++ b/test/pending/run/mixins.scala
@@ -0,0 +1,6 @@
+trait A { val x: Int }
+trait B extends A { override val x = 1 } // with A
+trait C extends A { override val x = 2 } // with A
+object Test extends B with C with Application {
+ println(x)
+}
diff --git a/test/pending/run/preinits.scala b/test/pending/run/preinits.scala
new file mode 100644
index 0000000..8de43b6
--- /dev/null
+++ b/test/pending/run/preinits.scala
@@ -0,0 +1,6 @@
+trait A { val x: Int; println("A") }
+trait B extends { override val x = 1 } with A { println("B") }
+trait C extends { override val x = 2 } with A
+object Test extends B with C with Application {
+ println(x)
+}
diff --git a/test/pending/run/t0508.scala b/test/pending/run/t0508.scala
deleted file mode 100644
index 8dc34dd..0000000
--- a/test/pending/run/t0508.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-object Test extends Application {
-
- case class Foo(s: String, n: Int)
-
- def foo[A, B, C](unapply1: A => Option[(B, C)], v: A) = {
- unapply1(v) match {
- case Some((fst, snd)) => println("first: " + fst, " second: " + snd)
- case _ => println(":(")
- }
- }
-
- foo(Foo.unapply, Foo("this might be fun", 10))
-}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/scala-2.10.git
More information about the pkg-java-commits
mailing list