summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--bincompat-backward.whitelist.conf217
-rw-r--r--bincompat-forward.whitelist.conf1266
-rw-r--r--build.examples.xml283
-rw-r--r--build.number2
-rw-r--r--build.xml59
-rw-r--r--docs/LICENSE36
-rw-r--r--docs/README58
-rw-r--r--docs/examples/actors/auction.scala131
-rw-r--r--docs/examples/actors/boundedbuffer.scala37
-rw-r--r--docs/examples/actors/channels.scala32
-rw-r--r--docs/examples/actors/fringe.scala82
-rw-r--r--docs/examples/actors/links.scala47
-rw-r--r--docs/examples/actors/looping.scala26
-rw-r--r--docs/examples/actors/message.scala40
-rw-r--r--docs/examples/actors/pingpong.scala61
-rw-r--r--docs/examples/actors/producers.scala114
-rw-r--r--docs/examples/actors/seq.scala15
-rw-r--r--docs/examples/boundedbuffer.scala46
-rw-r--r--docs/examples/computeserver.scala54
-rw-r--r--docs/examples/expressions/expressions-current.scala68
-rw-r--r--docs/examples/fors.scala112
-rw-r--r--docs/examples/futures.scala17
-rw-r--r--docs/examples/gadts.scala22
-rw-r--r--docs/examples/iterators.scala28
-rw-r--r--docs/examples/jolib/Ref.scala55
-rw-r--r--docs/examples/jolib/parallelOr.scala58
-rw-r--r--docs/examples/maps.scala187
-rw-r--r--docs/examples/monads/callccInterpreter.scala86
-rw-r--r--docs/examples/monads/directInterpreter.scala55
-rw-r--r--docs/examples/monads/errorInterpreter.scala86
-rw-r--r--docs/examples/monads/simpleInterpreter.scala75
-rw-r--r--docs/examples/monads/stateInterpreter.scala86
-rw-r--r--docs/examples/oneplacebuffer.scala64
-rw-r--r--docs/examples/parsing/ArithmeticParser.scala57
-rw-r--r--docs/examples/parsing/ArithmeticParsers.scala70
-rw-r--r--docs/examples/parsing/JSON.scala44
-rw-r--r--docs/examples/parsing/ListParser.scala33
-rw-r--r--docs/examples/parsing/ListParsers.scala30
-rw-r--r--docs/examples/parsing/MiniML.scala52
-rw-r--r--docs/examples/parsing/lambda/Main.scala34
-rw-r--r--docs/examples/parsing/lambda/TestParser.scala68
-rw-r--r--docs/examples/parsing/lambda/TestSyntax.scala86
-rw-r--r--docs/examples/parsing/lambda/test/test-01.kwi1
-rw-r--r--docs/examples/parsing/lambda/test/test-02.kwi1
-rw-r--r--docs/examples/parsing/lambda/test/test-03.kwi1
-rw-r--r--docs/examples/parsing/lambda/test/test-04.kwi1
-rw-r--r--docs/examples/parsing/lambda/test/test-05.kwi1
-rw-r--r--docs/examples/parsing/lambda/test/test-06.kwi1
-rw-r--r--docs/examples/parsing/lambda/test/test-07.kwi1
-rw-r--r--docs/examples/parsing/lambda/test/test-08.kwi1
-rw-r--r--docs/examples/patterns.scala36
-rw-r--r--docs/examples/pilib/elasticBuffer.scala77
-rw-r--r--docs/examples/pilib/handover.scala186
-rw-r--r--docs/examples/pilib/mobilePhoneProtocol.scala172
-rw-r--r--docs/examples/pilib/piNat.scala89
-rw-r--r--docs/examples/pilib/rwlock.scala329
-rw-r--r--docs/examples/pilib/scheduler.scala150
-rw-r--r--docs/examples/pilib/semaphore.scala72
-rw-r--r--docs/examples/pilib/twoPlaceBuffer.scala67
-rw-r--r--docs/examples/plugintemplate/.classpath11
-rw-r--r--docs/examples/plugintemplate/.project18
-rw-r--r--docs/examples/plugintemplate/build.xml265
-rw-r--r--docs/examples/plugintemplate/doc/README68
-rw-r--r--docs/examples/plugintemplate/doc/examples/plugintemplate/examples/BasicExample.scala8
-rw-r--r--docs/examples/plugintemplate/lib/scalatest.jar.desired.sha11
-rw-r--r--docs/examples/plugintemplate/misc/scalac-plugin.xml4
-rw-r--r--docs/examples/plugintemplate/plugin.properties10
-rw-r--r--docs/examples/plugintemplate/src/plugintemplate/PluginProperties.scala61
-rw-r--r--docs/examples/plugintemplate/src/plugintemplate/TemplateAnnotationChecker.scala20
-rw-r--r--docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala35
-rw-r--r--docs/examples/plugintemplate/src/plugintemplate/TemplateInfoTransformComponent.scala79
-rw-r--r--docs/examples/plugintemplate/src/plugintemplate/TemplatePlugin.scala52
-rw-r--r--docs/examples/plugintemplate/src/plugintemplate/TemplateTransformComponent.scala58
-rw-r--r--docs/examples/plugintemplate/src/plugintemplate/TemplateTraverseComponent.scala32
-rw-r--r--docs/examples/plugintemplate/src/plugintemplate/standalone/Main.scala44
-rw-r--r--docs/examples/plugintemplate/src/plugintemplate/standalone/PluginRunner.scala36
-rw-r--r--docs/examples/plugintemplate/test/plugintemplate/PluginPropertiesSuite.scala14
-rw-r--r--docs/examples/plugintemplate/test/plugintemplate/TemplatePluginSuite.scala22
-rw-r--r--docs/examples/sort.scala48
-rw-r--r--docs/examples/sort1.scala22
-rw-r--r--docs/examples/sort2.scala25
-rw-r--r--docs/examples/swing/ButtonApp.scala24
-rw-r--r--docs/examples/swing/CelsiusConverter.scala42
-rw-r--r--docs/examples/swing/CelsiusConverter2.scala36
-rw-r--r--docs/examples/swing/ComboBoxes.scala86
-rw-r--r--docs/examples/swing/CountButton.scala30
-rw-r--r--docs/examples/swing/Dialogs.scala176
-rw-r--r--docs/examples/swing/GridBagDemo.scala64
-rw-r--r--docs/examples/swing/HelloWorld.scala13
-rw-r--r--docs/examples/swing/LabelTest.scala19
-rw-r--r--docs/examples/swing/LinePainting.scala53
-rw-r--r--docs/examples/swing/ListViewDemo.scala17
-rw-r--r--docs/examples/swing/SimpleApplet.scala18
-rw-r--r--docs/examples/swing/SwingApp.scala29
-rw-r--r--docs/examples/swing/TableSelection.scala96
-rw-r--r--docs/examples/swing/UIDemo.scala147
-rw-r--r--docs/examples/swing/images/banana.jpgbin6000 -> 0 bytes
-rw-r--r--docs/examples/swing/images/margarita1.jpgbin14770 -> 0 bytes
-rw-r--r--docs/examples/swing/images/margarita2.jpgbin17310 -> 0 bytes
-rw-r--r--docs/examples/swing/images/rose.jpgbin13808 -> 0 bytes
-rw-r--r--docs/examples/tcpoly/collection/HOSeq.scala167
-rw-r--r--docs/examples/tcpoly/monads/Monads.scala69
-rw-r--r--docs/examples/typeinf.scala253
-rw-r--r--docs/examples/xml/phonebook/embeddedBook.scala26
-rw-r--r--docs/examples/xml/phonebook/phonebook.scala38
-rw-r--r--docs/examples/xml/phonebook/phonebook1.scala21
-rw-r--r--docs/examples/xml/phonebook/phonebook2.scala25
-rw-r--r--docs/examples/xml/phonebook/phonebook3.scala81
-rw-r--r--docs/examples/xml/phonebook/verboseBook.scala24
-rw-r--r--docs/licenses/apache_android.txt16
-rw-r--r--docs/licenses/apache_ant.txt16
-rw-r--r--docs/licenses/apache_jansi.txt203
-rw-r--r--docs/licenses/bsd_asm.txt31
-rw-r--r--docs/licenses/bsd_jline.txt2
-rw-r--r--src/asm/scala/tools/asm/MethodWriter.java7
-rw-r--r--src/build/maven/maven-deploy.xml20
-rw-r--r--src/build/pack.xml2
-rw-r--r--src/compiler/scala/tools/ant/templates/tool-windows.tmpl17
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala7
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala5
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala5
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Members.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala38
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala8
-rw-r--r--src/compiler/scala/tools/nsc/interactive/CompilerControl.scala23
-rw-r--r--src/compiler/scala/tools/nsc/interactive/ContextTrees.scala65
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala47
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Picklers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interactive/REPL.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala23
-rw-r--r--src/compiler/scala/tools/nsc/interactive/tests/core/CoreTestDefs.scala47
-rw-r--r--src/compiler/scala/tools/nsc/interactive/tests/core/TestMarker.scala4
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala16
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ILoop.scala28
-rw-r--r--src/compiler/scala/tools/nsc/symtab/BrowsingLoaders.scala6
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala7
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala21
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala12
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala10
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala9
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala14
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala48
-rw-r--r--src/compiler/scala/tools/reflect/ToolBoxFactory.scala9
-rw-r--r--src/library/scala/MatchError.scala10
-rw-r--r--src/library/scala/collection/TraversableLike.scala2
-rw-r--r--src/library/scala/collection/generic/GenericClassTagCompanion.scala2
-rw-r--r--src/library/scala/collection/generic/GenericCompanion.scala2
-rw-r--r--src/library/scala/collection/generic/GenericOrderedCompanion.scala2
-rw-r--r--src/library/scala/collection/immutable/TrieIterator.scala2
-rw-r--r--src/library/scala/collection/parallel/ParSeqLike.scala2
-rw-r--r--src/library/scala/concurrent/ExecutionContext.scala2
-rw-r--r--src/library/scala/concurrent/Future.scala5
-rw-r--r--src/reflect/scala/reflect/api/Universe.scala10
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala13
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala37
-rw-r--r--src/swing/scala/swing/Publisher.scala2
-rw-r--r--starr.number3
-rw-r--r--test/disabled/presentation/doc.check (renamed from test/files/presentation/doc.check)0
-rwxr-xr-xtest/disabled/presentation/doc/doc.scala (renamed from test/files/presentation/doc/doc.scala)0
-rwxr-xr-xtest/disabled/presentation/doc/src/Class.scala (renamed from test/files/presentation/doc/src/Class.scala)0
-rwxr-xr-xtest/disabled/presentation/doc/src/p/Base.scala (renamed from test/files/presentation/doc/src/p/Base.scala)0
-rwxr-xr-xtest/disabled/presentation/doc/src/p/Derived.scala (renamed from test/files/presentation/doc/src/p/Derived.scala)0
-rw-r--r--test/disabled/run/t6026.check9
-rw-r--r--test/disabled/run/t6026.scala9
-rw-r--r--test/files/android/HelloAndroid.scala16
-rw-r--r--test/files/android/HelloAndroid.xml11
-rw-r--r--test/files/disabled/t7020.check (renamed from test/files/neg/t7020.check)0
-rw-r--r--test/files/disabled/t7020.flags (renamed from test/files/neg/t7020.flags)0
-rw-r--r--test/files/disabled/t7020.scala (renamed from test/files/neg/t7020.scala)0
-rw-r--r--test/files/jvm/future-spec/PromiseTests.scala4
-rw-r--r--test/files/jvm/scala-concurrent-tck.scala4
-rw-r--r--test/files/neg/applydynamic_sip.check8
-rw-r--r--test/files/neg/classmanifests_new_deprecations.check8
-rw-r--r--test/files/neg/macro-invalidimpl-f.check2
-rw-r--r--test/files/neg/macro-invalidimpl-g.check2
-rw-r--r--test/files/neg/macro-invalidret-nontree.check2
-rw-r--r--test/files/neg/macro-invalidret-nonuniversetree.check2
-rw-r--r--test/files/neg/macro-invalidsig-context-bounds.check5
-rw-r--r--test/files/neg/macro-invalidsig-ctx-badargc.check2
-rw-r--r--test/files/neg/macro-invalidsig-ctx-badtype.check2
-rw-r--r--test/files/neg/macro-invalidsig-ctx-badvarargs.check2
-rw-r--r--test/files/neg/macro-invalidsig-ctx-noctx.check2
-rw-r--r--test/files/neg/macro-invalidsig-implicit-params.check5
-rw-r--r--test/files/neg/macro-invalidsig-params-badargc.check2
-rw-r--r--test/files/neg/macro-invalidsig-params-badtype.check2
-rw-r--r--test/files/neg/macro-invalidsig-params-badvarargs.check2
-rw-r--r--test/files/neg/macro-invalidsig-params-namemismatch.check2
-rw-r--r--test/files/neg/macro-invalidsig-tparams-badtype.check2
-rw-r--r--test/files/neg/macro-invalidsig-tparams-notparams-a.check2
-rw-r--r--test/files/neg/macro-invalidsig-tparams-notparams-b.check2
-rw-r--r--test/files/neg/t5689.check2
-rw-r--r--test/files/neg/t6426.check7
-rw-r--r--test/files/neg/t6426.scala5
-rw-r--r--test/files/neg/t6563.check4
-rw-r--r--test/files/neg/t6563.scala8
-rw-r--r--test/files/neg/t7519-b.check4
-rw-r--r--test/files/neg/t7519-b/Mac_1.scala14
-rw-r--r--test/files/neg/t7519-b/Use_2.scala8
-rw-r--r--test/files/neg/t7519.check7
-rw-r--r--test/files/neg/t7519.scala18
-rw-r--r--test/files/neg/t7783.check16
-rw-r--r--test/files/neg/t7783.flags1
-rw-r--r--test/files/neg/t7783.scala15
-rw-r--r--test/files/neg/t8104a.check4
-rw-r--r--test/files/neg/t8104a/Macros_1.scala23
-rw-r--r--test/files/neg/t8104a/Test_2.scala20
-rw-r--r--test/files/neg/t8104b.check4
-rw-r--r--test/files/neg/t8104b/Macros_1.scala23
-rw-r--r--test/files/neg/t8104b/Test_2.scala24
-rw-r--r--test/files/neg/t8146-non-finitary-2.check9
-rw-r--r--test/files/neg/t8146-non-finitary-2.scala8
-rw-r--r--test/files/neg/t8146-non-finitary.check9
-rw-r--r--test/files/neg/t8146-non-finitary.scala7
-rw-r--r--test/files/pos/SI-4012-a.scala7
-rw-r--r--test/files/pos/SI-4012-b.scala15
-rw-r--r--test/files/pos/t7776.check0
-rw-r--r--test/files/pos/t7776.scala12
-rw-r--r--test/files/pos/t7815.scala30
-rw-r--r--test/files/pos/t8060.scala11
-rw-r--r--test/files/pos/t8062.flags1
-rw-r--r--test/files/pos/t8062/A_1.scala5
-rw-r--r--test/files/pos/t8062/B_2.scala3
-rw-r--r--test/files/pos/t8111.scala24
-rw-r--r--test/files/pos/t8138.scala24
-rw-r--r--test/files/pos/t8146a.scala9
-rw-r--r--test/files/pos/t8146b.scala77
-rw-r--r--test/files/pos/t8152-performance.scala13
-rw-r--r--test/files/presentation/callcc-interpreter.check2
-rw-r--r--test/files/presentation/completion-implicit-chained.check29
-rw-r--r--test/files/presentation/completion-implicit-chained/Test.scala3
-rw-r--r--test/files/presentation/completion-implicit-chained/src/Completions.scala12
-rw-r--r--test/files/presentation/ide-bug-1000349.check2
-rw-r--r--test/files/presentation/ide-bug-1000475.check6
-rw-r--r--test/files/presentation/ide-bug-1000531.check2
-rw-r--r--test/files/presentation/ide-t1001388.check1
-rw-r--r--test/files/presentation/ide-t1001388/Test.scala28
-rw-r--r--test/files/presentation/ide-t1001388/src/a/A.scala6
-rw-r--r--test/files/presentation/implicit-member.check2
-rw-r--r--test/files/presentation/ping-pong.check4
-rw-r--r--test/files/presentation/scope-completion-1.check19
-rw-r--r--test/files/presentation/scope-completion-1/Test.scala3
-rw-r--r--test/files/presentation/scope-completion-1/src/Completions.scala12
-rw-r--r--test/files/presentation/scope-completion-2.check33
-rw-r--r--test/files/presentation/scope-completion-2/Test.scala3
-rw-r--r--test/files/presentation/scope-completion-2/src/Completions.scala31
-rw-r--r--test/files/presentation/scope-completion-3.check111
-rw-r--r--test/files/presentation/scope-completion-3/Test.scala3
-rw-r--r--test/files/presentation/scope-completion-3/src/Completions.scala106
-rw-r--r--test/files/presentation/scope-completion-4.check293
-rw-r--r--test/files/presentation/scope-completion-4/Test.scala3
-rw-r--r--test/files/presentation/scope-completion-4/src/Completions.scala84
-rw-r--r--test/files/presentation/scope-completion-import.check193
-rw-r--r--test/files/presentation/scope-completion-import/Test.scala3
-rw-r--r--test/files/presentation/scope-completion-import/src/Completions.scala72
-rw-r--r--test/files/presentation/t5708.check2
-rw-r--r--test/files/presentation/t7548.check1
-rw-r--r--test/files/presentation/t7548/Test.scala17
-rw-r--r--test/files/presentation/t7548/src/Foo.scala7
-rw-r--r--test/files/presentation/t7548b.check1
-rw-r--r--test/files/presentation/t7548b/Test.scala17
-rw-r--r--test/files/presentation/t7548b/src/Foo.scala12
-rw-r--r--test/files/presentation/t7915.check11
-rw-r--r--test/files/presentation/t7915/Test.scala8
-rw-r--r--test/files/presentation/t7915/src/Foo.scala9
-rw-r--r--test/files/presentation/t8085.check3
-rw-r--r--test/files/presentation/t8085.flags1
-rw-r--r--test/files/presentation/t8085/Test.scala27
-rw-r--r--test/files/presentation/t8085/src/nodescala/Foo.scala3
-rw-r--r--test/files/presentation/t8085/src/nodescala/NodeScalaSuite.scala10
-rw-r--r--test/files/presentation/t8085/src/nodescala/package.scala7
-rw-r--r--test/files/presentation/t8085b.check3
-rw-r--r--test/files/presentation/t8085b.flags1
-rw-r--r--test/files/presentation/t8085b/Test.scala27
-rw-r--r--test/files/presentation/t8085b/src/p1/nodescala/Foo.scala4
-rw-r--r--test/files/presentation/t8085b/src/p1/nodescala/NodeScalaSuite.scala11
-rw-r--r--test/files/presentation/t8085b/src/p1/nodescala/package.scala9
-rw-r--r--test/files/presentation/visibility.check10
-rw-r--r--test/files/run/dynamic-applyDynamic.check14
-rw-r--r--test/files/run/dynamic-applyDynamic.scala26
-rw-r--r--test/files/run/dynamic-applyDynamicNamed.check14
-rw-r--r--test/files/run/dynamic-applyDynamicNamed.scala26
-rw-r--r--test/files/run/dynamic-selectDynamic.check13
-rw-r--r--test/files/run/dynamic-selectDynamic.scala25
-rw-r--r--test/files/run/dynamic-updateDynamic.check14
-rw-r--r--test/files/run/dynamic-updateDynamic.scala28
-rw-r--r--test/files/run/large_code.check3
-rw-r--r--test/files/run/large_code.scala24
-rw-r--r--test/files/run/t4542.check3
-rw-r--r--test/files/run/t6546.flags1
-rw-r--r--test/files/run/t6546/A_1.scala6
-rw-r--r--test/files/run/t6546/B_2.scala8
-rw-r--r--test/files/run/t7439.check1
-rw-r--r--test/files/run/t7439/A_1.java3
-rw-r--r--test/files/run/t7439/B_1.java3
-rw-r--r--test/files/run/t7439/Test_2.scala31
-rw-r--r--test/files/run/t7912.scala16
-rw-r--r--test/files/run/t8010.scala22
-rw-r--r--test/files/run/t8029.scala57
-rw-r--r--test/files/run/t8114.scala15
-rw-r--r--test/files/run/toolbox_rangepos.check1
-rw-r--r--test/files/run/toolbox_rangepos.scala8
303 files changed, 2870 insertions, 7962 deletions
diff --git a/.gitignore b/.gitignore
index f90835d970..4329fce06f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,7 @@
# Developer specific Ant properties
/build.properties
+/buildcharacter.properties
# target directories for ant build
/build/
diff --git a/bincompat-backward.whitelist.conf b/bincompat-backward.whitelist.conf
index 0500ec10ab..2d3c20370d 100644
--- a/bincompat-backward.whitelist.conf
+++ b/bincompat-backward.whitelist.conf
@@ -1,4 +1,7 @@
filter {
+ packages = [
+ "scala.reflect.internal"
+ ]
problems=[
# Scala library
{
@@ -61,136 +64,6 @@ filter {
# problemName=IncompatibleResultTypeProblem
# },
-
- # scala.reflect.internal
- {
- matchName="scala.reflect.internal.TreeInfo.scala$reflect$internal$TreeInfo$$isVarPatternDeep0$1"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo.typeArguments"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo.applyDepth"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo.firstTypeArg"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo.methPart"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo.firstArgument"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Trees.DefDef"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ExistentialsAndSkolems.deskolemizeTypeParams"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.deAlias"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.deskolemizeTypeParams"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.AnnotationInfos#Annotatable.addThrowsAnnotation"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.StdAttachments#Attachable.setAttachments"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types#TypeVar.scala$reflect$internal$Types$TypeVar$$addBound$1"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.AnnotationCheckers$AnnotationChecker"
- problemName=IncompatibleTemplateDefProblem
- },
- {
- matchName="scala.reflect.internal.Types.deAlias"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.inheritsJavaVarArgsMethod"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.nonTrivialMembers"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.isJavaVarargsAncestor"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.nestedMemberType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.normalizeAliases"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Trees#ChangeOwnerTraverser.changeOwner"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.StdAttachments.SuppressMacroExpansionAttachment"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.Statistics#RelCounter.scala$reflect$internal$util$Statistics$RelCounter$$super$prefix"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Names#NameOps.name"
- problemName=MissingFieldProblem
- },
- {
- matchName="scala.reflect.internal.ExistentialsAndSkolems.existentialTransform$default$3"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ExistentialsAndSkolems.existentialTransform"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ExistentialsAndSkolems.packSymbols"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ExistentialsAndSkolems.packSymbols$default$3"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ExistentialsAndSkolems.isRawParameter"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Trees.substituteInfoParamsIntoDefDef"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ClassfileConstants.xxxunusedxxxx"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types#TypeVar.setInst"
- problemName=IncompatibleResultTypeProblem
- },
# scala.concurrent.forkjoin (SI-7442)
{
matchName="scala.concurrent.forkjoin.ForkJoinTask.internalGetCompleter"
@@ -221,96 +94,12 @@ filter {
problemName=IncompatibleResultTypeProblem
},
{
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.getClassMethods"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.primitiveGetClassMethods"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.StdAttachments.unsuppressMacroExpansion"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.StdAttachments.suppressMacroExpansion"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.StdAttachments.isMacroExpansionSuppressed"
- problemName=MissingMethodProblem
- },
- {
matchName="scala.reflect.runtime.JavaUniverse.isInvalidClassName"
problemName=MissingMethodProblem
},
{
matchName="scala.reflect.runtime.SymbolLoaders.isInvalidClassName"
problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.uncheckedBounds"
- problemName=MissingMethodProblem
- }
- {
- matchName="scala.reflect.internal.Trees.scala$reflect$internal$Trees$$duplicator"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Trees.duplicateAndKeepPositions"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Trees.scala$reflect$internal$Trees$$duplicator"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.scala$reflect$internal$Trees$$duplicator"
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.internal.StdNames.compactifyName"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet"
- problemName=FinalClassProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakReferenceWithEquals"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.scala$reflect$internal$Types$$uniques"
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.scala$reflect$internal$Types$$uniques_="
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.reflect.internal.Types.scala$reflect$internal$Types$$uniques"
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.internal.Types.scala$reflect$internal$Types$$uniques_="
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.reflect.internal.Types.scala$reflect$internal$Types$$uniques"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.scala$reflect$internal$Types$$uniques_="
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.HasFlags.isDeferredOrDefault"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.HasFlags.isDeferredNotDefault"
- problemName=MissingMethodProblem
}
]
}
diff --git a/bincompat-forward.whitelist.conf b/bincompat-forward.whitelist.conf
index 2ece671638..087fa07b37 100644
--- a/bincompat-forward.whitelist.conf
+++ b/bincompat-forward.whitelist.conf
@@ -1,4 +1,7 @@
filter {
+ packages = [
+ "scala.reflect.internal"
+ ]
problems=[
# rework d526f8bd74 to duplicate tailImpl as a private method
# {
@@ -98,339 +101,6 @@ filter {
# problemName=MissingMethodProblem
# },
- # scala.reflect.internal
- {
- matchName="scala.reflect.internal.Types#Type.dealiasWidenChain"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types#Type.dealiasWiden"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types#Type.addThrowsAnnotation"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types#TypeVar.scala$reflect$internal$Types$TypeVar$$unifySpecific$1"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types#SubstSymMap.mapTreeSymbols"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types#SubstSymMap.this"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.PrivateWithin"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo$Applied"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.AnnotationInfos#Annotatable.addThrowsAnnotation"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.inheritsJavaVarArgsMethod"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.nonTrivialMembers"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.isJavaVarargsAncestor"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.normalizeAliases"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.nestedMemberType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.deAlias"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ExistentialsAndSkolems.deskolemizeTypeParams"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.StdAttachments#Attachable.setAttachments"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.AnnotationInfos#AnnotationInfo.completeInfo"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Symbols#Symbol.isCompileTimeOnly"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Symbols#Symbol.addThrowsAnnotation"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Symbols#Symbol.toOption"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Symbols#Symbol.compileTimeOnlyMessage"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Symbols#Symbol.setAttachments"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Symbols#Symbol.addAnnotation"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.reflect.internal.Trees.DefDef"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Trees$TreeStackTraverser"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.Trees#ChangeOwnerTraverser.change"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.AnnotationCheckers$AnnotationChecker"
- problemName=IncompatibleTemplateDefProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo$Applied$"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.Trees#Tree.setAttachments"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.StdNames#TermNames.DEFAULT_CASE"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo.Applied"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo.isWildcardStarType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo.isSyntheticDefaultCase"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo.StripCast"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo.dissectApplied"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo.stripCast"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable"
- problemName=MissingTypesProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.StringContextStripMarginOps"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.inheritsJavaVarArgsMethod"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.assertCorrectThread"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.SuppressMacroExpansionAttachment"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.nonTrivialMembers"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.isJavaVarargsAncestor"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.normalizeAliases"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.DefDef"
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.nestedMemberType"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.importPrivateWithinFromJavaFlags"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.StdAttachments.SuppressMacroExpansionAttachment"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.ArrayModule_genericApply"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.allParameters"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.Predef_wrapArray"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.dropNullaryMethod"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.ArrayModule_apply"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.OptionModule"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.Option_apply"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.CompileTimeOnlyAttr"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.AnnotationInfos#LazyAnnotationInfo.completeInfo"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.package"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.util.package$"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.util.StripMarginInterpolator"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.util.package$StringContextStripMarginOps"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.annotations.compileTimeOnly"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.StdNames#TermNames.SelectFromTypeTree"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ExistentialsAndSkolems.existentialTransform$default$3"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ExistentialsAndSkolems.existentialTransform"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ExistentialsAndSkolems.packSymbols"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ExistentialsAndSkolems.packSymbols$default$3"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ExistentialsAndSkolems.isRawParameter"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Trees.substituteInfoParamsIntoDefDef"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.existentialTransform$default$3"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.existentialTransform"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.substituteInfoParamsIntoDefDef"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.packSymbols"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.packSymbols$default$3"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.isRawParameter"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ClassfileConstants.CONSTANT_INVOKEDYNAMIC"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ClassfileConstants.invokedynamic"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ClassfileConstants.CONSTANT_METHODHANDLE"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ClassfileConstants.CONSTANT_METHODTYPE"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types#TypeVar.setInst"
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.internal.TreeInfo.effectivePatternArity"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.ModifierFlags.DEFAULTMETHOD"
- problemName=MissingMethodProblem
- },
# scala.concurrent.forkjoin (SI-7442)
{
matchName="scala.concurrent.forkjoin.ForkJoinPool.registerWorker"
@@ -481,38 +151,6 @@ filter {
problemName=MissingMethodProblem
},
{
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.getClassMethods"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.primitiveGetClassMethods"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.StdAttachments.unsuppressMacroExpansion"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.StdAttachments.suppressMacroExpansion"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.StdAttachments.isMacroExpansionSuppressed"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.unsuppressMacroExpansion"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.suppressMacroExpansion"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.isMacroExpansionSuppressed"
- problemName=MissingMethodProblem
- },
- {
matchName="scala.reflect.runtime.JavaMirrors#JavaMirror#FromJavaClassCompleter.scala$reflect$runtime$JavaMirrors$JavaMirror$FromJavaClassCompleter$$enterEmptyCtorIfNecessary$1"
problemName=MissingMethodProblem
},
@@ -529,907 +167,11 @@ filter {
problemName=MissingMethodProblem
},
{
- matchName="scala.reflect.runtime.SymbolLoaders.isInvalidClassName"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.uncheckedBounds"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.uncheckedBounds"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Definitions#DefinitionsClass.UncheckedBoundsClass"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.annotations.uncheckedBounds"
- problemName=MissingClassProblem
- }
- {
- matchName="scala.reflect.internal.Trees$Duplicator"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.Trees.duplicateAndKeepPositions"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Trees.scala$reflect$internal$Trees$$duplicator"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Trees.scala$reflect$internal$Trees$$duplicator"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.duplicateAndKeepPositions"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.scala$reflect$internal$Trees$$duplicator"
- problemName=IncompatibleResultTypeProblem
- },
- {
matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$PackageAndClassPattern"
problemName=MissingMethodProblem
},
{
- matchName="scala.reflect.internal.SymbolTable.compactifyName"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.StdNames.compactifyName"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet$Diagnostics"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet$Entry"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet$"
- problemName=MissingClassProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet"
- problemName=MissingTypesProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.newBuilder"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.min"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.initialCapacity"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.foldLeft"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toIterable"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toIterable"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.union"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.union"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.groupBy"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.groupBy"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toSet"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toSet"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toSeq"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toSeq"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toIndexedSeq"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.unzip3"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.nonEmpty"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.slice"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.max"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.addString"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.addString"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.addString"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.subsetOf"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.fold"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toIterator"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.foreach"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.flatten"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.headOption"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.mapResult"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.scala$reflect$internal$util$WeakHashSet$$bucketFor"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toTraversable"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toTraversable"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.filter"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.tails"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.last"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.collect"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.takeRight"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.lastOption"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.reduceRightOption"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.+"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.+"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.+"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.+"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.+"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.+"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.take"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.zipWithIndex"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.foldRight"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.hasDefiniteSize"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.<<"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.sliceWithKnownBound"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.to"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.result"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.result"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.isTraversableAgain"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.add"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.partition"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toBuffer"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.update"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.view"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.view"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.view"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.view"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.tail"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.zipAll"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.retain"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.find"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.withFilter"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.init"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.findEntryOrUpdate"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.diagnostics"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.zip"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.drop"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.:\\"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.companion"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toMap"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toMap"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.genericBuilder"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.unzip"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.seq"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.seq"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.seq"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.seq"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.seq"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.seq"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.seq"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.&~"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toStream"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.-="
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.-="
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.-="
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.splitAt"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.addEntry"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.aggregate"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.parCombiner"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.maxBy"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.sliding"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.sliding"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.repr"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.repr"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.scan"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.span"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toArray"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.findEntry"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toVector"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.scala$collection$SetLike$$super$map"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.dropWhile"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.forall"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.reduce"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.intersect"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.this"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.--="
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.loadFactor"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.copyToArray"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.copyToArray"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.copyToArray"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.canEqual"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.inits"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.sliceWithKnownDelta"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.grouped"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.minBy"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet./:"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.--"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.--"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.sameElements"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.par"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.equals"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.sizeHint"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.sizeHint"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.sizeHint"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet./:\\"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.threshhold_="
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.++"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.++"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.++"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.map"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.clone"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.clone"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.diff"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.diff"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.isEmpty"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.&"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.head"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toCollection"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toCollection"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.++:"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.++:"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.mkString"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.mkString"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.mkString"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.threshhold"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.iterator"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.toList"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.-"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.-"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.-"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.-"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.-"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.-"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.-"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.++="
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.takeWhile"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.exists"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.scanRight"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.transpose"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.sizeHintBounded"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.hashCode"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.scala$collection$mutable$Cloneable$$super$clone"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.remove"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.|"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.reduceLeft"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.count"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.scanLeft"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.reduceLeftOption"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.dropRight"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.collectFirst"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.flatMap"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.+="
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.+="
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.+="
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.+="
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.reversed"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.sum"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.filterNot"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.product"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.thisCollection"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.thisCollection"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.copyToBuffer"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.subsets"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.subsets"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.reduceRight"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.empty"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.empty"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.empty"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.stringPrefix"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.util.WeakHashSet.reduceOption"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.scala$reflect$internal$Types$$uniques"
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.internal.SymbolTable.scala$reflect$internal$Types$$uniques_="
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.reflect.internal.Types.scala$reflect$internal$Types$$uniques"
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.internal.Types.scala$reflect$internal$Types$$uniques_="
- problemName=IncompatibleMethTypeProblem
- },
- {
- matchName="scala.reflect.internal.Types.scala$reflect$internal$Types$$uniques"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Types.scala$reflect$internal$Types$$uniques_="
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Symbols#Symbol.isDeferredOrDefault"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Symbols#Symbol.isDeferredNotDefault"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.HasFlags.isDeferredOrDefault"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.HasFlags.isDeferredNotDefault"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Trees#Modifiers.isDeferredOrDefault"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.internal.Trees#Modifiers.isDeferredNotDefault"
+ matchName="scala.reflect.runtime.SymbolLoaders.isInvalidClassName"
problemName=MissingMethodProblem
}
]
diff --git a/build.examples.xml b/build.examples.xml
deleted file mode 100644
index 62210d5ece..0000000000
--- a/build.examples.xml
+++ /dev/null
@@ -1,283 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="scala-examples" default="build">
-
- <description>
- I am SABBUS for ${ant.project.name}, the build system for the Scala compiler
- and core library. Please check the 'docs/README' file for more information
- about me.
- </description>
-
- <echo level="info" message="Running SABBUS for ${ant.project.name}..."/>
-
-<!-- ===========================================================================
-PROPERTIES
-============================================================================ -->
-
- <property environment="env"/>
-
- <!-- Prevents system classpath from being used -->
- <property name="build.sysclasspath" value="ignore"/>
-
- <!-- Base properties -->
- <property name="src.dir" value="${basedir}/docs"/>
- <property name="src.examples.dir" value="${src.dir}/examples"/>
- <property name="lib.dir" value="${basedir}/lib"/>
- <!-- User properties -->
- <property file="${basedir}/build.examples.properties"/>
- <!-- Location of pre-compiled libraries properties -->
- <property name="scala.lib.jar" value="${lib.dir}/scala-library.jar"/>
- <property name="scala.comp.jar" value="${lib.dir}/scala-compiler.jar"/>
- <property name="fjbg.name" value="fjbg.jar"/>
- <property name="fjbg.jar" value="${lib.dir}/${fjbg.name}"/>
- <property name="msil.name" value="msil.jar"/>
- <property name="msil.jar" value="${lib.dir}/${msil.name}"/>
- <property name="ant.jar" value="${ant.home}/lib/ant.jar"/>
- <property name="ant-contrib.jar" value="${lib.dir}/ant/ant-contrib.jar"/>
- <!-- -->
- <property name="build.dir" value="${basedir}/build"/>
- <property name="build.examples.dir" value="${build.dir}/examples"/>
- <!-- tbd -->
- <property name="excludes.compile"
- value="**/*current.*,**/parsers2.*,**/typeinf.*"/>
- <property name="excludes.run"
- value="**/Parsers.*"/>
-
-<!-- ===========================================================================
-INITIALISATION
-============================================================================ -->
-
- <target name="init" unless="init.avail">
- <tstamp prefix="start">
- <format
- property="human-time"
- pattern="EEEE, d MMMM yyyy, HH:mm:ss (zz)"
- />
- </tstamp>
- <!-- Testing if everything is in place -->
- <echo level="verbose" message="scala.lib.jar=${scala.lib.jar}"/>
- <fail message="Scala library in '${lib.dir}/' is not available">
- <condition><not><and>
- <available
- classname="scala.Predef"
- classpath="${scala.lib.jar}"
- />
- <available
- classname="scala.collection.immutable.List"
- classpath="${scala.lib.jar}"
- />
- <available
- classname="scala.runtime.ObjectRef"
- classpath="${scala.lib.jar}"
- />
- </and></not></condition>
- </fail>
- <echo level="verbose" message="scala.comp.jar=${scala.comp.jar}"/>
- <fail message="Scala compiler in '${lib.dir}/' is not available">
- <condition><not>
- <available
- classname="scala.tools.ant.Scalac"
- classpath="${scala.comp.jar}:${scala.lib.jar}"
- />
- </not></condition>
- </fail>
- <echo level="verbose" message="fjbg.jar=${fjbg.jar}"/>
- <fail message="FJBG library in '${lib.dir}/' is not available">
- <condition><not>
- <available
- classname="ch.epfl.lamp.fjbg.JCode"
- classpath="${fjbg.jar}"
- />
- </not></condition>
- </fail>
- <echo level="verbose" message="msil.jar=${msil.jar}"/>
- <fail message="MSIL library in '${lib.dir}/' is not available">
- <condition><not>
- <available
- classname="ch.epfl.lamp.compiler.msil.MemberInfo"
- classpath="${msil.jar}"
- />
- </not></condition>
- </fail>
- <echo level="verbose" message="ant.jar=${ant.jar}"/>
- <echo level="verbose" message="ant-contrib.jar=${ant-contrib.jar}"/>
- <fail message="Additional Ant tasks in '${lib.dir}/' is not available">
- <condition><not>
- <available
- classname="net.sf.antcontrib.AntContribVersion"
- classpath="${ant-contrib.jar}"
- />
- </not></condition>
- </fail>
- <!-- Creating class-pathes -->
- <path id="common.classpath">
- <pathelement location="${fjbg.jar}"/>
- <pathelement location="${msil.jar}"/>
- </path>
- <path id="scala.classpath">
- <pathelement location="${scala.lib.jar}"/>
- <pathelement location="${scala.comp.jar}"/>
- <path refid="common.classpath"/>
- </path>
- <!-- Creating boot-level tasks -->
- <taskdef resource="net/sf/antcontrib/antlib.xml">
- <classpath>
- <pathelement location="${ant-contrib.jar}"/>
- </classpath>
- </taskdef>
- <!-- Finding out what system architecture is being used -->
- <condition property="os.win">
- <os family="windows"/>
- </condition>
- <if><isset property="os.win"/>
- <then>
- <exec
- executable="cygpath"
- vmlauncher="no"
- errorproperty="cygpath.err"
- outputproperty="cygpath.out"
- >
- <arg value="--windir"/>
- </exec>
- <condition property="os.cygwin">
- <equals arg1="${cygpath.err}" arg2=""/>
- </condition>
- </then>
- </if>
- <condition property="os.unix">
- <or>
- <os family="unix"/>
- <os family="mac"/>
- <isset property="os.cygwin"/>
- </or>
- </condition>
- <if><isset property="os.cygwin"/>
- <then><property name="os.type" value="Cygwin"/></then>
- <elseif><isset property="os.win"/>
- <then><property name="os.type" value="Windows"/></then>
- </elseif>
- <elseif><isset property="os.unix"/>
- <then><property name="os.type" value="UNIX"/></then>
- </elseif>
- <else>
- <fail>System environment could not be determined</fail>
- </else>
- </if>
- <echo
- level="info"
- message="OS: ${os.type} (${os.name} ${os.arch} ${os.version});"
- />
- <echo
- level="info"
- message="Java: ${java.version} ('${java.home}');"
- />
- <echo
- level="info"
- message="JVM: ${java.vm.name} ${java.vm.version};"
- />
- <echo
- level="info"
- message="Ant: ${ant.version}."
- />
- <property name="init.avail" value="yes"/>
- </target>
-
- <target name="setup" depends="init">
- <!-- Creating boot-level tasks -->
- <taskdef
- name="scalac"
- classname="scala.tools.ant.Scalac"
- classpathref="scala.classpath"
- />
- <property name="init.avail" value="yes"/>
- </target>
-
-<!-- ===========================================================================
-BUILD
-============================================================================ -->
-
- <target name="build" depends="setup">
- <mkdir dir="${build.dir}"/>
- <echo level="verbose">src.dir=${src.dir}</echo>
- <pathconvert property="list" pathsep=",">
- <path>
- <fileset
- dir="${src.dir}"
- includes="examples/*.scala"
- excludes="${excludes.compile}"
- />
- </path>
- <mapper>
- <globmapper from="${src.dir}/*" to="*"/>
- </mapper>
- </pathconvert>
- <for list="${list}" param="file">
- <sequential>
- <scalac srcdir="${src.dir}"
- destdir="${build.dir}" deprecation="true">
- <classpath>
- <pathelement location="${scala.lib.jar}"/>
- <pathelement location="${build.dir}"/>
- </classpath>
- <include name="@{file}"/>
- </scalac>
- </sequential>
- </for>
- </target>
-
-<!-- ===========================================================================
-RUN
-============================================================================ -->
-
- <target name="run" depends="build">
- <pathconvert property="list" pathsep=",">
- <path>
- <fileset
- dir="${src.dir}"
- includes="examples/*.scala"
- excludes="${excludes.run}"
- />
- </path>
- <mapper>
- <globmapper from="${src.dir}/*" to="*"/>
- </mapper>
- </pathconvert>
- <for list="${list}" param="file">
- <sequential>
- <var name="classname" unset="true"/>
- <basename property="classname" file="@{file}" suffix=".scala"/>
- <echo>Executing Scala program examples.${classname}..</echo>
- <java classname="examples.${classname}" fork="true"
- output="${build.examples.dir}/${classname}.log"
- error="${build.examples.dir}/${classname}.log"
- append="true">
- <classpath>
- <pathelement location="${scala.lib.jar}"/>
- <pathelement location="${build.dir}"/>
- </classpath>
- </java>
- </sequential>
- </for>
- </target>
-
-<!-- ===========================================================================
-CLEAN
-============================================================================ -->
-
- <macrodef name="remove">
- <attribute name="dir"/>
- <sequential>
- <delete
- dir="@{dir}"
- includeemptydirs="yes"
- quiet="yes"
- failonerror="no"
- />
- </sequential>
- </macrodef>
-
- <target name="clean" description="Removes all build examples">
- <remove dir="${build.examples.dir}"/>
- </target>
-
-</project>
diff --git a/build.number b/build.number
index d5dd553362..7c027e7797 100644
--- a/build.number
+++ b/build.number
@@ -1,7 +1,7 @@
#Tue Sep 11 19:21:09 CEST 2007
version.major=2
version.minor=10
-version.patch=3
+version.patch=4
# This is the -N part of a version. if it's 0, it's dropped from maven versions.
version.bnum=0
diff --git a/build.xml b/build.xml
index 8930f0a56c..a54b033b01 100644
--- a/build.xml
+++ b/build.xml
@@ -219,12 +219,14 @@ TODO:
</artifact:dependencies>
<!-- Pax runner -->
- <property name="pax.exam.version" value="2.5.0"/>
+ <property name="pax.exam.version" value="2.6.0"/>
<artifact:dependencies pathId="pax.exam.classpath" filesetId="pax.exam.fileset">
<dependency groupId="org.ops4j.pax.exam" artifactId="pax-exam-container-native" version="${pax.exam.version}"/>
<dependency groupId="org.ops4j.pax.exam" artifactId="pax-exam-junit4" version="${pax.exam.version}"/>
<dependency groupId="org.ops4j.pax.exam" artifactId="pax-exam-link-assembly" version="${pax.exam.version}"/>
- <dependency groupId="org.ops4j.pax.url" artifactId="pax-url-aether" version="1.4.0"/>
+ <!-- upgraded to 1.6.0 to get fix for https://ops4j1.jira.com/browse/PAXURL-217
+ https://ops4j1.jira.com/browse/PAXURL-138 is still unresolved... -->
+ <dependency groupId="org.ops4j.pax.url" artifactId="pax-url-aether" version="1.6.0"/>
<dependency groupId="org.ops4j.pax.swissbox" artifactId="pax-swissbox-framework" version="1.5.1"/>
<dependency groupId="ch.qos.logback" artifactId="logback-core" version="0.9.20"/>
<dependency groupId="ch.qos.logback" artifactId="logback-classic" version="0.9.20"/>
@@ -240,12 +242,15 @@ TODO:
<!-- BND support -->
<typedef resource="aQute/bnd/ant/taskdef.properties" classpathref="extra.tasks.classpath" />
+ <artifact:remoteRepository id="extra-repo" url="${extra.repo.url}"/>
+
<!-- Download STARR via maven if `starr.use.released` is set,
and `starr.version` is specified (see the starr.number properties file).
Want to slow down STARR changes, using only released versions. -->
<if><isset property="starr.use.released"/><then>
<echo message="Using Scala ${starr.version} for STARR."/>
<artifact:dependencies pathId="starr.core.path">
+ <artifact:remoteRepository refid="extra-repo"/>
<dependency groupId="org.scala-lang" artifactId="scala-library" version="${starr.version}"/>
<dependency groupId="org.scala-lang" artifactId="scala-reflect" version="${starr.version}"/>
<dependency groupId="org.scala-lang" artifactId="scala-compiler" version="${starr.version}"/>
@@ -416,6 +421,17 @@ TODO:
<echo message=" OSGi version: ${osgi.version.number}" />
<echo message="canonical version: ${version.number}" />
+ <echoproperties destfile="buildcharacter.properties">
+ <propertyset>
+ <propertyref regex="time.*" />
+ <propertyref regex="git.*" />
+ <propertyref name="java.vm.name" />
+ <propertyref regex=".*version.*" />
+ <propertyref regex="scalac.args.*" />
+ <propertyref name="scalacfork.jvmargs" />
+ </propertyset>
+ </echoproperties>
+
<!-- validate version suffixes -->
<if><equals arg1="${maven.version.suffix}" arg2="-SNAPSHOT"/><then>
<condition property="version.suffixes.consistent"><and>
@@ -1589,7 +1605,7 @@ TODO:
<mkdir dir="${bc-build.dir}"/>
<!-- Pull down MIMA -->
<artifact:dependencies pathId="mima.classpath">
- <dependency groupId="com.typesafe" artifactId="mima-reporter_2.9.2" version="0.1.5"/>
+ <dependency groupId="com.typesafe" artifactId="mima-reporter_2.10" version="0.1.6"/>
</artifact:dependencies>
<artifact:dependencies pathId="old.bc.classpath">
<dependency groupId="org.scala-lang" artifactId="scala-swing" version="${bc-reference-version}"/>
@@ -1821,18 +1837,11 @@ TODO:
<copy toDir="${dist.dir}/lib">
<fileset dir="${build-pack.dir}/lib">
<include name="jline.jar"/>
- <include name="scalacheck.jar"/>
- <include name="scala-partest.jar"/>
+ <include name="scala-partest.jar"/> <!-- needed for maven publish -->
<include name="scalap.jar"/>
</fileset>
</copy>
- <copy todir="${dist.dir}/lib">
- <resources refid="partest.extras.fileset"/>
- <mapper classpathref="maven-ant-tasks.classpath" classname="org.apache.maven.artifact.ant.VersionMapper"
- from="${partest.extras.versions}" to="flatten"/>
- </copy>
-
<mkdir dir="${dist.dir}/bin"/>
<!-- TODO - Stop being inefficient and don't copy OSGi bundles overtop other jars. -->
<copy-bundle name="scala-library"/>
@@ -1853,27 +1862,27 @@ TODO:
</target>
<target name="dist.doc" depends="dist.base, docs.done">
- <mkdir dir="${dist.dir}/doc/scala-devel-docs"/>
+ <mkdir dir="${dist.dir}/doc"/>
+ <mkdir dir="${dist.dir}/doc/licenses"/>
+ <mkdir dir="${dist.dir}/doc/tools"/>
<copy file="${docs.dir}/LICENSE" toDir="${dist.dir}/doc"/>
- <copy file="${docs.dir}/README" toDir="${dist.dir}/doc"/>
- <mkdir dir="${dist.dir}/doc/scala-devel-docs/api"/>
- <copy toDir="${dist.dir}/doc/scala-devel-docs/api">
- <fileset dir="${build-docs.dir}/library"/>
- </copy>
- <mkdir dir="${dist.dir}/doc/scala-devel-docs/examples"/>
- <copy toDir="${dist.dir}/doc/scala-devel-docs/examples">
- <fileset dir="${docs.dir}/examples">
- <exclude name="**/*.desired.sha1"/>
- </fileset>
+ <copy file="${docs.dir}/README" toDir="${dist.dir}/doc"/>
+ <copy toDir="${dist.dir}/doc/licenses">
+ <fileset dir="${docs.dir}/licenses"/>
</copy>
- <mkdir dir="${dist.dir}/doc/scala-devel-docs/tools"/>
- <copy toDir="${dist.dir}/doc/scala-devel-docs/tools">
+ <copy toDir="${dist.dir}/doc/tools">
<fileset dir="${build-docs.dir}/manual/html"/>
</copy>
+
+ <mkdir dir="${dist.dir}/api"/>
+ <copy toDir="${dist.dir}/api">
+ <fileset dir="${build-docs.dir}/library"/>
+ </copy>
<copy file="${src.dir}/swing/doc/README"
- toFile="${dist.dir}/doc/scala-devel-docs/README.scala-swing"/>
+ toFile="${dist.dir}/api/README.scala-swing"/>
</target>
+
<target name="dist.man" depends="dist.base">
<mkdir dir="${dist.dir}/man"/>
<copy toDir="${dist.dir}/man">
diff --git a/docs/LICENSE b/docs/LICENSE
index 446a1a350b..4daedef581 100644
--- a/docs/LICENSE
+++ b/docs/LICENSE
@@ -1,5 +1,11 @@
+Scala is licensed under the [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause).
+
+## Scala License
+
Copyright (c) 2002-2013 EPFL
+Copyright (c) 2011-2013 Typesafe, Inc.
+
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -25,3 +31,33 @@ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Other Licenses
+
+This software includes projects with the following licenses,
+which are also included in the `licenses/` directory:
+
+### [Apache License](http://www.apache.org/licenses/LICENSE-2.0.html)
+This license is used by the following third-party libraries:
+ * jansi
+
+### [BSD License](http://www.opensource.org/licenses/bsd-license.php)
+This license is used by the following third-party libraries:
+ * jline
+
+### [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)
+This license is used by the following third-party libraries:
+ * asm
+
+### [MIT License](http://www.opensource.org/licenses/MIT)
+This license is used by the following third-party libraries:
+ * jquery
+ * jquery-ui
+ * jquery-layout
+ * sizzle
+ * tools tooltip
+
+### Public Domain
+The following libraries are freely available in the public domain:
+ * forkjoin
+
diff --git a/docs/README b/docs/README
index 6af633444d..1d5f553d2e 100644
--- a/docs/README
+++ b/docs/README
@@ -1,58 +1,36 @@
+Scala Distribution
+------------------
-Scala Software Distributions
-----------------------------
-
-- scala-<major>.<minor>.<patch>.tgz Unix distribution
-- scala-<major>.<minor>.<patch>.zip Windows distribution
-
-The standard distributions require Java 1.5 or above. If you don't
-know which version of Java you have, run the command "java -version".
+The Scala distribution requires Java 1.6 or above.
+Please report bugs at https://issues.scala-lang.org/.
+We welcome contributions at https://github.com/scala/scala!
Scala Tools
-----------
-- fsc Scala offline compiler
+- scala Scala interactive interpreter
- scalac Scala compiler
+- fsc Scala resident compiler
- scaladoc Scala API documentation generator
-- scala Scala interactive interpreter
- scalap Scala classfile decoder
Run the command "scalac -help" to display the list of available
compiler options.
-Unix Installation
------------------
-
-Untar the archive. All Scala tools are located in the "bin" directory.
-Adding that directory to the PATH variable will make the Scala commands
-directly accessible.
-
-You may test the distribution by running the following commands:
-
-$ ./bin/scala
-scala> Array(4,3,2,1).sorted
-res0: Array[Int] = Array(1, 2, 3, 4)
-
-scala>:quit
-$
-
-
-Windows Installation
---------------------
-
-Unzip the archive. All Scala tools are located in the "bin" directory.
-Adding that directory to the PATH variable will make the Scala commands
-directly accessible.
+Installation
+------------
-On Windows 95/98/Me, you must define the environment variable SCALA_HOME
-to point to the home directory of the Scala distribution to run any of
-these tools. This can be done by adding the following command to your
-AUTOEXEC.BAT file and then rebooting your machine.
+Decompress the archive and run the above commands directly from `bin` directory.
+We recommend adding the full path of the `bin` directory to the `PATH`
+environment variable.
-set SCALA_HOME=<install-directory>\scala-<major>.<minor>.<patch>
-On Windows NT/2000/XP, you do not need to define any variable in order
-for the Scala commands to run correctly.
+Licenses
+--------
+Scala is licensed under the standard 3-clause BSD license,
+included in the distribution as the file `doc/LICENSE`.
+The licenses of the software included in the Scala distribution can
+be found in the `doc/licenses` directory. \ No newline at end of file
diff --git a/docs/examples/actors/auction.scala b/docs/examples/actors/auction.scala
deleted file mode 100644
index c3124c67a9..0000000000
--- a/docs/examples/actors/auction.scala
+++ /dev/null
@@ -1,131 +0,0 @@
-package examples.actors
-
-import java.util.Date
-
-import scala.actors._
-import scala.actors.Actor._
-
-/** A simple demonstrator program implementing an online auction service
- * The example uses the actor abstraction defined in the API of
- * package scala.actors.
- */
-
-trait AuctionMessage
-case class Offer(bid: Int, client: Actor) extends AuctionMessage // make a bid
-case class Inquire(client: Actor) extends AuctionMessage // inquire status
-
-trait AuctionReply
-case class Status(asked: Int, expiration: Date) // asked sum, expiration date
- extends AuctionReply
-case object BestOffer extends AuctionReply // yours is the best offer
-case class BeatenOffer(maxBid: Int) extends AuctionReply // offer beaten by maxBid
-case class AuctionConcluded(seller: Actor, client: Actor) // auction concluded
- extends AuctionReply
-case object AuctionFailed extends AuctionReply // failed with no bids
-case object AuctionOver extends AuctionReply // bidding is closed
-
-class AuctionActor(seller: Actor, minBid: Int, closing: Date) extends Actor {
- val timeToShutdown = 3000 // msec
- val bidIncrement = 10
-
- def act() {
- var maxBid = minBid - bidIncrement
- var maxBidder: Actor = null
-
- loop {
- reactWithin (closing.getTime() - new Date().getTime()) {
-
- case Offer(bid, client) =>
- if (bid >= maxBid + bidIncrement) {
- if (maxBid >= minBid)
- maxBidder ! BeatenOffer(bid)
- maxBid = bid
- maxBidder = client
- client ! BestOffer
- }
- else
- client ! BeatenOffer(maxBid)
-
- case Inquire(client) =>
- client ! Status(maxBid, closing)
-
- case TIMEOUT =>
- if (maxBid >= minBid) {
- val reply = AuctionConcluded(seller, maxBidder)
- maxBidder ! reply
- seller ! reply
- } else {
- seller ! AuctionFailed
- }
- reactWithin(timeToShutdown) {
- case Offer(_, client) => client ! AuctionOver
- case TIMEOUT => exit()
- }
-
- }
- }
- }
-}
-
-object auction {
-
- val random = new scala.util.Random
-
- val minBid = 100
- val closing = new Date(new Date().getTime() + 4000)
-
- val seller = Actor.actor { }
- val auction = new AuctionActor(seller, minBid, closing)
-
- def client(i: Int, increment: Int, top: Int) = new Actor {
- val name = "Client " + i
- def log(msg: String) = Console.println(name + ": " + msg)
- var max: Int = _
- var current: Int = 0
- def act() {
- log("started")
- auction ! Inquire(this)
- receive {
- case Status(maxBid, _) =>
- log("status(" + maxBid + ")")
- max = maxBid
- }
- loop {
- if (max >= top) {
- log("too high for me")
- }
- else if (current < max) {
- current = max + increment
- Thread.sleep(1 + random.nextInt(1000))
- auction ! Offer(current, this)
- }
-
- reactWithin(3000) {
- case BestOffer =>
- log("bestOffer(" + current + ")")
-
- case BeatenOffer(maxBid) =>
- log("beatenOffer(" + maxBid + ")")
- max = maxBid
-
- case AuctionConcluded(seller, maxBidder) =>
- log("auctionConcluded"); exit()
-
- case AuctionOver =>
- log("auctionOver"); exit()
-
- case TIMEOUT =>
- exit()
- }
- }
- }
- }
-
- def main(args: Array[String]) {
- seller.start()
- auction.start()
- client(1, 20, 200).start()
- client(2, 10, 300).start()
- }
-
-}
diff --git a/docs/examples/actors/boundedbuffer.scala b/docs/examples/actors/boundedbuffer.scala
deleted file mode 100644
index c65bb7719c..0000000000
--- a/docs/examples/actors/boundedbuffer.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-package examples.actors
-
-import scala.actors.Actor._
-
-object boundedbuffer {
- class BoundedBuffer[T](N: Int)(implicit m: Manifest[T]) {
- private case class Put(x: T)
- private case object Get
- private case object Stop
-
- private val buffer = actor {
- val buf = new Array[T](N)
- var in, out, n = 0
- loop {
- react {
- case Put(x) if n < N =>
- buf(in) = x; in = (in + 1) % N; n += 1; reply()
- case Get if n > 0 =>
- val r = buf(out); out = (out + 1) % N; n -= 1; reply(r)
- case Stop =>
- reply(); exit("stopped")
- }
- }
- }
-
- def put(x: T) { buffer !? Put(x) }
- def get: T = (buffer !? Get).asInstanceOf[T]
- def stop() { buffer !? Stop }
- }
-
- def main(args: Array[String]) {
- val buf = new BoundedBuffer[Int](1)
- buf.put(42)
- println("" + buf.get)
- buf.stop()
- }
-}
diff --git a/docs/examples/actors/channels.scala b/docs/examples/actors/channels.scala
deleted file mode 100644
index 3c0dbf232d..0000000000
--- a/docs/examples/actors/channels.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-package examples.actors
-
-import scala.actors._
-import scala.actors.Actor._
-
-object channels extends Application {
- case class Msg(ch1: Channel[Int], ch2: Channel[String])
-
- val a = actor {
- val Ch1 = new Channel[Int]
- val Ch2 = new Channel[String]
-
- b ! Msg(Ch1, Ch2)
-
- val ICh1 = Ch1.asInstanceOf[InputChannel[Int]]
- val ICh2 = Ch2.asInstanceOf[InputChannel[String]]
-
- react {
- case ICh1 ! (x: Int) =>
- val r = x + 21
- println("result: "+r)
- case ICh2 ! y =>
- println("received: "+y)
- }
- }
-
- val b = actor {
- react {
- case Msg(ch1, ch2) => ch1 ! 21
- }
- }
-}
diff --git a/docs/examples/actors/fringe.scala b/docs/examples/actors/fringe.scala
deleted file mode 100644
index 2026628cb3..0000000000
--- a/docs/examples/actors/fringe.scala
+++ /dev/null
@@ -1,82 +0,0 @@
-package examples.actors
-
-import scala.actors.Actor._
-import scala.actors.{Channel, OutputChannel}
-
-/**
- @author Philipp Haller
- @version 1.1, 09/21/2007
- */
-object fringe extends Application {
-
- abstract class Tree
- case class Node(left: Tree, right: Tree) extends Tree
- case class Leaf(v: Int) extends Tree
-
- case class CompareFringe(t1: Tree, t2: Tree)
- case class ComputeFringe(t1: Tree, atoms: OutputChannel[Option[Leaf]])
- case class Equal(atom1: Option[Leaf], atom2: Option[Leaf])
- case class Extract(tree: Tree)
-
- val comparator = actor {
- val extractor1 = actor(extractorBehavior())
- val extractor2 = actor(extractorBehavior())
- val ch1 = new Channel[Option[Leaf]]
- val ch2 = new Channel[Option[Leaf]]
- loop {
- react {
- case CompareFringe(tree1, tree2) =>
- extractor1 ! ComputeFringe(tree1, ch1)
- extractor2 ! ComputeFringe(tree2, ch2)
- self ! Equal(ch1.?, ch2.?)
-
- case Equal(atom1, atom2) =>
- if (atom1 == atom2) atom1 match {
- case None =>
- println("same fringe")
- exit()
- case _ =>
- self ! Equal(ch1.?, ch2.?)
- } else {
- println("fringes differ")
- exit()
- }
- }
- }
- }
-
- val extractorBehavior = () => {
- var output: OutputChannel[Option[Leaf]] = null
- loop {
- react {
- case ComputeFringe(tree, leafSink) =>
- output = leafSink
- self ! Extract(tree)
-
- case Extract(tree) => tree match {
- case atom @ Leaf(_) =>
- output ! Some(atom)
- sender ! 'Continue
-
- case Node(left, right) =>
- val outer = self
- val outerCont = sender
- val cont = actor {
- react {
- case 'Continue =>
- outer.send(Extract(right), outerCont)
- }
- }
- self.send(Extract(left), cont)
- }
-
- case 'Continue =>
- output ! None
- exit()
- }
- }
- }
-
- comparator ! CompareFringe(Node(Leaf(5), Node(Leaf(7), Leaf(3))),
- Node(Leaf(5), Node(Leaf(7), Leaf(3))))
-}
diff --git a/docs/examples/actors/links.scala b/docs/examples/actors/links.scala
deleted file mode 100644
index 373e6b07ce..0000000000
--- a/docs/examples/actors/links.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-package examples.actors
-
-import scala.actors.{Actor, Exit}
-import scala.actors.Actor._
-
-object links extends Application {
-
- case object Stop
-
- actor {
- val start = link(p(2))
- start ! Stop
- }
-
- def p(n: Int): Actor =
- if (n == 0) top1()
- else top(p(n-1), n)
-
- def top(a: Actor, n: Int): Actor = actor {
- println("starting actor " + n + " (" + self + ")")
- self.trapExit = true
- link(a)
- loop {
- receive {
- case ex @ Exit(from, reason) =>
- println("Actor " + n + " received " + ex)
- exit('finished)
- case any => {
- println("Actor " + n + " received " + any)
- a ! any
- }
- }
- }
- }
-
- def top1(): Actor = actor {
- println("starting last actor" + " (" + self + ")")
- receive {
- case Stop =>
- println("Last actor now exiting")
- exit('abnormal)
- case any =>
- println("Last actor received " + any)
- top1()
- }
- }
-}
diff --git a/docs/examples/actors/looping.scala b/docs/examples/actors/looping.scala
deleted file mode 100644
index 1ce2e2e5e8..0000000000
--- a/docs/examples/actors/looping.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-package examples.actors
-
-import scala.actors.Actor._
-
-object looping extends Application {
- case object A
-
- val a = actor {
- var cnt = 0
- loop {
- react {
- case A =>
- cnt += 1
- if (cnt % 2 != 0) continue
- if (cnt < 10)
- println("received A")
- else {
- println("received last A")
- exit()
- }
- }
- }
- }
-
- for (i <- 0 until 10) a ! A
-}
diff --git a/docs/examples/actors/message.scala b/docs/examples/actors/message.scala
deleted file mode 100644
index d385543470..0000000000
--- a/docs/examples/actors/message.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-package examples.actors
-
-import scala.actors.{Actor, Scheduler}
-import scala.actors.Actor._
-import scala.actors.scheduler.SingleThreadedScheduler
-
-object message {
- def main(args: Array[String]) {
- val n = try { args(0).toInt }
- catch {
- case _ =>
- println("Usage: examples.actors.message <n>")
- Predef.exit
- }
- val nActors = 500
- val finalSum = n * nActors
- Scheduler.impl = new SingleThreadedScheduler
-
- def beh(next: Actor, sum: Int) {
- react {
- case value: Int =>
- val j = value + 1; val nsum = sum + j
- if (next == null && nsum >= n * j)
- println(nsum)
- else {
- if (next != null) next ! j
- if (nsum < n * j) beh(next, nsum)
- }
- }
- }
-
- def actorChain(i: Int, a: Actor): Actor =
- if (i > 0) actorChain(i-1, actor(beh(a, 0))) else a
-
- val firstActor = actorChain(nActors, null)
- var i = n; while (i > 0) { firstActor ! 0; i -= 1 }
-
- Scheduler.shutdown()
- }
-}
diff --git a/docs/examples/actors/pingpong.scala b/docs/examples/actors/pingpong.scala
deleted file mode 100644
index 4ed225c662..0000000000
--- a/docs/examples/actors/pingpong.scala
+++ /dev/null
@@ -1,61 +0,0 @@
-package examples.actors
-
-import scala.actors.Actor
-import scala.actors.Actor._
-
-case object Ping
-case object Pong
-case object Stop
-
-/**
- * Ping pong example.
- *
- * @author Philipp Haller
- * @version 1.1
- */
-object pingpong extends Application {
- val pong = new Pong
- val ping = new Ping(100000, pong)
- ping.start
- pong.start
-}
-
-class Ping(count: Int, pong: Actor) extends Actor {
- def act() {
- var pingsLeft = count - 1
- pong ! Ping
- loop {
- react {
- case Pong =>
- if (pingsLeft % 1000 == 0)
- println("Ping: pong")
- if (pingsLeft > 0) {
- pong ! Ping
- pingsLeft -= 1
- } else {
- println("Ping: stop")
- pong ! Stop
- exit()
- }
- }
- }
- }
-}
-
-class Pong extends Actor {
- def act() {
- var pongCount = 0
- loop {
- react {
- case Ping =>
- if (pongCount % 1000 == 0)
- println("Pong: ping "+pongCount)
- sender ! Pong
- pongCount += 1
- case Stop =>
- println("Pong: stop")
- exit()
- }
- }
- }
-}
diff --git a/docs/examples/actors/producers.scala b/docs/examples/actors/producers.scala
deleted file mode 100644
index 80e5ae33d3..0000000000
--- a/docs/examples/actors/producers.scala
+++ /dev/null
@@ -1,114 +0,0 @@
-package examples.actors
-
-import scala.actors.Actor
-import scala.actors.Actor._
-
-abstract class Producer[T] {
-
- /** A signal that the next value should be produced. */
- private val Next = new Object
-
- /** A label for an undefined state of the iterators. */
- private val Undefined = new Object
-
- /** A signal to stop the coordinator. */
- private val Stop = new Object
-
- protected def produce(x: T) {
- coordinator ! Some(x)
- receive { case Next => }
- }
-
- protected def produceValues: Unit
-
- def iterator = new Iterator[T] {
- private var current: Any = Undefined
- private def lookAhead = {
- if (current == Undefined) current = coordinator !? Next
- current
- }
-
- def hasNext: Boolean = lookAhead match {
- case Some(x) => true
- case None => { coordinator ! Stop; false }
- }
-
- def next: T = lookAhead match {
- case Some(x) => current = Undefined; x.asInstanceOf[T]
- }
- }
-
- private val coordinator: Actor = actor {
- loop {
- react {
- case Next =>
- producer ! Next
- reply {
- receive { case x: Option[_] => x }
- }
- case Stop =>
- exit('stop)
- }
- }
- }
-
- private val producer: Actor = actor {
- receive {
- case Next =>
- produceValues
- coordinator ! None
- }
- }
-}
-
-object producers extends Application {
-
- class Tree(val left: Tree, val elem: Int, val right: Tree)
- def node(left: Tree, elem: Int, right: Tree): Tree = new Tree(left, elem, right)
- def node(elem: Int): Tree = node(null, elem, null)
-
- def tree = node(node(node(3), 4, node(6)), 8, node(node(9), 10, node(11)))
-
- class PreOrder(n: Tree) extends Producer[Int] {
- def produceValues = traverse(n)
- def traverse(n: Tree) {
- if (n != null) {
- produce(n.elem)
- traverse(n.left)
- traverse(n.right)
- }
- }
- }
-
- class PostOrder(n: Tree) extends Producer[Int] {
- def produceValues = traverse(n)
- def traverse(n: Tree) {
- if (n != null) {
- traverse(n.left)
- traverse(n.right)
- produce(n.elem)
- }
- }
- }
-
- class InOrder(n: Tree) extends Producer[Int] {
- def produceValues = traverse(n)
- def traverse(n: Tree) {
- if (n != null) {
- traverse(n.left)
- produce(n.elem)
- traverse(n.right)
- }
- }
- }
-
- actor {
- print("PreOrder:")
- for (x <- new PreOrder(tree).iterator) print(" "+x)
- print("\nPostOrder:")
- for (x <- new PostOrder(tree).iterator) print(" "+x)
- print("\nInOrder:")
- for (x <- new InOrder(tree).iterator) print(" "+x)
- print("\n")
- }
-}
diff --git a/docs/examples/actors/seq.scala b/docs/examples/actors/seq.scala
deleted file mode 100644
index 816c969cb6..0000000000
--- a/docs/examples/actors/seq.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-package examples.actors
-
-object seq extends Application {
- import scala.actors.Actor._
- val a = actor {
- { react {
- case 'A => println("received 1st message")
- }; ()
- } andThen react {
- case 'A => println("received 2nd message")
- }
- }
- a ! 'A
- a ! 'A
-}
diff --git a/docs/examples/boundedbuffer.scala b/docs/examples/boundedbuffer.scala
deleted file mode 100644
index 359bfd8d06..0000000000
--- a/docs/examples/boundedbuffer.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-package examples
-
-object boundedbuffer {
-
- import concurrent.ops._
-
- class BoundedBuffer[A](N: Int)(implicit m: ClassManifest[A]) {
- var in, out, n = 0
- val elems = new Array[A](N)
-
- def await(cond: => Boolean) = while (!cond) { wait() }
-
- def put(x: A) = synchronized {
- await (n < N)
- elems(in) = x; in = (in + 1) % N; n += 1
- if (n == 1) notifyAll()
- }
-
- def get: A = synchronized {
- await (n != 0)
- val x = elems(out); out = (out + 1) % N ; n -= 1
- if (n == N - 1) notifyAll()
- x
- }
- }
-
- def kill(delay: Int) = new java.util.Timer().schedule(
- new java.util.TimerTask {
- override def run() = {
- println("[killed]")
- System.exit(0)
- }
- },
- delay) // in milliseconds
-
- def main(args: Array[String]) {
- val buf = new BoundedBuffer[String](10)
- var cnt = 0
- def produceString = { cnt += 1; cnt.toString() }
- def consumeString(ss: String) = println(ss)
- spawn { while (true) { val ssss = produceString; buf.put(ssss) } }
- spawn { while (true) { val s = buf.get; consumeString(s) } }
- kill(1000)
- }
-
-}
diff --git a/docs/examples/computeserver.scala b/docs/examples/computeserver.scala
deleted file mode 100644
index 788be284d1..0000000000
--- a/docs/examples/computeserver.scala
+++ /dev/null
@@ -1,54 +0,0 @@
-package examples
-
-import concurrent._, concurrent.ops._
-
-class ComputeServer(n: Int) {
-
- private trait Job {
- type t
- def task: t
- def ret(x: t): Unit
- }
-
- private val openJobs = new Channel[Job]()
-
- private def processor(i: Int) {
- while (true) {
- val job = openJobs.read
- println("read a job")
- job.ret(job.task)
- }
- }
-
- def future[a](p: => a): () => a = {
- val reply = new SyncVar[a]()
- openJobs.write{
- new Job {
- type t = a
- def task = p
- def ret(x: a) = reply.set(x)
- }
- }
- () => reply.get
- }
-
- //spawn(replicate(0, n) { processor })
- spawn((0 until n).par foreach { processor })
-}
-
-object computeserver extends App {
-
- def kill(delay: Int) = new java.util.Timer().schedule(
- new java.util.TimerTask {
- override def run() = {
- println("[killed]")
- sys exit 0
- }
- },
- delay) // in milliseconds
-
- val server = new ComputeServer(1)
- val f = server.future(42)
- println(f())
- kill(10000)
-}
diff --git a/docs/examples/expressions/expressions-current.scala b/docs/examples/expressions/expressions-current.scala
deleted file mode 100644
index 660a417c11..0000000000
--- a/docs/examples/expressions/expressions-current.scala
+++ /dev/null
@@ -1,68 +0,0 @@
-package examples.expressions
-
-class Ref[a](var elem:a) {}
-
-abstract class Lang {
- trait Visitor {
- def caseNum(n: int): unit
- }
-
- abstract class Exp {
- def visit(v: visitor): unit
- }
-
- type visitor <: Visitor
-
- class Num(n: int) extends Exp {
- def visit(v: visitor): unit = v.caseNum(n)
- }
-
- class Eval(result: Ref[int]) requires visitor extends Visitor {
- def caseNum(n: int) = result.elem = n
- }
-}
-
-abstract class Lang2 extends Lang {
- trait Visitor2 extends Visitor {
- def casePlus(left: Exp, right: Exp): unit
- }
-
- type visitor <: Visitor2
-
- class Plus(l: Exp, r: Exp) extends Exp {
- def visit(v: visitor): unit = v.casePlus(l, r)
- }
-
- // class Eval2(result: Ref[int]): visitor extends Eval(result) with Visitor2 {
- class Eval2(result: Ref[int]) requires visitor extends Eval(result) with Visitor2 {
- def casePlus(l: Exp, r: Exp) =
- result.elem = { l.visit(this); result.elem } + { r.visit(this); result.elem }
- }
-
- class Show2(result: Ref[String]) requires visitor extends Visitor2 {
- def caseNum(n: int) = result.elem = n.toString()
- def casePlus(l: Exp, r: Exp) =
- result.elem =
- "(" + { l.visit(this); result.elem } +
- "+" + { r.visit(this); result.elem } + ")"
- }
-}
-
-object Main {
- def main(args: Array[String]): unit = {
- //val l1 = new Lang { type visitor = Visitor } // not yet implemented
- object l1 extends Lang { type visitor = Visitor } // workaround
- val e1: l1.Exp = new l1.Num(42)
- val iref = new Ref(0)
- Console.println("eval: " + { e1.visit(new l1.Eval(iref)); iref.elem })
-
- //val l2 = new Lang2 { type visitor = Visitor2 } // not yet implemented
- object l2 extends Lang2 { type visitor = Visitor2 } // workaround
- val e2: l2.Exp = new l2.Plus(new l2.Num(5), new l2.Num(37))
- val sref = new Ref("")
- Console.println("eval: " + { e2.visit(new l2.Eval2(iref)); iref.elem })
- Console.println("show: " + { e2.visit(new l2.Show2(sref)); sref.elem })
- e1.visit(new l1.Eval(iref))
- e2.visit(new l2.Show2(sref))
- }
-}
diff --git a/docs/examples/fors.scala b/docs/examples/fors.scala
deleted file mode 100644
index b937e53fcd..0000000000
--- a/docs/examples/fors.scala
+++ /dev/null
@@ -1,112 +0,0 @@
-package examples
-
-import scala.xml._
-
-
-object fors {
-
- val e = Node.NoAttributes
-
- class Person(_name: String, _age: Int) {
- val name = _name
- val age = _age
- }
-
- def printOlderThan20(xs: Seq[Person]): Iterator[String] =
- printOlderThan20(xs.iterator)
-
- def printOlderThan20(xs: Iterator[Person]): Iterator[String] =
- for (p <- xs if p.age > 20) yield p.name
-
- val persons = List(
- new Person("John", 40),
- new Person("Richard", 68)
- )
-
- def divisors(n: Int): List[Int] =
- for (i <- List.range(1, n+1) if n % i == 0) yield i
-
- def isPrime(n: Int) = divisors(n).length == 2
-
- def findNums(n: Int): Iterable[(Int, Int)] =
- for (i <- 1 until n;
- j <- 1 until (i-1);
- if isPrime(i+j)) yield (i, j)
-
- def sum(xs: List[Double]): Double =
- xs.foldLeft(0.0) { (x, y) => x + y }
-
- def scalProd(xs: List[Double], ys: List[Double]) =
- sum(for((x, y) <- xs zip ys) yield x * y)
-
- type Lst = List[Any]
-
- val prefix = null
- val scope = TopScope
-
- val books = List(
- Elem(prefix, "book", e, scope,
- Elem(prefix, "title", e, scope,
- Text("Structure and Interpretation of Computer Programs")),
- Elem(prefix, "author", e, scope,
- Text("Abelson, Harald")),
- Elem(prefix, "author", e, scope,
- Text("Sussman, Gerald J."))),
- Elem(prefix, "book", e, scope,
- Elem(prefix, "title", e, scope,
- Text("Principles of Compiler Design")),
- Elem(prefix, "author", e, scope,
- Text("Aho, Alfred")),
- Elem(prefix, "author", e, scope,
- Text("Ullman, Jeffrey"))),
- Elem(prefix, "book", e, scope,
- Elem(prefix, "title", e, scope,
- Text("Programming in Modula-2")),
- Elem(prefix, "author", e, scope,
- Text("Wirth, Niklaus")))
- )
-
- def findAuthor(books: Lst) =
- for (Elem(_, "book", _, _, book @ _*) <- books;
- Elem(_, "title", _, _, Text(title)) <- book.toList;
- if (title indexOf "Program") >= 0;
- Elem(_, "author", _, _, Text(author)) <- List(book)) yield author
-
- for (Elem(_, "book", _, _, book @ _*) <- books;
- Elem(_, "author", _, _, Text(author)) <- book.toList;
- if author startsWith "Ullman";
- Elem(_, "title", _, _, Text(title)) <- List(book)) yield title
-
- removeDuplicates(
- for (Elem(_, "book", _, _, b1 @ _* ) <- books;
- Elem(_, "book", _, _, b2 @ _*) <- books;
- if b1 != b2;
- Elem(_, "author", _, _, Text(a1)) <- b1.toList;
- Elem(_, "author", _, _, Text(a2)) <- b2.toList;
- if a1 == a2) yield Pair(a1, a2))
-
- def removeDuplicates[a](xs: List[a]): List[a] =
- if (xs.isEmpty)
- xs
- else
- xs.head :: removeDuplicates(for (x <- xs.tail if x != xs.head) yield x)
-
- def main(args: Array[String]) {
- print("Persons over 20:")
- printOlderThan20(persons) foreach { x => print(" " + x) }
- println
-
- println("divisors(34) = " + divisors(34))
-
- print("findNums(15) =");
- findNums(15) foreach { x => print(" " + x); }
- println
-
- val xs = List(3.5, 5.0, 4.5)
- println("average(" + xs + ") = " + sum(xs) / xs.length)
-
- val ys = List(2.0, 1.0, 3.0)
- println("scalProd(" + xs + ", " + ys +") = " + scalProd(xs, ys))
- }
-
-}
diff --git a/docs/examples/futures.scala b/docs/examples/futures.scala
deleted file mode 100644
index e05b6b330e..0000000000
--- a/docs/examples/futures.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-package examples
-
-import concurrent.ops._
-
-object futures {
- def someLengthyComputation = 1
- def anotherLengthyComputation = 2
- def f(x: Int) = x + x
- def g(x: Int) = x * x
-
- def main(args: Array[String]) {
- val x = future(someLengthyComputation)
- anotherLengthyComputation
- val y = f(x()) + g(x())
- println(y)
- }
-}
diff --git a/docs/examples/gadts.scala b/docs/examples/gadts.scala
deleted file mode 100644
index d2792f4ada..0000000000
--- a/docs/examples/gadts.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-package examples
-
-object gadts extends Application {
-
- abstract class Term[T]
- case class Lit(x: Int) extends Term[Int]
- case class Succ(t: Term[Int]) extends Term[Int]
- case class IsZero(t: Term[Int]) extends Term[Boolean]
- case class If[T](c: Term[Boolean],
- t1: Term[T],
- t2: Term[T]) extends Term[T]
-
- def eval[T](t: Term[T]): T = t match {
- case Lit(n) => n
- case Succ(u) => eval(u) + 1
- case IsZero(u) => eval(u) == 0
- case If(c, u1, u2) => eval(if (eval(c)) u1 else u2)
- }
- println(
- eval(If(IsZero(Lit(1)), Lit(41), Succ(Lit(41)))))
-}
-
diff --git a/docs/examples/iterators.scala b/docs/examples/iterators.scala
deleted file mode 100644
index e2e5e050a0..0000000000
--- a/docs/examples/iterators.scala
+++ /dev/null
@@ -1,28 +0,0 @@
-package examples
-
-object iterators {
-
- def Array(elems: Double*): Array[Double] = {
- val ar = new Array[Double](elems.length)
- for (i <- 0 until elems.length)
- ar(i) = elems(i)
- ar
- }
-
- def printArray(xs: Array[Double]) =
- xs.iterator foreach { x => println(x) }
-
- def findGreater(xs: Array[Double], limit: Double) =
- xs.iterator
- .zip(Iterator.from(0))
- .filter{case Pair(x, i) => x > limit }
- .map{case Pair(x, i) => i}
-
- def main(args: Array[String]) {
- val ar = Array/*[Double]*/(6, 2, 8, 5, 1)
- printArray(ar)
- println("Elements greater than 3.0:")
- findGreater(ar, 3.0) foreach { x => Console.println(ar(x)) }
- }
-
-}
diff --git a/docs/examples/jolib/Ref.scala b/docs/examples/jolib/Ref.scala
deleted file mode 100644
index 5f655f16b1..0000000000
--- a/docs/examples/jolib/Ref.scala
+++ /dev/null
@@ -1,55 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package examples.jolib;
-/*
-import concurrent.SyncVar;
-import concurrent.jolib._;
-
-class Ref[a](init: a) extends Join {
-
- object get extends Synchr[a](this) { case class C() extends SyncVar[a]; }
- object set extends Synchr[unit](this) { case class C(x: a) extends SyncVar[unit]; }
- object state extends Asynchr(this) { case class C(x: a); }
-
- rules (
- Pair(List(get, state), { case List(g @ get.C(), state.C(x) ) =>
- { g.set(x); state(state.C(x)) } }),
- Pair(List(set, state), { case List(s @ set.C(x), state.C(y) ) =>
- { s.set(()); state(state.C(x)) } })
- );
-
- state(state.C(init));
-
- def Get: a = get(get.C());
- def Set(x: a): unit = set(set.C(x));
-}
-*/
-object RefTest {
-
- def main(args: Array[String]) = {
- System.out.println("Started.");
-/*
- concurrent.ops.spawn({
- val r1 = new Ref(0);
- System.out.println("Reference r1 created.");
- System.out.println("Value r1 (first time) = " + r1.Get);
- r1.Set(42);
- System.out.println("Value r1 (second time) = " + r1.Get);
- });
- concurrent.ops.spawn({
- val r2 = new Ref(100);
- System.out.println("Reference r2 created.");
- System.out.println("Value r2 (first time) = " + r2.Get);
- r2.Set(89);
- System.out.println("Value r2 (second time) = " + r2.Get);
- });
-*/
- }
-
-}
diff --git a/docs/examples/jolib/parallelOr.scala b/docs/examples/jolib/parallelOr.scala
deleted file mode 100644
index 72d282bee3..0000000000
--- a/docs/examples/jolib/parallelOr.scala
+++ /dev/null
@@ -1,58 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package examples.jolib;
-/*
-import concurrent.jolib._;
-import concurrent.SyncVar;
-
-/** Implementation in the join-calculus of a parallel OR. */
-object or extends Join {
-
- object res extends Synchr[boolean](this) { case class C() extends SyncVar[boolean] };
- object res1 extends Asynchr(this) { case class C(b: boolean); }
- object res2 extends Asynchr(this) { case class C(b: boolean); }
- object res1False extends Synchr[boolean](this) { case class C() extends SyncVar[boolean] };
- object res2False extends Synchr[boolean](this) { case class C() extends SyncVar[boolean] };
-
- rules(
- Pair(List(res, res1), { case List(r @ res.C(), res1.C(b)) =>
- if (b) r.set(b) else r.set(res1False(res1False.C())) }),
-
- Pair(List(res, res2), { case List(r @ res.C(), res2.C(b)) =>
- if (b) r.set(b) else r.set(res2False(res2False.C())) }),
-
- Pair(List(res1False, res2), { case List(r @ res1False.C(), res2.C(b)) =>
- r.set(b) }),
-
- Pair(List(res2False, res1), { case List(r @ res2False.C(), res1.C(b)) =>
- r.set(b) })
- );
-
- def apply(b1: => boolean, b2: => boolean): boolean = {
- concurrent.ops.spawn(res1(res1.C(b1)));
- concurrent.ops.spawn(res2(res2.C(b2)));
- res(res.C())
- }
-}
-*/
-object parallelOr {
-
- def main(args: Array[String]): unit = {
- def loop: boolean = { while (true) {}; true };
-/*
- System.out.println("true || true = " + or(true, true));
- System.out.println("false || false = " + or(false, false));
- System.out.println("false || true = " + or(false, true));
- System.out.println("true || false = " + or(true, false));
- System.out.println("true || loop = " + or(true, loop));
- System.out.println("loop || true = " + or(loop, true));
-*/
- }
-
-}
diff --git a/docs/examples/maps.scala b/docs/examples/maps.scala
deleted file mode 100644
index d545b50ab9..0000000000
--- a/docs/examples/maps.scala
+++ /dev/null
@@ -1,187 +0,0 @@
-package examples
-
-object maps {
-
- import scala.collection.immutable._
-
- trait MapStruct[kt, vt] {
- trait Map extends Function1[kt, vt] {
- def extend(key: kt, value: vt): Map
- def remove(key: kt): Map
- def domain: Stream[kt]
- def range: Stream[vt]
- }
- type map <: Map
- val empty: map
- }
-
- class AlgBinTree[kt >: Null <: Ordered[kt], vt >: Null <: AnyRef]() extends MapStruct[kt, vt] {
- type map = AlgMap
-
- val empty: AlgMap = Empty()
-
- private case class Empty() extends AlgMap {}
- private case class Node(key: kt, value: vt, l: map, r: map) extends AlgMap {}
-
- trait AlgMap extends Map {
- def apply(key: kt): vt = this match {
- case Empty() => null
- case Node(k, v, l, r) =>
- if (key < k) l.apply(key)
- else if (key > k) r.apply(key)
- else v
- }
-
- def extend(key: kt, value: vt): map = this match {
- case Empty()=> Node(key, value, empty, empty)
- case Node(k, v, l, r) =>
- if (key < k) Node(k, v, l.extend(key, value), r)
- else if (key > k) Node(k, v, l, r.extend(key, value))
- else Node(k, value, l, r)
- }
-
- def remove(key: kt): map = this match {
- case Empty()=> empty
- case Node(k, v, l, r) =>
- if (key < k) Node(k, v, l.remove(key), r)
- else if (key > k) Node(k, v, l, r.remove(key))
- else if (l == empty) r
- else if (r == empty) l
- else {
- val midKey = r.domain.head
- Node(midKey, r.apply(midKey), l, r.remove(midKey))
- }
- }
-
- def domain: Stream[kt] = this match {
- case Empty()=> Stream.empty
- case Node(k, v, l, r) => l.domain append Stream.cons(k, r.domain)
- }
-
- def range: Stream[vt] = this match {
- case Empty()=> Stream.empty
- case Node(k, v, l, r) => l.range append Stream.cons(v, r.range)
- }
- }
- }
-
- class OOBinTree[kt >: Null <: Ordered[kt], vt >: Null <: AnyRef]() extends MapStruct[kt, vt] {
- type map = OOMap
-
- trait OOMap extends Map {
- def apply(key: kt): vt
- def extend(key: kt, value: vt): map
- def remove(key: kt): map
- def domain: Stream[kt]
- def range: Stream[vt]
- }
- val empty: OOMap = new OOMap {
- def apply(key: kt): vt = null
- def extend(key: kt, value: vt) = new Node(key, value, empty, empty)
- def remove(key: kt) = empty
- def domain: Stream[kt] = Stream.empty
- def range: Stream[vt] = Stream.empty
- }
- private class Node(k: kt, v: vt, l: map, r: map) extends OOMap {
- def apply(key: kt): vt =
- if (key < k) l.apply(key)
- else if (key > k) r.apply(key)
- else v;
- def extend(key: kt, value: vt): map =
- if (key < k) new Node(k, v, l.extend(key, value), r)
- else if (key > k) new Node(k, v, l, r.extend(key, value))
- else new Node(k, value, l, r)
- def remove(key: kt): map =
- if (key < k) new Node(k, v, l.remove(key), r)
- else if (key > k) new Node(k, v, l, r.remove(key))
- else if (l == empty) r
- else if (r == empty) l
- else {
- val midKey = r.domain.head
- new Node(midKey, r(midKey), l, r.remove(midKey))
- }
- def domain: Stream[kt] = l.domain append Stream.cons(k, r.domain)
- def range: Stream[vt] = l.range append Stream.cons(v, r.range)
- }
- }
-
- class MutBinTree[kt >: Null <: Ordered[kt], vt >: Null <: AnyRef]() extends MapStruct[kt, vt] {
- type map = MutMap
- class MutMap(key: kt, value: vt) extends Map {
- val k = key
- var v = value
- var l, r = empty
-
- def apply(key: kt): vt =
- if (this == empty) null
- else if (key < k) l.apply(key)
- else if (key > k) r.apply(key)
- else v
-
- def extend(key: kt, value: vt): map =
- if (this == empty) new MutMap(key, value)
- else {
- if (key < k) l = l.extend(key, value)
- else if (key > k) r = r.extend(key, value)
- else v = value
- this
- }
-
- def remove(key: kt): map =
- if (this == empty) this
- else if (key < k) { l = l.remove(key); this }
- else if (key > k) { r = r.remove(key); this }
- else if (l == empty) r
- else if (r == empty) l
- else {
- var mid = r
- while (!(mid.l == empty)) { mid = mid.l }
- mid.r = r.remove(mid.k)
- mid.l = l
- mid
- }
-
- def domain: Stream[kt] =
- if (this == empty) Stream.empty
- else l.domain append Stream.cons(k, r.domain)
-
- def range: Stream[vt] =
- if (this == empty) Stream.empty
- else l.range append Stream.cons(v, r.range)
- }
- val empty = new MutMap(null, null)
- }
-
- class Date(y: Int, m: Int, d: Int) extends Ordered[Date] {
- def year = y
- def month = m
- def day = d
-
- def compare(other: Date): Int =
- if (year == other.year &&
- month == other.month &&
- day == other.day)
- 0
- else if (year < other.year ||
- year == other.year && month < other.month ||
- month == other.month && day < other.day)
- -1
- else
- 1
-
- override def equals(that: Any): Boolean =
- that.isInstanceOf[Date] && {
- val o = that.asInstanceOf[Date];
- day == o.day && month == o.month && year == o.year
- }
- }
-
- def main(args: Array[String]) {
- val t = new OOBinTree[Date, String]()
- ()
- }
-
-}
-
-
-
diff --git a/docs/examples/monads/callccInterpreter.scala b/docs/examples/monads/callccInterpreter.scala
deleted file mode 100644
index 5b556bd8fa..0000000000
--- a/docs/examples/monads/callccInterpreter.scala
+++ /dev/null
@@ -1,86 +0,0 @@
-object callccInterpreter {
-
- def id[a](x: a) = x
-
- type Answer = Value;
-
- case class M[A](in: (A => Answer) => Answer) {
- def bind[B](k: A => M[B]) = M[B](c => in (a => k(a) in c));
- def map[B](f: A => B): M[B] = bind(x => unitM(f(x)));
- def flatMap[B](f: A => M[B]): M[B] = bind(f);
- }
-
- def unitM[A](a: A) = M[A](c => c(a));
-
- def showM(m: M[Value]): String = (m in id).toString();
-
- def callCC[A](h: (A => M[A]) => M[A]) =
- M[A](c => h(a => M[A](d => c(a))) in c);
-
- type Name = String;
-
- trait Term;
- case class Var(x: Name) extends Term;
- case class Con(n: Int) extends Term;
- case class Add(l: Term, r: Term) extends Term;
- case class Lam(x: Name, body: Term) extends Term;
- case class App(fun: Term, arg: Term) extends Term;
- case class Ccc(x: Name, t: Term) extends Term;
-
- trait Value;
- case object Wrong extends Value {
- override def toString() = "wrong"
- }
- case class Num(n: Int) extends Value {
- override def toString() = n.toString();
- }
- case class Fun(f: Value => M[Value]) extends Value {
- override def toString() = "<function>"
- }
-
- type Environment = List[Pair[Name, Value]];
-
- def lookup(x: Name, e: Environment): M[Value] = e match {
- case List() => unitM(Wrong)
- case Pair(y, b) :: e1 => if (x == y) unitM(b) else lookup(x, e1)
- }
-
- def add(a: Value, b: Value): M[Value] = Pair(a, b) match {
- case Pair(Num(m), Num(n)) => unitM(Num(m + n))
- case _ => unitM(Wrong)
- }
-
- def apply(a: Value, b: Value): M[Value] = a match {
- case Fun(k) => k(b)
- case _ => unitM(Wrong)
- }
-
- def interp(t: Term, e: Environment): M[Value] = t match {
- case Var(x) => lookup(x, e)
- case Con(n) => unitM(Num(n))
- case Add(l, r) => for (a <- interp(l, e);
- b <- interp(r, e);
- c <- add(a, b))
- yield c
- case Lam(x, t) => unitM(Fun(a => interp(t, Pair(x, a) :: e)))
- case App(f, t) => for (a <- interp(f, e);
- b <- interp(t, e);
- c <- apply(a, b))
- yield c
- case Ccc(x, t) => callCC(k => interp(t, Pair(x, Fun(k)) :: e))
- }
-
- def test(t: Term): String =
- showM(interp(t, List()));
-
- val term0 = App(Lam("x", Add(Var("x"), Var("x"))), Add(Con(10), Con(11)));
- val term1 = App(Con(1), Con(2));
- val term2 = Add(Con(1), Ccc("k", Add(Con(2), App(Var("k"), Con(4)))));
-
- def main(args: Array[String]) = {
- System.out.println(test(term0));
- System.out.println(test(term1));
- System.out.println(test(term2));
- }
-}
-
diff --git a/docs/examples/monads/directInterpreter.scala b/docs/examples/monads/directInterpreter.scala
deleted file mode 100644
index 06fffba8e2..0000000000
--- a/docs/examples/monads/directInterpreter.scala
+++ /dev/null
@@ -1,55 +0,0 @@
-object directInterpreter {
-
- type Name = String;
-
- trait Term;
- case class Var(x: Name) extends Term;
- case class Con(n: Int) extends Term;
- case class Add(l: Term, r: Term) extends Term;
- case class Lam(x: Name, body: Term) extends Term;
- case class App(fun: Term, arg: Term) extends Term;
-
- trait Value;
- case object Wrong extends Value;
- case class Num(n: Int) extends Value;
- case class Fun(f: Value => Value)extends Value;
-
- def showval(v: Value): String = v match {
- case Wrong => "<wrong>"
- case Num(n) => n.toString()
- case Fun(f) => "<function>"
- }
-
- type Environment = List[Pair[Name, Value]];
-
- def lookup(x: Name, e: Environment): Value = e match {
- case List() => Wrong
- case Pair(y, b) :: e1 => if (x == y) b else lookup(x, e1)
- }
-
- def add(a: Value, b: Value): Value = Pair(a, b) match {
- case Pair(Num(m), Num(n)) => Num(m + n)
- case _ => Wrong
- }
-
- def apply(a: Value, b: Value) = a match {
- case Fun(k) => k(b)
- case _ => Wrong
- }
-
- def interp(t: Term, e: Environment): Value = t match {
- case Var(x) => lookup(x, e)
- case Con(n) => Num(n)
- case Add(l, r) => add(interp(l, e), interp(r, e))
- case Lam(x, t) => Fun(a => interp(t, Pair(x, a) :: e))
- case App(f, t) => apply(interp(f, e), interp(t, e))
- }
-
- def test(t: Term): String =
- showval(interp(t, List()));
-
- val term0 = App(Lam("x", Add(Var("x"), Var("x"))), Add(Con(10), Con(11)));
-
- def main(args: Array[String]) =
- System.out.println(test(term0));
-}
diff --git a/docs/examples/monads/errorInterpreter.scala b/docs/examples/monads/errorInterpreter.scala
deleted file mode 100644
index d3cc45627d..0000000000
--- a/docs/examples/monads/errorInterpreter.scala
+++ /dev/null
@@ -1,86 +0,0 @@
-object errorInterpreter {
-
- trait M[A] {
- def show: String
- def bind[B](k: A => M[B]): M[B]
- def map[B](f: A => B): M[B] = bind(x => unitM(f(x)))
- def flatMap[B](f: A => M[B]): M[B] = bind(f)
- }
-
- def unitM[A](a: A): M[A] = new Suc(a)
- def errorM[A](msg: String): M[A] = new Err(msg)
-
- def showM(m: M[Value]): String = m.show
-
- class Suc[A](x: A) extends M[A] {
- def bind[B](k: A => M[B]): M[B] = k(x)
- def show: String = "Success: " + x
- }
- class Err[A](msg: String) extends M[A] {
- def bind[B](k: A => M[B]): M[B] = new Err(msg)
- def show: String = "Error: " + msg
- }
-
- type Name = String
-
- trait Term
- case class Var(x: Name) extends Term
- case class Con(n: Int) extends Term
- case class Add(l: Term, r: Term) extends Term
- case class Lam(x: Name, body: Term) extends Term
- case class App(fun: Term, arg: Term) extends Term
-
- trait Value
- case object Wrong extends Value {
- override def toString() = "wrong"
- }
- case class Num(n: Int) extends Value {
- override def toString() = n.toString()
- }
- case class Fun(f: Value => M[Value]) extends Value {
- override def toString() = "<function>"
- }
-
- type Environment = List[Pair[Name, Value]]
-
- def lookup(x: Name, e: Environment): M[Value] = e match {
- case List() => errorM("unbound variable: " + x);
- case Pair(y, b) :: e1 => if (x == y) unitM(b) else lookup(x, e1)
- }
-
- def add(a: Value, b: Value): M[Value] = Pair(a, b) match {
- case Pair(Num(m), Num(n)) => unitM(Num(m + n))
- case _ => errorM("should be numbers: " + a + "," + b)
- }
-
- def apply(a: Value, b: Value): M[Value] = a match {
- case Fun(k) => k(b)
- case _ => errorM("should be function: " + a)
- }
-
- def interp(t: Term, e: Environment): M[Value] = t match {
- case Var(x) => lookup(x, e)
- case Con(n) => unitM(Num(n))
- case Add(l, r) => for (a <- interp(l, e);
- b <- interp(r, e);
- c <- add(a, b))
- yield c
- case Lam(x, t) => unitM(Fun(a => interp(t, Pair(x, a) :: e)))
- case App(f, t) => for (a <- interp(f, e);
- b <- interp(t, e);
- c <- apply(a, b))
- yield c
- }
-
- def test(t: Term): String =
- showM(interp(t, List()))
-
- val term0 = App(Lam("x", Add(Var("x"), Var("x"))), Add(Con(10), Con(11)))
- val term1 = App(Con(1), Con(2))
-
- def main(args: Array[String]) = {
- System.out.println(test(term0))
- System.out.println(test(term1))
- }
-}
-
diff --git a/docs/examples/monads/simpleInterpreter.scala b/docs/examples/monads/simpleInterpreter.scala
deleted file mode 100644
index cde3a92dbb..0000000000
--- a/docs/examples/monads/simpleInterpreter.scala
+++ /dev/null
@@ -1,75 +0,0 @@
-object simpleInterpreter {
-
- case class M[A](value: A) {
- def bind[B](k: A => M[B]): M[B] = k(value);
- def map[B](f: A => B): M[B] = bind(x => unitM(f(x)));
- def flatMap[B](f: A => M[B]): M[B] = bind(f);
- }
-
- def unitM[A](a: A): M[A] = M(a);
-
- def showM(m: M[Value]): String = m.value.toString();
-
- type Name = String;
-
- trait Term;
- case class Var(x: Name) extends Term;
- case class Con(n: Int) extends Term;
- case class Add(l: Term, r: Term) extends Term;
- case class Lam(x: Name, body: Term) extends Term;
- case class App(fun: Term, arg: Term) extends Term;
-
- trait Value;
- case object Wrong extends Value {
- override def toString() = "wrong"
- }
- case class Num(n: Int) extends Value {
- override def toString() = n.toString();
- }
- case class Fun(f: Value => M[Value]) extends Value {
- override def toString() = "<function>"
- }
-
- type Environment = List[Pair[Name, Value]];
-
- def lookup(x: Name, e: Environment): M[Value] = e match {
- case List() => unitM(Wrong)
- case Pair(y, b) :: e1 => if (x == y) unitM(b) else lookup(x, e1)
- }
-
- def add(a: Value, b: Value): M[Value] = Pair(a, b) match {
- case Pair(Num(m), Num(n)) => unitM(Num(m + n))
- case _ => unitM(Wrong)
- }
-
- def apply(a: Value, b: Value): M[Value] = a match {
- case Fun(k) => k(b)
- case _ => unitM(Wrong)
- }
-
- def interp(t: Term, e: Environment): M[Value] = t match {
- case Var(x) => lookup(x, e)
- case Con(n) => unitM(Num(n))
- case Add(l, r) => for (a <- interp(l, e);
- b <- interp(r, e);
- c <- add(a, b))
- yield c
- case Lam(x, t) => unitM(Fun(a => interp(t, Pair(x, a) :: e)))
- case App(f, t) => for (a <- interp(f, e);
- b <- interp(t, e);
- c <- apply(a, b))
- yield c
- }
-
- def test(t: Term): String =
- showM(interp(t, List()));
-
- val term0 = App(Lam("x", Add(Var("x"), Var("x"))), Add(Con(10), Con(11)));
- val term1 = App(Con(1), Con(2));
-
- def main(args: Array[String]) = {
- System.out.println(test(term0));
- System.out.println(test(term1));
- }
-}
-
diff --git a/docs/examples/monads/stateInterpreter.scala b/docs/examples/monads/stateInterpreter.scala
deleted file mode 100644
index 97f3335dab..0000000000
--- a/docs/examples/monads/stateInterpreter.scala
+++ /dev/null
@@ -1,86 +0,0 @@
-package examples.monads;
-
-object stateInterpreter {
-
- type State = Int;
-
- val tickS = new M(s => Pair((), s + 1));
-
- case class M[A](in: State => Pair[A, State]) {
- def bind[B](k: A => M[B]) = M[B]{ s0 =>
- val Pair(a, s1) = this in s0; k(a) in s1
- }
- def map[B](f: A => B): M[B] = bind(x => unitM(f(x)));
- def flatMap[B](f: A => M[B]): M[B] = bind(f);
- }
-
- def unitM[A](a: A) = M[A](s => Pair(a, s));
-
- def showM(m: M[Value]): String = {
- val Pair(a, s1) = m in 0;
- "Value: " + a + "; Count: " + s1
- }
-
- type Name = String;
-
- trait Term;
- case class Var(x: Name) extends Term;
- case class Con(n: Int) extends Term;
- case class Add(l: Term, r: Term) extends Term;
- case class Lam(x: Name, body: Term) extends Term;
- case class App(fun: Term, arg: Term) extends Term;
-
- trait Value;
- case object Wrong extends Value {
- override def toString() = "wrong"
- }
- case class Num(n: Int) extends Value {
- override def toString() = n.toString();
- }
- case class Fun(f: Value => M[Value]) extends Value {
- override def toString() = "<function>"
- }
-
- type Environment = List[Pair[Name, Value]];
-
- def lookup(x: Name, e: Environment): M[Value] = e match {
- case List() => unitM(Wrong)
- case Pair(y, b) :: e1 => if (x == y) unitM(b) else lookup(x, e1)
- }
-
- def add(a: Value, b: Value): M[Value] = Pair(a, b) match {
- case Pair(Num(m), Num(n)) => for (_ <- tickS) yield Num(m + n)
- case _ => unitM(Wrong)
- }
-
- def apply(a: Value, b: Value): M[Value] = a match {
- case Fun(k) => for (_ <- tickS; c <- k(b)) yield c
- case _ => unitM(Wrong)
- }
-
- def interp(t: Term, e: Environment): M[Value] = t match {
- case Var(x) => lookup(x, e)
- case Con(n) => unitM(Num(n))
- case Add(l, r) => for (a <- interp(l, e);
- b <- interp(r, e);
- c <- add(a, b))
- yield c
- case Lam(x, t) => unitM(Fun(a => interp(t, Pair(x, a) :: e)))
- case App(f, t) => for (a <- interp(f, e);
- b <- interp(t, e);
- c <- apply(a, b))
- yield c
- }
-
- def test(t: Term): String =
- showM(interp(t, List()));
-
- val term0 = App(Lam("x", Add(Var("x"), Var("x"))), Add(Con(10), Con(11)));
- val term1 = App(Con(1), Con(2));
-
- def main(args: Array[String]) = {
- System.out.println(test(term0));
- System.out.println(test(term1));
- }
-}
-
diff --git a/docs/examples/oneplacebuffer.scala b/docs/examples/oneplacebuffer.scala
deleted file mode 100644
index f7047a1c92..0000000000
--- a/docs/examples/oneplacebuffer.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-package examples
-
-object oneplacebuffer {
-
- import scala.actors.Actor._
- import scala.concurrent.ops
-
- class OnePlaceBuffer {
- private case class Put(x: Int)
- private case object Get
-
- private val m = actor {
- var buf: Option[Int] = None
- loop {
- react {
- case Put(x) if buf.isEmpty =>
- println("put "+x);
- buf = Some(x); reply()
- case Get if !buf.isEmpty =>
- val x = buf.get
- println("get "+x)
- buf = None; reply(x)
- }
- }
- }
- m.start()
-
- def write(x: Int) { m !? Put(x) }
-
- def read(): Int = (m !? Get).asInstanceOf[Int]
- }
-
- def kill(delay: Int) = new java.util.Timer().schedule(
- new java.util.TimerTask {
- override def run() {
- println("[killed]")
- sys exit 0
- }
- },
- delay) // in milliseconds
-
- def main(args: Array[String]) {
- val buf = new OnePlaceBuffer
- val random = new java.util.Random()
-
- def producer(n: Int) {
- Thread.sleep(random nextInt 1000)
- buf write n
- producer(n + 1)
- }
-
- def consumer {
- Thread.sleep(random nextInt 1000)
- val n = buf.read()
- consumer
- }
-
- ops spawn producer(0)
- ops spawn consumer
- kill(10000)
- }
-
-}
-
diff --git a/docs/examples/parsing/ArithmeticParser.scala b/docs/examples/parsing/ArithmeticParser.scala
deleted file mode 100644
index 99cf7a5578..0000000000
--- a/docs/examples/parsing/ArithmeticParser.scala
+++ /dev/null
@@ -1,57 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2006-2011, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package examples.parsing
-
-import scala.util.parsing.combinator.lexical.StdLexical
-import scala.util.parsing.combinator.syntactical.StdTokenParsers
-
-/** Parse and evaluate a numeric expression as a sequence of terms, separated by + or -
- * a term is a sequence of factors, separated by * or /
- * a factor is a parenthesized expression or a number
- *
- * @author Adriaan Moors
- */
-object arithmeticParser extends StdTokenParsers {
- type Tokens = StdLexical ; val lexical = new StdLexical
- lexical.delimiters ++= List("(", ")", "+", "-", "*", "/")
-
- lazy val expr = term*("+" ^^^ {(x: int, y: int) => x + y} | "-" ^^^ {(x: int, y: int) => x - y})
- lazy val term = factor*("*" ^^^ {(x: int, y: int) => x * y} | "/" ^^^ {(x: int, y: int) => x / y})
- lazy val factor: Parser[int] = "(" ~> expr <~ ")" | numericLit ^^ (_.toInt)
-
- def main(args: Array[String]) {
- println(
- if (args.length == 1) {
- expr(new lexical.Scanner(args(0)))
- }
- else
- "usage: scala examples.parsing.arithmeticParser <expr-string>"
- )
- }
-}
-
-
-object arithmeticParserDesugared extends StdTokenParsers {
- type Tokens = StdLexical ; val lexical = new StdLexical
- lexical.delimiters ++= List("(", ")", "+", "-", "*", "/")
-
- lazy val expr = chainl1(term, (keyword("+").^^^{(x: int, y: int) => x + y}).|(keyword("-").^^^{(x: int, y: int) => x - y}))
- lazy val term = chainl1(factor, (keyword("*").^^^{(x: int, y: int) => x * y}).|(keyword("/").^^^{(x: int, y: int) => x / y}))
- lazy val factor: Parser[int] = keyword("(").~>(expr.<~(keyword(")"))).|(numericLit.^^(x => x.toInt))
-
- def main(args: Array[String]) {
- println(
- if (args.length == 1) {
- expr(new lexical.Scanner(args(0)))
- }
- else
- "usage: scala examples.parsing.arithmeticParser <expr-string>"
- )
- }
-}
diff --git a/docs/examples/parsing/ArithmeticParsers.scala b/docs/examples/parsing/ArithmeticParsers.scala
deleted file mode 100644
index 62d7a61862..0000000000
--- a/docs/examples/parsing/ArithmeticParsers.scala
+++ /dev/null
@@ -1,70 +0,0 @@
-package examples.parsing
-
-import scala.util.parsing.combinator1.syntactical.StandardTokenParsers
-
-object ArithmeticParsers extends StandardTokenParsers {
- lexical.delimiters ++= List("(", ")", "+", "-", "*", "/")
-
- def expr: Parser[Any] = term ~ rep("+" ~ term | "-" ~ term)
- def term = factor ~ rep("*" ~ factor | "/" ~ factor)
- def factor: Parser[Any] = "(" ~ expr ~ ")" | numericLit
-
- def main(args: Array[String]) {
- val tokens = new lexical.Scanner(args(0))
- println(args(0))
- println(phrase(expr)(tokens))
- }
-}
-
-object ArithmeticParsers1 extends StandardTokenParsers {
- lexical.delimiters ++= List("(", ")", "+", "-", "*", "/")
-
- val reduceList: Int ~ List[String ~ Int] => Int = {
- case i ~ ps => (i /: ps)(reduce)
- }
-
- def reduce(x: Int, r: String ~ Int) = (r: @unchecked) match {
- case "+" ~ y => x + y
- case "-" ~ y => x - y
- case "*" ~ y => x * y
- case "/" ~ y => x / y
- }
-
- def expr : Parser[Int] = term ~ rep ("+" ~ term | "-" ~ term) ^^ reduceList
- def term : Parser[Int] = factor ~ rep ("*" ~ factor | "/" ~ factor) ^^ reduceList
- def factor: Parser[Int] = "(" ~> expr <~ ")" | numericLit ^^ (_.toInt)
-
- def main(args: Array[String]) {
- val tokens = new lexical.Scanner(args(0))
- println(args(0))
- println(phrase(expr)(tokens))
- }
-}
-
-class Expr
-case class BinOp(op: String, l: Expr, r: Expr) extends Expr
-case class Num(n: Int) extends Expr
-
-object ArithmeticParsers2 extends StandardTokenParsers {
- lexical.delimiters ++= List("(", ")", "+", "-", "*", "/")
-
- val reduceList: Expr ~ List[String ~ Expr] => Expr = {
- case i ~ ps => (i /: ps)(reduce)
- }
-
- def reduce(l: Expr, r: String ~ Expr) = BinOp(r._1, l, r._2)
- def mkNum(s: String) = Num(s.toInt)
-
- def expr : Parser[Expr] = term ~ rep ("+" ~ term | "-" ~ term) ^^ reduceList
- def term : Parser[Expr] = factor ~ rep ("*" ~ factor | "/" ~ factor) ^^ reduceList
- def factor: Parser[Expr] = "(" ~> expr <~ ")" | numericLit ^^ ((s: String) => Num(s.toInt))
-
- def main(args: Array[String]) {
- val parse = phrase(expr)
- val tokens = new lexical.Scanner(args(0))
- println(args(0))
- println(parse(tokens))
- }
-}
-
-
diff --git a/docs/examples/parsing/JSON.scala b/docs/examples/parsing/JSON.scala
deleted file mode 100644
index abfa242e9f..0000000000
--- a/docs/examples/parsing/JSON.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-package examples.parsing
-
-import scala.util.parsing.combinator1.syntactical.StandardTokenParsers
-
-object JSON extends StandardTokenParsers {
- lexical.delimiters += ("{", "}", "[", "]", ":", ",")
- lexical.reserved += ("null", "true", "false")
-
- def obj : Parser[Any] = "{" ~ repsep(member, ",") ~ "}"
- def arr : Parser[Any] = "[" ~ repsep(value, ",") ~ "]"
- def member: Parser[Any] = ident ~ ":" ~ value
- def value : Parser[Any] = ident | numericLit | obj | arr |
- "null" | "true" | "false"
-
- def main(args: Array[String]) {
- val tokens = new lexical.Scanner(args(0))
- println(args(0))
- println(phrase(value)(tokens))
- }
-}
-object JSON1 extends StandardTokenParsers {
- lexical.delimiters += ("{", "}", "[", "]", ":", ",")
- lexical.reserved += ("null", "true", "false")
-
- def obj: Parser[Map[String, Any]] =
- "{" ~> repsep(member, ",") <~ "}" ^^ (Map() ++ _)
-
- def arr: Parser[List[Any]] =
- "[" ~> repsep(value, ",") <~ "]"
-
- def member: Parser[(String, Any)] =
- ident ~ ":" ~ value ^^ { case name ~ ":" ~ value => (name -> value) }
-
- def value: Parser[Any] =
- ident | numericLit ^^ (_.toInt) | obj | arr |
- "null" ^^^ null | "true" ^^^ true | "false" ^^^ false
-
- def main(args: Array[String]) {
- val tokens = new lexical.Scanner(args(0))
- println(args(0))
- println(phrase(value)(tokens))
- }
-}
-
diff --git a/docs/examples/parsing/ListParser.scala b/docs/examples/parsing/ListParser.scala
deleted file mode 100644
index 59fc292c1d..0000000000
--- a/docs/examples/parsing/ListParser.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-package examples.parsing
-
-import scala.util.parsing.combinator.{Parsers, ImplicitConversions, ~, mkTilde}
-import scala.util.parsing.input.CharArrayReader
-
-object listParser {
- abstract class Tree
- case class Id(s: String) extends Tree
- case class Num(n: Int) extends Tree
- case class Lst(elems: List[Tree]) extends Tree
-
- import Character.{isLetter, isLetterOrDigit, isDigit}
- def mkString(cs: List[Any]) = cs.mkString("")
-
- class ListParsers extends Parsers {
- type Elem = Char
-
- lazy val ident = rep1(elem("letter", isLetter), elem("letter or digit", isLetterOrDigit)) ^^ {cs => Id(mkString(cs))}
- lazy val number = chainl1(elem("digit", isDigit) ^^ (_ - '0'), success{(accum: Int, d: Int) => accum * 10 + d}) ^^ Num
- lazy val list = '(' ~> repsep(expr, ',') <~ ')' ^^ Lst
- lazy val expr: Parser[Tree] = list | ident | number
- }
-
- def main(args: Array[String]) {
- println(
- if (args.length == 1) {
- (new ListParsers).expr(new CharArrayReader(args(0).toCharArray()))
- }
- else
- "usage: scala examples.parsing.listParser <list-string>"
- )
- }
-}
diff --git a/docs/examples/parsing/ListParsers.scala b/docs/examples/parsing/ListParsers.scala
deleted file mode 100644
index b449c4a641..0000000000
--- a/docs/examples/parsing/ListParsers.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-package examples.parsing
-
-import scala.util.parsing.combinator1.syntactical.StandardTokenParsers
-
-object ListParsers extends StandardTokenParsers {
- lexical.delimiters ++= List("(", ")", ",")
-
- def expr: Parser[Any] = "(" ~ exprs ~ ")" | ident | numericLit
- def exprs: Parser[Any] = expr ~ rep ("," ~ expr)
-
- def main(args: Array[String]) {
- val tokens = new lexical.Scanner(args(0))
- println(args(0))
- println(phrase(expr)(tokens))
- }
-}
-
-object ListParsers1 extends StandardTokenParsers {
- lexical.delimiters ++= List("(", ")", ",")
-
- def expr: Parser[Any] = "(" ~> exprs <~ ")" | ident | numericLit
-
- def exprs: Parser[List[Any]] = expr ~ rep ("," ~> expr) ^^ { case x ~ y => x :: y }
-
- def main(args: Array[String]) {
- val tokens = new lexical.Scanner(args(0))
- println(args(0))
- println(phrase(expr)(tokens))
- }
-}
diff --git a/docs/examples/parsing/MiniML.scala b/docs/examples/parsing/MiniML.scala
deleted file mode 100644
index f7f7172e8d..0000000000
--- a/docs/examples/parsing/MiniML.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-package examples.parsing
-
-import scala.util.parsing.combinator1.syntactical.StandardTokenParsers
-import scala.util.parsing.combinator1.syntactical.StandardTokenParsers
-
-object MiniML extends StandardTokenParsers {
- lexical.delimiters += ("(", ")", ".", "=")
- lexical.reserved += ("lambda", "let", "in")
-
- def expr: Parser[Any] = (
- "let" ~ ident ~ "=" ~ expr ~ "in" ~ expr
- | "lambda" ~ ident ~ "." ~ expr
- | simpleExpr ~ rep(expr)
- )
- def simpleExpr: Parser[Any] = (
- ident
- | "(" ~ expr ~ ")"
- )
-
- def main(args: Array[String]) {
- val tokens = new lexical.Scanner(args(0))
- println(args(0))
- println(phrase(expr)(tokens))
- }
-}
-
-class Expr
-case class Let(x: String, expr: Expr, body: Expr) extends Expr
-case class Lambda(x: String, expr: Expr) extends Expr
-case class Apply(fun: Expr, arg: Expr) extends Expr
-case class Var(x: String) extends Expr
-
-object MiniML1 extends StandardTokenParsers {
- lexical.delimiters += ("(", ")", ".", "=")
- lexical.reserved += ("lambda", "let", "in")
-
- def expr: Parser[Expr] = (
- "let" ~ ident ~ "=" ~ expr ~ "in" ~ expr ^^ { case "let" ~ x ~ "=" ~ e ~ "in" ~ b => Let(x, e, b) }
- | "lambda" ~ ident ~ "." ~ expr ^^ { case "lambda" ~ x ~ "." ~ e => Lambda(x, e) }
- | simpleExpr ~ rep(expr) ^^ { case f ~ as => (f /: as) (Apply) }
- )
- def simpleExpr: Parser[Expr] = (
- ident ^^ { Var }
- | "(" ~> expr <~ ")"
- )
-
- def main(args: Array[String]) {
- val tokens = new lexical.Scanner(args(0))
- println(args(0))
- println(phrase(expr)(tokens))
- }
-}
diff --git a/docs/examples/parsing/lambda/Main.scala b/docs/examples/parsing/lambda/Main.scala
deleted file mode 100644
index 165e82b670..0000000000
--- a/docs/examples/parsing/lambda/Main.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-package examples.parsing.lambda
-
-import scala.util.parsing.combinator.Parsers
-import scala.util.parsing.input.StreamReader
-
-import java.io.File
-import java.io.FileInputStream
-import java.io.InputStreamReader
-
-/**
- * Parser for an untyped lambda calculus
- *
- * Usage: scala examples.parsing.lambda.Main <file>
- *
- * (example files: see test/ *.kwi)
- *
- * @author Miles Sabin (adapted slightly by Adriaan Moors)
- */
-object Main extends Application with TestParser
-{
- override def main(args: Array[String]) =
- {
- val in = StreamReader(new InputStreamReader(new FileInputStream(new File(args(0))), "ISO-8859-1"))
- parse(in) match
- {
- case Success(term, _) =>
- {
- Console.println("Term: \n"+term)
- }
- case Failure(msg, remainder) => Console.println("Failure: "+msg+"\n"+"Remainder: \n"+remainder.pos.longString)
- case Error(msg, remainder) => Console.println("Error: "+msg+"\n"+"Remainder: \n"+remainder.pos.longString)
- }
- }
-}
diff --git a/docs/examples/parsing/lambda/TestParser.scala b/docs/examples/parsing/lambda/TestParser.scala
deleted file mode 100644
index d26589da1b..0000000000
--- a/docs/examples/parsing/lambda/TestParser.scala
+++ /dev/null
@@ -1,68 +0,0 @@
-package examples.parsing.lambda
-
-import scala.util.parsing.input.Reader
-import scala.util.parsing.combinator.lexical.StdLexical
-import scala.util.parsing.combinator.syntactical.StdTokenParsers
-import scala.util.parsing.combinator.ImplicitConversions
-
-/**
- * Parser for an untyped lambda calculus
- *
- * @author Miles Sabin (adapted slightly by Adriaan Moors)
- */
-trait TestParser extends StdTokenParsers with ImplicitConversions with TestSyntax
-{
- type Tokens = StdLexical
- val lexical = new StdLexical
- lexical.reserved ++= List("unit", "let", "in", "if", "then", "else")
- lexical.delimiters ++= List("=>", "->", "==", "(", ")", "=", "\\", "+", "-", "*", "/")
-
-
- def name : Parser[Name] = ident ^^ Name
-
- // meaning of the arguments to the closure during subsequent iterations
- // (...(expr2 op1 expr1) ... op1 expr1)
- // ^a^^^ ^o^ ^b^^^
- // ^^^^^^^a^^^^^^^ ^o^ ^^b^^
- def expr1 : Parser[Term] =
- chainl1(expr2, expr1, op1 ^^ {o => (a: Term, b: Term) => App(App(o, a), b)})
-
- def expr2 : Parser[Term] =
- chainl1(expr3, expr2, op2 ^^ {o => (a: Term, b: Term) => App(App(o, a), b)})
-
- def expr3 : Parser[Term] =
- chainl1(expr4, expr3, op3 ^^ {o => (a: Term, b: Term) => App(App(o, a), b)})
-
- def expr4 : Parser[Term] =
- ( "\\" ~> lambdas
- | ("let" ~> name) ~ ("=" ~> expr1) ~ ("in" ~> expr1) ^^ flatten3(Let)
- | ("if" ~> expr1) ~ ("then" ~> expr1) ~ ("else" ~> expr1) ^^ flatten3(If)
- | chainl1(aexpr, success(App(_: Term, _: Term)))
- )
-
- def lambdas : Parser[Term] =
- name ~ ("->" ~> expr1 | lambdas) ^^ flatten2(Lam)
-
- def aexpr : Parser[Term] =
- ( numericLit ^^ (_.toInt) ^^ Lit
- | name ^^ Ref
- | "unit" ^^^ Unit()
- | "(" ~> expr1 <~ ")"
- )
-
- def op1 : Parser[Term] =
- "==" ^^^ Ref(Name("=="))
-
- def op2 : Parser[Term] =
- ( "+" ^^^ Ref(Name("+"))
- | "-" ^^^ Ref(Name("-"))
- )
-
- def op3 : Parser[Term] =
- ( "*" ^^^ Ref(Name("*"))
- | "/" ^^^ Ref(Name("/"))
- )
-
- def parse(r: Reader[char]) : ParseResult[Term] =
- phrase(expr1)(new lexical.Scanner(r))
-}
diff --git a/docs/examples/parsing/lambda/TestSyntax.scala b/docs/examples/parsing/lambda/TestSyntax.scala
deleted file mode 100644
index 7edca6ccdc..0000000000
--- a/docs/examples/parsing/lambda/TestSyntax.scala
+++ /dev/null
@@ -1,86 +0,0 @@
-package examples.parsing.lambda
-
-/**
- * Parser for an untyped lambda calculus: abstract syntax tree
- *
- * @author Miles Sabin (adapted slightly by Adriaan Moors)
- */
-trait TestSyntax
-{
- trait Term
-
- case class Unit extends Term
- {
- override def toString = "unit"
- }
-
- case class Lit(n: int) extends Term
- {
- override def toString = n.toString
- }
-
- case class Bool(b: boolean) extends Term
- {
- override def toString = b.toString
- }
-
- case class Name(name: String) extends Term
- {
- override def toString = name
- }
-
- case class Ref(n: Name) extends Term
- {
- def value = n
- }
-
- case class Lam(n: Name, l: Term) extends Term
- {
- override def toString = "(\\ "+n+" -> "+l+")"
- }
-
- case class App(t1: Term, t2: Term) extends Term
- {
- override def toString = "("+t1+" "+t2+")"
- }
-
- case class Let(n: Name, t1: Term, t2: Term) extends Term
- {
- override def toString = "let "+n+" = "+t1+" in "+t2
- }
-
- case class If(c: Term, t1: Term, t2: Term) extends Term
- {
- override def toString = "if "+c+" then "+t1+" else "+t2
- }
-
- trait PrimTerm extends Term
- {
- def apply(n: Lit) : Term
- }
-
- case class PrimPlus extends PrimTerm
- {
- def apply(x: Lit) = new PrimTerm { def apply(y: Lit) = Lit(x.n+y.n) }
- }
-
- case class PrimMinus extends PrimTerm
- {
- def apply(x: Lit) = new PrimTerm { def apply(y: Lit) = Lit(x.n-y.n) }
- }
-
- case class PrimMultiply extends PrimTerm
- {
- def apply(x: Lit) = new PrimTerm { def apply(y: Lit) = Lit(x.n*y.n) }
- }
-
- case class PrimDivide extends PrimTerm
- {
- def apply(x: Lit) = new PrimTerm { def apply(y: Lit) = Lit(x.n/y.n) }
- }
-
- case class PrimEquals extends PrimTerm
- {
- def apply(x: Lit) = new PrimTerm { def apply(y: Lit) = Bool(x.n == y.n) }
- }
-}
diff --git a/docs/examples/parsing/lambda/test/test-01.kwi b/docs/examples/parsing/lambda/test/test-01.kwi
deleted file mode 100644
index 9833d10673..0000000000
--- a/docs/examples/parsing/lambda/test/test-01.kwi
+++ /dev/null
@@ -1 +0,0 @@
-let x = 23 in (\y z -> x+y+z) 1 2
diff --git a/docs/examples/parsing/lambda/test/test-02.kwi b/docs/examples/parsing/lambda/test/test-02.kwi
deleted file mode 100644
index 11198c6fc9..0000000000
--- a/docs/examples/parsing/lambda/test/test-02.kwi
+++ /dev/null
@@ -1 +0,0 @@
-let f = (\x y -> x*y) in f 2 3
diff --git a/docs/examples/parsing/lambda/test/test-03.kwi b/docs/examples/parsing/lambda/test/test-03.kwi
deleted file mode 100644
index d4515d7297..0000000000
--- a/docs/examples/parsing/lambda/test/test-03.kwi
+++ /dev/null
@@ -1 +0,0 @@
-let f = (\x y -> x*y) in f (f 1 2) 3
diff --git a/docs/examples/parsing/lambda/test/test-04.kwi b/docs/examples/parsing/lambda/test/test-04.kwi
deleted file mode 100644
index e54c45457a..0000000000
--- a/docs/examples/parsing/lambda/test/test-04.kwi
+++ /dev/null
@@ -1 +0,0 @@
-let fact = \x -> if x == 0 then 1 else x*(fact (x-1)) in unit
diff --git a/docs/examples/parsing/lambda/test/test-05.kwi b/docs/examples/parsing/lambda/test/test-05.kwi
deleted file mode 100644
index 0b95d67846..0000000000
--- a/docs/examples/parsing/lambda/test/test-05.kwi
+++ /dev/null
@@ -1 +0,0 @@
-let fact = \x -> if x == 0 then 1 else x*(fact (x-1)) in fact 6
diff --git a/docs/examples/parsing/lambda/test/test-06.kwi b/docs/examples/parsing/lambda/test/test-06.kwi
deleted file mode 100644
index 47723dc998..0000000000
--- a/docs/examples/parsing/lambda/test/test-06.kwi
+++ /dev/null
@@ -1 +0,0 @@
-2*3+4*5 == 26
diff --git a/docs/examples/parsing/lambda/test/test-07.kwi b/docs/examples/parsing/lambda/test/test-07.kwi
deleted file mode 100644
index 14fba0d66a..0000000000
--- a/docs/examples/parsing/lambda/test/test-07.kwi
+++ /dev/null
@@ -1 +0,0 @@
-let fix = \f -> f(fix f) in unit
diff --git a/docs/examples/parsing/lambda/test/test-08.kwi b/docs/examples/parsing/lambda/test/test-08.kwi
deleted file mode 100644
index 7166d154f0..0000000000
--- a/docs/examples/parsing/lambda/test/test-08.kwi
+++ /dev/null
@@ -1 +0,0 @@
-let fix = (\f -> f(fix f)) in (fix (\g n -> if n == 0 then 1 else n*(g(n-1)))) 5
diff --git a/docs/examples/patterns.scala b/docs/examples/patterns.scala
deleted file mode 100644
index 738deabc66..0000000000
--- a/docs/examples/patterns.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-package examples
-
-object patterns {
-
- trait Tree
- case class Branch(left: Tree, right: Tree) extends Tree
- case class Leaf(x: Int) extends Tree
-
- val tree1 = Branch(Branch(Leaf(1), Leaf(2)), Branch(Leaf(3), Leaf(4)))
-
- def sumLeaves(t: Tree): Int = t match {
- case Branch(l, r) => sumLeaves(l) + sumLeaves(r)
- case Leaf(x) => x
- }
-
- def find[a,b](it: Iterator[Pair[a, b]], x: a): Option[b] = {
- var result: Option[b] = None
- var found = false
- while (it.hasNext && !found) {
- val Pair(x1, y) = it.next
- if (x == x1) { found = true; result = Some(y) }
- }
- result
- }
-
- def printFinds[a](xs: List[Pair[a, String]], x: a) =
- find(xs.iterator, x) match {
- case Some(y) => System.out.println(y)
- case None => System.out.println("no match")
- }
-
- def main(args: Array[String]) {
- println("sum of leafs=" + sumLeaves(tree1))
- printFinds(List(Pair(3, "three"), Pair(4, "four")), 4)
- }
-}
diff --git a/docs/examples/pilib/elasticBuffer.scala b/docs/examples/pilib/elasticBuffer.scala
deleted file mode 100644
index 5fec96ab6c..0000000000
--- a/docs/examples/pilib/elasticBuffer.scala
+++ /dev/null
@@ -1,77 +0,0 @@
-package examples.pilib
-
-object elasticBuffer {
-
- import scala.concurrent.pilib._
-
- /**
- * Recursive type for channels that carry a "String" channel and
- * an object of the type we define.
- */
- class MetaChan extends Chan[Pair[Chan[String], MetaChan]]
-
- def Buffer(put: Chan[String], get: Chan[String]): Unit = {
-
- /**
- * An empty buffer cell, ready to pass on (o,r) to the left.
- */
- def Bl(i:Chan[String], l: MetaChan,
- o: Chan[String], r: MetaChan): unit =
- choice (
- l(Pair(o,r)) * (System.out.println("Removed one cell.")),
- i * (inp => Cl(i, l, o, r, inp))
- )
-
- /**
- * A buffer cell containing a value, ready to receive (o,r) from the right.
- */
- def Cl(i: Chan[String], l: MetaChan,
- o: Chan[String], r: MetaChan, content: String): Unit =
- choice (
- o(content) * (Bl(i,l,o,r)),
- i * (inp => Dl(i,l,o,r,content, inp)),
- r * ( { case Pair(newo, newr) => Cl(i,l,newo,newr,content) })
- )
-
- /**
- * Two joined buffer cells, of type Cl
- */
- def Dl(i: Chan[String], l: MetaChan,
- o: Chan[String], r: MetaChan,
- content: String, inp: String): Unit = {
- val newlr = new MetaChan
- val newio = new Chan[String]
- spawn < Cl(i, l, newio, newlr, inp) | Cl(newio, newlr, o, r, content) >
- }
-
- // l and r channels for the leftmost and rightmost cell, respectively.
- val unused1 = new MetaChan
- val unused2 = new MetaChan
-
- Bl(put, unused1, get, unused2)
- }
-
- val random = new java.util.Random()
-
- def Producer(n: int, put: Chan[String]): Unit = {
- Thread.sleep(1 + random.nextInt(1000))
- val msg = "object " + n
- put.write(msg)
- System.out.println("Producer gave " + msg)
- Producer(n + 1, put)
- }
-
- def Consumer(get: Chan[String]): Unit = {
- Thread.sleep(1 + random.nextInt(1000))
- val msg = get.read
- System.out.println("Consumer took " + msg)
- Consumer(get)
- }
-
- def main(args: Array[String]): Unit = {
- val put = new Chan[String]
- val get = new Chan[String]
- spawn < Producer(0, put) | Consumer(get) | Buffer(put, get) >
- }
-
-}
diff --git a/docs/examples/pilib/handover.scala b/docs/examples/pilib/handover.scala
deleted file mode 100644
index c9b6156c2c..0000000000
--- a/docs/examples/pilib/handover.scala
+++ /dev/null
@@ -1,186 +0,0 @@
-package examples.pilib
-
-/**
- * Handover example with recursive types for channels.
- */
-object handoverRecursive {
-
- import concurrent.pilib._
-
- val random = new java.util.Random()
-
- /**
- * Recursive type for channels that carry a channel "unit" and
- * an object of the type we define.
- */
- class Switch extends Chan[Pair[Chan[unit], Switch]]
-
- /**
- * Car.
- */
- def Car(talk: Chan[unit], switch: Switch): unit =
- choice (
- switch * ({ case Pair(t,s) => Car(t, s) }),
- talk(()) * ( {
- Thread.sleep(1 + random.nextInt(1000));
- System.out.println("Car emitted a message.");
- Car(talk, switch)
- })
- );
-
- /**
- * Control center.
- */
- def Control(talk1: Chan[unit], switch1: Switch,
- gain1: Switch, lose1: Switch,
- talk2: Chan[unit], switch2: Switch,
- gain2: Switch, lose2: Switch): unit
- = {
- def Control1: unit= {
- Thread.sleep(1 + random.nextInt(1000));
- lose1.write(Pair(talk2, switch2));
- gain2.write(Pair(talk2, switch2));
- Control2
- }
- def Control2: unit = {
- Thread.sleep(1 + random.nextInt(1000));
- lose2.write(Pair(talk1, switch1));
- gain1.write(Pair(talk1, switch1));
- Control1
- }
- Control1
- }
-
- /**
- * Active transmitter.
- */
- def ActiveTransmitter(id: String, talk: Chan[unit], switch: Switch,
- gain: Switch, lose: Switch): unit
- =
- choice (
- talk * (x => {
- System.out.println(id + " received a message.")
- ActiveTransmitter(id, talk, switch, gain, lose)
- }),
- lose * ({ case Pair(t, s) => {
- switch.write(Pair(t, s))
- IdleTransmitter(id, gain, lose)
- }})
- );
-
- /**
- * Idle transmitter.
- */
- def IdleTransmitter(id: String, gain: Switch, lose: Switch): unit = {
- val Pair(t, s) = gain.read;
- ActiveTransmitter(id, t, s, gain, lose)
- }
-
- def main(args: Array[String]): unit = {
- val talk1 = new Chan[unit]
- val switch1 = new Switch
- val gain1 = new Switch
- val lose1 = new Switch
- val talk2 = new Chan[unit]
- val switch2 = new Switch
- val gain2 = new Switch
- val lose2 = new Switch
- spawn <
- Car(talk1, switch1) |
- ActiveTransmitter("Transmitter 1", talk1, switch1, gain1, lose1) |
- IdleTransmitter("Transmitter 2", gain2, lose2) |
- Control(talk1, switch1, gain1, lose1, talk2, switch2, gain2, lose2) >
- }
-}
-
-/**
-* Handover example with type casts.
-*/
-object handoverCast {
-
- import concurrent.pilib._;
-
- val random = new java.util.Random();
-
- /**
- * Car.
- */
- def Car(talk: Chan[Any], switch: Chan[Any]): unit =
- choice (
- switch * (o => {
- val Pair(t,s) = o.asInstanceOf[Pair[Chan[Any],Chan[Any]]];
- Car(t, s)
- }),
- talk(()) * ( {
- Thread.sleep(1 + random.nextInt(1000));
- System.out.println("Car emitted a message.");
- Car(talk, switch)
- })
- );
-
- /**
- * Control center.
- */
- def Control(talk1: Chan[Any], switch1: Chan[Any],
- gain1: Chan[Any], lose1: Chan[Any],
- talk2: Chan[Any], switch2: Chan[Any],
- gain2: Chan[Any], lose2: Chan[Any]): unit
- = {
- def Control1: unit = {
- Thread.sleep(1 + random.nextInt(1000));
- lose1.write(Pair(talk2, switch2));
- gain2.write(Pair(talk2, switch2));
- Control2
- }
- def Control2: unit = {
- Thread.sleep(1 + random.nextInt(1000));
- lose2.write(Pair(talk1, switch1));
- gain1.write(Pair(talk1, switch1));
- Control1
- }
- Control1
- }
-
- /**
- * Active transmitter.
- */
- def ActiveTransmitter(id: String, talk: Chan[Any], switch: Chan[Any],
- gain: Chan[Any], lose: Chan[Any]): unit
- =
- choice (
- talk * (x => {
- System.out.println(id + " received a message.")
- ActiveTransmitter(id, talk, switch, gain, lose)
- }),
- lose * (o => {
- val Pair(t, s) = o.asInstanceOf[Pair[Chan[Any],Chan[Any]]]
- switch.write(Pair(t, s))
- IdleTransmitter(id, gain, lose)
- })
- )
-
- /**
- * Idle transmitter.
- */
- def IdleTransmitter(id: String, gain: Chan[Any], lose: Chan[Any]): unit = {
- val Pair(t, s) = gain.read.asInstanceOf[Pair[Chan[Any],Chan[Any]]]
- ActiveTransmitter(id, t, s, gain, lose)
- }
-
- def main(args: Array[String]): unit = {
- val talk1 = new Chan[Any]
- val switch1 = new Chan[Any]
- val gain1 = new Chan[Any]
- val lose1 = new Chan[Any]
- val talk2 = new Chan[Any]
- val switch2 = new Chan[Any]
- val gain2 = new Chan[Any]
- val lose2 = new Chan[Any]
- spawn <
- Car(talk1, switch1) |
- ActiveTransmitter("Transmitter 1", talk1, switch1, gain1, lose1) |
- IdleTransmitter("Transmitter 2", gain2, lose2) |
- Control(talk1, switch1, gain1, lose1, talk2, switch2, gain2, lose2) >
- }
-
-}
diff --git a/docs/examples/pilib/mobilePhoneProtocol.scala b/docs/examples/pilib/mobilePhoneProtocol.scala
deleted file mode 100644
index e8c0ac1dc4..0000000000
--- a/docs/examples/pilib/mobilePhoneProtocol.scala
+++ /dev/null
@@ -1,172 +0,0 @@
-package examples.pilib
-
-/**
-* Mobile phone protocol.
-* Equivalent to a three-place buffer.
-* @see Bjoern Victor "A verification tool for the polyadic pi-calculus".
-*/
-object mobilePhoneProtocol {
-
- import concurrent.pilib._
-
- val random = new java.util.Random()
-
- // Internal messages exchanged by the protocol.
- trait Message
-
- // Predefined messages used by the protocol.
- case class Data() extends Message;
- case class HoCmd() extends Message; // handover command
- case class HoAcc() extends Message; // handover access
- case class HoCom() extends Message; // handover complete
- case class HoFail() extends Message; // handover fail
- case class ChRel() extends Message; // release
- case class Voice(s: String) extends Message; // voice
- case class Channel(n: Chan[Message]) extends Message; // channel
-
- def MobileSystem(in: Chan[String], out: Chan[String]): unit = {
-
- def CC(fa: Chan[Message], fp: Chan[Message], l: Chan[Channel]): unit =
- choice (
- in * (v => { fa.write(Data()); fa.write(Voice(v)); CC(fa, fp, l) })
- ,
- l * (m_new => {
- fa.write(HoCmd());
- fa.write(m_new);
- choice (
- fp * ({ case HoCom() => {
- System.out.println("Mobile has moved from one cell to another");
- fa.write(ChRel());
- val Channel(m_old) = fa.read;
- l.write(Channel(m_old));
- CC(fp, fa, l)
- }})
- ,
- fa * ({ case HoFail() => {
- System.out.println("Mobile has failed to move from one cell to another");
- l.write(m_new);
- CC(fa, fp, l)
- }})
- )
- })
- );
-
- /*
- * Continuously orders the MSC to switch the MS to the non-used BS.
- */
- def HC(l: Chan[Channel], m: Chan[Message]): unit = {
- Thread.sleep(1 + random.nextInt(1000));
- l.write(Channel(m));
- val Channel(m_new) = l.read;
- HC(l, m_new)
- }
-
- /**
- * Mobile switching center.
- */
- def MSC(fa: Chan[Message], fp: Chan[Message], m: Chan[Message]): unit = {
- val l = new Chan[Channel];
- spawn < HC(l, m) | CC(fa, fp, l) >
- }
-
- /**
- * Active base station.
- */
- def BSa(f: Chan[Message], m: Chan[Message]): unit =
- (f.read) match {
- case Data() => {
- val v = f.read;
- m.write(Data());
- m.write(v);
- BSa(f, m)
- }
- case HoCmd() => {
- val v = f.read;
- m.write(HoCmd());
- m.write(v);
- choice (
- f * ({ case ChRel() => {
- f.write(Channel(m));
- BSp(f, m)
- }})
- ,
- m * ({ case HoFail() => {
- f.write(HoFail());
- BSa(f, m)
- }})
- )
- }
- };
-
- /**
- * Passive base station.
- */
- def BSp(f: Chan[Message], m: Chan[Message]): unit = {
- val HoAcc = m.read
- f.write(HoCom())
- BSa(f, m)
- }
-
- /**
- * Mobile station.
- */
- def MS(m: Chan[Message]): unit =
- (m.read) match {
- case Data() => {
- val Voice(v) = m.read;
- out.write(v);
- MS(m)
- }
- case HoCmd() =>
- (m.read) match {
- case Channel(m_new) => {
- if (random.nextInt(1) == 0)
- choice ( m_new(HoAcc()) * (MS(m_new)) );
- else
- choice ( m(HoFail()) * (MS(m)) );
- }
- }
- };
-
- def P(fa: Chan[Message], fp: Chan[Message]): unit = {
- val m = new Chan[Message];
- spawn < MSC(fa, fp, m) | BSp(fp, m) >
- }
-
- def Q(fa: Chan[Message]): unit = {
- val m = new Chan[Message];
- spawn < BSa(fa, m) | MS(m) >
- }
-
- val fa = new Chan[Message];
- val fp = new Chan[Message];
- spawn < Q(fa) | P(fa, fp) >;
- }
-
- //***************** Entry function ******************//
-
- def main(args: Array[String]): unit = {
-
- def Producer(n: Int, put: Chan[String]): unit = {
- Thread.sleep(1 + random.nextInt(1000));
- val msg = "object " + n;
- put.write(msg);
- System.out.println("Producer gave " + msg);
- Producer(n + 1, put)
- }
-
- def Consumer(get: Chan[String]): unit = {
- Thread.sleep(1 + random.nextInt(1000));
- val msg = get.read;
- System.out.println("Consumer took " + msg);
- Consumer(get)
- }
-
- val put = new Chan[String];
- val get = new Chan[String];
- spawn < Producer(0, put) | Consumer(get) | MobileSystem(put, get) >
- }
-
-}
-
-
diff --git a/docs/examples/pilib/piNat.scala b/docs/examples/pilib/piNat.scala
deleted file mode 100644
index a1a0e682e1..0000000000
--- a/docs/examples/pilib/piNat.scala
+++ /dev/null
@@ -1,89 +0,0 @@
-package examples.pilib
-
-import scala.concurrent.pilib._
-
-/** Church encoding of naturals in the Pi-calculus */
-object piNat extends Application {
-
- /** Locations of Pi-calculus natural */
- class NatChan extends Chan[Triple[Chan[Unit], Chan[NatChan], Chan[NatChan]]]
-
- /** Zero */
- def Z(l: NatChan): Unit = choice (
- l * { case Triple(z, sd, d) => z.write(()) }
- )
-
- /** Successor of Double */
- def SD(n: NatChan, l: NatChan): Unit = choice (
- l * { case Triple(z, sd, d) => sd.write(n) }
- )
-
- /** Double */
- def D(n: NatChan, l: NatChan): Unit = choice (
- l * { case Triple(z, sd, d) => d.write(n) }
- )
-
- /** Make "l" a location representing the natural "n" */
- def make(n: Int, l: NatChan): Unit =
- if (n == 0) Z(l)
- else if (n % 2 == 0) { val l1 = new NatChan; spawn < D(l1, l) >; make(n/2, l1) }
- else { val l1 = new NatChan; spawn < SD(l1, l) >; make(n/2, l1) }
-
- /** Consume the natural "m" and put it successor at location "n" */
- def Succ(m: NatChan, n: NatChan) {
- val z = new Chan[Unit]
- val sd = new Chan[NatChan]
- val d = new Chan[NatChan]
- spawn < m.write(Triple(z, sd, d)) >;
- choice (
- z * { x => make(1, n) },
- sd * { m1 => { val n1 = new NatChan; spawn < D(n1, n) >; Succ(m1, n1) } },
- d * { m1 => SD(m1, n) }
- )
- }
-
- /** Consume the natural "l" and put two copies at locations "m" and "n" */
- def Copy(l: NatChan, m: NatChan, n: NatChan) {
- val z = new Chan[Unit]
- val sd = new Chan[NatChan]
- val d = new Chan[NatChan]
- spawn < l.write(Triple(z, sd, d)) >;
- choice (
- z * { x => spawn < Z(m) >; Z(n) },
- sd * { l1 => { val m1 = new NatChan; val n1 = new NatChan;
- spawn < SD(m1, m) | SD(n1, n) >;
- Copy(l1, m1, n1) } },
- d * { l1 => { val m1 = new NatChan; val n1 = new NatChan;
- spawn < D(m1, m) | D(n1, n) >;
- Copy(l1, m1, n1) } }
- )
- }
-
- /** Consume the natural at location "n" and return its value */
- def value(n: NatChan): Int = {
- val z = new Chan[Unit]
- val sd = new Chan[NatChan]
- val d = new Chan[NatChan]
- spawn < n.write(Triple(z, sd, d)) >;
- choice (
- z * { x => 0 },
- sd * { n1 => 2 * value(n1) + 1 },
- d * { n1 => 2 * value(n1) }
- )
- }
-
- // Test
- val i = 42
- val l = new NatChan
- val l1 = new NatChan
- val l2 = new NatChan
- val l3 = new NatChan
-
- spawn <
- make(i, l) |
- Copy(l, l1, l2) |
- Succ(l2, l3) |
- println("" + i + " = " + value(l1)) |
- println("succ " + i + " = " + value(l3)) >
-
-}
diff --git a/docs/examples/pilib/rwlock.scala b/docs/examples/pilib/rwlock.scala
deleted file mode 100644
index bb1c26bdf2..0000000000
--- a/docs/examples/pilib/rwlock.scala
+++ /dev/null
@@ -1,329 +0,0 @@
-package examples.pilib
-
-/**
-* From Pi to Scala: Semaphores, monitors, read/write locks.
-* Readers/writers locks.
-*/
-object rwlock {
-
- import scala.concurrent.pilib._
-
- class Signal extends Chan[unit] {
- def send = write(())
- def receive = read
- }
-
- class CountLock {
- private val busy = new Signal
- def get = busy.send
- def release = busy.receive
- spawn < release >
- }
-
- /** A binary semaphore
- */
- class Lock {
- private val busy = new Signal;
- private val free = new Signal;
- def get = busy.send;
- def release = free.send;
- spawn < (while (true) {
- choice (
- busy * (x => free.receive),
- free * (x => ())
- )
- }) >
- }
-
- /** A monitor a la Java
- */
- class JavaMonitor {
-
- private val lock = new Lock
-
- private var waiting: List[Signal] = Nil
-
- def Wait = {
- val s = new Signal
- waiting = s :: waiting
- lock.release
- s.receive
- lock.get
- }
-
- def Notify =
- if (!waiting.isEmpty) {
- waiting.head.send
- waiting = waiting.tail
- }
-
- def NotifyAll =
- while (!waiting.isEmpty) {
- waiting.head.send
- waiting = waiting.tail
- }
-
- def await(cond: => boolean): unit =
- while (false == cond) (Wait)
- }
-
- /*
- class Buffer[a](size: Int) extends JavaMonitor with {
- var in = 0, out = 0, n = 0;
- val elems = new Array[a](size);
- def put(x: a) = synchronized {
- await(n < size);
- elems(out) = x;
- out = (out + 1) % size;
- }
- def get: a = synchronized {
- await(n > 0);
- val x = elems(in);
- in = (in + 1) % size;
- x
- }
- }
- */
-
- /** A readers/writers lock. */
- trait ReadWriteLock {
- def startRead: unit
- def startWrite: unit
- def endRead: unit
- def endWrite: unit
- }
-
- /**
- * A readers/writers lock, using monitor abstractions.
- */
- class ReadWriteLock1 extends JavaMonitor with ReadWriteLock {
-
- private var nactive: int = 0
- private var nwriters: int = 0
-
- def status =
- System.out.println(nactive + " active, " + nwriters + " writers");
-
- def startRead = synchronized {
- await(nwriters == 0)
- nactive = nactive + 1
- status
- }
-
- def startWrite = synchronized {
- nwriters = nwriters + 1
- await(nactive == 0)
- nactive = 1
- status
- }
-
- def endRead = synchronized {
- nactive = nactive - 1
- if (nactive == 0) NotifyAll
- status
- }
-
- def endWrite = synchronized {
- nwriters = nwriters - 1
- nactive = 0
- NotifyAll
- status
- }
- }
-
- /** A readers/writers lock, using semaphores
- */
- class ReadWriteLock2 extends ReadWriteLock {
-
- private var rc: int = 0 // reading readers
- private var wc: int = 0 // writing writers
- private var rwc: int = 0 // waiting readers
- private var wwc: int = 0 // waiting writers
- private val mutex = new Lock
- private val rsem = new Lock
- private val wsem = new Lock
-
- def startRead = {
- mutex.get;
- if (wwc > 0 || wc > 0) {
- rwc = rwc + 1;
- mutex.release;
- rsem.get;
- rwc = rwc - 1
- }
- rc = rc + 1;
- if (rwc > 0) rsem.release;
- mutex.release
- }
-
- def startWrite = {
- mutex.get;
- if (rc > 0 || wc > 0) {
- wwc = wwc + 1;
- mutex.release;
- wsem.get;
- wwc = wwc - 1
- }
- wc = wc + 1;
- mutex.release
- }
-
- def endRead = {
- mutex.get;
- rc = rc - 1;
- if (rc == 0 && wwc > 0) wsem.release;
- mutex.release
- }
-
- def endWrite = {
- mutex.get;
- wc = wc - 1;
- if (rwc > 0)
- rsem.release
- else if (wwc > 0) wsem.release;
- mutex.release
- }
- }
-
- /** A readers/writers lock, using channels, without priortities
- */
- class ReadWriteLock3 extends ReadWriteLock {
-
- private val sr = new Signal
- private val er = new Signal
- private val sw = new Signal
- private val ew = new Signal
-
- def startRead = sr.send
- def startWrite = sw.send
- def endRead = er.send
- def endWrite = ew.send
-
- private def rwlock: unit = choice (
- sr * (x => reading(1)),
- sw * (x => { ew.receive; rwlock })
- )
-
- private def reading(n: int): unit = choice (
- sr * (x => reading(n+1)),
- er * (x => if (n == 1) rwlock else reading(n-1))
- )
-
- spawn < rwlock >
- }
-
- /** Same, with sequencing
- */
- class ReadWriteLock4 extends ReadWriteLock {
-
- private val rwlock = new ReadWriteLock3
-
- private val sr = new Signal
- private val ww = new Signal
- private val sw = new Signal
-
- def startRead = sr.send
- def startWrite = { ww.send; sw.send }
- def endRead = rwlock.endRead
- def endWrite = rwlock.endWrite
-
- private def queue: unit = choice (
- sr * (x => { rwlock.startRead ; queue }),
- ww * (x => { rwlock.startWrite; sw.receive; queue })
- )
-
- spawn < queue >;
- }
-
- /** Readwritelock where writers always have priority over readers
- */
- class ReadWriteLock5 extends ReadWriteLock {
-
- private val sr = new Signal
- private val er = new Signal
- private val ww = new Signal
- private val sw = new Signal
- private val ew = new Signal
-
- def startRead = sr.send
- def startWrite = { ww.send; sw.send }
- def endRead = er.send
- def endWrite = ew.send
-
- private def Reading(nr: int, nw: int): unit =
- if (nr == 0 && nw == 0)
- choice (
- sr * (x => Reading(1, 0)),
- ww * (x => Reading(0, 1))
- )
- else if (nr == 0 && nw != 0) {
- sw.receive;
- Writing(nw);
- }
- else if (nr != 0 && nw == 0)
- choice (
- sr * (x => Reading(nr + 1, 0)),
- er * (x => Reading(nr - 1, 0)),
- ww * (x => Reading(nr, 1))
- )
- else if (nr != 0 && nw != 0)
- choice (
- ww * (x => Reading(nr, nw + 1)),
- er * (x => Reading(nr - 1, nw))
- );
-
- private def Writing(nw: int): unit = choice (
- ew * (x => Reading(0, nw - 1)),
- ww * (x => Writing(nw + 1))
- );
-
- spawn < Reading(0, 0) >;
-
- }
-
- /**
- * Main function.
- */
- def main(args: Array[String]): unit = {
- val random = new java.util.Random()
-
- def reader(i: int, rwlock: ReadWriteLock): unit = {
- Thread.sleep(1 + random.nextInt(100))
- System.err.println("Reader " + i + " wants to read.")
- rwlock.startRead
- System.err.println("Reader " + i + " is reading.")
- Thread.sleep(1 + random.nextInt(100))
- rwlock.endRead
- System.err.println("Reader " + i + " has read.")
- reader(i, rwlock)
- }
-
- def writer(i: int, rwlock: ReadWriteLock): unit = {
- Thread.sleep(1 + random.nextInt(100))
- System.err.println("Writer " + i + " wants to write.")
- rwlock.startWrite
- System.err.println("Writer " + i + " is writing.")
- Thread.sleep(1 + random.nextInt(100))
- rwlock.endWrite
- System.err.println("Writer " + i + " has written.")
- writer(i, rwlock)
- }
-
- val n = try { Integer.parseInt(args(0)) } catch { case _ => 0 }
- if (n < 1 || 5 < n) {
- Console.println("Usage: scala examples.pilib.rwlock <n> (n=1..5)")
- exit
- }
- val rwlock = n match {
- case 1 => new ReadWriteLock1
- case 2 => new ReadWriteLock2
- case 3 => new ReadWriteLock3
- case 4 => new ReadWriteLock4
- case 5 => new ReadWriteLock5
- }
- List.range(0, 5) foreach (i => spawn < reader(i, rwlock) >)
- List.range(0, 5) foreach (i => spawn < writer(i, rwlock) >)
- }
-
-}
-
diff --git a/docs/examples/pilib/scheduler.scala b/docs/examples/pilib/scheduler.scala
deleted file mode 100644
index fd8fd52600..0000000000
--- a/docs/examples/pilib/scheduler.scala
+++ /dev/null
@@ -1,150 +0,0 @@
-package examples.pilib
-
-import scala.concurrent.pilib._
-
-object scheduler {
-
- /**
- * Random number generator.
- */
- val random = new util.Random()
-
- //***************** Scheduler ******************//
-
- /**
- * A cell of the scheduler whose attached agent is allowed to start.
- */
- def A(a: Chan[Unit], b: Chan[Unit])(d: Chan[Unit], c: Chan[Unit]) {
- ///- ... complete here ...
- choice ( a * { x => C(a, b)(d, c) })
- ///+
- }
-
- /**
- * A cell of the scheduler in another intermediate state.
- */
- def C(a: Chan[Unit], b: Chan[Unit])(d: Chan[Unit], c: Chan[Unit]) {
- ///- ... complete here ...
- choice (c * { x => B(a, b)(d, c) })
- ///+
- }
-
- /**
- * A cell of the scheduler whose attached agent is allowed to finish.
- */
- def B(a: Chan[Unit], b: Chan[Unit])(d: Chan[Unit], c: Chan[Unit]) {
- ///- ... complete here ...
- // choice (b * { x => D(a, b)(d, c) }) // incorrect naive solution
- choice (
- b * { x => choice ( d(()) * A(a, b)(d, c) ) }, // b.'d.A
- d(()) * (choice (b * { x => A(a, b)(d, c) })) // 'd.b.A
- )
- ///+
- }
-
- /**
- * A cell of the scheduler whose attached agent is not yet allowed to start.
- */
- def D(a: Chan[Unit], b: Chan[Unit])(d: Chan[Unit], c: Chan[Unit]) {
- ///- ... complete here ...
- choice (d(()) * A(a, b)(d, c))
- ///+
- }
-
- //***************** Agents ******************//
-
- def agent(i: Int)(a: Chan[Unit], b: Chan[Unit]) {
- // 50% chance that we sleep forever
- if (i == 0 && random.nextInt(10) < 5) {
- a.attach(x => println("Start and sleeps ----> " + i))
- Thread.sleep(random.nextInt(1000))
- a.write(())
- }
- else {
- a.attach(x => println("Start ----> " + i))
- b.attach(x => println("Stop -> " + i))
- Thread.sleep(random.nextInt(1000))
- a.write(())
- Thread.sleep(random.nextInt(1000))
- b.write(())
- agent(i)(a, b)
- }
- }
-
- //***************** Entry function ******************//
-
- /**
- * Creates a scheduler for five agents (programs).
- */
-
- def main(args: Array[String]) {
- val agentNb = 5
- val agents = List.range(0, agentNb) map agent
- scheduleAgents(agents)
- }
-
- //***************** Infrastructure *****************//
-
- /**
- * A cell is modelled as a function that takes as parameters
- * input and output channels and which returns nothing.
- */
- type Cell = (Chan[Unit], Chan[Unit]) => Unit
-
- /**
- * Creates a cell composed of two cells linked together.
- */
- def join(cell1: Cell, cell2: Cell): Cell =
- (l: Chan[Unit], r: Chan[Unit]) => {
- val link = new Chan[Unit];
- spawn < cell1(l, link) | cell2(link, r) >
- };
-
- /**
- * Links the output of a cell to its input.
- */
- def close(cell: Cell) {
- val a = new Chan[Unit]
- cell(a, a)
- }
-
- /**
- * Creates a cell consisting of a chain of cells.
- */
- def chain(cells: List[Cell]): Cell =
- cells reduceLeft join
-
- /**
- * Creates a cell consisting of a chain of cells.
- */
- def makeRing(cells: List[Cell]): Unit =
- close(chain(cells))
-
- /**
- * An agent is modelled as a function that takes as parameters channels to
- * signal that it has started or finished.
- */
- type Agent = (Chan[Unit], Chan[Unit]) => Unit
-
- /**
- * Takes a list of agents and schedules them.
- */
- def scheduleAgents(agents: List[Agent]) {
- var firstAgent = true;
- val cells = agents map (ag => {
- val a = new Chan[Unit];
- val b = new Chan[Unit];
- spawn < ag(a, b) >;
- (d: Chan[Unit], c: Chan[Unit]) => if (firstAgent) {
- firstAgent = false;
- A(a, b)(d, c)
- }
- else
- D(a, b)(d, c)
- });
- makeRing(cells)
- }
-
-}
-
-
diff --git a/docs/examples/pilib/semaphore.scala b/docs/examples/pilib/semaphore.scala
deleted file mode 100644
index 951c90e8d4..0000000000
--- a/docs/examples/pilib/semaphore.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-package examples.pilib
-
-import scala.concurrent.pilib._
-
-/** Solution of exercise session 6 (first question). */
-object semaphore {
-
- class Signal extends Chan[Unit] {
- def send = write(())
- def receive = read
- }
-
- /** Interface. */
- trait Semaphore {
- def get: Unit
- def release: Unit
- }
-
- /** First implementation. */
- class Sem1 extends Semaphore {
-
- private val g = new Signal
- private val r = new Signal
-
- def get: Unit = g.send
- def release: Unit = r.send
-
- private def Sched: Unit = choice (
- g * (x => { r.receive; Sched }),
- r * (x => Sched)
- )
- spawn< Sched >
- }
-
- /** Second implementation. */
- class Sem2 extends Semaphore {
-
- private val a = new Signal
- private val na = new Signal
-
- def get { a.receive; spawn< na.send > }
- def release: Unit = choice (
- a * (x => spawn< a.send >),
- na * (x => spawn< a.send >)
- )
- spawn< a.send >
- }
-
- /** Test program. */
- def main(args: Array[String]) {
- val random = new util.Random()
- val sem = new Sem2
- def mutex(p: => Unit) { sem.get; p; sem.release }
-
- spawn< {
- Thread.sleep(1 + random.nextInt(100));
- mutex( {
- println("a1");
- Thread.sleep(1 + random.nextInt(100));
- println("a2")
- } )
- } | {
- Thread.sleep(1 + random.nextInt(100));
- mutex( {
- println("b1");
- Thread.sleep(1 + random.nextInt(100));
- println("b2")
- } )
- } >;
- }
-}
-
diff --git a/docs/examples/pilib/twoPlaceBuffer.scala b/docs/examples/pilib/twoPlaceBuffer.scala
deleted file mode 100644
index 255f70ca06..0000000000
--- a/docs/examples/pilib/twoPlaceBuffer.scala
+++ /dev/null
@@ -1,67 +0,0 @@
-package examples.pilib
-
-import scala.concurrent.pilib._
-
-/** Two-place buffer specification and implementation. */
-object twoPlaceBuffer extends Application {
-
- /**
- * Specification.
- */
- def Spec[A](in: Chan[A], out: Chan[A]) {
-
- def B0: Unit = choice (
- in * (x => B1(x))
- )
-
- def B1(x: A): Unit = choice (
- out(x) * (B0),
- in * (y => B2(x, y))
- )
-
- def B2(x: A, y: A): Unit = choice (
- out(x) * (B1(y))
- )
-
- B0
- }
-
- /**
- * Implementation using two one-place buffers.
- */
- def Impl[A](in: Chan[A], out: Chan[A]) {
- ///- ... complete here ...
- // one-place buffer
- def OnePlaceBuffer[A](in: Chan[A], out: Chan[A]) {
- def B0: Unit = choice ( in * (x => B1(x)) )
- def B1(x: A): Unit = choice ( out(x) * (B0))
- B0
- }
- val hidden = new Chan[A]
- spawn < OnePlaceBuffer(in, hidden) | OnePlaceBuffer(hidden, out) >
- ///+
- }
-
- val random = new util.Random()
-
- def Producer(n: Int, in: Chan[String]) {
- Thread.sleep(random.nextInt(1000))
- val msg = "" + n
- choice (in(msg) * {})
- Producer(n + 1, in)
- }
-
- def Consumer(out: Chan[String]) {
- Thread.sleep(random.nextInt(1000))
- choice (out * { msg => () })
- Consumer(out)
- }
-
- val in = new Chan[String]
- in.attach(s => println("put " + s))
- val out = new Chan[String]
- out.attach(s => println("get " + s))
- //spawn < Producer(0, in) | Consumer(out) | Spec(in, out) >
- spawn < Producer(0, in) | Consumer(out) | Impl(in, out) >
-
-}
diff --git a/docs/examples/plugintemplate/.classpath b/docs/examples/plugintemplate/.classpath
deleted file mode 100644
index e9069639ae..0000000000
--- a/docs/examples/plugintemplate/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="doc/examples"/>
- <classpathentry kind="src" path="test"/>
- <classpathentry kind="con" path="ch.epfl.lamp.sdt.launching.SCALA_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="/Applications/eclipse-3.4M6a/plugins/ch.epfl.lamp.sdt.core_2.7.1.r14724-b20080421111118/lib/scala-compiler.jar"/>
- <classpathentry kind="lib" path="lib/scalatest.jar"/>
- <classpathentry kind="output" path="build/eclipse"/>
-</classpath>
diff --git a/docs/examples/plugintemplate/.project b/docs/examples/plugintemplate/.project
deleted file mode 100644
index 075b0c580c..0000000000
--- a/docs/examples/plugintemplate/.project
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>plugintemplate</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>ch.epfl.lamp.sdt.core.scalabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>ch.epfl.lamp.sdt.core.scalanature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/docs/examples/plugintemplate/build.xml b/docs/examples/plugintemplate/build.xml
deleted file mode 100644
index 37c8441ce3..0000000000
--- a/docs/examples/plugintemplate/build.xml
+++ /dev/null
@@ -1,265 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="plugintemplate" default="pack">
- <!-- Edit the file plugin.properties to set
- - scala.home
- - plugin.name
- - plugin.commandname
- - plugin.description
- - plugin.mainclass
- - version numbers
- -->
- <property file="${basedir}/plugin.properties"/>
-
- <property name="version" value="${version.major}.${version.minor}"/>
-
- <taskdef resource="scala/tools/ant/antlib.xml">
- <classpath>
- <pathelement location="${scala.home}/lib/scala-compiler.jar"/>
- <pathelement location="${scala.home}/lib/scala-library.jar"/>
- </classpath>
- </taskdef>
-
-
- <!-- =================================================================
- End-user targets
- ================================================================== -->
-
- <target name="build" depends="build.main"/>
- <target name="build.all" depends="build.done"/>
- <target name="test" depends="test.all"/>
- <target name="guitest" depends="guitest.all"/>
- <target name="doc" depends="doc.done"/>
- <target name="pack" depends="pack.done"/>
- <target name="dist" depends="dist.done"/>
- <target name="clean" depends="clean.all"/>
-
- <!-- =================================================================
- Build targets
- ================================================================== -->
-
- <target name="build.main">
- <mkdir dir="build/build.main"/>
- <scalac srcdir="src"
- destdir="build/build.main"
- includes="**/*.scala">
- <classpath>
- <pathelement location="${scala.home}/lib/scala-library.jar"/>
- <pathelement location="${scala.home}/lib/scala-compiler.jar"/>
- </classpath>
- </scalac>
- </target>
-
- <target name="build.test" depends="build.main">
- <mkdir dir="build/build.test"/>
- <scalac srcdir="test"
- destdir="build/build.test"
- includes="**/*.scala">
- <classpath>
- <pathelement location="${scala.home}/lib/scala-library.jar"/>
- <pathelement location="${scala.home}/lib/scala-compiler.jar"/>
- <pathelement location="lib/scalatest.jar"/>
- <pathelement location="build/build.main"/>
- </classpath>
- </scalac>
- </target>
-
- <target name="build.examples" depends="build.test">
- <mkdir dir="build/build.examples"/>
- <scalac srcdir="doc/examples"
- destdir="build/build.examples"
- includes="**/*.scala">
- <classpath>
- <pathelement location="${scala.home}/lib/scala-library.jar"/>
- <pathelement location="${scala.home}/lib/scala-compiler.jar"/>
- <pathelement location="build/build.main"/>
- </classpath>
- </scalac>
- </target>
-
- <target name="build.done" depends="build.examples"/>
-
- <!-- =================================================================
- Test targets
- ================================================================== -->
-
- <target name="test.all" depends="build.done">
- <!-- fork="true" is good for running the graphical mode -->
- <java classname="org.scalatest.tools.Runner" fork="true">
- <classpath>
- <pathelement location="${scala.home}/lib/scala-compiler.jar" />
- <pathelement location="${scala.home}/lib/scala-library.jar" />
- <pathelement location="lib/scalatest.jar" />
- <pathelement location="build/build.main" />
- <pathelement location="build/build.test" />
- </classpath>
-
- <arg value="-p" />
- <arg value="build/build.test" />
-
- <arg value="-o" />
- </java>
- </target>
-
- <target name="guitest.all" depends="build.done">
- <!-- fork="true" is good for running the graphical mode -->
- <java classname="org.scalatest.tools.Runner" fork="true">
- <classpath>
- <pathelement location="${scala.home}/lib/scala-compiler.jar" />
- <pathelement location="${scala.home}/lib/scala-library.jar" />
- <pathelement location="lib/scalatest.jar" />
- <pathelement location="build/build.main" />
- <pathelement location="build/build.test" />
- </classpath>
-
- <arg value="-p" />
- <arg value="build/build.test" />
-
- <arg value="-g" />
- </java>
- </target>
-
- <!-- =================================================================
- Doc targets
- ================================================================== -->
-
- <target name="doc.main">
- <mkdir dir="doc/api"/>
- <scaladoc srcdir="src"
- destdir="doc/api"
- includes="**/*.scala">
- <classpath>
- <pathelement location="${scala.home}/lib/scala-library.jar"/>
- <pathelement location="${scala.home}/lib/scala-compiler.jar"/>
- </classpath>
- </scaladoc>
- </target>
-
- <target name="doc.done" depends="doc.main"/>
-
- <!-- =================================================================
- Pack targets
- ================================================================== -->
-
- <target name="pack.main" depends="build.done">
- <mkdir dir="build/pack"/>
- <jar destfile="build/pack/${plugin.name}.jar">
- <fileset dir="build/build.main"/>
- <fileset file="plugin.properties"/>
- <fileset file="misc/scalac-plugin.xml"/>
- </jar>
- </target>
-
- <target name="pack.src" depends="pack.main">
- <jar destfile="build/pack/${plugin.name}-src.jar"
- basedir="src"
- includes="**/*.scala"/>
- </target>
-
- <target name="pack.done" depends="pack.src"/>
-
- <!-- =================================================================
- Dist targets
- ================================================================== -->
-
- <target name="dist.bin" depends="test.all,pack.done,doc.done">
- <mkdir dir="build/toolscript"/>
- <scalascript
- file="build/toolscript/${plugin.commandname}"
- class="${plugin.mainclass}"/>
- <chmod dir="build/toolscript" perm="a+rx" excludes="*.bat"/>
- </target>
-
- <target name="dist.archive" depends="dist.bin">
- <mkdir dir="build/dist"/>
- <tar destfile="build/dist/${plugin.name}-${version}.tgz"
- compression="gzip">
- <tarfileset prefix="lib" dir="build/pack"
- includes="${plugin.name}.jar"/>
- <tarfileset prefix="src" dir="build/pack"
- includes="${plugin.name}-src.jar"/>
- <tarfileset prefix="doc/${plugin.name}" dir="doc"
- includes="README"/>
- <tarfileset prefix="doc/${plugin.name}" dir="doc"
- includes="examples/**"/>
- <tarfileset prefix="doc/${plugin.name}" dir="doc"
- includes="api/**"/>
- <tarfileset prefix="bin" dir="build/toolscript"
- includes="${plugin.commandname}" mode="755"/>
- <tarfileset prefix="bin" dir="build/toolscript"
- includes="${plugin.commandname}.bat"/>
- <tarfileset prefix="misc/scala-devel/plugins" dir="build/pack"
- includes="${plugin.name}.jar"/>
- </tar>
- </target>
-
- <target name="dist.sbaz" depends="dist.archive">
- <sbaz file="build/dist/${plugin.name}-${version}.sbp"
- adfile="build/dist/${plugin.name}-${version}.advert"
- name="${plugin.name}"
- version="${version}"
- depends="scala-devel"
- desc="${plugin.description}"
- link="${plugin.sbazbaseurl}/${plugin.name}-${version}.sbp">
- <libset dir="build/pack" includes="${plugin.name}.jar"/>
- <srcset dir="build/pack" includes="${plugin.name}-src.jar"/>
- <docset dir="doc" includes="README"/>
- <docset dir="doc" includes="examples/**"/>
- <docset dir="doc" includes="api/**"/>
- <binset dir="build/toolscript"/>
- <looseset destination="misc/scala-devel/plugins">
- <fileset file="build/pack/${plugin.name}.jar"/>
- </looseset>
- </sbaz>
- </target>
-
- <target name="dist.done" depends="dist.sbaz"/>
-
- <!-- =================================================================
- Local installation
- ================================================================== -->
-
- <target name="install" depends="dist.done">
- <exec executable="sbaz">
- <arg line="-v install -f build/dist/${plugin.name}-${version}.sbp"/>
- </exec>
- </target>
-
- <target name="uninstall">
- <exec executable="sbaz">
- <arg line="remove ${plugin.name}"/>
- </exec>
- </target>
-
- <!-- =================================================================
- Clean targets
- ================================================================== -->
-
- <target name="clean.build">
- <delete dir="build/build.main" includeemptydirs="yes"
- quiet="yes" failonerror="no"/>
- <delete dir="build/build.test" includeemptydirs="yes"
- quiet="yes" failonerror="no"/>
- <delete dir="build/build.examples" includeemptydirs="yes"
- quiet="yes" failonerror="no"/>
- </target>
-
- <target name="clean.pack" depends="clean.build">
- <delete dir="build/pack" includeemptydirs="yes"
- quiet="yes" failonerror="no"/>
- </target>
-
- <target name="clean.dist" depends="clean.pack">
- <delete dir="build/dist" includeemptydirs="yes"
- quiet="yes" failonerror="no"/>
- <delete dir="build/toolscript" includeemptydirs="yes"
- quiet="yes" failonerror="no"/>
- </target>
-
- <target name="clean.doc">
- <delete dir="doc/api" includeemptydirs="yes"
- quiet="yes" failonerror="no"/>
- </target>
-
- <target name="clean.all" depends="clean.dist,clean.doc"/>
-</project>
diff --git a/docs/examples/plugintemplate/doc/README b/docs/examples/plugintemplate/doc/README
deleted file mode 100644
index 958f71282b..0000000000
--- a/docs/examples/plugintemplate/doc/README
+++ /dev/null
@@ -1,68 +0,0 @@
-Scala compiler plugin template
-------------------------------
-
-This project is a template that can be used for creating compiler
-plugins for the Scala compiler.
-
-
-Installation
-------------
-To install the compiler plugin, run "ant install". This will create
-an sbaz package for the template plugin and install it in the scala
-installation available in your PATH.
-The install command will also create a script for running the plugin
-as standalone application. The command is called "runplugintemplate"
-and available in your scala installation as well.
-To uninstall the plugin again, run "and uninstall".
-
-Alternatively, copy the file build/pack/plugintemplate.jar, generated
-by "ant pack", to the directory misc/scala-devel/plugins of your
-scala distribution. The scala compiler will then find and integrate
-the new plugin.
-
-Customization
--------------
-The following files need to be edited when creating a new plugin
-- plugin.properties
-- misc/scalac-plugin.xml
-- src / test / doc/examples: The source files of the template plugin
- are located a package called "plugintemplate". This will most likely
- be changed for new plugins.
-
-When using eclipse for development, make sure "scala-compiler.jar" is
-in the Java Build Path: Right-Click the project and select "Properties".
-Then go to "Java Build Path" -> "Libraries" and add the jar file
-"eclipse/plugins/ch.epfl.lamp.sdt.core[..]/lib/scala-compiler.jar".
-
-Traverse, Transform, Check
---------------------------
-There are several pre-defined components that can be used to code
-the behavior of a plugin:
-- TemplateTraverseComponent: a template for tree traversers. Used
- to analyze and collect data about compiler trees.
- -> implement the "check" method
-
-- TemplateTransformComponent: a template for tree transformers.
- -> implement "preTransform" and / or "postTransform"
-
-- TemplateInfoTransformComponent: also a tree transformer, which
- additionally is an InfoTransformer. Allows changing the type
- of some symbols for later phases.
- -> implement "preTransform" and / or "postTransform", and the
- "apply" method of the "infoTransformer".
-
-- TemplateAnnotationChecker: a plugin for the typechecker, useful
- for pluggable type systems. Computes the subtyping between two
- annotated types, and allows providing inferred type information.
- -> implement "annotationsConform" and optionally "addAnnotations"
-
-- TemplateComponent: the most general component. Can do anything it
- likes with the CompilationUnits.
- -> implement the "run" method
-
-Ant tasks
----------
-"build.xml" defines Ant tasks for building, testing and packing a
-plugin. The tests are written using the ScalaTest framework
-(http://www.artima.com/scalatest/).
-Run the tests using "ant test", or "ant guitest".
diff --git a/docs/examples/plugintemplate/doc/examples/plugintemplate/examples/BasicExample.scala b/docs/examples/plugintemplate/doc/examples/plugintemplate/examples/BasicExample.scala
deleted file mode 100644
index d1f6c91cdc..0000000000
--- a/docs/examples/plugintemplate/doc/examples/plugintemplate/examples/BasicExample.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-package plugintemplate.examples
-
-/** An example demonstrating the fancy features of the new
- * compiler plugin.
- */
-class BasicExample {
- def foo = ()
-}
diff --git a/docs/examples/plugintemplate/lib/scalatest.jar.desired.sha1 b/docs/examples/plugintemplate/lib/scalatest.jar.desired.sha1
deleted file mode 100644
index 14c20f874f..0000000000
--- a/docs/examples/plugintemplate/lib/scalatest.jar.desired.sha1
+++ /dev/null
@@ -1 +0,0 @@
-8b6ba65c8146217333f0762087fe2340d572e832 ?scalatest.jar
diff --git a/docs/examples/plugintemplate/misc/scalac-plugin.xml b/docs/examples/plugintemplate/misc/scalac-plugin.xml
deleted file mode 100644
index bad4e87327..0000000000
--- a/docs/examples/plugintemplate/misc/scalac-plugin.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<plugin>
- <name>plugintemplate</name>
- <classname>plugintemplate.TemplatePlugin</classname>
-</plugin>
diff --git a/docs/examples/plugintemplate/plugin.properties b/docs/examples/plugintemplate/plugin.properties
deleted file mode 100644
index 131f96110f..0000000000
--- a/docs/examples/plugintemplate/plugin.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-scala.home=../../../build/pack
-
-plugin.name=plugintemplate
-plugin.commandname=runplugintemplate
-plugin.description=A template compiler plugin saying hello to the World
-plugin.mainclass=plugintemplate.standalone.Main
-plugin.sbazbaseurl=http://scala.epfl.ch/downloads/packages
-
-version.major=0
-version.minor=1
diff --git a/docs/examples/plugintemplate/src/plugintemplate/PluginProperties.scala b/docs/examples/plugintemplate/src/plugintemplate/PluginProperties.scala
deleted file mode 100644
index ed078a03d7..0000000000
--- a/docs/examples/plugintemplate/src/plugintemplate/PluginProperties.scala
+++ /dev/null
@@ -1,61 +0,0 @@
-package plugintemplate
-
-import java.util.Properties
-
-/** A utility to load properties of this plugin via the property
- * file "plugin.properties"
- */
-object PluginProperties {
- private val propFilename = "plugin.properties"
-
- val pluginName = getOrElse("plugin.name", "(name_unknown)")
- val pluginDescription = getOrElse("plugin.description", "(plugin description not found)")
- val pluginCommand = getOrElse("plugin.commandname", "(command_unknown)")
- val versionString = {
- val default = "(version_unknown)"
- props match {
- case Some(p) =>
- val major = p.getProperty("version.major")
- val minor = p.getProperty("version.minor")
- if ((major eq null) || (minor eq null)) default
- else major +"."+ minor
- case None => default
- }
- }
-
- private def getOrElse(property: String, default: String) = {
- props match {
- case Some(p) if (p.getProperty(property) != null) =>
- p.getProperty(property)
- case _ =>
- default
- }
- }
-
- private lazy val props: Option[Properties] = {
- /** Running from JAR file: the properties file should be in the
- * jar as well
- */
- var stream = this.getClass.getResourceAsStream("/"+ propFilename)
- if (stream == null) {
- /** Running from .class files: expect classfiles to be in
- * directory [...]/build/build.main, and [...] to contain
- * the properties file.
- */
- try {
- val current = this.getClass.getClassLoader.getResource(".")
- val dir = new java.io.File(current.toURI)
- // dir will be [...]/build/build.main/
- stream = new java.io.FileInputStream(dir.getParentFile.getParent +"/"+ propFilename)
- } catch {
- case _ => ()
- }
- }
- if (stream == null) None
- else {
- val p = new Properties
- p.load(stream)
- Some(p)
- }
- }
-}
diff --git a/docs/examples/plugintemplate/src/plugintemplate/TemplateAnnotationChecker.scala b/docs/examples/plugintemplate/src/plugintemplate/TemplateAnnotationChecker.scala
deleted file mode 100644
index 6cd3472675..0000000000
--- a/docs/examples/plugintemplate/src/plugintemplate/TemplateAnnotationChecker.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-package plugintemplate
-
-import scala.tools.nsc.Global
-
-abstract class TemplateAnnotationChecker {
- val global: Global
- import global._
-
- object checker extends AnnotationChecker {
- def annotationsConform(tpe1: Type, tpe2: Type): Boolean = {
- println("checking: "+ tpe1 +" <: "+ tpe2)
- true
- }
-
- override def addAnnotations(tree: Tree, tpe: Type): Type = {
- println("adding annot to "+ tree.symbol)
- tpe
- }
- }
-}
diff --git a/docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala b/docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala
deleted file mode 100644
index b63f3203b5..0000000000
--- a/docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-package plugintemplate
-
-import scala.tools.nsc._
-import scala.tools.nsc.plugins.PluginComponent
-
-/** This class shows how to implement a compiler component that
- * can be used in a compiler plugin. If the plugin uses a tree
- * transformer and / or an InfoTransformer, look at the two
- * classes <code>TemplateTransformComponent</code> and
- * <code>TemplateInfoTransformComponent</code>.
- *
- * @todo Adapt the name of this class to the plugin, and implement it.
- */
-class TemplateComponent(val global: Global) extends PluginComponent {
- import global._
-
- val runsAfter = List[String]("refchecks")
-
- /** The name of this plugin phase
- * @todo Adapt to specific plugin.
- */
- val phaseName = "plugintemplate"
-
- def newPhase(prev: Phase) = new Phase(prev) {
- def name = phaseName
-
- /** The implementation of this Phase's behavior
- *
- * @todo Implementation.
- */
- def run {
- println("Hello from phase "+ name)
- }
- }
-}
diff --git a/docs/examples/plugintemplate/src/plugintemplate/TemplateInfoTransformComponent.scala b/docs/examples/plugintemplate/src/plugintemplate/TemplateInfoTransformComponent.scala
deleted file mode 100644
index 71069aed6f..0000000000
--- a/docs/examples/plugintemplate/src/plugintemplate/TemplateInfoTransformComponent.scala
+++ /dev/null
@@ -1,79 +0,0 @@
-package plugintemplate
-
-import scala.tools.nsc._
-import scala.tools.nsc.plugins.PluginComponent
-import scala.tools.nsc.transform.InfoTransform
-// import scala.tools.nsc.transform.TypingTransformers
-
-/** This class implements a plugin component using tree transformers and
- * InfoTransformer. An InfoTransformer will be automatically created
- * and registered in <code>SymbolTable.infoTransformers</code>. If
- * a <code>Typer</code> is needed during transformation, the component
- * should mix in <code>TypingTransformers</code>. This provides a local
- * variable <code>localTyper: Typer</code> that is always updated to
- * the current context.
- *
- * @todo Adapt the name of this class to the plugin, and implement it.
- */
-class TemplateInfoTransformComponent(val global: Global) extends PluginComponent
- // with TypingTransformers
- with InfoTransform {
-
- import global._
- import global.definitions._
-
- val runsAfter = List[String]("refchecks")
- /** The phase name of the compiler plugin
- * @todo Adapt to specific plugin.
- */
- val phaseName = "plugintemplateinfotransform"
-
- def transformInfo(sym: Symbol, tp: Type): Type = infoTransformer.mapOver(tp)
-
- def newTransformer(unit: CompilationUnit) = new TemplateTransformer
-
- /** The type transformation applied by this component. The trait InfoTransform
- * will create an instance of InfoTransformer applying this TypeMap. The type
- * map will be applied when computing a symbol's type in all phases
- * <em>after</em> "plugintemplateinfotransform".
- *
- * @todo Implement.
- */
- private val infoTransformer = new TypeMap {
- def apply(tp: Type): Type = tp match {
- case MethodType(pts, rt) =>
- println("methodType (_, _, ..) => "+ rt)
- tp
- case _ => mapOver(tp)
- }
- }
-
- /** The tree transformer that implements the behavior of this
- * component. Change the superclass to <code>TypingTransformer</code>
- * to make a local typechecker <code>localTyper</code> available.
- *
- * @todo Implement.
- */
- class TemplateTransformer extends /*Typing*/ Transformer {
- /** When using <code>preTransform</code>, each node is
- * visited before its children.
- */
- def preTransform(tree: Tree): Tree = tree match {
- case ValDef(_, name, _, _) =>
- println("pre-info-transforming valdef "+ name)
- tree
- case _ => tree
- }
-
- /** When using <code>postTransform</code>, each node is
- * visited after its children.
- */
- def postTransform(tree: Tree): Tree = tree match {
- case _ => tree
- }
-
- override def transform(tree: Tree): Tree = {
- postTransform(super.transform(preTransform(tree)))
- }
- }
-}
diff --git a/docs/examples/plugintemplate/src/plugintemplate/TemplatePlugin.scala b/docs/examples/plugintemplate/src/plugintemplate/TemplatePlugin.scala
deleted file mode 100644
index 6cda37d4e3..0000000000
--- a/docs/examples/plugintemplate/src/plugintemplate/TemplatePlugin.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-package plugintemplate
-
-import scala.tools.nsc.Global
-import scala.tools.nsc.plugins.Plugin
-
-/** A class describing the compiler plugin
- *
- * @todo Adapt the name of this class to the plugin being
- * implemented
- */
-class TemplatePlugin(val global: Global) extends Plugin {
- /** The name of this plugin. Extracted from the properties file. */
- val name = PluginProperties.pluginName
-
- val runsAfter = List[String]("refchecks")
-
- /** A short description of the plugin, read from the properties file */
- val description = PluginProperties.pluginDescription
-
- /** @todo A description of the plugin's options */
- override val optionsHelp = Some(
- " -P:"+ name +":option sets some option for this plugin")
-
- /** @todo Implement parsing of plugin options */
- override def processOptions(options: List[String], error: String => Unit) {
- super.processOptions(options, error)
- }
-
- /** The compiler components that will be applied when running
- * this plugin
- *
- * @todo Adapt to the plugin being implemented
- */
- val components = TemplatePlugin.components(global)
-
- val checker = new TemplateAnnotationChecker {
- val global: TemplatePlugin.this.global.type = TemplatePlugin.this.global
- }
- global.addAnnotationChecker(checker.checker)
-}
-
-object TemplatePlugin {
- /** Yields the list of Components to be executed in this plugin
- *
- * @todo: Adapt to specific implementation.
- */
- def components(global: Global) =
- List(new TemplateComponent(global),
- new TemplateTraverseComponent(global),
- new TemplateTransformComponent(global),
- new TemplateInfoTransformComponent(global))
-}
diff --git a/docs/examples/plugintemplate/src/plugintemplate/TemplateTransformComponent.scala b/docs/examples/plugintemplate/src/plugintemplate/TemplateTransformComponent.scala
deleted file mode 100644
index 7c2630dc16..0000000000
--- a/docs/examples/plugintemplate/src/plugintemplate/TemplateTransformComponent.scala
+++ /dev/null
@@ -1,58 +0,0 @@
-package plugintemplate
-
-import scala.tools.nsc._
-import scala.tools.nsc.plugins.PluginComponent
-import scala.tools.nsc.transform.Transform
-// import scala.tools.nsc.transform.TypingTransformers
-
-/** This class implements a plugin component using tree transformers. If
- * a <code>Typer</code> is needed during transformation, the component
- * should mix in <code>TypingTransformers</code>. This provides a local
- * variable <code>localTyper: Typer</code> that is always updated to
- * the current context.
- *
- * @todo Adapt the name of this class to the plugin, and implement it.
- */
-class TemplateTransformComponent(val global: Global) extends PluginComponent
- // with TypingTransformers
- with Transform {
- import global._
- import global.definitions._
-
- val runsAfter = List[String]("refchecks")
- /** The phase name of the compiler plugin
- * @todo Adapt to specific plugin.
- */
- val phaseName = "plugintemplatetransform"
-
- def newTransformer(unit: CompilationUnit) = new TemplateTransformer
-
- /** The tree transformer that implements the behavior of this
- * component. Change the superclass to <code>TypingTransformer</code>
- * to make a local typechecker <code>localTyper</code> available.
- *
- * @todo Implement.
- */
- class TemplateTransformer extends /*Typing*/ Transformer {
- /** When using <code>preTransform</code>, each node is
- * visited before its children.
- */
- def preTransform(tree: Tree): Tree = tree match {
- case _ => tree
- }
-
- /** When using <code>postTransform</code>, each node is
- * visited after its children.
- */
- def postTransform(tree: Tree): Tree = tree match {
- case New(tpt) =>
- println("post-transforming new "+ tpt)
- tree
- case _ => tree
- }
-
- override def transform(tree: Tree): Tree = {
- postTransform(super.transform(preTransform(tree)))
- }
- }
-}
diff --git a/docs/examples/plugintemplate/src/plugintemplate/TemplateTraverseComponent.scala b/docs/examples/plugintemplate/src/plugintemplate/TemplateTraverseComponent.scala
deleted file mode 100644
index 400daf7437..0000000000
--- a/docs/examples/plugintemplate/src/plugintemplate/TemplateTraverseComponent.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-package plugintemplate
-
-import scala.tools.nsc._
-import scala.tools.nsc.plugins.PluginComponent
-
-/** This class implements a plugin component using a tree
- * traverser */
-class TemplateTraverseComponent (val global: Global) extends PluginComponent {
- import global._
- import global.definitions._
-
- val runsAfter = List[String]("refchecks")
- /** The phase name of the compiler plugin
- * @todo Adapt to specific plugin.
- */
- val phaseName = "plugintemplatetraverse"
-
- def newPhase(prev: Phase): Phase = new TraverserPhase(prev)
- class TraverserPhase(prev: Phase) extends StdPhase(prev) {
- def apply(unit: CompilationUnit) {
- newTraverser().traverse(unit.body)
- }
- }
-
- def newTraverser(): Traverser = new ForeachTreeTraverser(check)
-
- def check(tree: Tree): Unit = tree match {
- case Apply(fun, args) =>
- println("traversing application of "+ fun)
- case _ => ()
- }
-}
diff --git a/docs/examples/plugintemplate/src/plugintemplate/standalone/Main.scala b/docs/examples/plugintemplate/src/plugintemplate/standalone/Main.scala
deleted file mode 100644
index 0bfcbf53c7..0000000000
--- a/docs/examples/plugintemplate/src/plugintemplate/standalone/Main.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-package plugintemplate.standalone
-
-import plugintemplate.PluginProperties
-import scala.tools.nsc.CompilerCommand
-import scala.tools.nsc.Settings
-
-/** An object for running the plugin as standalone application.
- *
- * @todo: print, parse and apply plugin options !!!
- * ideally re-use the TemplatePlugin (-> runsAfter, optionsHelp,
- * processOptions, components, annotationChecker) instead of
- * duplicating it here and in PluginRunner.
- */
-object Main {
- def main(args: Array[String]) {
- val settings = new Settings
-
- val command = new CompilerCommand(args.toList, settings) {
- /** The command name that will be printed in the usage message.
- * This is automatically set to the value of 'plugin.commandname' in the
- * file build.properties.
- */
- override val cmdName = PluginProperties.pluginCommand
- }
-
- if (!command.ok)
- return()
-
- /** The version number of this plugin is read from the properties file
- */
- if (settings.version.value) {
- println(command.cmdName +" version "+ PluginProperties.versionString)
- return()
- }
- if (settings.help.value) {
- println(command.usageMsg)
- return()
- }
-
- val runner = new PluginRunner(settings)
- val run = new runner.Run
- run.compile(command.files)
- }
-}
diff --git a/docs/examples/plugintemplate/src/plugintemplate/standalone/PluginRunner.scala b/docs/examples/plugintemplate/src/plugintemplate/standalone/PluginRunner.scala
deleted file mode 100644
index 06fe669cbd..0000000000
--- a/docs/examples/plugintemplate/src/plugintemplate/standalone/PluginRunner.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-package plugintemplate.standalone
-
-import plugintemplate.{TemplateAnnotationChecker, TemplatePlugin}
-import scala.tools.nsc.{Global, Settings, SubComponent}
-import scala.tools.nsc.reporters.{ConsoleReporter, Reporter}
-
-/** This class is a compiler that will be used for running
- * the plugin in standalone mode.
- */
-class PluginRunner(settings: Settings, reporter: Reporter)
-extends Global(settings, reporter) {
- def this(settings: Settings) = this(settings, new ConsoleReporter(settings))
-
- val annotChecker = new TemplateAnnotationChecker {
- val global: PluginRunner.this.type = PluginRunner.this
- }
- addAnnotationChecker(annotChecker.checker)
-
- /** The phases to be run.
- *
- * @todo: Adapt to specific plugin implementation
- */
- override protected def computeInternalPhases() {
- phasesSet += syntaxAnalyzer
- phasesSet += analyzer.namerFactory
- phasesSet += analyzer.typerFactory
- phasesSet += superAccessors // add super accessors
- phasesSet += pickler // serialize symbol tables
- phasesSet += refChecks // perform reference and override checking, translate nested objects
-
- for (phase <- TemplatePlugin.components(this)) {
- phasesSet += phase
- }
- }
-
-}
diff --git a/docs/examples/plugintemplate/test/plugintemplate/PluginPropertiesSuite.scala b/docs/examples/plugintemplate/test/plugintemplate/PluginPropertiesSuite.scala
deleted file mode 100644
index a07796a7f2..0000000000
--- a/docs/examples/plugintemplate/test/plugintemplate/PluginPropertiesSuite.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-package plugintemplate
-
-import org.scalatest.Suite
-
-class PluginPropertiesSuite extends Suite {
- def testProperties() {
- expect("A template compiler plugin saying hello to the World") {
- PluginProperties.pluginDescription
- }
- expect("0.1") {
- PluginProperties.versionString
- }
- }
-}
diff --git a/docs/examples/plugintemplate/test/plugintemplate/TemplatePluginSuite.scala b/docs/examples/plugintemplate/test/plugintemplate/TemplatePluginSuite.scala
deleted file mode 100644
index 06916f9dd3..0000000000
--- a/docs/examples/plugintemplate/test/plugintemplate/TemplatePluginSuite.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-package plugintemplate
-
-import org.scalatest.Suite
-import org.scalatest.Ignore
-
-class TemplatePluginSuite extends Suite {
- def testName() {
- import scala.tools.nsc.{Global, Settings}
- import scala.tools.nsc.reporters.ConsoleReporter
- val settings = new Settings
- val compiler = new Global(settings, new ConsoleReporter(settings))
- val plugin = new TemplatePlugin(compiler)
- expect("plugintemplate") {
- plugin.name
- }
- }
-
- @Ignore
- def testFail() {
- expect(1) { 2 }
- }
-}
diff --git a/docs/examples/sort.scala b/docs/examples/sort.scala
deleted file mode 100644
index 9a928f1107..0000000000
--- a/docs/examples/sort.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-package examples
-
-object sort {
-
- def sort(a: Array[Int]) {
-
- def swap(i: Int, j: Int) {
- val t = a(i); a(i) = a(j); a(j) = t
- }
-
- def sort1(l: Int, r: Int) {
- val pivot = a((l + r) / 2)
- var i = l
- var j = r
- while (i <= j) {
- while (a(i) < pivot) { i += 1 }
- while (a(j) > pivot) { j -= 1 }
- if (i <= j) {
- swap(i, j)
- i += 1
- j -= 1
- }
- }
- if (l < j) sort1(l, j)
- if (j < r) sort1(i, r)
- }
-
- if (a.length > 0)
- sort1(0, a.length - 1)
- }
-
- def println(ar: Array[Int]) {
- def print1 = {
- def iter(i: Int): String =
- ar(i) + (if (i < ar.length-1) "," + iter(i+1) else "")
- if (ar.length == 0) "" else iter(0)
- }
- Console.println("[" + print1 + "]")
- }
-
- def main(args: Array[String]) {
- val ar = Array(6, 2, 8, 5, 1)
- println(ar)
- sort(ar)
- println(ar)
- }
-
-}
diff --git a/docs/examples/sort1.scala b/docs/examples/sort1.scala
deleted file mode 100644
index 39e5519fe0..0000000000
--- a/docs/examples/sort1.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-package examples
-
-object sort1 {
-
- def sort(a: List[Int]): List[Int] = {
- if (a.length < 2)
- a
- else {
- val pivot = a(a.length / 2)
- sort(a.filter(x => x < pivot)) :::
- a.filter(x => x == pivot) :::
- sort(a.filter(x => x > pivot))
- }
- }
-
- def main(args: Array[String]) {
- val xs = List(6, 2, 8, 5, 1)
- println(xs)
- println(sort(xs))
- }
-
-}
diff --git a/docs/examples/sort2.scala b/docs/examples/sort2.scala
deleted file mode 100644
index e0016088bb..0000000000
--- a/docs/examples/sort2.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-package examples
-
-object sort2 {
-
- def sort(a: List[Int]): List[Int] = {
- if (a.length < 2)
- a
- else {
- val pivot = a(a.length / 2)
- def lePivot(x: Int) = x < pivot
- def gtPivot(x: Int) = x > pivot
- def eqPivot(x: Int) = x == pivot
- sort(a filter lePivot) :::
- (a filter eqPivot) :::
- sort(a filter gtPivot)
- }
- }
-
- def main(args: Array[String]) {
- val xs = List(6, 2, 8, 5, 1, 8)
- println(xs)
- println(sort(xs))
- }
-
-}
diff --git a/docs/examples/swing/ButtonApp.scala b/docs/examples/swing/ButtonApp.scala
deleted file mode 100644
index 96799b24f2..0000000000
--- a/docs/examples/swing/ButtonApp.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-package examples.swing
-
-import java.awt.Dimension
-
-import swing._
-import swing.event._
-
-object ButtonApp extends SimpleSwingApplication {
- def top = new MainFrame {
- title = "My Frame"
- contents = new GridPanel(2, 2) {
- hGap = 3
- vGap = 3
- contents += new Button {
- text = "Press Me!"
- reactions += {
- case ButtonClicked(_) => text = "Hello Scala"
- }
- }
- }
- size = new Dimension(300, 80)
- }
-}
-
diff --git a/docs/examples/swing/CelsiusConverter.scala b/docs/examples/swing/CelsiusConverter.scala
deleted file mode 100644
index b4a62fb366..0000000000
--- a/docs/examples/swing/CelsiusConverter.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-package examples.swing
-
-import swing._
-import event._
-
-/** A GUI app to convert celsius to centigrade
- */
-object CelsiusConverter extends SimpleSwingApplication {
- def top = new MainFrame {
- title = "Convert Celsius to Fahrenheit"
- val tempCelsius = new TextField
- val celsiusLabel = new Label {
- text = "Celsius"
- border = Swing.EmptyBorder(5, 5, 5, 5)
- }
- val convertButton = new Button {
- text = "Convert"//new javax.swing.ImageIcon("c:\\workspace\\gui\\images\\convert.gif")
- //border = Border.Empty(5, 5, 5, 5)
- }
- val fahrenheitLabel = new Label {
- text = "Fahrenheit "
- border = Swing.EmptyBorder(5, 5, 5, 5)
- listenTo(convertButton, tempCelsius)
-
- def convert() {
- val c = Integer.parseInt(tempCelsius.text)
- val f = c * 9 / 5 + 32
- text = "<html><font color = red>"+f+"</font> Fahrenheit</html>"
- }
-
- reactions += {
- case ButtonClicked(_) | EditDone(_) => convert()
- }
- }
- contents = new GridPanel(2,2) {
- contents.append(tempCelsius, celsiusLabel, convertButton, fahrenheitLabel)
- border = Swing.EmptyBorder(10, 10, 10, 10)
- }
- //defaultButton = Some(convertButton)
- }
-}
-
diff --git a/docs/examples/swing/CelsiusConverter2.scala b/docs/examples/swing/CelsiusConverter2.scala
deleted file mode 100644
index 3630d61b61..0000000000
--- a/docs/examples/swing/CelsiusConverter2.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-package examples.swing
-
-import swing._
-import event._
-
-object CelsiusConverter2 extends SimpleSwingApplication {
- def newField = new TextField {
- text = "0"
- columns = 5
- horizontalAlignment = Alignment.Right
- }
- val celsius = newField
- val fahrenheit = newField
-
- listenTo(fahrenheit, celsius)
- reactions += {
- case EditDone(`fahrenheit`) =>
- val f = Integer.parseInt(fahrenheit.text)
- val c = (f - 32) * 5 / 9
- celsius.text = c.toString
- case EditDone(`celsius`) =>
- val c = Integer.parseInt(celsius.text)
- val f = c * 9 / 5 + 32
- fahrenheit.text = f.toString
- }
-
- lazy val ui = new FlowPanel(celsius, new Label(" Celsius = "),
- fahrenheit, new Label(" Fahrenheit")) {
- border = Swing.EmptyBorder(15, 10, 10, 10)
- }
- def top = new MainFrame {
- title = "Convert Celsius / Fahrenheit"
- contents = ui
- }
-}
-
diff --git a/docs/examples/swing/ComboBoxes.scala b/docs/examples/swing/ComboBoxes.scala
deleted file mode 100644
index c6ee19013a..0000000000
--- a/docs/examples/swing/ComboBoxes.scala
+++ /dev/null
@@ -1,86 +0,0 @@
-package examples.swing
-
-import swing._
-import event._
-import java.util.Date
-import java.awt.Color
-import java.text.SimpleDateFormat
-import javax.swing.{Icon, ImageIcon}
-
-/**
- * Demonstrates how to use combo boxes and custom item renderers.
- *
- * TODO: clean up layout
- */
-object ComboBoxes extends SimpleSwingApplication {
- import ComboBox._
- lazy val ui = new FlowPanel {
- contents += new ComboBox(List(1,2,3,4))
-
- val patterns = List("dd MMMMM yyyy",
- "dd.MM.yy",
- "MM/dd/yy",
- "yyyy.MM.dd G 'at' hh:mm:ss z",
- "EEE, MMM d, ''yy",
- "h:mm a",
- "H:mm:ss:SSS",
- "K:mm a,z",
- "yyyy.MMMMM.dd GGG hh:mm aaa")
- val dateBox = new ComboBox(patterns) { makeEditable() }
- contents += dateBox
- val field = new TextField(20) { editable = false }
- contents += field
-
- reactions += {
- case SelectionChanged(`dateBox`) => reformat()
- }
- listenTo(dateBox.selection)
-
- def reformat() {
- try {
- val today = new Date
- val formatter = new SimpleDateFormat(dateBox.selection.item)
- val dateString = formatter.format(today)
- field.foreground = Color.black
- field.text = dateString
- } catch {
- case e: IllegalArgumentException =>
- field.foreground = Color.red
- field.text = "Error: " + e.getMessage
- }
- }
-
-
- val icons = try {
- List(new ImageIcon(resourceFromClassloader("images/margarita1.jpg")),
- new ImageIcon(resourceFromClassloader("images/margarita2.jpg")),
- new ImageIcon(resourceFromClassloader("images/rose.jpg")),
- new ImageIcon(resourceFromClassloader("images/banana.jpg")))
- } catch {
- case _ =>
- println("Couldn't load images for combo box")
- List(Swing.EmptyIcon)
- }
-
- val iconBox = new ComboBox(icons) {
- renderer = new ListView.AbstractRenderer[Icon, Label](new Label) {
- def configure(list: ListView[_], isSelected: Boolean, focused: Boolean, icon: Icon, index: Int) {
- component.icon = icon
- component.xAlignment = Alignment.Center
- if(isSelected) {
- component.border = Swing.LineBorder(list.selectionBackground, 3)
- } else {
- component.border = Swing.EmptyBorder(3)
- }
- }
- }
- }
- contents += iconBox
- }
-
- def top = new MainFrame {
- title = "ComboBoxes Demo"
- contents = ui
- }
-}
-
diff --git a/docs/examples/swing/CountButton.scala b/docs/examples/swing/CountButton.scala
deleted file mode 100644
index 5fb14681d6..0000000000
--- a/docs/examples/swing/CountButton.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-package examples.swing
-
-import scala.swing._
-import scala.swing.event._
-
-object CountButton extends SimpleSwingApplication {
- def top = new MainFrame {
- title = "My Frame"
- contents = new GridPanel(2, 2) {
- hGap = 3
- vGap = 3
- val button = new Button {
- text = "Press Me!"
- }
- contents += button
- val label = new Label {
- text = "No button clicks registered"
- }
- contents += label
-
- listenTo(button)
- var nclicks = 0
- reactions += {
- case ButtonClicked(b) =>
- nclicks += 1
- label.text = "Number of button clicks: "+nclicks
- }
- }
- }
-}
diff --git a/docs/examples/swing/Dialogs.scala b/docs/examples/swing/Dialogs.scala
deleted file mode 100644
index 0b4ac258cf..0000000000
--- a/docs/examples/swing/Dialogs.scala
+++ /dev/null
@@ -1,176 +0,0 @@
-package examples.swing
-
-import swing._
-import swing.event._
-
-object Dialogs extends SimpleSwingApplication {
- import TabbedPane._
-
- lazy val label = new Label("No Result yet")
- lazy val tabs = new TabbedPane {
- pages += new Page("File", new GridBagPanel { grid =>
- import GridBagPanel._
- val buttonText = new TextField("Click Me")
-
- val c = new Constraints
- c.fill = Fill.Horizontal
- c.grid = (1,1)
-
- val chooser = new FileChooser
- layout(new Button(Action("Open") {
- chooser.showOpenDialog(grid)
- })) = c
-
- c.grid = (1,2)
- layout(new Button(Action("Save") {
- chooser.showSaveDialog(grid)
- })) = c
-
- c.grid = (1,3)
- layout(new Button(Action("Custom") {
- chooser.showDialog(grid, buttonText.text)
- })) = c
-
- c.grid = (2,3)
- layout(new Label(" with Text ")) = c
-
- c.grid = (3,3)
- c.ipadx = 50
- layout(buttonText) = c
-
- border = Swing.EmptyBorder(5, 5, 5, 5)
- })
- pages += new Page("Simple Modal Dialogs", new BorderPanel {
- import BorderPanel._
- val mutex = new ButtonGroup
- val ok = new RadioButton("OK (in the L&F's words)")
- val ynlf = new RadioButton("Yes/No (in the L&F's words)")
- val ynp = new RadioButton("Yes/No (in the programmer's words)")
- val yncp = new RadioButton("Yes/No/Cancel (in the programmer's words)")
- val radios = List(ok, ynlf, ynp, yncp)
- mutex.buttons ++= radios
- mutex.select(ok)
- val buttons = new BoxPanel(Orientation.Vertical) {
- contents ++= radios
- }
- layout(buttons) = Position.North
- layout(new Button(Action("Show It!") {
- import Dialog._
- mutex.selected.get match {
- case `ok` =>
- showMessage(buttons, "Eggs aren't supposed to be green.")
- case `ynlf` =>
- label.text = showConfirmation(buttons,
- "Would you like green eggs and ham?",
- "An Inane Question") match {
- case Result.Yes => "Ewww!"
- case Result.No => "Me neither!"
- case _ => "Come on -- tell me!"
- }
- case `ynp` =>
- val options = List("Yes, please",
- "No, thanks",
- "No eggs, no ham!")
- label.text = showOptions(buttons,
- "Would you like some green eggs to go with that ham?",
- "A Silly Question",
- entries = options,
- initial = 2) match {
- case Result.Yes => "You're kidding!"
- case Result.No => "I don't like them, either."
- case _ => "Come on -- 'fess up!"
- }
- case `yncp` =>
- val options = List("Yes, please",
- "No, thanks",
- "No eggs, no ham!")
- label.text = showOptions(buttons,
- message = "Would you like some green eggs to go with that ham?",
- title = "A Silly Question",
- entries = options,
- initial = 2) match {
- case Result.Yes => "Here you go: green eggs and ham!"
- case Result.No => "OK, just the ham, then."
- case Result.Cancel => "Well, I'm certainly not going to eat them!"
- case _ => "Please tell me what you want!"
- }
- }
- })) = Position.South
- })
- pages += new Page("More Dialogs", new BorderPanel {
- import BorderPanel._
- val mutex = new ButtonGroup
- val pick = new RadioButton("Pick one of several choices")
- val enter = new RadioButton("Enter some text")
- val custom = new RadioButton("Custom")
- val customUndec = new RadioButton("Custom undecorated")
- val custom2 = new RadioButton("2 custom dialogs")
- val radios = List(pick, enter, custom, customUndec, custom2)
- mutex.buttons ++= radios
- mutex.select(pick)
- val buttons = new BoxPanel(Orientation.Vertical) {
- contents ++= radios
- }
- layout(buttons) = Position.North
- layout(new Button(Action("Show It!") {
- import Dialog._
- mutex.selected.get match {
- case `pick` =>
- val possibilities = List("ham", "spam", "yam")
- val s = showInput(buttons,
- "Complete the sentence:\n\"Green eggs and...\"",
- "Customized Dialog",
- Message.Plain,
- Swing.EmptyIcon,
- possibilities, "ham")
-
- //If a string was returned, say so.
- label.text = if ((s != None) && (s.get.length > 0))
- "Green eggs and... " + s.get + "!"
- else
- "Come on, finish the sentence!"
- case `enter` =>
- val s = showInput(buttons,
- "Complete the sentence:\n\"Green eggs and...\"",
- "Customized Dialog",
- Message.Plain,
- Swing.EmptyIcon,
- Nil, "ham")
-
- //If a string was returned, say so.
- label.text = if ((s != None) && (s.get.length > 0))
- "Green eggs and... " + s.get + "!"
- else
- "Come on, finish the sentence!"
- case `custom` =>
- val dialog = new Dialog(top)
- dialog.open()
- dialog.contents = Button("Close Me!") { dialog.close() }
- case `customUndec` =>
- val dialog = new Dialog with RichWindow.Undecorated
- dialog.open()
- dialog.contents = Button("Close Me!") { dialog.close() }
- case `custom2` =>
- val d1 = new Dialog
- val d2 = new Dialog(d1)
- d1.open()
- d2.open()
- d1.contents = Button("Close Me! I am the owner and will automatically close the other one") { d1.close() }
- d2.contents = Button("Close Me!") { d2.close() }
- }
- })) = Position.South
- })
- }
-
- lazy val ui: Panel = new BorderPanel {
- layout(tabs) = BorderPanel.Position.Center
- layout(label) = BorderPanel.Position.South
- }
-
-
- lazy val top = new MainFrame {
- title = "Dialog Demo"
- contents = ui
- }
-}
-
diff --git a/docs/examples/swing/GridBagDemo.scala b/docs/examples/swing/GridBagDemo.scala
deleted file mode 100644
index 60cfc13acb..0000000000
--- a/docs/examples/swing/GridBagDemo.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-package examples.swing
-
-import swing._
-import swing.event._
-import GridBagPanel._
-import java.awt.Insets
-
-object GridBagDemo extends SimpleSwingApplication {
- lazy val ui = new GridBagPanel {
- val c = new Constraints
- val shouldFill = true
- if (shouldFill) {
- c.fill = Fill.Horizontal
- }
-
- val button1 = new Button("Button 1")
-
- c.weightx = 0.5
-
- c.fill = Fill.Horizontal
- c.gridx = 0;
- c.gridy = 0;
- layout(button1) = c
-
- val button2 = new Button("Button 2")
- c.fill = Fill.Horizontal
- c.weightx = 0.5;
- c.gridx = 1;
- c.gridy = 0;
- layout(button2) = c
-
- val button3 = new Button("Button 3")
- c.fill = Fill.Horizontal
- c.weightx = 0.5;
- c.gridx = 2;
- c.gridy = 0;
- layout(button3) = c
-
- val button4 = new Button("Long-Named Button 4")
- c.fill = Fill.Horizontal
- c.ipady = 40; //make this component tall
- c.weightx = 0.0;
- c.gridwidth = 3;
- c.gridx = 0;
- c.gridy = 1;
- layout(button4) = c
-
- val button5 = new Button("5")
- c.fill = Fill.Horizontal
- c.ipady = 0; //reset to default
- c.weighty = 1.0; //request any extra vertical space
- c.anchor = Anchor.PageEnd
- c.insets = new Insets(10,0,0,0); //top padding
- c.gridx = 1; //aligned with button 2
- c.gridwidth = 2; //2 columns wide
- c.gridy = 2; //third row
- layout(button5) = c
- }
-
- def top = new MainFrame {
- title = "GridBag Demo"
- contents = ui
- }
-}
diff --git a/docs/examples/swing/HelloWorld.scala b/docs/examples/swing/HelloWorld.scala
deleted file mode 100644
index e89bfedd8a..0000000000
--- a/docs/examples/swing/HelloWorld.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-package examples.swing
-
-import swing._
-
-/**
- * A simple swing demo.
- */
-object HelloWorld extends SimpleSwingApplication {
- def top = new MainFrame {
- title = "Hello, World!"
- contents = new Button("Click Me!")
- }
-}
diff --git a/docs/examples/swing/LabelTest.scala b/docs/examples/swing/LabelTest.scala
deleted file mode 100644
index edd7a14634..0000000000
--- a/docs/examples/swing/LabelTest.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-package examples.swing
-
-import scala.swing._
-import scala.swing.event._
-
-object LabelTest extends SimpleSwingApplication {
- def top = new MainFrame{
- contents = new Label {
- text = "Hello"
- import java.awt.event._
- listenTo(mouse.clicks)
- reactions += {
- case MousePressed(_,_,_,_,_) =>
- println("Mouse pressed2")
- }
- }
- }
-}
-
diff --git a/docs/examples/swing/LinePainting.scala b/docs/examples/swing/LinePainting.scala
deleted file mode 100644
index f72f8701ed..0000000000
--- a/docs/examples/swing/LinePainting.scala
+++ /dev/null
@@ -1,53 +0,0 @@
-package examples.swing
-
-import scala.swing.Swing._
-import scala.swing.{MainFrame, Panel}
-import scala.swing.event._
-import java.awt.{Color, Graphics2D, Point, geom}
-
-/**
- * Dragging the mouse draws a simple graph
- *
- * @author Frank Teubler, Ingo Maier
- */
-object LinePainting extends SimpleSwingApplication {
- lazy val ui = new Panel {
- background = Color.white
- preferredSize = (200,200)
-
- focusable = true
- listenTo(mouse.clicks, mouse.moves, keys)
-
- reactions += {
- case e: MousePressed =>
- moveTo(e.point)
- requestFocusInWindow()
- case e: MouseDragged => lineTo(e.point)
- case e: MouseReleased => lineTo(e.point)
- case KeyTyped(_,'c',_,_) =>
- path = new geom.GeneralPath
- repaint()
- case _: FocusLost => repaint()
- }
-
- /* records the dragging */
- var path = new geom.GeneralPath
-
- def lineTo(p: Point) { path.lineTo(p.x, p.y); repaint() }
- def moveTo(p: Point) { path.moveTo(p.x, p.y); repaint() }
-
- override def paintComponent(g: Graphics2D) = {
- super.paintComponent(g)
- g.setColor(new Color(100,100,100))
- g.drawString("Press left mouse button and drag to paint." +
- (if(hasFocus) " Press 'c' to clear." else ""), 10, size.height-10)
- g.setColor(Color.black)
- g.draw(path)
- }
- }
-
- def top = new MainFrame {
- title = "Simple Line Painting Demo"
- contents = ui
- }
-}
diff --git a/docs/examples/swing/ListViewDemo.scala b/docs/examples/swing/ListViewDemo.scala
deleted file mode 100644
index 5630f2871d..0000000000
--- a/docs/examples/swing/ListViewDemo.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-package examples.swing
-
-object ListViewDemo extends SimpleSwingApplication {
- def top = new MainFrame {
- case class City(name: String, country: String, population: Int, capital: Boolean)
- val items = List(City("Lausanne", "Switzerland", 129273, false),
- City("Paris", "France", 2203817, true),
- City("New York", "USA", 8363710 , false),
- City("Berlin", "Germany", 3416300, true),
- City("Tokio", "Japan", 12787981, true))
- import ListView._
- contents = new FlowPanel(new ScrollPane(new ListView(items) {
- renderer = Renderer(_.name)
- }))
- //new ScrollPane(new Table(items)))
- }
-}
diff --git a/docs/examples/swing/SimpleApplet.scala b/docs/examples/swing/SimpleApplet.scala
deleted file mode 100644
index 502de537a3..0000000000
--- a/docs/examples/swing/SimpleApplet.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-package examples.swing
-
-import event._
-
-class SimpleApplet extends Applet {
- object ui extends UI with Reactor {
- def init() = {
- val button = new Button("Press here!")
- val text = new TextArea("Java Version: " + util.Properties.javaVersion + "\n")
- listenTo(button)
- reactions += {
- case ButtonClicked(_) => text.text += "Button Pressed!\n"
- case _ =>
- }
- contents = new BoxPanel(Orientation.Vertical) { contents.append(button, text) }
- }
- }
-}
diff --git a/docs/examples/swing/SwingApp.scala b/docs/examples/swing/SwingApp.scala
deleted file mode 100644
index b3fe7447ef..0000000000
--- a/docs/examples/swing/SwingApp.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-package examples.swing
-
-import swing._
-import swing.event._
-
-object SwingApp extends SimpleSwingApplication {
- def top = new MainFrame {
- title = "SwingApp"
- var numclicks = 0
- object label extends Label {
- val prefix = "Number of button clicks: "
- text = prefix + "0 "
- listenTo(button)
- reactions += {
- case ButtonClicked(button) =>
- numclicks = numclicks + 1
- text = prefix + numclicks
- }
- }
- object button extends Button {
- text = "I am a button"
- }
- contents = new FlowPanel {
- contents.append(button, label)
- border = Swing.EmptyBorder(5, 5, 5, 5)
- }
- }
-}
-
diff --git a/docs/examples/swing/TableSelection.scala b/docs/examples/swing/TableSelection.scala
deleted file mode 100644
index 8c8ea4ffcc..0000000000
--- a/docs/examples/swing/TableSelection.scala
+++ /dev/null
@@ -1,96 +0,0 @@
-package examples.swing
-
-import java.awt.Dimension
-import swing.event._
-
-object TableSelection extends SimpleSwingApplication {
- val model = Array(List("Mary", "Campione", "Snowboarding", 5, false).toArray,
- List("Alison", "Huml", "Rowing", 5, false).toArray,
- List("Kathy", "Walrath", "Knitting", 5, false).toArray,
- List("Sharon", "Zakhour", "Speed reading", 5, false).toArray,
- List("Philip", "Milne", "Pool", 5, false).toArray)
- /*val model = Array.tabulate(10000) { i =>
- List("Mary", "Campione", "Snowboarding", i, false).toArray
- }*/
-
- lazy val ui = new BoxPanel(Orientation.Vertical) {
- val table = new Table(model, Array("First Name", "Last Name", "Sport", "# of Years", "Vegetarian")) {
- preferredViewportSize = new Dimension(500, 70)
- }
- //1.6:table.fillsViewportHeight = true
- listenTo(table.selection)
-
- contents += new ScrollPane(table)
- contents += new Label("Selection Mode")
-
- def radio(mutex: ButtonGroup, text: String): RadioButton = {
- val b = new RadioButton(text)
- listenTo(b)
- mutex.buttons += b
- contents += b
- b
- }
-
- val intervalMutex = new ButtonGroup
- val multiInterval = radio(intervalMutex, "Multiple Interval Selection")
- val elementInterval = radio(intervalMutex, "Single Selection")
- val singleInterval = radio(intervalMutex, "Single Interval Selection")
- intervalMutex.select(multiInterval)
-
- contents += new Label("Selection Options")
- val elemMutex = new ButtonGroup
- val rowSelection = radio(elemMutex, "Row Selection")
- val columnSelection = radio(elemMutex, "Column Selection")
- val cellSelection = radio(elemMutex, "Cell Selection")
- elemMutex.select(rowSelection)
-
- val output = new TextArea(5, 40) { editable = false }
- contents += new ScrollPane(output)
-
- def outputSelection() {
- output.append("Lead: " + table.selection.rows.leadIndex + "," +
- table.selection.columns.leadIndex + ". ")
- output.append("Rows:")
- for (c <- table.selection.rows) output.append(" " + c)
- output.append(". Columns:")
- for (c <- table.selection.columns) output.append(" " + c)
- output.append(".\n")
- }
-
- reactions += {
- case ButtonClicked(`multiInterval`) =>
- table.selection.intervalMode = Table.IntervalMode.MultiInterval
- if (cellSelection.selected) {
- elemMutex.select(rowSelection)
- table.selection.elementMode = Table.ElementMode.None
- }
- cellSelection.enabled = false
- case ButtonClicked(`elementInterval`) =>
- table.selection.intervalMode = Table.IntervalMode.Single
- cellSelection.enabled = true
- case ButtonClicked(`singleInterval`) =>
- table.selection.intervalMode = Table.IntervalMode.SingleInterval
- cellSelection.enabled = true
- case ButtonClicked(`rowSelection`) =>
- if (rowSelection.selected)
- table.selection.elementMode = Table.ElementMode.Row
- case ButtonClicked(`columnSelection`) =>
- if (columnSelection.selected)
- table.selection.elementMode = Table.ElementMode.Column
- case ButtonClicked(`cellSelection`) =>
- if (cellSelection.selected)
- table.selection.elementMode = Table.ElementMode.Cell
- case TableRowsSelected(_, range, false) =>
- output.append("Rows selected, changes: " + range + "\n")
- outputSelection()
- case TableColumnsSelected(_, range, false) =>
- output.append("Columns selected, changes " + range + "\n")
- outputSelection()
- }
- }
-
- def top = new MainFrame {
- title = "Table Selection"
- contents = ui
- }
-}
diff --git a/docs/examples/swing/UIDemo.scala b/docs/examples/swing/UIDemo.scala
deleted file mode 100644
index 6d77c049e0..0000000000
--- a/docs/examples/swing/UIDemo.scala
+++ /dev/null
@@ -1,147 +0,0 @@
-package examples.swing
-
-import swing._
-import event._
-import Swing._
-import ListView._
-
-object UIDemo extends SimpleSwingApplication {
- def top = new MainFrame {
- title = "Scala Swing Demo"
-
- /*
- * Create a menu bar with a couple of menus and menu items and
- * set the result as this frame's menu bar.
- */
- menuBar = new MenuBar {
- contents += new Menu("A Menu") {
- contents += new MenuItem("An item")
- contents += new MenuItem(Action("An action item") {
- println("Action '"+ title +"' invoked")
- })
- contents += new Separator
- contents += new CheckMenuItem("Check me")
- contents += new CheckMenuItem("Me too!")
- contents += new Separator
- val a = new RadioMenuItem("a")
- val b = new RadioMenuItem("b")
- val c = new RadioMenuItem("c")
- val mutex = new ButtonGroup(a,b,c)
- contents ++= mutex.buttons
- }
- contents += new Menu("Empty Menu")
- }
-
- /*
- * The root component in this frame is a panel with a border layout.
- */
- contents = new BorderPanel {
- import BorderPanel.Position._
-
- var reactLive = false
-
- val tabs = new TabbedPane {
- import TabbedPane._
- val buttons = new FlowPanel {
- border = Swing.EmptyBorder(5,5,5,5)
-
- contents += new BoxPanel(Orientation.Vertical) {
- border = CompoundBorder(TitledBorder(EtchedBorder, "Radio Buttons"), EmptyBorder(5,5,5,10))
- val a = new RadioButton("Green Vegetables")
- val b = new RadioButton("Red Meat")
- val c = new RadioButton("White Tofu")
- val mutex = new ButtonGroup(a,b,c)
- contents ++= mutex.buttons
- }
- contents += new BoxPanel(Orientation.Vertical) {
- border = CompoundBorder(TitledBorder(EtchedBorder, "Check Boxes"), EmptyBorder(5,5,5,10))
- val paintLabels = new CheckBox("Paint Labels")
- val paintTicks = new CheckBox("Paint Ticks")
- val snapTicks = new CheckBox("Snap To Ticks")
- val live = new CheckBox("Live")
- contents.append(paintLabels, paintTicks, snapTicks, live)
- listenTo(paintLabels, paintTicks, snapTicks, live)
- reactions += {
- case ButtonClicked(`paintLabels`) =>
- slider.paintLabels = paintLabels.selected
- case ButtonClicked(`paintTicks`) =>
- slider.paintTicks = paintTicks.selected
- case ButtonClicked(`snapTicks`) =>
- slider.snapToTicks = snapTicks.selected
- case ButtonClicked(`live`) =>
- reactLive = live.selected
- }
- }
- contents += new Button(Action("Center Frame") { centerOnScreen() })
- }
- pages += new Page("Buttons", buttons)
- pages += new Page("GridBag", GridBagDemo.ui)
- pages += new Page("Converter", CelsiusConverter2.ui)
- pages += new Page("Tables", TableSelection.ui)
- pages += new Page("Dialogs", Dialogs.ui)
- pages += new Page("Combo Boxes", ComboBoxes.ui)
- pages += new Page("Split Panes",
- new SplitPane(Orientation.Vertical, new Button("Hello"), new Button("World")) {
- continuousLayout = true
- })
-
- val password = new FlowPanel {
- contents += new Label("Enter your secret password here ")
- val field = new PasswordField(10)
- contents += field
- val label = new Label(field.text)
- contents += label
- listenTo(field)
- reactions += {
- case EditDone(`field`) => label.text = field.password.mkString
- }
- }
-
- pages += new Page("Password", password)
- pages += new Page("Painting", LinePainting.ui)
- //pages += new Page("Text Editor", TextEditor.ui)
- }
-
- val list = new ListView(tabs.pages) {
- selectIndices(0)
- selection.intervalMode = ListView.IntervalMode.Single
- renderer = ListView.Renderer(_.title)
- }
- val center = new SplitPane(Orientation.Vertical, new ScrollPane(list), tabs) {
- oneTouchExpandable = true
- continuousLayout = true
- }
- layout(center) = Center
-
- /*
- * This slider is used above, so we need lazy initialization semantics.
- * Objects or lazy vals are the way to go, but objects give us better
- * type inference at times.
- */
- object slider extends Slider {
- min = 0
- value = tabs.selection.index
- max = tabs.pages.size-1
- majorTickSpacing = 1
- }
- layout(slider) = South
-
- /*
- * Establish connection between the tab pane, slider, and list view.
- */
- listenTo(slider)
- listenTo(tabs.selection)
- listenTo(list.selection)
- reactions += {
- case ValueChanged(`slider`) =>
- if(!slider.adjusting || reactLive) tabs.selection.index = slider.value
- case SelectionChanged(`tabs`) =>
- slider.value = tabs.selection.index
- list.selectIndices(tabs.selection.index)
- case SelectionChanged(`list`) =>
- if (list.selection.items.length == 1)
- tabs.selection.page = list.selection.items(0)
- }
- }
- }
-}
diff --git a/docs/examples/swing/images/banana.jpg b/docs/examples/swing/images/banana.jpg
deleted file mode 100644
index 62267a4325..0000000000
--- a/docs/examples/swing/images/banana.jpg
+++ /dev/null
Binary files differ
diff --git a/docs/examples/swing/images/margarita1.jpg b/docs/examples/swing/images/margarita1.jpg
deleted file mode 100644
index d315f7c79f..0000000000
--- a/docs/examples/swing/images/margarita1.jpg
+++ /dev/null
Binary files differ
diff --git a/docs/examples/swing/images/margarita2.jpg b/docs/examples/swing/images/margarita2.jpg
deleted file mode 100644
index c8b076e5f9..0000000000
--- a/docs/examples/swing/images/margarita2.jpg
+++ /dev/null
Binary files differ
diff --git a/docs/examples/swing/images/rose.jpg b/docs/examples/swing/images/rose.jpg
deleted file mode 100644
index d4a2b58062..0000000000
--- a/docs/examples/swing/images/rose.jpg
+++ /dev/null
Binary files differ
diff --git a/docs/examples/tcpoly/collection/HOSeq.scala b/docs/examples/tcpoly/collection/HOSeq.scala
deleted file mode 100644
index a6757b95ba..0000000000
--- a/docs/examples/tcpoly/collection/HOSeq.scala
+++ /dev/null
@@ -1,167 +0,0 @@
-package examples.tcpoly.collection;
-
-trait HOSeq {
- // an internal interface that encapsulates the accumulation of elements (of type elT) to produce
- // a structure of type coll[elT] -- different kinds of collections should provide different implicit
- // values implementing this interface, in order to provide more performant ways of building that structure
- trait Accumulator[+coll[x], elT] {
- def += (el: elT): Unit
- def result: coll[elT]
- }
-
-
- // Iterable abstracts over the type of its structure as well as its elements (see PolyP's Bifunctor)
- // m[x] is intentionally unbounded: fold can then be defined nicely
- // variance: if we write m[+x] instead of +m[+x], x is an invariant position because its enclosing type
- // is an invariant position -- should probably rule that out?
- trait Iterable[+m[+x], +t] {
- //def unit[a](orig: a): m[a]
- def iterator: Iterator[t]
-
- // construct an empty accumulator that will produce the same structure as this iterable, with elements of type t
- def accumulator[t]: Accumulator[m, t]
-
- def filter(p: t => Boolean): m[t] = {
- val buf = accumulator[t]
- val elems = elements
- while (elems.hasNext) { val x = elems.next; if (p(x)) buf += x }
- buf.result
- }
-
- def map[s](f: t => s): m[s] = {
- val buf = accumulator[s]
- val elems = elements
- while (elems.hasNext) buf += f(elems.next)
- buf.result
- }
-
- // flatMap is a more specialized map, it only works if the mapped function produces Iterable values,
- // which are then added to the result one by one
- // the compiler should be able to find the right accumulator (implicit buf) to build the result
- // to get concat, resColl = SingletonIterable, f = unit for SingletonIterable
- def flatMap[resColl[x] <: Iterable[resColl, x], s](f: t => resColl[s])(implicit buf: Accumulator[resColl, s]): resColl[s] = {
- // TODO: would a viewbound for resColl[x] be better?
- // -- 2nd-order type params are not yet in scope in view bound
- val elems = elements
- while (elems.hasNext) {
- val elemss: Iterator[s] = f(elems.next).iterator
- while (elemss.hasNext) buf += elemss.next
- }
- buf.result
- }
- }
-
- final class ListBuffer[A] {
- private var start: List[A] = Nil
- private var last: ::[A] = _
- private var exported: boolean = false
-
- /** Appends a single element to this buffer.
- *
- * @param x the element to append.
- */
- def += (x: A): unit = {
- if (exported) copy
- if (start.isEmpty) {
- last = new HOSeq.this.:: (x, Nil)
- start = last
- } else {
- val last1 = last
- last = new HOSeq.this.:: (x, null) // hack: ::'s tail will actually be last
- //last1.tl = last
- }
- }
-
- /** Converts this buffer to a list
- */
- def toList: List[A] = {
- exported = !start.isEmpty
- start
- }
-
- /** Clears the buffer contents.
- */
- def clear: unit = {
- start = Nil
- exported = false
- }
-
- /** Copy contents of this buffer */
- private def copy = {
- var cursor = start
- val limit = last.tail
- clear
- while (cursor ne limit) {
- this += cursor.head
- cursor = cursor.tail
- }
- }
- }
-
- implicit def listAccumulator[elT]: Accumulator[List, elT] = new Accumulator[List, elT] {
- private[this] val buff = new ListBuffer[elT]
- def += (el: elT): Unit = buff += el
- def result: List[elT] = buff.toList
- }
-
- trait List[+t] extends Iterable[List, t] {
- def head: t
- def tail: List[t]
- def isEmpty: Boolean
- def iterator: Iterator[t] = error("TODO")
-
- // construct an empty accumulator that will produce the same structure as this iterable, with elements of type t
- def accumulator[t]: Accumulator[List, t] = error("TODO")
- }
-
- // TODO: the var tl approach does not seem to work because subtyping isn't fully working yet
- final case class ::[+b](hd: b, private val tl: List[b]) extends List[b] {
- def head = hd
- def tail = if(tl==null) this else tl // hack
- override def isEmpty: boolean = false
- }
-
- case object Nil extends List[Nothing] {
- def isEmpty = true
- def head: Nothing =
- throw new NoSuchElementException("head of empty list")
- def tail: List[Nothing] =
- throw new NoSuchElementException("tail of empty list")
- }
-}
-
-
-
-// misc signatures collected from mailing list / library code:
- /*override def flatMap[B](f: A => Iterable[B]): Set[B]
- final override def flatMap[b](f: Any => Iterable[b]): Array[b]
- def flatMap[b](f: a => Parser[b]) = new Parser[b]
- override def flatMap[b](f: a => Iterable[b]): List[b]
-
-
- MapResult[K] <: Seq[K]
- FilterResult <: Seq[T]
- Concat <: Seq[T]
- Subseq <: Seq[T]
-
-
- def map[K](f: T=>K): MapResult[K]
- def filter(f: T=>Boolean): FilterResult
- def subseq(from: int, to: int): Subseq
- def flatMap[S <: Seq[K], K](f: T => S): S#Concat // legal?
- def concat(others: Seq[T]): Concat
- */
-
-/*trait Iterator[t] {
- // @post hasAdvanced implies hasNext
- // model def hasAdvanced: Boolean
-
- def hasNext: Boolean // pure
-
- // @pre hasAdvanced
- def current: t // pure
-
- // @pre hasNext
- // @post hasAdvanced
- def advance: Unit
-}*/
diff --git a/docs/examples/tcpoly/monads/Monads.scala b/docs/examples/tcpoly/monads/Monads.scala
deleted file mode 100644
index b6e3d5b9a8..0000000000
--- a/docs/examples/tcpoly/monads/Monads.scala
+++ /dev/null
@@ -1,69 +0,0 @@
-package examples.tcpoly.monad;
-
-trait Monads {
- /**
- * class Monad m where
- * (>>=) :: m a -> (a -> m b) -> m b
- * return :: a -> m a
- *
- * MonadTC encodes the above Haskell type class,
- * an instance of MonadTC corresponds to a method dictionary.
- * (see http://lampwww.epfl.ch/~odersky/talks/wg2.8-boston06.pdf)
- *
- * Note that the identity (`this') of the method dictionary does not really correspond
- * to the instance of m[x] (`self') that is `wrapped': e.g., unit does not use `self' (which
- * corresponds to the argument of the implicit conversion that encodes an instance of this type class)
- */
- // Option =:= [x] => Option[x] <: [x] => Any
-// trait MonadTC[m <: [x] => Any, a] {
- // MonadTC[m[x], a] x is a type parameter too -- should not write e.g., m[Int] here
- trait MonadTC[m[x], a] {
- def unit[a](orig: a): m[a]
-
- // >>='s first argument comes from the implicit definition constructing this "method dictionary"
- def >>=[b](fun: a => m[b]): m[b]
- }
-}
-
-/**
- * instance Monad Maybe where
- * (Just x) >>= k = k x
- * Nothing >>= _ = Nothing
- */
-trait OptionMonad extends Monads {
- // this implicit method encodes the Monad type class instance for Option
- implicit def OptionInstOfMonad[a](self: Option[a]): MonadTC[Option, a]
- = new MonadTC[Option, a] {
- def unit[a](orig: a) = Some(orig)
- def >>=[b](fun: a => Option[b]): Option[b] = self match {
- case Some(x) => fun(x)
- case None => None
- }
- }
-}
-
-object main extends OptionMonad with Application {
- Console.println(Some("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") >>= (x => Some(x.length)))
-}
-
-
-/*
-trait MonadTC[m[x], a] requires m[x] {
- def unit[a](orig: a): m[a]
-
- // >>='s first argument comes from the implicit definition constructing this "method dictionary"
- def >>=[b](fun: a => m[b]): m[b]
-}
-
-abstract class OptionIsMonad[t[x] <: Option[x], a] implicit extends MonadTC[t, a] {
- def unit[a](orig: a) = Some(orig) // TODO: problematic.. is a meta-member: not invoked on this
-}
-
-class SomeIsMonad[a] extends OptionIsMonad[Some, a] {
- def >>=[b](fun: a => Option[b]): Option[b] = fun(x)
-}
-
-class NoneIsMonad[a] extends OptionIsMonad[None, a] {
- def >>=[b](fun: a => Option[b]): Option[b] = None
-}
-*/
diff --git a/docs/examples/typeinf.scala b/docs/examples/typeinf.scala
deleted file mode 100644
index d4bc8bf3e1..0000000000
--- a/docs/examples/typeinf.scala
+++ /dev/null
@@ -1,253 +0,0 @@
-package examples
-
-object typeinf {
-
-trait Term {}
-
-case class Var(x: String) extends Term {
- override def toString() = x
-}
-case class Lam(x: String, e: Term) extends Term {
- override def toString() = "(\\" + x + "." + e + ")"
-}
-case class App(f: Term, e: Term) extends Term {
- override def toString() = "(" + f + " " + e + ")"
-}
-case class Let(x: String, e: Term, f: Term) extends Term {
- override def toString() = "let " + x + " = " + e + " in " + f
-}
-
-sealed trait Type {}
-case class Tyvar(a: String) extends Type {
- override def toString() = a
-}
-case class Arrow(t1: Type, t2: Type) extends Type {
- override def toString() = "(" + t1 + "->" + t2 + ")"
-}
-case class Tycon(k: String, ts: List[Type]) extends Type {
- override def toString() =
- k + (if (ts.isEmpty) "" else ts.mkString("[", ",", "]"))
-}
-
-object typeInfer {
-
- private var n: Int = 0
- def newTyvar(): Type = { n += 1; Tyvar("a" + n) }
-
- trait Subst extends Function1[Type, Type] {
- def lookup(x: Tyvar): Type
- def apply(t: Type): Type = t match {
- case tv @ Tyvar(a) => val u = lookup(tv); if (t == u) t else apply(u)
- case Arrow(t1, t2) => Arrow(apply(t1), apply(t2))
- case Tycon(k, ts) => Tycon(k, ts map apply)
- }
- def extend(x: Tyvar, t: Type) = new Subst {
- def lookup(y: Tyvar): Type = if (x == y) t else Subst.this.lookup(y)
- }
- }
-
- val emptySubst = new Subst { def lookup(t: Tyvar): Type = t }
-
- case class TypeScheme(tyvars: List[Tyvar], tpe: Type) {
- def newInstance: Type =
- (emptySubst /: tyvars) ((s, tv) => s.extend(tv, newTyvar())) (tpe)
- }
-
- type Env = List[Pair[String, TypeScheme]]
-
- def lookup(env: Env, x: String): TypeScheme = env match {
- case List() => null
- case Pair(y, t) :: env1 => if (x == y) t else lookup(env1, x)
- }
-
- def gen(env: Env, t: Type): TypeScheme =
- TypeScheme(tyvars(t) diff tyvars(env), t)
-
- def tyvars(t: Type): List[Tyvar] = t match {
- case tv @ Tyvar(a) => List(tv)
- case Arrow(t1, t2) => tyvars(t1) union tyvars(t2)
- case Tycon(k, ts) => (List[Tyvar]() /: ts) ((tvs, t) => tvs union tyvars(t))
- }
-
- def tyvars(ts: TypeScheme): List[Tyvar] =
- tyvars(ts.tpe) diff ts.tyvars;
-
- def tyvars(env: Env): List[Tyvar] =
- (List[Tyvar]() /: env) ((tvs, nt) => tvs union tyvars(nt._2))
-
- def mgu(t: Type, u: Type, s: Subst): Subst = Pair(s(t), s(u)) match {
- case Pair(Tyvar(a), Tyvar(b)) if (a == b) =>
- s
- case Pair(Tyvar(a), _) if !(tyvars(u) contains a) =>
- s.extend(Tyvar(a), u)
- case Pair(_, Tyvar(a)) =>
- mgu(u, t, s)
- case Pair(Arrow(t1, t2), Arrow(u1, u2)) =>
- mgu(t1, u1, mgu(t2, u2, s))
- case Pair(Tycon(k1, ts), Tycon(k2, us)) if (k1 == k2) =>
- (s /: (ts zip us)) ((s, tu) => mgu(tu._1, tu._2, s))
- case _ =>
- throw new TypeError("cannot unify " + s(t) + " with " + s(u))
- }
-
- case class TypeError(s: String) extends Exception(s) {}
-
- def tp(env: Env, e: Term, t: Type, s: Subst): Subst = {
- current = e
- e match {
- case Var(x) =>
- val u = lookup(env, x)
- if (u == null) throw new TypeError("undefined: " + x)
- else mgu(u.newInstance, t, s)
-
- case Lam(x, e1) =>
- val a, b = newTyvar()
- val s1 = mgu(t, Arrow(a, b), s)
- val env1 = Pair(x, TypeScheme(List(), a)) :: env
- tp(env1, e1, b, s1)
-
- case App(e1, e2) =>
- val a = newTyvar()
- val s1 = tp(env, e1, Arrow(a, t), s)
- tp(env, e2, a, s1)
-
- case Let(x, e1, e2) =>
- val a = newTyvar()
- val s1 = tp(env, e1, a, s)
- tp(Pair(x, gen(env, s1(a))) :: env, e2, t, s1)
- }
- }
- var current: Term = null
-
- def typeOf(env: Env, e: Term): Type = {
- val a = newTyvar()
- tp(env, e, a, emptySubst)(a)
- }
-}
-
- object predefined {
- val booleanType = Tycon("Boolean", List())
- val intType = Tycon("Int", List())
- def listType(t: Type) = Tycon("List", List(t))
-
- private def gen(t: Type): typeInfer.TypeScheme = typeInfer.gen(List(), t)
- private val a = typeInfer.newTyvar()
- val env = List(
-/*
- Pair("true", gen(booleanType)),
- Pair("false", gen(booleanType)),
- Pair("if", gen(Arrow(booleanType, Arrow(a, Arrow(a, a))))),
- Pair("zero", gen(intType)),
- Pair("succ", gen(Arrow(intType, intType))),
- Pair("nil", gen(listType(a))),
- Pair("cons", gen(Arrow(a, Arrow(listType(a), listType(a))))),
- Pair("isEmpty", gen(Arrow(listType(a), booleanType))),
- Pair("head", gen(Arrow(listType(a), a))),
- Pair("tail", gen(Arrow(listType(a), listType(a)))),
-*/
- Pair("fix", gen(Arrow(Arrow(a, a), a)))
- )
- }
-
- trait MiniMLParsers extends CharParsers {
-
- /** whitespace */
- def whitespace = rep{chr(' ') ||| chr('\t') ||| chr('\n')}
-
- /** A given character, possible preceded by whitespace */
- def wschr(ch: char) = whitespace &&& chr(ch)
-
- def isLetter = (c: char) => Character.isLetter(c)
- def isLetterOrDigit: char => boolean = Character.isLetterOrDigit
-
- /** identifiers or keywords */
- def id: Parser[String] =
- for (
- c: char <- rep(chr(' ')) &&& chr(isLetter);
- cs: List[char] <- rep(chr(isLetterOrDigit))
- ) yield (c :: cs).mkString("", "", "")
-
- /** Non-keyword identifiers */
- def ident: Parser[String] =
- for (s <- id if s != "let" && s != "in") yield s
-
- /** term = '\' ident '.' term | term1 {term1} | let ident "=" term in term */
- def term: Parser[Term] = (
- ( for (
- _ <- wschr('\\');
- x <- ident;
- _ <- wschr('.');
- t <- term)
- yield Lam(x, t): Term )
- |||
- ( for (
- letid <- id if letid == "let";
- x <- ident;
- _ <- wschr('=');
- t <- term;
- inid <- id; if inid == "in";
- c <- term)
- yield Let(x, t, c) )
- |||
- ( for (
- t <- term1;
- ts <- rep(term1))
- yield (t /: ts)((f, arg) => App(f, arg)) )
- )
-
- /** term1 = ident | '(' term ')' */
- def term1: Parser[Term] = (
- ( for (s <- ident)
- yield Var(s): Term )
- |||
- ( for (
- _ <- wschr('(');
- t <- term;
- _ <- wschr(')'))
- yield t )
- )
-
- /** all = term ';' */
- def all: Parser[Term] =
- for (
- t <- term;
- _ <- wschr(';'))
- yield t
- }
-
- class ParseString(s: String) extends Parsers {
- type inputType = int
- val input = 0
- def any = new Parser[char] {
- def apply(in: int): Parser[char]#Result =
- if (in < s.length()) Some(Pair(s charAt in, in + 1)) else None
- }
- }
-
- def showType(e: Term): String =
- try {
- typeInfer.typeOf(predefined.env, e).toString()
- }
- catch {
- case typeInfer.TypeError(msg) =>
- "\n cannot type: " + typeInfer.current +
- "\n reason: " + msg
- }
-
- def main(args: Array[String]) {
- Console.println(
- if (args.length == 1) {
- val ps = new ParseString(args(0)) with MiniMLParsers
- ps.all(ps.input) match {
- case Some(Pair(term, _)) =>
- "" + term + ": " + showType(term)
- case None =>
- "syntax error"
- }
- }
- else
- "usage: java examples.typeinf <expr-string>"
- )
- }
-
-}
diff --git a/docs/examples/xml/phonebook/embeddedBook.scala b/docs/examples/xml/phonebook/embeddedBook.scala
deleted file mode 100644
index 3286485f0b..0000000000
--- a/docs/examples/xml/phonebook/embeddedBook.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/* examples/phonebook/embeddedBook.scala */
-package phonebook
-
-object embeddedBook {
-
- val company = <a href="http://acme.org">ACME</a>
- val first = "Burak"
- val last = "Emir"
- val location = "work"
-
- val embBook =
- <phonebook>
- <descr>
- This is the <b>phonebook</b> of the
- {company} corporation.
- </descr>
- <entry>
- <name>{ first+" "+last }</name>
- <phone where={ location }>+41 21 693 68 {val x = 60 + 7; x}</phone>
- </entry>
- </phonebook>;
-
- def main(args: Array[String]) =
- Console.println( embBook )
-
-}
diff --git a/docs/examples/xml/phonebook/phonebook.scala b/docs/examples/xml/phonebook/phonebook.scala
deleted file mode 100644
index 3c0dfbd837..0000000000
--- a/docs/examples/xml/phonebook/phonebook.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-package phonebook ;
-
-object phonebook {
-
- val labPhoneBook =
- <phonebook>
- <descr>
- This is the <b>phonebook</b> of the
- <a href="http://acme.org">ACME</a> corporation.
- </descr>
- <entry>
- <name>Burak</name>
- <phone where="work"> +41 21 693 68 67</phone>
- <phone where="mobile">+41 79 602 23 23</phone>
- </entry>
- </phonebook>;
-
- Console.println( labPhoneBook );
-
- // XML is immutable - adding an element
-
- import scala.xml.{ Node, Text };
-
- def add( phonebook:Node, newEntry:Node ):Node = phonebook match {
- case <phonebook>{ ch @ _* }</phonebook> =>
- <phonebook>{ ch }{ newEntry }</phonebook>
- }
-
- val pb2 =
- add( labPhoneBook,
- <entry>
- <name>Kim</name>
- <phone where="work"> +41 21 111 11 11</phone>
- </entry> );
-
- def main(args:Array[String]) = Console.println( pb2 );
-
-}
diff --git a/docs/examples/xml/phonebook/phonebook1.scala b/docs/examples/xml/phonebook/phonebook1.scala
deleted file mode 100644
index 316c6c1995..0000000000
--- a/docs/examples/xml/phonebook/phonebook1.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-/* examples/phonebook/phonebook1.scala */
-package phonebook
-
-object phonebook1 {
-
- val labPhoneBook =
- <phonebook>
- <descr>
- This is the <b>phonebook</b> of the
- <a href="http://acme.org">ACME</a> corporation.
- </descr>
- <entry>
- <name>Burak Emir</name>
- <phone where="work">+41 21 693 68 67</phone>
- </entry>
- </phonebook>;
-
- def main(args: Array[String]) =
- Console.println( labPhoneBook )
-
-}
diff --git a/docs/examples/xml/phonebook/phonebook2.scala b/docs/examples/xml/phonebook/phonebook2.scala
deleted file mode 100644
index 2a708daf7c..0000000000
--- a/docs/examples/xml/phonebook/phonebook2.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/* examples/xml/phonebook/phonebook2.scala */
-package phonebook;
-
-object phonebook2 {
-
- import scala.xml.Node
-
- /** adds an entry to a phonebook */
- def add( p: Node, newEntry: Node ): Node = p match {
-
- case <phonebook>{ ch @ _* }</phonebook> =>
-
- <phonebook>{ ch }{ newEntry }</phonebook>
- }
-
- val pb2 =
- add( phonebook1.labPhoneBook,
- <entry>
- <name>Kim</name>
- <phone where="work">+41 21 111 11 11</phone>
- </entry> );
-
- def main( args: Array[String] ) =
- Console.println( pb2 )
-}
diff --git a/docs/examples/xml/phonebook/phonebook3.scala b/docs/examples/xml/phonebook/phonebook3.scala
deleted file mode 100644
index 12f2deaa79..0000000000
--- a/docs/examples/xml/phonebook/phonebook3.scala
+++ /dev/null
@@ -1,81 +0,0 @@
-package phonebook;
-
-object phonebook3 {
-
- import scala.xml.{Elem, Node, Text} ;
- import scala.xml.PrettyPrinter ;
- import Node.NoAttributes ;
-
- /* this method "changes" (returns an updated copy) of the phonebook when the
- * entry for Name exists. If it has an attribute "where" whose value is equal to the
- * parameter Where, it is changed, otherwise, it is added.
- */
- def change ( phonebook:Node, Name:String, Where:String, newPhone:String ) = {
-
- /** this nested function walks through tree, and returns an updated copy of it */
- def copyOrChange ( ch: Iterator[Node] ) = {
-
- import xml.Utility.{trim,trimProper} //removes whitespace nodes, which are annoying in matches
-
- for( val c <- ch ) yield
- trimProper(c) match {
-
- // if the node is the particular entry we are looking for, return an updated copy
-
- case x @ <entry><name>{ Text(Name) }</name>{ ch1 @ _* }</entry> =>
-
- var updated = false;
- val ch2 = for(c <- ch1) yield c match { // does it have the phone number?
-
- case y @ <phone>{ _* }</phone> if y \ "@where" == Where =>
- updated = true
- <phone where={ Where }>{ newPhone }</phone>
-
- case y => y
-
- }
- if( !updated ) { // no, so we add as first entry
-
- <entry>
- <name>{ Name }</name>
- <phone where={ Where }>{ newPhone }</phone>
- { ch1 }
- </entry>
-
- } else { // yes, and we changed it as we should
-
- <entry>
- { ch2 }
- </entry>
-
- }
- // end case x @ <entry>...
-
- // other entries are copied without changing them
-
- case x =>
- x
-
- }
- } ; // for ... yield ... returns an Iterator[Node]
-
- // decompose phonebook, apply updates
- phonebook match {
- case <phonebook>{ ch @ _* }</phonebook> =>
- <phonebook>{ copyOrChange( ch.iterator ) }</phonebook>
- }
-
- }
-
- val pb2 =
- change( phonebook1.labPhoneBook, "John", "work", "+41 55 555 55 55" );
-
- val pp = new PrettyPrinter( 80, 5 );
-
- def main( args:Array[String] ) = {
- Console.println("---before---");
- Console.println( pp.format( phonebook1.labPhoneBook ));
- Console.println("---after---");
- Console.println( pp.format( pb2 ));
- }
-}
diff --git a/docs/examples/xml/phonebook/verboseBook.scala b/docs/examples/xml/phonebook/verboseBook.scala
deleted file mode 100644
index 2dcb155480..0000000000
--- a/docs/examples/xml/phonebook/verboseBook.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-/* examples/xml/phonebook/verboseBook.scala */
-package phonebook
-
-object verboseBook {
-
- import scala.xml.{ UnprefixedAttribute, Elem, Node, Null, Text, TopScope }
-
- val pbookVerbose =
- Elem(null, "phonebook", Null, TopScope,
- Elem(null, "descr", Null, TopScope,
- Text("This is a "),
- Elem(null, "b", Null, TopScope, Text("sample")),
- Text("description")
- ),
- Elem(null, "entry", Null, TopScope,
- Elem(null, "name", Null, TopScope, Text("Burak Emir")),
- Elem(null, "phone", new UnprefixedAttribute("where","work", Null), TopScope,
- Text("+41 21 693 68 67"))
- )
- )
-
- def main(args: Array[String]) =
- Console.println( pbookVerbose )
-}
diff --git a/docs/licenses/apache_android.txt b/docs/licenses/apache_android.txt
deleted file mode 100644
index 00f339625f..0000000000
--- a/docs/licenses/apache_android.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Scala includes various example files for Android:
-
-Copyright (c) 2005-2009, The Android Open Source Project
-Copyright (c) 2007, Steven Osborn
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License. \ No newline at end of file
diff --git a/docs/licenses/apache_ant.txt b/docs/licenses/apache_ant.txt
deleted file mode 100644
index ac637d760d..0000000000
--- a/docs/licenses/apache_ant.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Scala includes Ant as a library needed for build with sbt
-
-Copyright © 1999-2010, The Apache Software Foundation.
- http://ant.apache.org/
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/docs/licenses/apache_jansi.txt b/docs/licenses/apache_jansi.txt
new file mode 100644
index 0000000000..067a5a6a34
--- /dev/null
+++ b/docs/licenses/apache_jansi.txt
@@ -0,0 +1,203 @@
+Scala includes the JLine library, which includes the Jansi library.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/docs/licenses/bsd_asm.txt b/docs/licenses/bsd_asm.txt
new file mode 100644
index 0000000000..8613cd33a2
--- /dev/null
+++ b/docs/licenses/bsd_asm.txt
@@ -0,0 +1,31 @@
+Scala includes the ASM library.
+
+Copyright (c) 2000-2011 INRIA, France Telecom
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/docs/licenses/bsd_jline.txt b/docs/licenses/bsd_jline.txt
index 4ac4a378ed..3e5dba75da 100644
--- a/docs/licenses/bsd_jline.txt
+++ b/docs/licenses/bsd_jline.txt
@@ -1,4 +1,4 @@
-Scala includes the jLine library:
+Scala includes the JLine library:
Copyright (c) 2002-2006, Marc Prud'hommeaux <mwp1@cornell.edu>
All rights reserved.
diff --git a/src/asm/scala/tools/asm/MethodWriter.java b/src/asm/scala/tools/asm/MethodWriter.java
index 321bacb6fc..887cb28c6f 100644
--- a/src/asm/scala/tools/asm/MethodWriter.java
+++ b/src/asm/scala/tools/asm/MethodWriter.java
@@ -1853,7 +1853,12 @@ class MethodWriter extends MethodVisitor {
int size = 8;
if (code.length > 0) {
if (code.length > 65536) {
- throw new RuntimeException("Method code too large!");
+ String nameString = "";
+ int i = 0;
+ // find item that corresponds to the index of our name
+ while (i < cw.items.length && (cw.items[i] == null || cw.items[i].index != name)) i++;
+ if (cw.items[i] != null) nameString = cw.items[i].strVal1 +"'s ";
+ throw new RuntimeException("Method "+ nameString +"code too large!");
}
cw.newUTF8("Code");
size += 18 + code.length + 8 * handlerCount;
diff --git a/src/build/maven/maven-deploy.xml b/src/build/maven/maven-deploy.xml
index e70173319e..8da1d76a6f 100644
--- a/src/build/maven/maven-deploy.xml
+++ b/src/build/maven/maven-deploy.xml
@@ -176,6 +176,21 @@
</sequential>
</macrodef>
+ <!-- IDE needs swing/actors/continuations -->
+ <macrodef name="deploy-remote-core">
+ <attribute name="repository" />
+ <attribute name="version" />
+ <sequential>
+ <deploy-remote name="scala-library" version="@{version}" repository="@{repository}"/>
+ <deploy-remote name="scala-reflect" version="@{version}" repository="@{repository}"/>
+ <deploy-remote name="scala-compiler" version="@{version}" repository="@{repository}" />
+ <deploy-remote name="jline" version="@{version}" repository="@{repository}"/>
+ <deploy-remote name="scala-swing" version="@{version}" repository="@{repository}"/>
+ <deploy-remote name="scala-actors" version="@{version}" repository="@{repository}"/>
+ <deploy-remote-plugin name="continuations" version="@{version}" repository="@{repository}"/>
+ </sequential>
+ </macrodef>
+
<!-- PGP Signed deployment -->
<macrodef name="deploy-remote-signed-single">
<attribute name="pom" />
@@ -268,6 +283,11 @@
<deploy-remote-all version="${maven.version.number}" repository="${remote.snapshot.repository}" />
</target>
+ <!-- for PR validation -->
+ <target name="deploy-core.snapshot" depends="deploy.remote.init">
+ <deploy-remote-core version="${maven.version.number}" repository="${remote.snapshot.repository}" />
+ </target>
+
<target name="deploy.release" depends="deploy.remote.init" unless="version.is.snapshot" description="Deploys the bundled files as a release into the desired remote Maven repository">
<deploy-remote-all version="${maven.version.number}" repository="${remote.release.repository}" />
</target>
diff --git a/src/build/pack.xml b/src/build/pack.xml
index 20c4034107..8aedd3feb8 100644
--- a/src/build/pack.xml
+++ b/src/build/pack.xml
@@ -56,7 +56,7 @@ MAIN DISTRIBUTION PACKAGING
<target name="pack-devel-docs.tar" depends="pack-archives.zip">
<tar destfile="${dists.dir}/archives/${dist.name}-devel-docs.tar"
compression="none" longfile="gnu">
- <tarfileset dir="${dist.dir}/doc/scala-devel-docs" prefix="${dist.name}-devel-docs"/>
+ <tarfileset dir="${dist.dir}/api" prefix="${dist.name}-devel-docs"/>
</tar>
<gzip src="${dists.dir}/archives/${dist.name}-devel-docs.tar" destfile="${dists.dir}/archives/${dist.name}-devel-docs.tgz"/>
<if>
diff --git a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl
index 1288eb0b7c..8441f3af23 100644
--- a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl
+++ b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl
@@ -12,15 +12,18 @@ setlocal enableextensions enabledelayedexpansion
set _LINE_TOOLCP=
-:another_param
-
rem Use "%~1" to handle spaces in paths. See http://ss64.com/nt/syntax-args.html
-if "%~1"=="-toolcp" (
- set _LINE_TOOLCP=%~2
- shift
- shift
- goto another_param
+rem SI-7295 The goto here is needed to avoid problems with `scala Script.cmd "arg(with)paren"`,
+rem we must not evaluate %~2 eagerly, but delayed expansion doesn't seem to allow
+rem removal of quotation marks.
+if not [%~1]==[-toolcp] (
+ goto :notoolcp
)
+shift
+set _LINE_TOOLCP=%~1
+shift
+
+:notoolcp
rem We keep in _JAVA_PARAMS all -J-prefixed and -D-prefixed arguments
set _JAVA_PARAMS=
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 996287dea8..b9e4109623 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -980,8 +980,11 @@ self =>
/** Assumed (provisionally) to be TermNames. */
def ident(skipIt: Boolean): Name =
- if (isIdent) rawIdent().encode
- else {
+ if (isIdent) {
+ val name = in.name.encode
+ in.nextToken()
+ name
+ } else {
syntaxErrorOrIncomplete(expectedMsg(IDENTIFIER), skipIt)
nme.ERROR
}
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index 1aa50be83a..8d295a28d0 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -611,10 +611,7 @@ trait Scanners extends ScannersCommon {
if (ch == '`') {
nextChar()
finishNamed(BACKQUOTED_IDENT)
- if (name.length == 0)
- syntaxError("empty quoted identifier")
- else if (name == nme.WILDCARD)
- syntaxError("wildcard invalid as backquoted identifier")
+ if (name.length == 0) syntaxError("empty quoted identifier")
}
else syntaxError("unclosed quoted identifier")
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 44d7a1929b..71a5b85271 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -954,10 +954,7 @@ abstract class GenICode extends SubComponent {
case _ =>
}
ctx1.bb.emit(cm, tree.pos)
-
- if (sym == ctx1.method.symbol) {
- ctx1.method.recursive = true
- }
+ ctx1.method.updateRecursive(sym)
generatedType =
if (sym.isClassConstructor) UNIT
else toTypeKind(sym.info.resultType);
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
index b74770f051..00bcf603cf 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
@@ -185,6 +185,10 @@ trait Members {
this
}
+ final def updateRecursive(called: Symbol): Unit = {
+ recursive ||= (called == symbol)
+ }
+
def addLocal(l: Local): Local = findOrElse(locals)(_ == l) { locals ::= l ; l }
def addParam(p: Local): Unit =
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
index 7c46d648fe..3712745590 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
@@ -86,6 +86,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM {
if (settings.Xdce.value)
for ((sym, cls) <- icodes.classes if inliner.isClosureClass(sym) && !deadCode.liveClosures(sym)) {
log(s"Optimizer eliminated ${sym.fullNameString}")
+ deadCode.elidedClosures += sym
icodes.classes -= sym
}
@@ -449,7 +450,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM {
}
// -----------------------------------------------------------------------------------------
- // utitilies useful when emitting plain, mirror, and beaninfo classes.
+ // utilities useful when emitting plain, mirror, and beaninfo classes.
// -----------------------------------------------------------------------------------------
def writeIfNotTooBig(label: String, jclassName: String, jclass: asm.ClassWriter, sym: Symbol) {
@@ -457,9 +458,9 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM {
val arr = jclass.toByteArray()
bytecodeWriter.writeClass(label, jclassName, arr, sym)
} catch {
- case e: java.lang.RuntimeException if(e.getMessage() == "Class file too large!") =>
- // TODO check where ASM throws the equivalent of CodeSizeTooBigException
- log("Skipped class "+jclassName+" because it exceeds JVM limits (it's too big or has methods that are too long).")
+ case e: java.lang.RuntimeException if e != null && (e.getMessage contains "too large!") =>
+ reporter.error(sym.pos,
+ s"Could not write class $jclassName because it exceeds JVM code size limits. ${e.getMessage}")
}
}
@@ -624,7 +625,8 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM {
innerClassBuffer += m
}
- val allInners: List[Symbol] = innerClassBuffer.toList
+ val allInners: List[Symbol] = innerClassBuffer.toList filterNot deadCode.elidedClosures
+
if (allInners.nonEmpty) {
debuglog(csym.fullName('.') + " contains " + allInners.size + " inner classes.")
@@ -1395,12 +1397,36 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM {
}
clasz.fields foreach genField
- clasz.methods foreach { im => genMethod(im, c.symbol.isInterface) }
+ clasz.methods foreach { im =>
+ if (im.symbol.isBridge && isRedundantBridge(im, clasz))
+ // We can't backport the erasure fix of SI-7120 to 2.10.x, but we can detect and delete
+ // bridge methods with identical signatures to their targets.
+ //
+ // NOTE: this backstop only implemented here in the ASM backend, and is not implemented in the FJBG backend.
+ debugwarn(s"Discarding redundant bridge method: ${im.symbol.debugLocationString}. See SI-8114.")
+ else
+ genMethod(im, c.symbol.isInterface)
+ }
addInnerClasses(clasz.symbol, jclass)
jclass.visitEnd()
writeIfNotTooBig("" + c.symbol.name, thisName, jclass, c.symbol)
+ }
+ private def isRedundantBridge(bridge: IMethod, owner: IClass): Boolean = {
+ def lastCalledMethod: Option[Symbol] = bridge.code.instructions.reverseIterator.collectFirst {
+ case CALL_METHOD(meth, _) => meth
+ }
+ def hasSameSignatureAsBridge(targetMethod: Symbol): Boolean = {
+ val targetIMethod = clasz.methods find (m => m.symbol == targetMethod)
+ // Important to compare the IMethod#paramss, rather then the erased MethodTypes, as
+ // due to the bug SI-7120, these are out of sync. For example, in the `applyOrElse`
+ // method in run/t8114.scala, the method symbol info has a parameter of type `Long`,
+ // but the IMethod parameter has type `Object`. The latter comes from the info of the
+ // symbol representing the parameter ValDef in the tree, which is incorrectly erased.
+ targetIMethod exists (m => bridge.matchesSignature(m))
+ }
+ lastCalledMethod exists hasSameSignatureAsBridge
}
/**
diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
index 1beed3f420..db56f61f16 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
@@ -40,7 +40,13 @@ abstract class DeadCodeElimination extends SubComponent {
}
/** closures that are instantiated at least once, after dead code elimination */
- val liveClosures: mutable.Set[Symbol] = new mutable.HashSet()
+ val liveClosures = perRunCaches.newSet[Symbol]()
+
+ /** closures that are eliminated, populated by GenASM.AsmPhase.run()
+ * these class symbols won't have a .class physical file, thus shouldn't be included in InnerClasses JVM attribute,
+ * otherwise some tools get confused or slow (SI-6546)
+ * */
+ val elidedClosures = perRunCaches.newSet[Symbol]()
/** Remove dead code.
*/
diff --git a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
index af82957a2e..8d12581c9c 100644
--- a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
+++ b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
@@ -202,15 +202,20 @@ trait CompilerControl { self: Global =>
postWorkItem(new AskToDoFirstItem(source))
/** If source is not yet loaded, loads it, and starts a new run, otherwise
- * continues with current pass.
- * Waits until source is fully type checked and returns body in response.
- * @param source The source file that needs to be fully typed.
- * @param response The response, which is set to the fully attributed tree of `source`.
+ * continues with current pass.
+ * Waits until source is fully type checked and returns body in response.
+ * @param source The source file that needs to be fully typed.
+ * @param keepLoaded Whether to keep that file in the PC if it was not loaded before. If
+ the file is already loaded, this flag is ignored.
+ * @param response The response, which is set to the fully attributed tree of `source`.
* If the unit corresponding to `source` has been removed in the meantime
* the a NoSuchUnitError is raised in the response.
*/
- def askLoadedTyped(source: SourceFile, response: Response[Tree]) =
- postWorkItem(new AskLoadedTypedItem(source, response))
+ def askLoadedTyped(source:SourceFile, keepLoaded: Boolean, response: Response[Tree]): Unit =
+ postWorkItem(new AskLoadedTypedItem(source, keepLoaded, response))
+
+ final def askLoadedTyped(source: SourceFile, response: Response[Tree]): Unit =
+ askLoadedTyped(source, false, response)
/** If source if not yet loaded, get an outline view with askParseEntered.
* If source is loaded, wait for it to be typechecked.
@@ -219,7 +224,7 @@ trait CompilerControl { self: Global =>
*/
def askStructure(keepSrcLoaded: Boolean)(source: SourceFile, response: Response[Tree]) = {
getUnit(source) match {
- case Some(_) => askLoadedTyped(source, response)
+ case Some(_) => askLoadedTyped(source, keepSrcLoaded, response)
case None => askParsedEntered(source, keepSrcLoaded, response)
}
}
@@ -403,8 +408,8 @@ trait CompilerControl { self: Global =>
response raise new MissingResponse
}
- case class AskLoadedTypedItem(val source: SourceFile, response: Response[Tree]) extends WorkItem {
- def apply() = self.waitLoadedTyped(source, response, this.onCompilerThread)
+ case class AskLoadedTypedItem(val source: SourceFile, keepLoaded: Boolean, response: Response[Tree]) extends WorkItem {
+ def apply() = self.waitLoadedTyped(source, response, keepLoaded, this.onCompilerThread)
override def toString = "wait loaded & typed "+source
def raiseMissing() =
diff --git a/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala b/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala
index b2568e34bd..4a61a98921 100644
--- a/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala
+++ b/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala
@@ -6,7 +6,7 @@ package scala.tools.nsc
package interactive
import scala.collection.mutable.ArrayBuffer
-import scala.reflect.internal.util.Position
+import scala.annotation.tailrec
trait ContextTrees { self: Global =>
@@ -29,44 +29,59 @@ trait ContextTrees { self: Global =>
override def toString = "ContextTree("+pos+", "+children+")"
}
- /** Optionally returns the smallest context that contains given `pos`, or None if none exists.
+ /** Returns the most precise context possible for the given `pos`.
+ *
+ * It looks for the finest ContextTree containing `pos`, and then look inside
+ * this ContextTree for a child ContextTree located immediately before `pos`.
+ * If such a child exists, returns its context, otherwise returns the context of
+ * the parent ContextTree.
+ *
+ * This is required to always return a context which contains the all the imports
+ * declared up to `pos` (see SI-7280 for a test case).
+ *
+ * Can return None if `pos` is before any valid Scala code.
*/
def locateContext(contexts: Contexts, pos: Position): Option[Context] = synchronized {
- def locateNearestContextTree(contexts: Contexts, pos: Position, recent: Array[ContextTree]): Option[ContextTree] = {
- locateContextTree(contexts, pos) match {
- case Some(x) =>
- recent(0) = x
- locateNearestContextTree(x.children, pos, recent)
- case None => recent(0) match {
- case null => None
- case x => Some(x)
- }
+ @tailrec
+ def locateFinestContextTree(context: ContextTree): ContextTree = {
+ if (context.pos includes pos) {
+ locateContextTree(context.children, pos) match {
+ case Some(x) =>
+ locateFinestContextTree(x)
+ case None =>
+ context
+ }
+ } else {
+ context
}
}
- locateNearestContextTree(contexts, pos, new Array[ContextTree](1)) map (_.context)
+ locateContextTree(contexts, pos) map locateFinestContextTree map (_.context)
}
+ /** Returns the ContextTree containing `pos`, or the ContextTree positioned just before `pos`,
+ * or None if `pos` is located before all ContextTrees.
+ */
def locateContextTree(contexts: Contexts, pos: Position): Option[ContextTree] = {
if (contexts.isEmpty) None
else {
- val hi = contexts.length - 1
- if ((contexts(hi).pos properlyPrecedes pos) || (pos properlyPrecedes contexts(0).pos)) None
- else {
- def loop(lo: Int, hi: Int): Option[ContextTree] = {
+ @tailrec
+ def loop(lo: Int, hi: Int, previousSibling: Option[ContextTree]): Option[ContextTree] = {
+ if (pos properlyPrecedes contexts(lo).pos)
+ previousSibling
+ else if (contexts(hi).pos properlyPrecedes pos)
+ Some(contexts(hi))
+ else {
val mid = (lo + hi) / 2
val midpos = contexts(mid).pos
- if ((pos precedes midpos) && (mid < hi))
- loop(lo, mid)
- else if ((midpos precedes pos) && (lo < mid))
- loop(mid, hi)
- else if (midpos includes pos)
+ if (midpos includes pos)
Some(contexts(mid))
- else if (contexts(mid+1).pos includes pos)
- Some(contexts(mid+1))
- else None
+ else if (midpos properlyPrecedes pos)
+ loop(mid + 1, hi, Some(contexts(mid)))
+ else
+ loop(lo, mid, previousSibling)
}
- loop(0, hi)
}
+ loop(0, contexts.length - 1, None)
}
}
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index 84670750d7..d6fa42b1cc 100644
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -238,7 +238,12 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
* @param result The transformed node
*/
override def signalDone(context: Context, old: Tree, result: Tree) {
- if (interruptsEnabled && analyzer.lockedCount == 0) {
+ val canObserveTree = (
+ interruptsEnabled
+ && analyzer.lockedCount == 0
+ && !context.bufferErrors // SI-7558 look away during exploratory typing in "silent mode"
+ )
+ if (canObserveTree) {
if (context.unit.exists &&
result.pos.isOpaqueRange &&
(result.pos includes context.unit.targetPos)) {
@@ -249,14 +254,16 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
}
throw new TyperResult(located)
}
- try {
- checkForMoreWork(old.pos)
- } catch {
- case ex: ValidateException => // Ignore, this will have been reported elsewhere
- debugLog("validate exception caught: "+ex)
- case ex: Throwable =>
- log.flush()
- throw ex
+ else {
+ try {
+ checkForMoreWork(old.pos)
+ } catch {
+ case ex: ValidateException => // Ignore, this will have been reported elsewhere
+ debugLog("validate exception caught: "+ex)
+ case ex: Throwable =>
+ log.flush()
+ throw ex
+ }
}
}
}
@@ -948,7 +955,11 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
val enclosing = new Members[ScopeMember]
def addScopeMember(sym: Symbol, pre: Type, viaImport: Tree) =
locals.add(sym, pre, false) { (s, st) =>
- new ScopeMember(s, st, context.isAccessible(s, pre, false), viaImport)
+ // imported val and var are always marked as inaccessible, but they could be accessed through their getters. SI-7995
+ if (s.hasGetter)
+ new ScopeMember(s, st, context.isAccessible(s.getter, pre, superAccess = false), viaImport)
+ else
+ new ScopeMember(s, st, context.isAccessible(s, pre, superAccess = false), viaImport)
}
def localsToEnclosing() = {
enclosing.addNonShadowed(locals)
@@ -999,7 +1010,13 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
val context = doLocateContext(pos)
- if (tree.tpe == null)
+ val shouldTypeQualifier = tree.tpe match {
+ case null => true
+ case mt: MethodType => mt.isImplicit
+ case _ => false
+ }
+
+ if (shouldTypeQualifier)
// TODO: guard with try/catch to deal with ill-typed qualifiers.
tree = analyzer.newTyper(context).typedQualifier(tree)
@@ -1059,7 +1076,7 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
}
/** Implements CompilerControl.askLoadedTyped */
- private[interactive] def waitLoadedTyped(source: SourceFile, response: Response[Tree], onSameThread: Boolean = true) {
+ private[interactive] def waitLoadedTyped(source: SourceFile, response: Response[Tree], keepLoaded: Boolean = false, onSameThread: Boolean = true) {
getUnit(source) match {
case Some(unit) =>
if (unit.isUpToDate) {
@@ -1077,7 +1094,10 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
case None =>
debugLog("load unit and type")
try reloadSources(List(source))
- finally waitLoadedTyped(source, response, onSameThread)
+ finally {
+ waitLoadedTyped(source, response, onSameThread)
+ if (!keepLoaded) removeUnitOf(source)
+ }
}
}
@@ -1192,4 +1212,3 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
}
object CancelException extends Exception
-
diff --git a/src/compiler/scala/tools/nsc/interactive/Picklers.scala b/src/compiler/scala/tools/nsc/interactive/Picklers.scala
index 2b389158c3..64e050e799 100644
--- a/src/compiler/scala/tools/nsc/interactive/Picklers.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Picklers.scala
@@ -172,7 +172,7 @@ trait Picklers { self: Global =>
implicit def askLoadedTypedItem: CondPickler[AskLoadedTypedItem] =
pkl[SourceFile]
- .wrapped { source => new AskLoadedTypedItem(source, new Response) } { _.source }
+ .wrapped { source => new AskLoadedTypedItem(source, false, new Response) } { _.source }
.asClass (classOf[AskLoadedTypedItem])
implicit def askParsedEnteredItem: CondPickler[AskParsedEnteredItem] =
diff --git a/src/compiler/scala/tools/nsc/interactive/REPL.scala b/src/compiler/scala/tools/nsc/interactive/REPL.scala
index 7b89d5b0aa..4b64313e1b 100644
--- a/src/compiler/scala/tools/nsc/interactive/REPL.scala
+++ b/src/compiler/scala/tools/nsc/interactive/REPL.scala
@@ -170,7 +170,7 @@ object REPL {
comp.askReload(List(toSourceFile(file)), reloadResult)
Thread.sleep(millis.toInt)
println("ask type now")
- comp.askLoadedTyped(toSourceFile(file), typedResult)
+ comp.askLoadedTyped(toSourceFile(file), keepLoaded = true, typedResult)
typedResult.get
case List("typeat", file, off1, off2) =>
doTypeAt(makePos(file, off1, off2))
diff --git a/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala b/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala
index 597b9012ce..1c722ea3a0 100644
--- a/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala
+++ b/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala
@@ -69,7 +69,7 @@ abstract class InteractiveTest
* Override this member if you need to change the default set of executed test actions.
*/
protected lazy val testActions: ListBuffer[PresentationCompilerTestDef] = {
- ListBuffer(new CompletionAction(compiler), new TypeAction(compiler), new HyperlinkAction(compiler))
+ ListBuffer(new TypeCompletionAction(compiler), new ScopeCompletionAction(compiler), new TypeAction(compiler), new HyperlinkAction(compiler))
}
/** Add new presentation compiler actions to test. Presentation compiler's test
diff --git a/src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala b/src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala
index 8d446cbbf8..d5da52bc13 100644
--- a/src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala
+++ b/src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala
@@ -42,7 +42,7 @@ trait AskParse extends AskCommand {
import compiler.Tree
/** `sources` need to be entirely parsed before running the test
- * (else commands such as `AskCompletionAt` may fail simply because
+ * (else commands such as `AskTypeCompletionAt` may fail simply because
* the source's AST is not yet loaded).
*/
def askParse(sources: Seq[SourceFile]) {
@@ -72,10 +72,10 @@ trait AskReload extends AskCommand {
}
/** Ask the presentation compiler for completion at a given position. */
-trait AskCompletionAt extends AskCommand {
+trait AskTypeCompletionAt extends AskCommand {
import compiler.Member
- private[tests] def askCompletionAt(pos: Position)(implicit reporter: Reporter): Response[List[Member]] = {
+ private[tests] def askTypeCompletionAt(pos: Position)(implicit reporter: Reporter): Response[List[Member]] = {
reporter.println("\naskTypeCompletion at " + pos.source.file.name + ((pos.line, pos.column)))
ask {
@@ -84,6 +84,19 @@ trait AskCompletionAt extends AskCommand {
}
}
+/** Ask the presentation compiler for scope completion at a given position. */
+trait AskScopeCompletionAt extends AskCommand {
+ import compiler.Member
+
+ private[tests] def askScopeCompletionAt(pos: Position)(implicit reporter: Reporter): Response[List[Member]] = {
+ reporter.println("\naskScopeCompletion at " + pos.source.file.name + ((pos.line, pos.column)))
+
+ ask {
+ compiler.askScopeCompletion(pos, _)
+ }
+ }
+}
+
/** Ask the presentation compiler for type info at a given position. */
trait AskTypeAt extends AskCommand {
import compiler.Tree
@@ -100,9 +113,9 @@ trait AskTypeAt extends AskCommand {
trait AskLoadedTyped extends AskCommand {
import compiler.Tree
- protected def askLoadedTyped(source: SourceFile)(implicit reporter: Reporter): Response[Tree] = {
+ protected def askLoadedTyped(source: SourceFile, keepLoaded: Boolean = false)(implicit reporter: Reporter): Response[Tree] = {
ask {
- compiler.askLoadedTyped(source, _)
+ compiler.askLoadedTyped(source, keepLoaded, _)
}
}
diff --git a/src/compiler/scala/tools/nsc/interactive/tests/core/CoreTestDefs.scala b/src/compiler/scala/tools/nsc/interactive/tests/core/CoreTestDefs.scala
index c8e6b6ccce..214f7a4553 100644
--- a/src/compiler/scala/tools/nsc/interactive/tests/core/CoreTestDefs.scala
+++ b/src/compiler/scala/tools/nsc/interactive/tests/core/CoreTestDefs.scala
@@ -13,19 +13,19 @@ private[tests] trait CoreTestDefs
/** Ask the presentation compiler for completion at all locations
* (in all sources) where the defined `marker` is found. */
- class CompletionAction(override val compiler: Global)
+ class TypeCompletionAction(override val compiler: Global)
extends PresentationCompilerTestDef
- with AskCompletionAt {
+ with AskTypeCompletionAt {
def memberPrinter(member: compiler.Member): String =
"[accessible: %5s] ".format(member.accessible) + "`" + (member.sym.toString() + member.tpe.toString()).trim() + "`"
override def runTest() {
- askAllSources(CompletionMarker) { pos =>
- askCompletionAt(pos)
+ askAllSources(TypeCompletionMarker) { pos =>
+ askTypeCompletionAt(pos)
} { (pos, members) =>
withResponseDelimiter {
- reporter.println("[response] aksTypeCompletion at " + format(pos))
+ reporter.println("[response] askTypeCompletion at " + format(pos))
// we skip getClass because it changed signature between 1.5 and 1.6, so there is no
// universal check file that we can provide for this to work
reporter.println("retrieved %d members".format(members.size))
@@ -38,6 +38,39 @@ private[tests] trait CoreTestDefs
}
}
+ /** Ask the presentation compiler for completion at all locations
+ * (in all sources) where the defined `marker` is found. */
+ class ScopeCompletionAction(override val compiler: Global)
+ extends PresentationCompilerTestDef
+ with AskScopeCompletionAt {
+
+ def memberPrinter(member: compiler.Member): String =
+ "[accessible: %5s] ".format(member.accessible) + "`" + (member.sym.toString() + member.tpe.toString()).trim() + "`"
+
+ override def runTest() {
+ askAllSources(ScopeCompletionMarker) { pos =>
+ askScopeCompletionAt(pos)
+ } { (pos, members) =>
+ withResponseDelimiter {
+ reporter.println("[response] askScopeCompletion at " + format(pos))
+ try {
+ // exclude members not from source (don't have position), for more focussed and self contained tests.
+ def eligible(sym: compiler.Symbol) = sym.pos != compiler.NoPosition
+ val filtered = members.filter(member => eligible(member.sym))
+ reporter.println("retrieved %d members".format(filtered.size))
+ compiler ask { () =>
+ reporter.println(filtered.map(memberPrinter).sortBy(_.toString()).mkString("\n"))
+ }
+ } catch {
+ case t: Throwable =>
+ t.printStackTrace()
+ }
+
+ }
+ }
+ }
+ }
+
/** Ask the presentation compiler for type info at all locations
* (in all sources) where the defined `marker` is found. */
class TypeAction(override val compiler: Global)
@@ -61,7 +94,7 @@ private[tests] trait CoreTestDefs
class HyperlinkAction(override val compiler: Global)
extends PresentationCompilerTestDef
with AskTypeAt
- with AskCompletionAt {
+ with AskTypeCompletionAt {
override def runTest() {
askAllSources(HyperlinkMarker) { pos =>
@@ -97,4 +130,4 @@ private[tests] trait CoreTestDefs
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/compiler/scala/tools/nsc/interactive/tests/core/TestMarker.scala b/src/compiler/scala/tools/nsc/interactive/tests/core/TestMarker.scala
index ba1722382b..8698ada4ad 100644
--- a/src/compiler/scala/tools/nsc/interactive/tests/core/TestMarker.scala
+++ b/src/compiler/scala/tools/nsc/interactive/tests/core/TestMarker.scala
@@ -20,7 +20,9 @@ abstract case class TestMarker(val marker: String) {
TestMarker.checkForDuplicate(this)
}
-object CompletionMarker extends TestMarker("/*!*/")
+object TypeCompletionMarker extends TestMarker("/*!*/")
+
+object ScopeCompletionMarker extends TestMarker("/*_*/")
object TypeMarker extends TestMarker("/*?*/")
diff --git a/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala b/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala
index 638bca8a72..59508fa951 100644
--- a/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala
@@ -7,7 +7,7 @@ package interpreter
import scala.tools.nsc.io.{ File, AbstractFile }
import util.ScalaClassLoader
-import java.net.URL
+import java.net.{ URL, URLConnection, URLStreamHandler }
import scala.collection.{ mutable, immutable }
/**
@@ -55,10 +55,24 @@ class AbstractFileClassLoader(val root: AbstractFile, parent: ClassLoader)
return file
}
+ // parent delegation in JCL uses getResource; so either add parent.getResAsStream
+ // or implement findResource, which we do here as a study in scarlet (my complexion
+ // after looking at CLs and URLs)
+ override def findResource(name: String): URL = findAbstractFile(name) match {
+ case null => null
+ case file => new URL(null, "repldir:" + file.path, new URLStreamHandler {
+ override def openConnection(url: URL): URLConnection = new URLConnection(url) {
+ override def connect() { }
+ override def getInputStream = file.input
+ }
+ })
+ }
+ // this inverts delegation order: super.getResAsStr calls parent.getRes if we fail
override def getResourceAsStream(name: String) = findAbstractFile(name) match {
case null => super.getResourceAsStream(name)
case file => file.input
}
+ // ScalaClassLoader.classBytes uses getResAsStream, so we'll try again before delegating
override def classBytes(name: String): Array[Byte] = findAbstractFile(name) match {
case null => super.classBytes(name)
case file => file.toByteArray
diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
index 6aef72a3b8..ee45dc558a 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
@@ -394,20 +394,24 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
(install map (_.parent) flatMap jarAt) orElse
(jdkDir flatMap deeply)
}
- private def addToolsJarToLoader() = {
- val cl = platformTools match {
- case Some(tools) => ScalaClassLoader.fromURLs(Seq(tools.toURL), intp.classLoader)
- case _ => intp.classLoader
- }
- if (Javap.isAvailable(cl)) {
- repldbg(":javap available.")
- cl
- }
- else {
- repldbg(":javap unavailable: no tools.jar at " + jdkHome)
+ private def addToolsJarToLoader() = (
+ if (Javap isAvailable intp.classLoader) {
+ repldbg(":javap available on interpreter class path.")
intp.classLoader
+ } else {
+ val cl = platformTools match {
+ case Some(tools) => ScalaClassLoader.fromURLs(Seq(tools.toURL), intp.classLoader)
+ case _ => intp.classLoader
+ }
+ if (Javap isAvailable cl) {
+ repldbg(":javap available on extended class path.")
+ cl
+ } else {
+ repldbg(s":javap unavailable: no tools.jar at $jdkHome")
+ intp.classLoader
+ }
}
- }
+ )
protected def newJavap() = new JavapClass(addToolsJarToLoader(), new IMain.ReplStrippingWriter(intp)) {
override def tryClass(path: String): Array[Byte] = {
diff --git a/src/compiler/scala/tools/nsc/symtab/BrowsingLoaders.scala b/src/compiler/scala/tools/nsc/symtab/BrowsingLoaders.scala
index f2aab36b51..c7bd678385 100644
--- a/src/compiler/scala/tools/nsc/symtab/BrowsingLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/BrowsingLoaders.scala
@@ -64,8 +64,10 @@ abstract class BrowsingLoaders extends SymbolLoaders {
addPackagePrefix(pre)
packagePrefix += ("." + name)
case Ident(name) =>
- if (packagePrefix.length != 0) packagePrefix += "."
- packagePrefix += name
+ if (name != nme.EMPTY_PACKAGE_NAME) { // mirrors logic in Namers, see createPackageSymbol
+ if (packagePrefix.length != 0) packagePrefix += "."
+ packagePrefix += name
+ }
case _ =>
throw new MalformedInput(pkg.pos.point, "illegal tree node in package prefix: "+pkg)
}
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
index c304c18c4f..d0c540a2c6 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
@@ -489,23 +489,28 @@ abstract class ICodeReader extends ClassfileParser {
case JVM.invokevirtual =>
val m = pool.getMemberSymbol(in.nextChar, false); size += 2
code.emit(CALL_METHOD(m, Dynamic))
+ method.updateRecursive(m)
case JVM.invokeinterface =>
val m = pool.getMemberSymbol(in.nextChar, false); size += 4
in.skip(2)
code.emit(CALL_METHOD(m, Dynamic))
+ // invokeinterface can't be recursive
case JVM.invokespecial =>
val m = pool.getMemberSymbol(in.nextChar, false); size += 2
val style = if (m.name == nme.CONSTRUCTOR || m.isPrivate) Static(true)
else SuperCall(m.owner.name);
code.emit(CALL_METHOD(m, style))
+ method.updateRecursive(m)
case JVM.invokestatic =>
val m = pool.getMemberSymbol(in.nextChar, true); size += 2
if (isBox(m))
code.emit(BOX(toTypeKind(m.info.paramTypes.head)))
else if (isUnbox(m))
code.emit(UNBOX(toTypeKind(m.info.resultType)))
- else
+ else {
code.emit(CALL_METHOD(m, Static(false)))
+ method.updateRecursive(m)
+ }
case JVM.invokedynamic =>
// TODO, this is just a place holder. A real implementation must parse the class constant entry
debuglog("Found JVM invokedynamic instructionm, inserting place holder ICode INVOKE_DYNAMIC.")
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 76249974ac..df220b7381 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -895,6 +895,9 @@ abstract class Erasure extends AddInterfaces
* but their erased types are the same.
*/
private def checkNoDoubleDefs(root: Symbol) {
+ def sameTypeAfterErasure(sym1: Symbol, sym2: Symbol) =
+ afterPostErasure(sym1.info =:= sym2.info) && !sym1.isMacro && !sym2.isMacro
+
def doubleDefError(sym1: Symbol, sym2: Symbol) {
// the .toString must also be computed at the earlier phase
val tpe1 = afterRefchecks(root.thisType.memberType(sym1))
@@ -915,12 +918,25 @@ abstract class Erasure extends AddInterfaces
}
val decls = root.info.decls
+
+ // SI-8010 force infos, otherwise makeNotPrivate in ExplicitOuter info transformer can trigger
+ // a scope rehash while were iterating and we can see the same entry twice!
+ // Inspection of SymbolPairs (the basis of OverridingPairs), suggests that it is immune
+ // from this sort of bug as it copies the symbols into a temporary scope *before* any calls to `.info`,
+ // ie, no variant of it calls `info` or `tpe` in `SymbolPair#exclude`.
+ //
+ // Why not just create a temporary scope here? We need to force the name changes in any case before
+ // we do these checks, so that we're comparing same-named methods based on the expanded names that actually
+ // end up in the bytecode.
+ afterPostErasure(decls.foreach(_.info))
+
var e = decls.elems
while (e ne null) {
if (e.sym.isTerm) {
var e1 = decls.lookupNextEntry(e)
while (e1 ne null) {
- if (afterPostErasure(e1.sym.info =:= e.sym.info)) doubleDefError(e.sym, e1.sym)
+ assert(e.sym ne e1.sym, s"Internal error: encountered ${e.sym.debugLocationString} twice during scope traversal. This might be related to SI-8010.")
+ if (sameTypeAfterErasure(e1.sym, e.sym)) doubleDefError(e.sym, e1.sym)
e1 = decls.lookupNextEntry(e1)
}
}
@@ -939,7 +955,8 @@ abstract class Erasure extends AddInterfaces
while (opc.hasNext) {
if (!afterRefchecks(
root.thisType.memberType(opc.overriding) matches
- root.thisType.memberType(opc.overridden))) {
+ root.thisType.memberType(opc.overridden)) &&
+ sameTypeAfterErasure(opc.overriding, opc.overridden)) {
debuglog("" + opc.overriding.locationString + " " +
opc.overriding.infosString +
opc.overridden.locationString + " " +
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 430129aaff..e61b35a621 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -878,11 +878,13 @@ abstract class UnCurry extends InfoTransform
case Packed(param, tempVal) => (param, tempVal)
}.unzip
- val rhs1 = localTyper.typedPos(rhs.pos) {
- // Patch the method body to refer to the temp vals
- val rhsSubstituted = rhs.substituteSymbols(packedParams map (_.symbol), tempVals map (_.symbol))
- // The new method body: { val p$1 = p.asInstanceOf[<dependent type>]; ...; <rhsSubstituted> }
- Block(tempVals, rhsSubstituted)
+ val rhs1 = if (tempVals.isEmpty) rhs else {
+ localTyper.typedPos(rhs.pos) {
+ // Patch the method body to refer to the temp vals
+ val rhsSubstituted = rhs.substituteSymbols(packedParams map (_.symbol), tempVals map (_.symbol))
+ // The new method body: { val p$1 = p.asInstanceOf[<dependent type>]; ...; <rhsSubstituted> }
+ Block(tempVals, rhsSubstituted)
+ }
}
(allParams :: Nil, rhs1)
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index 5d6d094b44..a7b0e47214 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -1294,7 +1294,7 @@ trait ContextErrors {
private def compatibilityError(message: String) =
implRefError(
- "macro implementation has wrong shape:"+
+ "macro implementation has incompatible shape:"+
"\n required: " + showMeth(rparamss, rret, abbreviate = true) +
"\n found : " + showMeth(aparamss, aret, abbreviate = false) +
"\n" + message)
@@ -1328,7 +1328,11 @@ trait ContextErrors {
def MacroImplOverloadedError() = implRefError("macro implementation cannot be overloaded")
- def MacroImplWrongNumberOfTypeArgumentsError(macroImplRef: Tree) = implRefError(typer.TyperErrorGen.TypedApplyWrongNumberOfTpeParametersErrorMessage(macroImplRef))
+ def MacroImplWrongNumberOfTypeArgumentsError(macroImplRef: Tree) = {
+ val MacroImplReference(owner, meth, targs) = macroImplRef
+ val diagnostic = if (meth.typeParams.length > targs.length) "has too few type arguments" else "has too many arguments"
+ implRefError(s"macro implementation reference $diagnostic for " + treeSymTypeMsg(macroImplRef))
+ }
def MacroImplNotStaticError() = implRefError("macro implementation must be in statically accessible object")
@@ -1336,7 +1340,7 @@ trait ContextErrors {
// aXXX (e.g. aparams) => characteristics of the macro impl ("a" stands for "actual")
// rXXX (e.g. rparams) => characteristics of a reference macro impl signature synthesized from the macro def ("r" stands for "reference")
- def MacroImplNonTagImplicitParameters(params: List[Symbol]) = compatibilityError("macro implementations cannot have implicit parameters other than WeakTypeTag evidences")
+ def MacroImplNonTagImplicitParameters(params: List[Symbol]) = implRefError("macro implementations cannot have implicit parameters other than WeakTypeTag evidences")
def MacroImplParamssMismatchError() = compatibilityError("number of parameter sections differ")
diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
index aafff8a48e..70f2f41ec7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
@@ -164,7 +164,7 @@ trait NamesDefaults { self: Analyzer =>
// never used for constructor calls, they always have a stable qualifier
def blockWithQualifier(qual: Tree, selected: Name) = {
- val sym = blockTyper.context.owner.newValue(unit.freshTermName("qual$"), qual.pos) setInfo uncheckedBounds(qual.tpe)
+ val sym = blockTyper.context.owner.newValue(unit.freshTermName("qual$"), qual.pos) setInfo uncheckedBounds(qual.tpe) setPos (qual.pos.makeTransparent)
blockTyper.context.scope enter sym
val vd = atPos(sym.pos)(ValDef(sym, qual) setType NoType)
// it stays in Vegas: SI-5720, SI-5727
@@ -175,13 +175,16 @@ trait NamesDefaults { self: Analyzer =>
// setSymbol below is important because the 'selected' function might be overloaded. by
// assigning the correct method symbol, typedSelect will just assign the type. the reason
// to still call 'typed' is to correctly infer singleton types, SI-5259.
- val f = blockTyper.typedOperator(Select(newQual, selected).setSymbol(baseFun1.symbol))
+ val selectPos =
+ if(qual.pos.isRange && baseFun.pos.isRange) qual.pos.union(baseFun.pos).withStart(Math.min(qual.pos.end, baseFun.pos.end))
+ else baseFun.pos
+ val f = blockTyper.typedOperator(Select(newQual, selected).setSymbol(baseFun1.symbol).setPos(selectPos))
if (funTargs.isEmpty) f
else TypeApply(f, funTargs).setType(baseFun.tpe)
}
val b = Block(List(vd), baseFunTransformed)
- .setType(baseFunTransformed.tpe).setPos(baseFun.pos)
+ .setType(baseFunTransformed.tpe).setPos(baseFun.pos.makeTransparent)
context.namedApplyBlockInfo =
Some((b, NamedApplyInfo(Some(newQual), defaultTargs, Nil, blockTyper)))
b
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 83afb3a728..fea234dd14 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -909,11 +909,13 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
// case DeBruijnIndex(_, _) =>
case SingleType(pre, sym) =>
validateVariance(pre, variance)
+ case TypeRef(_, sym, _) if sym.isAliasType =>
+ // okay to ignore pre/args here. In 2.10.3 we used to check them in addition to checking
+ // the normalized type, which led to exponential time type checking, see pos/t8152-performance.scala
+ validateVariance(tp.normalize, variance)
case TypeRef(pre, sym, args) =>
// println("validate "+sym+" at "+relativeVariance(sym))
- if (sym.isAliasType/* && relativeVariance(sym) == AnyVariance*/)
- validateVariance(tp.normalize, variance)
- else if (sym.variance != NoVariance) {
+ if (sym.variance != NoVariance) {
val v = relativeVariance(sym)
if (v != AnyVariance && sym.variance != v * variance) {
//Console.println("relativeVariance(" + base + "," + sym + ") = " + v);//DEBUG
@@ -1515,7 +1517,11 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
private def checkTypeRef(tp: Type, tree: Tree, skipBounds: Boolean) = tp match {
case TypeRef(pre, sym, args) =>
- checkDeprecated(sym, tree.pos)
+ tree match {
+ case tt: TypeTree if tt.original == null => // SI-7783 don't warn about inferred types
+ case _ =>
+ checkDeprecated(sym, tree.pos)
+ }
if(sym.isJavaDefined)
sym.typeParams foreach (_.cookJavaRawInfo())
if (!tp.isHigherKinded && !skipBounds)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index e27f540a7d..e09a509839 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -876,8 +876,9 @@ trait Typers extends Modes with Adaptations with Tags {
case SilentResultValue(result) =>
result
case _ =>
- debuglog("fallback on implicits: " + tree + "/" + resetAllAttrs(original))
- val tree1 = typed(resetAllAttrs(original), mode, WildcardType)
+ val resetTree = resetLocalAttrs(original)
+ debuglog(s"fallback on implicits: ${tree}/$resetTree")
+ val tree1 = typed(resetTree, mode, WildcardType)
// Q: `typed` already calls `pluginsTyped` and `adapt`. the only difference here is that
// we pass `EmptyTree` as the `original`. intended? added in 2009 (53d98e7d42) by martin.
tree1.tpe = pluginsTyped(tree1.tpe, this, tree1, mode, pt)
@@ -3268,6 +3269,28 @@ trait Typers extends Modes with Adaptations with Tags {
// calls to the default getters. Example:
// foo[Int](a)() ==> foo[Int](a)(b = foo$qual.foo$default$2[Int](a))
checkNotMacro()
+
+ // SI-8111 transformNamedApplication eagerly shuffles around the application to preserve
+ // evaluation order. During this process, it calls `changeOwner` on symbols that
+ // are transplanted underneath synthetic temporary vals.
+ //
+ // Here, we keep track of the symbols owned by `context.owner` to enable us to
+ // rollback, so that we don't end up with "orphaned" symbols.
+ //
+ // TODO: Find a better way!
+ //
+ // Note that duplicating trees would not be enough to fix this problem, we would also need to
+ // clone local symbols in the duplicated tree to truly isolate things (in the spirit of BodyDuplicator),
+ // or, better yet, disentangle the logic in `transformNamedApplication` so that we could
+ // determine whether names/defaults is viable *before* transforming trees.
+ def ownerOf(sym: Symbol) = if (sym == null || sym == NoSymbol) NoSymbol else sym.owner
+ val symsOwnedByContextOwner = tree.collect {
+ case t @ (_: DefTree | _: Function) if ownerOf(t.symbol) == context.owner => t.symbol
+ }
+ def rollbackNamesDefaultsOwnerChanges() {
+ symsOwnedByContextOwner foreach (_.owner = context.owner)
+ }
+
val fun1 = transformNamedApplication(Typer.this, mode, pt)(fun, x => x)
if (fun1.isErroneous) duplErrTree
else {
@@ -3296,6 +3319,7 @@ trait Typers extends Modes with Adaptations with Tags {
if (!(context.diagnostic contains note)) context.diagnostic = note :: context.diagnostic
doTypedApply(tree, if (blockIsEmpty) fun else fun1, allArgs, mode, pt)
} else {
+ rollbackNamesDefaultsOwnerChanges()
tryTupleApply getOrElse duplErrorTree(NotEnoughArgsError(tree, fun, missing))
}
}
@@ -3825,7 +3849,7 @@ trait Typers extends Modes with Adaptations with Tags {
val normalizeLocals = new TypeMap {
def apply(tp: Type): Type = tp match {
case TypeRef(pre, sym, args) =>
- if (sym.isAliasType && containsLocal(tp)) apply(tp.dealias)
+ if (sym.isAliasType && containsLocal(tp) && (tp.dealias ne tp)) apply(tp.dealias)
else {
if (pre.isVolatile)
InferTypeWithVolatileTypeSelectionError(tree, pre)
@@ -3998,9 +4022,14 @@ trait Typers extends Modes with Adaptations with Tags {
def typedNamedApply(orig: Tree, fun: Tree, args: List[Tree], mode: Int, pt: Type): Tree = {
def argToBinding(arg: Tree): Tree = arg match {
- case AssignOrNamedArg(Ident(name), rhs) => gen.mkTuple(List(CODE.LIT(name.toString), rhs))
- case _ => gen.mkTuple(List(CODE.LIT(""), arg))
+ case AssignOrNamedArg(i @ Ident(name), rhs) =>
+ atPos(i.pos.withEnd(rhs.pos.endOrPoint)) {
+ gen.mkTuple(List(atPos(i.pos)(CODE.LIT(name.toString)), rhs))
+ }
+ case _ =>
+ gen.mkTuple(List(CODE.LIT(""), arg))
}
+
val t = treeCopy.Apply(orig, fun, args map argToBinding)
wrapErrors(t, _.typed(t, mode, pt))
}
@@ -4060,7 +4089,10 @@ trait Typers extends Modes with Adaptations with Tags {
case Some((opName, treeInfo.Applied(_, targs, _))) =>
val fun = gen.mkTypeApply(Select(qual, opName), targs)
if (opName == nme.updateDynamic) suppressMacroExpansion(fun) // SI-7617
- atPos(qual.pos)(Apply(fun, Literal(Constant(name.decode)) :: Nil))
+ val nameStringLit = atPos(treeSelection.pos.withStart(treeSelection.pos.point).makeTransparent) {
+ Literal(Constant(name.decode))
+ }
+ atPos(qual.pos)(Apply(fun, List(nameStringLit)))
case _ =>
setError(tree)
}
@@ -4264,7 +4296,9 @@ trait Typers extends Modes with Adaptations with Tags {
}
else if(dyna.isDynamicallyUpdatable(lhs1)) {
val rhs1 = typed(rhs, EXPRmode | BYVALmode, WildcardType)
- val t = Apply(lhs1, List(rhs1))
+ val t = atPos(lhs1.pos.withEnd(rhs1.pos.endOrPoint)) {
+ Apply(lhs1, List(rhs1))
+ }
dyna.wrapErrors(t, _.typed1(t, mode, pt))
}
else fail()
diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
index b9541ece5d..8803980dac 100644
--- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
+++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
@@ -16,6 +16,7 @@ import scala.compat.Platform.EOL
import scala.reflect.NameTransformer
import scala.reflect.api.JavaUniverse
import scala.reflect.io.NoAbstractFile
+import scala.tools.nsc.interactive.RangePositions
abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf =>
@@ -329,8 +330,12 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf =>
try {
val errorFn: String => Unit = msg => frontEnd.log(scala.reflect.internal.util.NoPosition, msg, frontEnd.ERROR)
val command = new CompilerCommand(arguments.toList, errorFn)
- command.settings.outputDirs setSingleOutput virtualDirectory
- val instance = new ToolBoxGlobal(command.settings, frontEndToReporter(frontEnd, command.settings))
+ val settings = command.settings
+ settings.outputDirs setSingleOutput virtualDirectory
+ val reporter = frontEndToReporter(frontEnd, command.settings)
+ val instance =
+ if (settings.Yrangepos.value) new ToolBoxGlobal(settings, reporter) with RangePositions
+ else new ToolBoxGlobal(settings, reporter)
if (frontEnd.hasErrors) {
var msg = "reflective compilation has failed: cannot initialize the compiler: " + EOL + EOL
msg += frontEnd.infos map (_.msg) mkString EOL
diff --git a/src/library/scala/MatchError.scala b/src/library/scala/MatchError.scala
index 6ba7e833d3..9965bb19b5 100644
--- a/src/library/scala/MatchError.scala
+++ b/src/library/scala/MatchError.scala
@@ -23,9 +23,15 @@ final class MatchError(obj: Any) extends RuntimeException {
/** There's no reason we need to call toString eagerly,
* so defer it until getMessage is called.
*/
- private lazy val objString =
+ private lazy val objString = {
+ def ofClass = "of class " + obj.getClass.getName
if (obj == null) "null"
- else obj.toString() + " (of class " + obj.getClass.getName + ")"
+ else try {
+ obj.toString() + " (" + ofClass + ")"
+ } catch {
+ case _: Throwable => "an instance " + ofClass
+ }
+ }
override def getMessage() = objString
}
diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala
index 5f193eb211..8b430ca3d2 100644
--- a/src/library/scala/collection/TraversableLike.scala
+++ b/src/library/scala/collection/TraversableLike.scala
@@ -77,7 +77,7 @@ trait TraversableLike[+A, +Repr] extends Any
import Traversable.breaks._
/** The type implementing this traversable */
- protected type Self = Repr
+ protected[this] type Self = Repr
/** The collection of type $coll underlying this `TraversableLike` object.
* By default this is implemented as the `TraversableLike` object itself,
diff --git a/src/library/scala/collection/generic/GenericClassTagCompanion.scala b/src/library/scala/collection/generic/GenericClassTagCompanion.scala
index a587bbf544..76c12d118e 100644
--- a/src/library/scala/collection/generic/GenericClassTagCompanion.scala
+++ b/src/library/scala/collection/generic/GenericClassTagCompanion.scala
@@ -19,7 +19,7 @@ import scala.reflect.ClassTag
* @author Aleksandar Prokopec
*/
abstract class GenericClassTagCompanion[+CC[X] <: Traversable[X]] {
- type Coll = CC[_]
+ protected[this] type Coll = CC[_]
def newBuilder[A](implicit ord: ClassTag[A]): Builder[A, CC[A]]
diff --git a/src/library/scala/collection/generic/GenericCompanion.scala b/src/library/scala/collection/generic/GenericCompanion.scala
index 5b03f8e5c6..b966ce51db 100644
--- a/src/library/scala/collection/generic/GenericCompanion.scala
+++ b/src/library/scala/collection/generic/GenericCompanion.scala
@@ -24,7 +24,7 @@ import scala.language.higherKinds
*/
abstract class GenericCompanion[+CC[X] <: GenTraversable[X]] {
/** The underlying collection type with unknown element type */
- type Coll = CC[_]
+ protected[this] type Coll = CC[_]
/** The default builder for `$Coll` objects.
* @tparam A the type of the ${coll}'s elements
diff --git a/src/library/scala/collection/generic/GenericOrderedCompanion.scala b/src/library/scala/collection/generic/GenericOrderedCompanion.scala
index a9a50a1c35..094912c75a 100644
--- a/src/library/scala/collection/generic/GenericOrderedCompanion.scala
+++ b/src/library/scala/collection/generic/GenericOrderedCompanion.scala
@@ -19,7 +19,7 @@ import scala.language.higherKinds
* @since 2.8
*/
abstract class GenericOrderedCompanion[+CC[X] <: Traversable[X]] {
- type Coll = CC[_]
+ protected[this] type Coll = CC[_]
def newBuilder[A](implicit ord: Ordering[A]): Builder[A, CC[A]]
diff --git a/src/library/scala/collection/immutable/TrieIterator.scala b/src/library/scala/collection/immutable/TrieIterator.scala
index ae427852d4..b0bd253359 100644
--- a/src/library/scala/collection/immutable/TrieIterator.scala
+++ b/src/library/scala/collection/immutable/TrieIterator.scala
@@ -46,7 +46,7 @@ private[collection] abstract class TrieIterator[+T](elems: Array[Iterable[T]]) e
case x: HashSetCollision1[_] => x.ks.map(x => HashSet(x)).toArray
}).asInstanceOf[Array[Iterable[T]]]
- private type SplitIterators = ((Iterator[T], Int), Iterator[T])
+ private[this] type SplitIterators = ((Iterator[T], Int), Iterator[T])
private def isTrie(x: AnyRef) = x match {
case _: HashTrieMap[_,_] | _: HashTrieSet[_] => true
diff --git a/src/library/scala/collection/parallel/ParSeqLike.scala b/src/library/scala/collection/parallel/ParSeqLike.scala
index 201b624c72..da9abfcf5c 100644
--- a/src/library/scala/collection/parallel/ParSeqLike.scala
+++ b/src/library/scala/collection/parallel/ParSeqLike.scala
@@ -45,7 +45,7 @@ extends scala.collection.GenSeqLike[T, Repr]
with ParIterableLike[T, Repr, Sequential] {
self =>
- type SuperParIterator = IterableSplitter[T]
+ protected[this] type SuperParIterator = IterableSplitter[T]
/** A more refined version of the iterator found in the `ParallelIterable` trait,
* this iterator can be split into arbitrary subsets of iterators.
diff --git a/src/library/scala/concurrent/ExecutionContext.scala b/src/library/scala/concurrent/ExecutionContext.scala
index 8928724b34..b4af161c3c 100644
--- a/src/library/scala/concurrent/ExecutionContext.scala
+++ b/src/library/scala/concurrent/ExecutionContext.scala
@@ -16,7 +16,7 @@ import scala.util.Try
/**
* An `ExecutionContext` is an abstraction over an entity that can execute program logic.
*/
-@implicitNotFound("Cannot find an implicit ExecutionContext, either require one yourself or import ExecutionContext.Implicits.global")
+@implicitNotFound("Cannot find an implicit ExecutionContext, either import scala.concurrent.ExecutionContext.Implicits.global or use a custom one")
trait ExecutionContext {
/** Runs a block of code on this execution context.
diff --git a/src/library/scala/concurrent/Future.scala b/src/library/scala/concurrent/Future.scala
index 39946e4472..b2c09ec53e 100644
--- a/src/library/scala/concurrent/Future.scala
+++ b/src/library/scala/concurrent/Future.scala
@@ -384,7 +384,10 @@ trait Future[+T] extends Awaitable[T] {
val p = Promise[U]()
onComplete {
case s @ Success(_) => p complete s
- case _ => p completeWith that
+ case f @ Failure(_) => that onComplete {
+ case s2 @ Success(_) => p complete s2
+ case _ => p complete f // Use the first failure as the failure
+ }
}
p.future
}
diff --git a/src/reflect/scala/reflect/api/Universe.scala b/src/reflect/scala/reflect/api/Universe.scala
index 4928b8bb38..15fa11c6cf 100644
--- a/src/reflect/scala/reflect/api/Universe.scala
+++ b/src/reflect/scala/reflect/api/Universe.scala
@@ -75,14 +75,14 @@ abstract class Universe extends Symbols
with Printers
with Importers
{
- /** Use `refiy` to produce the abstract syntax tree representing a given Scala expression.
+ /** Use `reify` to produce the abstract syntax tree representing a given Scala expression.
*
* For example:
*
* {{{
- * val five = reify{ 5 } // Literal(Constant(5))
- * reify{ 2 + 4 } // Apply( Select( Literal(Constant(2)), newTermName("\$plus")), List( Literal(Constant(4)) ) )
- * reify{ five.splice + 4 } // Apply( Select( Literal(Constant(5)), newTermName("\$plus")), List( Literal(Constant(4)) ) )
+ * val five = reify{ 5 } // Literal(Constant(5))
+ * reify{ 5.toString } // Apply(Select(Literal(Constant(5)), TermName("toString")), List())
+ * reify{ five.splice.toString } // Apply(Select(five, TermName("toString")), List())
* }}}
*
* The produced tree is path dependent on the Universe `reify` was called from.
@@ -93,4 +93,4 @@ abstract class Universe extends Symbols
// implementation is hardwired to `scala.reflect.reify.Taggers`
// using the mechanism implemented in `scala.tools.reflect.FastTrack`
def reify[T](expr: T): Expr[T] = ??? // macro
-} \ No newline at end of file
+}
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 45c16b7302..579f7684fd 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -709,7 +709,9 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
final def isMonomorphicType =
isType && {
val info = originalInfo
- info.isComplete && !info.isHigherKinded
+ ( (info eq null)
+ || (info.isComplete && !info.isHigherKinded)
+ )
}
def isStrictFP = hasAnnotation(ScalaStrictFPAttr) || (enclClass hasAnnotation ScalaStrictFPAttr)
@@ -1282,6 +1284,13 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
def hasRawInfo: Boolean = infos ne null
def hasCompleteInfo = hasRawInfo && rawInfo.isComplete
+ // does not run adaptToNewRun, which is prone to trigger cycles (SI-8029)
+ // TODO: give this a better name if you understand the intent of the caller.
+ // Is it something to do with `reallyExists` or `isStale`?
+ final def rawInfoIsNoType: Boolean = {
+ hasRawInfo && (infos.info eq NoType)
+ }
+
/** Return info without checking for initialization or completing */
def rawInfo: Type = {
var infos = this.infos
@@ -1928,7 +1937,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
/** Is this symbol defined in the same scope and compilation unit as `that` symbol? */
def isCoDefinedWith(that: Symbol) = (
- (this.rawInfo ne NoType)
+ !rawInfoIsNoType
&& (this.effectiveOwner == that.effectiveOwner)
&& ( !this.effectiveOwner.isPackageClass
|| (this.sourceFile eq null)
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index cfa6f927b5..2f49995030 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -2626,7 +2626,7 @@ trait Types extends api.Types { self: SymbolTable =>
private var isdepmeth: ThreeValue = UNKNOWN
override def isDependentMethodType: Boolean = {
- if (isdepmeth == UNKNOWN) isdepmeth = fromBoolean(IsDependentCollector.collect(resultType))
+ if (isdepmeth == UNKNOWN) isdepmeth = fromBoolean(IsDependentCollector.collect(resultType.dealias))
toBoolean(isdepmeth)
}
@@ -4807,7 +4807,7 @@ trait Types extends api.Types { self: SymbolTable =>
object IsDependentCollector extends TypeCollector(false) {
def traverse(tp: Type) {
if (tp.isImmediatelyDependent) result = true
- else if (!result) mapOver(tp)
+ else if (!result) mapOver(tp.dealias)
}
}
@@ -5230,30 +5230,15 @@ trait Types extends api.Types { self: SymbolTable =>
}
}
- class SubTypePair(val tp1: Type, val tp2: Type) {
- override def hashCode = tp1.hashCode * 41 + tp2.hashCode
- override def equals(other: Any) = other match {
- case stp: SubTypePair =>
- // suspend TypeVars in types compared by =:=,
- // since we don't want to mutate them simply to check whether a subtype test is pending
- // in addition to making subtyping "more correct" for type vars,
- // it should avoid the stackoverflow that's been plaguing us (https://groups.google.com/d/topic/scala-internals/2gHzNjtB4xA/discussion)
- // this method is only called when subtyping hits a recursion threshold (subsametypeRecursions >= LogPendingSubTypesThreshold)
- def suspend(tp: Type) =
- if (tp.isGround) null else suspendTypeVarsInType(tp)
- def revive(suspension: List[TypeVar]) =
- if (suspension ne null) suspension foreach (_.suspended = false)
-
- val suspensions = Array(tp1, stp.tp1, tp2, stp.tp2) map suspend
-
- val sameTypes = (tp1 =:= stp.tp1) && (tp2 =:= stp.tp2)
-
- suspensions foreach revive
+ final case class SubTypePair(tp1: Type, tp2: Type) {
+ // SI-8146 we used to implement equality here in terms of pairwise =:=.
+ // But, this was inconsistent with hashCode, which was based on the
+ // Type#hashCode, based on the structure of types, not the meaning.
+ // Now, we use `Type#{equals,hashCode}` as the (consistent) basis for
+ // detecting cycles (aka keeping subtyping decidable.)
+ //
+ // I added tests to show that we detect the cycle: neg/t8146-no-finitary*
- sameTypes
- case _ =>
- false
- }
override def toString = tp1+" <:<? "+tp2
}
@@ -5819,7 +5804,7 @@ trait Types extends api.Types { self: SymbolTable =>
if (subsametypeRecursions >= LogPendingSubTypesThreshold) {
val p = new SubTypePair(tp1, tp2)
if (pendingSubTypes(p))
- false
+ false // see neg/t8146-no-finitary*
else
try {
pendingSubTypes += p
diff --git a/src/swing/scala/swing/Publisher.scala b/src/swing/scala/swing/Publisher.scala
index 96207de808..578ef71e09 100644
--- a/src/swing/scala/swing/Publisher.scala
+++ b/src/swing/scala/swing/Publisher.scala
@@ -44,7 +44,7 @@ trait Publisher extends Reactor {
/**
* Notify all registered reactions.
*/
- def publish(e: Event) { for (l <- listeners) l(e) }
+ def publish(e: Event) { for (l <- listeners) if (l.isDefinedAt(e)) l(e) }
listenTo(this)
}
diff --git a/starr.number b/starr.number
index 7e6e869eaf..8f1f615fd2 100644
--- a/starr.number
+++ b/starr.number
@@ -1 +1,2 @@
-starr.version=2.10.1 \ No newline at end of file
+starr.version=2.10.3
+starr.use.released=1 \ No newline at end of file
diff --git a/test/files/presentation/doc.check b/test/disabled/presentation/doc.check
index 5a3ff13151..5a3ff13151 100644
--- a/test/files/presentation/doc.check
+++ b/test/disabled/presentation/doc.check
diff --git a/test/files/presentation/doc/doc.scala b/test/disabled/presentation/doc/doc.scala
index 371b825026..371b825026 100755
--- a/test/files/presentation/doc/doc.scala
+++ b/test/disabled/presentation/doc/doc.scala
diff --git a/test/files/presentation/doc/src/Class.scala b/test/disabled/presentation/doc/src/Class.scala
index a974bd6f5c..a974bd6f5c 100755
--- a/test/files/presentation/doc/src/Class.scala
+++ b/test/disabled/presentation/doc/src/Class.scala
diff --git a/test/files/presentation/doc/src/p/Base.scala b/test/disabled/presentation/doc/src/p/Base.scala
index 9031de3e3e..9031de3e3e 100755
--- a/test/files/presentation/doc/src/p/Base.scala
+++ b/test/disabled/presentation/doc/src/p/Base.scala
diff --git a/test/files/presentation/doc/src/p/Derived.scala b/test/disabled/presentation/doc/src/p/Derived.scala
index 1a9c9a26d1..1a9c9a26d1 100755
--- a/test/files/presentation/doc/src/p/Derived.scala
+++ b/test/disabled/presentation/doc/src/p/Derived.scala
diff --git a/test/disabled/run/t6026.check b/test/disabled/run/t6026.check
new file mode 100644
index 0000000000..779bb3ace5
--- /dev/null
+++ b/test/disabled/run/t6026.check
@@ -0,0 +1,9 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> class Foo
+defined class Foo
+
+scala> :javap Foo
+Compiled from "<console>"public class Foo extends java.lang.Object{ public Foo();}
+scala>
diff --git a/test/disabled/run/t6026.scala b/test/disabled/run/t6026.scala
new file mode 100644
index 0000000000..bee27bc72a
--- /dev/null
+++ b/test/disabled/run/t6026.scala
@@ -0,0 +1,9 @@
+
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ override def code =
+"""|class Foo
+ |:javap Foo
+ |""".stripMargin
+}
diff --git a/test/files/android/HelloAndroid.scala b/test/files/android/HelloAndroid.scala
deleted file mode 100644
index 9fd145a4f1..0000000000
--- a/test/files/android/HelloAndroid.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-//package examples.hello3
-
-import android.app.Activity
-import android.os.Bundle
-import android.widget.TextView
-
-//class HelloAndroid extends Activity {
-class Test extends Activity {
- /** Called when the activity is first created. */
- override def onCreate(icicle: Bundle) {
- super.onCreate(icicle)
- val tv = new TextView(this)
- tv setText "Hello, Android (Scala)"
- setContentView(tv)
- }
-}
diff --git a/test/files/android/HelloAndroid.xml b/test/files/android/HelloAndroid.xml
deleted file mode 100644
index 41907b16a3..0000000000
--- a/test/files/android/HelloAndroid.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="">
- <application>
- <activity class="HelloAndroid" android:label="HelloAndroid">
- <intent-filter>
- <action android:value="android.intent.action.MAIN" />
- <category android:value="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/test/files/neg/t7020.check b/test/files/disabled/t7020.check
index a869b12363..a869b12363 100644
--- a/test/files/neg/t7020.check
+++ b/test/files/disabled/t7020.check
diff --git a/test/files/neg/t7020.flags b/test/files/disabled/t7020.flags
index e8fb65d50c..e8fb65d50c 100644
--- a/test/files/neg/t7020.flags
+++ b/test/files/disabled/t7020.flags
diff --git a/test/files/neg/t7020.scala b/test/files/disabled/t7020.scala
index cc5421bab1..cc5421bab1 100644
--- a/test/files/neg/t7020.scala
+++ b/test/files/disabled/t7020.scala
diff --git a/test/files/jvm/future-spec/PromiseTests.scala b/test/files/jvm/future-spec/PromiseTests.scala
index 8e07393900..48f94666ba 100644
--- a/test/files/jvm/future-spec/PromiseTests.scala
+++ b/test/files/jvm/future-spec/PromiseTests.scala
@@ -38,10 +38,10 @@ object PromiseTests extends MinimalScalaTest {
Await.result(failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout")
Await.result(timedOut fallbackTo empty, defaultTimeout) mustBe ("Timedout")
- Await.result(failure fallbackTo failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout")
+ Await.result(otherFailure fallbackTo failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout")
intercept[RuntimeException] {
Await.result(failure fallbackTo otherFailure, defaultTimeout)
- }.getMessage mustBe ("last")
+ }.getMessage mustBe ("br0ken")
}
}
diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala
index 6e2b8ca033..a306a7d15b 100644
--- a/test/files/jvm/scala-concurrent-tck.scala
+++ b/test/files/jvm/scala-concurrent-tck.scala
@@ -344,8 +344,8 @@ def testTransformFailure(): Unit = once {
def testFallbackToFailure(): Unit = once {
done =>
val cause = new Exception
- val f = future { sys.error("failed") }
- val g = future { throw cause }
+ val f = future { throw cause }
+ val g = future { sys.error("failed") }
val h = f fallbackTo g
h onSuccess { case _ => done(false) }
diff --git a/test/files/neg/applydynamic_sip.check b/test/files/neg/applydynamic_sip.check
index dcf97b29fc..b50858356d 100644
--- a/test/files/neg/applydynamic_sip.check
+++ b/test/files/neg/applydynamic_sip.check
@@ -13,28 +13,28 @@ applydynamic_sip.scala:18: error: type mismatch;
error after rewriting to Test.this.bad1.selectDynamic("sel")
possible cause: maybe a wrong Dynamic method signature?
bad1.sel
- ^
+ ^
applydynamic_sip.scala:19: error: type mismatch;
found : String("sel")
required: Int
error after rewriting to Test.this.bad1.applyDynamic("sel")
possible cause: maybe a wrong Dynamic method signature?
bad1.sel(1)
- ^
+ ^
applydynamic_sip.scala:20: error: type mismatch;
found : String("sel")
required: Int
error after rewriting to Test.this.bad1.applyDynamicNamed("sel")
possible cause: maybe a wrong Dynamic method signature?
bad1.sel(a = 1)
- ^
+ ^
applydynamic_sip.scala:21: error: type mismatch;
found : String("sel")
required: Int
error after rewriting to Test.this.bad1.updateDynamic("sel")
possible cause: maybe a wrong Dynamic method signature?
bad1.sel = 1
- ^
+ ^
applydynamic_sip.scala:29: error: Int does not take parameters
error after rewriting to Test.this.bad2.selectDynamic("sel")
possible cause: maybe a wrong Dynamic method signature?
diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check
index 12428c7626..4ad4a12b3e 100644
--- a/test/files/neg/classmanifests_new_deprecations.check
+++ b/test/files/neg/classmanifests_new_deprecations.check
@@ -7,9 +7,6 @@ classmanifests_new_deprecations.scala:3: error: type ClassManifest in object Pre
classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
val cm3: ClassManifest[Int] = null
^
-classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
- val cm3: ClassManifest[Int] = null
- ^
classmanifests_new_deprecations.scala:6: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
def rcm1[T: scala.reflect.ClassManifest] = ???
^
@@ -19,13 +16,10 @@ classmanifests_new_deprecations.scala:7: error: type ClassManifest in package re
classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
val rcm3: scala.reflect.ClassManifest[Int] = null
^
-classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
- val rcm3: scala.reflect.ClassManifest[Int] = null
- ^
classmanifests_new_deprecations.scala:10: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
type CM[T] = ClassManifest[T]
^
classmanifests_new_deprecations.scala:15: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
type RCM[T] = scala.reflect.ClassManifest[T]
^
-10 errors found
+8 errors found
diff --git a/test/files/neg/macro-invalidimpl-f.check b/test/files/neg/macro-invalidimpl-f.check
index 4e5851f566..8820e05152 100644
--- a/test/files/neg/macro-invalidimpl-f.check
+++ b/test/files/neg/macro-invalidimpl-f.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+Macros_Test_2.scala:2: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context)(): c.Expr[Unit]
found : (c: scala.reflect.macros.Context): c.Expr[Unit]
number of parameter sections differ
diff --git a/test/files/neg/macro-invalidimpl-g.check b/test/files/neg/macro-invalidimpl-g.check
index 7342f7336f..c063803723 100644
--- a/test/files/neg/macro-invalidimpl-g.check
+++ b/test/files/neg/macro-invalidimpl-g.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+Macros_Test_2.scala:2: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context): c.Expr[Unit]
found : (c: scala.reflect.macros.Context)(): c.Expr[Unit]
number of parameter sections differ
diff --git a/test/files/neg/macro-invalidret-nontree.check b/test/files/neg/macro-invalidret-nontree.check
index 6d8336d06d..74e6f33339 100644
--- a/test/files/neg/macro-invalidret-nontree.check
+++ b/test/files/neg/macro-invalidret-nontree.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+Macros_Test_2.scala:2: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
found : (c: scala.reflect.macros.Context): Int
type mismatch for return type: Int does not conform to c.Expr[Any]
diff --git a/test/files/neg/macro-invalidret-nonuniversetree.check b/test/files/neg/macro-invalidret-nonuniversetree.check
index 089bfd0dc9..81c4114ce0 100644
--- a/test/files/neg/macro-invalidret-nonuniversetree.check
+++ b/test/files/neg/macro-invalidret-nonuniversetree.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+Macros_Test_2.scala:2: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
found : (c: scala.reflect.macros.Context): reflect.runtime.universe.Literal
type mismatch for return type: reflect.runtime.universe.Literal does not conform to c.Expr[Any]
diff --git a/test/files/neg/macro-invalidsig-context-bounds.check b/test/files/neg/macro-invalidsig-context-bounds.check
index 43b8c23b35..cbb2b06892 100644
--- a/test/files/neg/macro-invalidsig-context-bounds.check
+++ b/test/files/neg/macro-invalidsig-context-bounds.check
@@ -1,7 +1,4 @@
-Macros_Test_1.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context): c.Expr[Any]
- found : (c: scala.reflect.macros.Context)(implicit evidence$2: Numeric[U]): c.universe.Literal
-macro implementations cannot have implicit parameters other than WeakTypeTag evidences
+Macros_Test_1.scala:2: error: macro implementations cannot have implicit parameters other than WeakTypeTag evidences
def foo[U] = macro Impls.foo[U]
^
one error found
diff --git a/test/files/neg/macro-invalidsig-ctx-badargc.check b/test/files/neg/macro-invalidsig-ctx-badargc.check
index 1c14072a94..7e8bcbaf74 100644
--- a/test/files/neg/macro-invalidsig-ctx-badargc.check
+++ b/test/files/neg/macro-invalidsig-ctx-badargc.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+Macros_Test_2.scala:2: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
found : : Nothing
number of parameter sections differ
diff --git a/test/files/neg/macro-invalidsig-ctx-badtype.check b/test/files/neg/macro-invalidsig-ctx-badtype.check
index 340ace6a38..837ec3e496 100644
--- a/test/files/neg/macro-invalidsig-ctx-badtype.check
+++ b/test/files/neg/macro-invalidsig-ctx-badtype.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+Macros_Test_2.scala:2: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
found : (c: scala.reflect.api.Universe): Nothing
type mismatch for parameter c: scala.reflect.macros.Context does not conform to scala.reflect.api.Universe
diff --git a/test/files/neg/macro-invalidsig-ctx-badvarargs.check b/test/files/neg/macro-invalidsig-ctx-badvarargs.check
index a6478f03e3..a96421a8c4 100644
--- a/test/files/neg/macro-invalidsig-ctx-badvarargs.check
+++ b/test/files/neg/macro-invalidsig-ctx-badvarargs.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+Macros_Test_2.scala:2: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
found : (cs: scala.reflect.macros.Context*): Nothing
types incompatible for parameter cs: corresponding is not a vararg parameter
diff --git a/test/files/neg/macro-invalidsig-ctx-noctx.check b/test/files/neg/macro-invalidsig-ctx-noctx.check
index b7dc9a449b..fd3632eb9b 100644
--- a/test/files/neg/macro-invalidsig-ctx-noctx.check
+++ b/test/files/neg/macro-invalidsig-ctx-noctx.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+Macros_Test_2.scala:2: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Any]): c.Expr[Any]
found : (c: scala.reflect.macros.Context): Nothing
number of parameter sections differ
diff --git a/test/files/neg/macro-invalidsig-implicit-params.check b/test/files/neg/macro-invalidsig-implicit-params.check
index f210eb8a32..900098fd98 100644
--- a/test/files/neg/macro-invalidsig-implicit-params.check
+++ b/test/files/neg/macro-invalidsig-implicit-params.check
@@ -1,7 +1,4 @@
-Impls_Macros_1.scala:18: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Unit]
- found : (c: scala.reflect.macros.Context)(implicit x: c.Expr[Int]): c.Expr[Unit]
-macro implementations cannot have implicit parameters other than WeakTypeTag evidences
+Impls_Macros_1.scala:18: error: macro implementations cannot have implicit parameters other than WeakTypeTag evidences
def foo_targs[U](x: Int) = macro Impls.foo_targs[T, U]
^
one error found
diff --git a/test/files/neg/macro-invalidsig-params-badargc.check b/test/files/neg/macro-invalidsig-params-badargc.check
index 3f6d815b8e..bb26b24f80 100644
--- a/test/files/neg/macro-invalidsig-params-badargc.check
+++ b/test/files/neg/macro-invalidsig-params-badargc.check
@@ -1,4 +1,4 @@
-Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
+Impls_Macros_1.scala:8: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any]
found : (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): Nothing
parameter lists have different length, found extra parameter y: c.Expr[Int]
diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check
index 3ec40d7e5b..82276141a4 100644
--- a/test/files/neg/macro-invalidsig-params-badtype.check
+++ b/test/files/neg/macro-invalidsig-params-badtype.check
@@ -1,4 +1,4 @@
-Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
+Impls_Macros_1.scala:8: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any]
found : (c: scala.reflect.macros.Context)(x: c.universe.Tree): Nothing
type mismatch for parameter x: c.Expr[Int] does not conform to c.universe.Tree
diff --git a/test/files/neg/macro-invalidsig-params-badvarargs.check b/test/files/neg/macro-invalidsig-params-badvarargs.check
index 50607ff52d..cb4d2d91b1 100644
--- a/test/files/neg/macro-invalidsig-params-badvarargs.check
+++ b/test/files/neg/macro-invalidsig-params-badvarargs.check
@@ -1,4 +1,4 @@
-Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
+Impls_Macros_1.scala:8: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any]
found : (c: scala.reflect.macros.Context)(xs: c.Expr[Int]*): Nothing
parameter lists have different length, required extra parameter y: c.Expr[Int]
diff --git a/test/files/neg/macro-invalidsig-params-namemismatch.check b/test/files/neg/macro-invalidsig-params-namemismatch.check
index 4029bc8129..82612a94d3 100644
--- a/test/files/neg/macro-invalidsig-params-namemismatch.check
+++ b/test/files/neg/macro-invalidsig-params-namemismatch.check
@@ -1,4 +1,4 @@
-Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
+Impls_Macros_1.scala:8: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any]
found : (c: scala.reflect.macros.Context)(y: c.Expr[Int], x: c.Expr[Int]): Nothing
parameter names differ: x != y
diff --git a/test/files/neg/macro-invalidsig-tparams-badtype.check b/test/files/neg/macro-invalidsig-tparams-badtype.check
index e9f3547133..273d011412 100644
--- a/test/files/neg/macro-invalidsig-tparams-badtype.check
+++ b/test/files/neg/macro-invalidsig-tparams-badtype.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:2: error: macro implementation has wrong shape:
+Macros_Test_2.scala:2: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
found : (c: scala.reflect.macros.Context)(U: c.universe.Type): Nothing
number of parameter sections differ
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a.check b/test/files/neg/macro-invalidsig-tparams-notparams-a.check
index 61a5628b7e..c73125963f 100644
--- a/test/files/neg/macro-invalidsig-tparams-notparams-a.check
+++ b/test/files/neg/macro-invalidsig-tparams-notparams-a.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:2: error: wrong number of type parameters for method foo: [U](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[U])Nothing
+Macros_Test_2.scala:2: error: macro implementation reference has too few type arguments for method foo: [U](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[U])Nothing
def foo = macro Impls.foo
^
one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b.check b/test/files/neg/macro-invalidsig-tparams-notparams-b.check
index a605af6beb..e3d45055de 100644
--- a/test/files/neg/macro-invalidsig-tparams-notparams-b.check
+++ b/test/files/neg/macro-invalidsig-tparams-notparams-b.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[T], implicit evidence$2: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit]
+Macros_Test_2.scala:3: error: macro implementation reference has too few type arguments for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[T], implicit evidence$2: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit]
def foo[V] = macro Impls.foo
^
one error found
diff --git a/test/files/neg/t5689.check b/test/files/neg/t5689.check
index 50aaa7dbfe..e497e3bb07 100644
--- a/test/files/neg/t5689.check
+++ b/test/files/neg/t5689.check
@@ -1,4 +1,4 @@
-t5689.scala:4: error: macro implementation has wrong shape:
+t5689.scala:4: error: macro implementation has incompatible shape:
required: (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[String]
found : (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[Int]
type mismatch for return type: c.Expr[Int] does not conform to c.Expr[String]
diff --git a/test/files/neg/t6426.check b/test/files/neg/t6426.check
deleted file mode 100644
index 149f74c4de..0000000000
--- a/test/files/neg/t6426.check
+++ /dev/null
@@ -1,7 +0,0 @@
-t6426.scala:4: error: wildcard invalid as backquoted identifier
- println(`_`.Buffer(0))
- ^
-t6426.scala:5: error: ')' expected but '}' found.
-}
-^
-two errors found
diff --git a/test/files/neg/t6426.scala b/test/files/neg/t6426.scala
deleted file mode 100644
index a27d18eb58..0000000000
--- a/test/files/neg/t6426.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-class A {
- import collection.{mutable => _, _}
-
- println(`_`.Buffer(0))
-}
diff --git a/test/files/neg/t6563.check b/test/files/neg/t6563.check
new file mode 100644
index 0000000000..75dca1507d
--- /dev/null
+++ b/test/files/neg/t6563.check
@@ -0,0 +1,4 @@
+t6563.scala:4: error: not found: value e
+ e("f")
+ ^
+one error found
diff --git a/test/files/neg/t6563.scala b/test/files/neg/t6563.scala
new file mode 100644
index 0000000000..b0077b6f94
--- /dev/null
+++ b/test/files/neg/t6563.scala
@@ -0,0 +1,8 @@
+class A{
+ def b(c: => Unit){}
+ b{
+ e("f")
+ new G()(){}
+ }
+}
+class G(h:String="i")()
diff --git a/test/files/neg/t7519-b.check b/test/files/neg/t7519-b.check
new file mode 100644
index 0000000000..ad554b8633
--- /dev/null
+++ b/test/files/neg/t7519-b.check
@@ -0,0 +1,4 @@
+Use_2.scala:6: error: No implicit view available from String => K.
+ val x: Q = ex.Mac.mac("asdf")
+ ^
+one error found
diff --git a/test/files/neg/t7519-b/Mac_1.scala b/test/files/neg/t7519-b/Mac_1.scala
new file mode 100644
index 0000000000..55b583d24b
--- /dev/null
+++ b/test/files/neg/t7519-b/Mac_1.scala
@@ -0,0 +1,14 @@
+// get expected error message without package declaration
+package ex
+
+import scala.language.experimental.macros
+import scala.reflect.macros._
+
+object IW {
+ def foo(a: String): String = ???
+}
+object Mac {
+ def mac(s: String): String = macro macImpl
+ def macImpl(c: Context)(s: c.Expr[String]): c.Expr[String] =
+ c.universe.reify(IW.foo(s.splice))
+}
diff --git a/test/files/neg/t7519-b/Use_2.scala b/test/files/neg/t7519-b/Use_2.scala
new file mode 100644
index 0000000000..413e40e25e
--- /dev/null
+++ b/test/files/neg/t7519-b/Use_2.scala
@@ -0,0 +1,8 @@
+trait Q
+trait K
+
+object Use {
+ implicit def cd[T](p: T)(implicit ev: T => K): Q = ???
+ val x: Q = ex.Mac.mac("asdf")
+}
+
diff --git a/test/files/neg/t7519.check b/test/files/neg/t7519.check
new file mode 100644
index 0000000000..164d67f595
--- /dev/null
+++ b/test/files/neg/t7519.check
@@ -0,0 +1,7 @@
+t7519.scala:5: error: could not find implicit value for parameter nada: Nothing
+ locally(0 : String) // was: "value conversion is not a member of C.this.C"
+ ^
+t7519.scala:15: error: could not find implicit value for parameter nada: Nothing
+ locally(0 : String) // was: "value conversion is not a member of U"
+ ^
+two errors found
diff --git a/test/files/neg/t7519.scala b/test/files/neg/t7519.scala
new file mode 100644
index 0000000000..aea0f35d8e
--- /dev/null
+++ b/test/files/neg/t7519.scala
@@ -0,0 +1,18 @@
+class C {
+ implicit def conversion(m: Int)(implicit nada: Nothing): String = ???
+
+ class C { // rename class to get correct error, can't find implicit: Nothing.
+ locally(0 : String) // was: "value conversion is not a member of C.this.C"
+ }
+}
+
+object Test2 {
+ trait T; trait U
+ new T {
+ implicit def conversion(m: Int)(implicit nada: Nothing): String = ???
+
+ new U { // nested anonymous classes also share a name.
+ locally(0 : String) // was: "value conversion is not a member of U"
+ }
+ }
+}
diff --git a/test/files/neg/t7783.check b/test/files/neg/t7783.check
new file mode 100644
index 0000000000..f489b3c8fd
--- /dev/null
+++ b/test/files/neg/t7783.check
@@ -0,0 +1,16 @@
+t7783.scala:1: error: type D in object O is deprecated:
+object O { class C; @deprecated("", "") type D = C; def foo: Seq[D] = Nil }
+ ^
+t7783.scala:11: error: type D in object O is deprecated:
+ type T = O.D
+ ^
+t7783.scala:12: error: type D in object O is deprecated:
+ locally(null: O.D)
+ ^
+t7783.scala:13: error: type D in object O is deprecated:
+ val x: O.D = null
+ ^
+t7783.scala:14: error: type D in object O is deprecated:
+ locally(null.asInstanceOf[O.D])
+ ^
+5 errors found
diff --git a/test/files/neg/t7783.flags b/test/files/neg/t7783.flags
new file mode 100644
index 0000000000..d1b831ea87
--- /dev/null
+++ b/test/files/neg/t7783.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t7783.scala b/test/files/neg/t7783.scala
new file mode 100644
index 0000000000..995b644a09
--- /dev/null
+++ b/test/files/neg/t7783.scala
@@ -0,0 +1,15 @@
+object O { class C; @deprecated("", "") type D = C; def foo: Seq[D] = Nil }
+
+object NoWarn {
+ O.foo // nowarn
+ O.foo +: Nil // nowarn
+ def bar(a: Any, b: Any) = () // nowarn
+ bar(b = O.foo, a = ()) // nowarn
+}
+
+object Warn {
+ type T = O.D
+ locally(null: O.D)
+ val x: O.D = null
+ locally(null.asInstanceOf[O.D])
+}
diff --git a/test/files/neg/t8104a.check b/test/files/neg/t8104a.check
new file mode 100644
index 0000000000..ef92c2e1ef
--- /dev/null
+++ b/test/files/neg/t8104a.check
@@ -0,0 +1,4 @@
+Test_2.scala:19: error: could not find implicit value for parameter e: Generic.Aux[Test.C,(Int, Int)]
+ implicitly[Generic.Aux[C, (Int, Int)]]
+ ^
+one error found
diff --git a/test/files/neg/t8104a/Macros_1.scala b/test/files/neg/t8104a/Macros_1.scala
new file mode 100644
index 0000000000..688d0694c0
--- /dev/null
+++ b/test/files/neg/t8104a/Macros_1.scala
@@ -0,0 +1,23 @@
+import scala.reflect.macros.Context
+
+object Macros {
+ def impl[T](c: Context)(implicit T: c.WeakTypeTag[T]) = {
+ import c.universe._
+ import Flag._
+ import definitions._
+ val fields = T.tpe.declarations.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x }
+ val Repr = appliedType(TupleClass(fields.length).asType.toType, fields.map(_.typeSignature))
+ c.Expr(Block(
+ List(ClassDef(
+ Modifiers(FINAL),
+ newTypeName("$anon"),
+ List(),
+ Template(
+ List(AppliedTypeTree(Ident(newTypeName("Generic")), List(TypeTree(T.tpe)))),
+ emptyValDef,
+ List(
+ DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))),
+ TypeDef(Modifiers(), newTypeName("Repr"), List(), TypeTree(Repr)))))),
+ Apply(Select(New(Ident(newTypeName("$anon"))), nme.CONSTRUCTOR), List())))
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/t8104a/Test_2.scala b/test/files/neg/t8104a/Test_2.scala
new file mode 100644
index 0000000000..f601fc3570
--- /dev/null
+++ b/test/files/neg/t8104a/Test_2.scala
@@ -0,0 +1,20 @@
+trait Generic[T] { type Repr }
+object Generic {
+ type Aux[T, Repr0] = Generic[T] { type Repr = Repr0 }
+ import scala.language.experimental.macros
+ implicit def materializeGeneric[T]: Generic[T] = macro Macros.impl[T]
+}
+
+object Test extends App {
+ case class C(x: Int, y: Int)
+
+ def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr]) = ???
+ reprify(C(40, 2))
+
+ // this is a compilation error at the moment as explained in SI-8104
+ // because matchesPt in implicit search says that depoly(<type of materializeGeneric>) isn't a subtype of Generic.Aux[C, (Int, Int)]
+ // which is rightfully so, because depoly only replaces type parameters, not type members with wildcard types
+ // however in the future we might want to relax the matchesPt check, so this might start compiling
+ // therefore, if you've broken this test, then you should be happy, because most likely you've just enabled an interesting use case!
+ implicitly[Generic.Aux[C, (Int, Int)]]
+}
diff --git a/test/files/neg/t8104b.check b/test/files/neg/t8104b.check
new file mode 100644
index 0000000000..3214a132c2
--- /dev/null
+++ b/test/files/neg/t8104b.check
@@ -0,0 +1,4 @@
+Test_2.scala:16: error: could not find implicit value for parameter generic: Generic.Aux[Test.C,Repr]
+ reprify(C(40, 2))
+ ^
+one error found
diff --git a/test/files/neg/t8104b/Macros_1.scala b/test/files/neg/t8104b/Macros_1.scala
new file mode 100644
index 0000000000..688d0694c0
--- /dev/null
+++ b/test/files/neg/t8104b/Macros_1.scala
@@ -0,0 +1,23 @@
+import scala.reflect.macros.Context
+
+object Macros {
+ def impl[T](c: Context)(implicit T: c.WeakTypeTag[T]) = {
+ import c.universe._
+ import Flag._
+ import definitions._
+ val fields = T.tpe.declarations.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x }
+ val Repr = appliedType(TupleClass(fields.length).asType.toType, fields.map(_.typeSignature))
+ c.Expr(Block(
+ List(ClassDef(
+ Modifiers(FINAL),
+ newTypeName("$anon"),
+ List(),
+ Template(
+ List(AppliedTypeTree(Ident(newTypeName("Generic")), List(TypeTree(T.tpe)))),
+ emptyValDef,
+ List(
+ DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))),
+ TypeDef(Modifiers(), newTypeName("Repr"), List(), TypeTree(Repr)))))),
+ Apply(Select(New(Ident(newTypeName("$anon"))), nme.CONSTRUCTOR), List())))
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/t8104b/Test_2.scala b/test/files/neg/t8104b/Test_2.scala
new file mode 100644
index 0000000000..a0d35942ba
--- /dev/null
+++ b/test/files/neg/t8104b/Test_2.scala
@@ -0,0 +1,24 @@
+trait Generic[T] { type Repr }
+object Generic {
+ type Aux[T, Repr0] = Generic[T] { type Repr = Repr0 }
+ import scala.language.experimental.macros
+ implicit def materializeGeneric[T, Repr]: Generic.Aux[T, Repr] = macro Macros.impl[T]
+}
+
+object Test extends App {
+ case class C(x: Int, y: Int)
+
+ // this doesn't work because of SI-7470
+ // well, in fact SI-7470 has been fixed: https://github.com/scala/scala/pull/2499
+ // it's just that the fix hasn't been backported to 2.10.x
+ // if you've made this compile, consider taking a look at the aforementioned pull request
+ def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr]) = ???
+ reprify(C(40, 2))
+
+ // this is a compilation error at the moment as explained in SI-8104
+ // because matchesPt in implicit search says that depoly(<type of materializeGeneric>) isn't a subtype of Generic.Aux[C, (Int, Int)]
+ // which is rightfully so, because depoly only replaces type parameters, not type members with wildcard types
+ // however in the future we might want to relax the matchesPt check, so this might start compiling
+ // therefore, if you've broken this test, then you should be happy, because most likely you've just enabled an interesting use case!
+ implicitly[Generic.Aux[C, (Int, Int)]]
+}
diff --git a/test/files/neg/t8146-non-finitary-2.check b/test/files/neg/t8146-non-finitary-2.check
new file mode 100644
index 0000000000..8c2e1436c2
--- /dev/null
+++ b/test/files/neg/t8146-non-finitary-2.check
@@ -0,0 +1,9 @@
+t8146-non-finitary-2.scala:5: error: class graph is not finitary because type parameter X is expansively recursive
+trait C[X] extends N[N[C[D[X]]]]
+ ^
+t8146-non-finitary-2.scala:7: error: type mismatch;
+ found : C[Int]
+ required: N[C[Int]]
+ def foo(c: C[Int]): N[C[Int]] = c
+ ^
+two errors found
diff --git a/test/files/neg/t8146-non-finitary-2.scala b/test/files/neg/t8146-non-finitary-2.scala
new file mode 100644
index 0000000000..c12f5f8f49
--- /dev/null
+++ b/test/files/neg/t8146-non-finitary-2.scala
@@ -0,0 +1,8 @@
+// Example 3 from "On Decidability of Nominal Subtyping with Variance" (Pierce, Kennedy)
+// http://research.microsoft.com/pubs/64041/fool2007.pdf
+trait N[-Z]
+trait D[Y]
+trait C[X] extends N[N[C[D[X]]]]
+object Test {
+ def foo(c: C[Int]): N[C[Int]] = c
+}
diff --git a/test/files/neg/t8146-non-finitary.check b/test/files/neg/t8146-non-finitary.check
new file mode 100644
index 0000000000..8363b750ca
--- /dev/null
+++ b/test/files/neg/t8146-non-finitary.check
@@ -0,0 +1,9 @@
+t8146-non-finitary.scala:4: error: class graph is not finitary because type parameter A is expansively recursive
+trait C[A] extends N[N[C[C[A]]]]
+ ^
+t8146-non-finitary.scala:6: error: type mismatch;
+ found : C[Int]
+ required: N[C[Int]]
+ def foo(c: C[Int]): N[C[Int]] = c
+ ^
+two errors found
diff --git a/test/files/neg/t8146-non-finitary.scala b/test/files/neg/t8146-non-finitary.scala
new file mode 100644
index 0000000000..3d8a3074c7
--- /dev/null
+++ b/test/files/neg/t8146-non-finitary.scala
@@ -0,0 +1,7 @@
+// Example 3 from "On Decidability of Nominal Subtyping with Variance" (Pierce, Kennedy)
+// http://research.microsoft.com/pubs/64041/fool2007.pdf
+trait N[-A]
+trait C[A] extends N[N[C[C[A]]]]
+object Test {
+ def foo(c: C[Int]): N[C[Int]] = c
+}
diff --git a/test/files/pos/SI-4012-a.scala b/test/files/pos/SI-4012-a.scala
new file mode 100644
index 0000000000..7fceeea3c3
--- /dev/null
+++ b/test/files/pos/SI-4012-a.scala
@@ -0,0 +1,7 @@
+trait C1[+A] {
+ def head: A = sys.error("")
+}
+trait C2[@specialized +A] extends C1[A] {
+ override def head: A = super.head
+}
+class C3 extends C2[Char]
diff --git a/test/files/pos/SI-4012-b.scala b/test/files/pos/SI-4012-b.scala
new file mode 100644
index 0000000000..6bc8592766
--- /dev/null
+++ b/test/files/pos/SI-4012-b.scala
@@ -0,0 +1,15 @@
+trait Super[@specialized(Int) A] {
+ def superb = 0
+}
+
+object Sub extends Super[Int] {
+ // it is expected that super[Super].superb crashes, since
+ // specialization does parent class rewiring, and the super
+ // of Sub becomes Super$mcII$sp and not Super. But I consider
+ // this normal behavior -- if you want, I can modify duplicatiors
+ // to make this work, but I consider it's best to keep this
+ // let the user know Super is not the superclass anymore.
+ // super[Super].superb - Vlad
+ super.superb // okay
+ override def superb: Int = super.superb // okay
+}
diff --git a/test/files/pos/t7776.check b/test/files/pos/t7776.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/t7776.check
diff --git a/test/files/pos/t7776.scala b/test/files/pos/t7776.scala
new file mode 100644
index 0000000000..0340facd1b
--- /dev/null
+++ b/test/files/pos/t7776.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Context
+
+class MacroErasure {
+ def app(f: Any => Any, x: Any): Any = macro MacroErasure.appMacro
+ def app[A](f: A => Any, x: Any): Any = macro MacroErasure.appMacroA[A]
+}
+
+object MacroErasure {
+ def appMacro(c: Context)(f: c.Expr[Any => Any], x: c.Expr[Any]): c.Expr[Any] = ???
+ def appMacroA[A](c: Context)(f: c.Expr[A => Any], x: c.Expr[Any])(implicit tt: c.WeakTypeTag[A]): c.Expr[Any] = ???
+} \ No newline at end of file
diff --git a/test/files/pos/t7815.scala b/test/files/pos/t7815.scala
new file mode 100644
index 0000000000..12a434c5b0
--- /dev/null
+++ b/test/files/pos/t7815.scala
@@ -0,0 +1,30 @@
+import language.higherKinds
+
+trait Foo[A <: AnyRef] {
+ type Repr
+ def f(a: A): Repr
+ def g(a: A): Option[Repr]
+
+ type M[X]
+ def m(a: A): M[a.type]
+
+ type Id[X] = X
+ def n(a: A): Id[(Repr, M[a.type])]
+
+}
+
+object Foo {
+ type Aux[A <: AnyRef, B] = Foo[A] { type Repr = B; type M[X] = Int }
+
+}
+
+object Main extends App {
+ def mapWithFoo[A <: AnyRef, B](as: List[A])(implicit foo: Foo.Aux[A, B]) = {
+ // Should be Eta expandable because the result type of `f` is not
+ // dependant on the value, it is just `B`.
+ as map foo.f
+ as map foo.g
+ as map foo.m
+ as map foo.n
+ }
+}
diff --git a/test/files/pos/t8060.scala b/test/files/pos/t8060.scala
new file mode 100644
index 0000000000..90e014d74b
--- /dev/null
+++ b/test/files/pos/t8060.scala
@@ -0,0 +1,11 @@
+trait M[F[_]]
+
+trait P[A] {
+ type CC[X] = P[X]
+ def f(p: A => Boolean): M[CC]
+}
+
+trait Other {
+ // was infinite loop trying to dealias `x$1.CC`
+ def g[A](p: A => Boolean): P[A] => M[P] = _ f p
+}
diff --git a/test/files/pos/t8062.flags b/test/files/pos/t8062.flags
new file mode 100644
index 0000000000..49d036a887
--- /dev/null
+++ b/test/files/pos/t8062.flags
@@ -0,0 +1 @@
+-optimize
diff --git a/test/files/pos/t8062/A_1.scala b/test/files/pos/t8062/A_1.scala
new file mode 100644
index 0000000000..ca0411dae8
--- /dev/null
+++ b/test/files/pos/t8062/A_1.scala
@@ -0,0 +1,5 @@
+package warmup
+
+object Warmup {
+ def filter[A](p: Any => Boolean): Any = filter[Any](p)
+}
diff --git a/test/files/pos/t8062/B_2.scala b/test/files/pos/t8062/B_2.scala
new file mode 100644
index 0000000000..f0a6761488
--- /dev/null
+++ b/test/files/pos/t8062/B_2.scala
@@ -0,0 +1,3 @@
+object Test {
+ warmup.Warmup.filter[Any](x => false)
+}
diff --git a/test/files/pos/t8111.scala b/test/files/pos/t8111.scala
new file mode 100644
index 0000000000..0d63a16ba4
--- /dev/null
+++ b/test/files/pos/t8111.scala
@@ -0,0 +1,24 @@
+trait T {
+
+ def crashy(ma: Any) {
+ // okay
+ val f1 = (u: Unit) => ma
+ foo(f1)()
+ foo((u: Unit) => ma)
+ foo(0, (u: Any) => ma) apply ()
+
+ // crash due to side effects on the onwer of the symbol in the
+ // qualifier or arguments of the application during an abandoned
+ // names/defaults transform. The code type checkes because of
+ // autp-tupling which promotes and empty parmater list to `(): Unit`
+ foo((u: Any) => ma)()
+
+ {{(u: Any) => ma}; this}.foo(0)()
+
+ foo({def foo = ma; 0})()
+
+ {def foo = ma; this}.foo(0)()
+ }
+
+ def foo(f: Any): Any => Any
+}
diff --git a/test/files/pos/t8138.scala b/test/files/pos/t8138.scala
new file mode 100644
index 0000000000..b980930955
--- /dev/null
+++ b/test/files/pos/t8138.scala
@@ -0,0 +1,24 @@
+
+class U {
+ trait Transformer {
+ def transform(a: Tree): Tree = ???
+ }
+ trait Tree
+}
+
+object Test {
+ def m(u: U) = {
+ class C extends u.Transformer {
+ override def transform(t: u.Tree): u.Tree = {
+ null match {
+ case _ =>
+ // crashes in GenICode:
+ // error: Unknown type: <notype>, <notype> [class scala.reflect.internal.Types$NoType$, class scala.reflect.internal.Types$NoType$] TypeRef? false
+ (y: Any) => super.transform(???)
+ null
+ }
+ ???
+ }
+ }
+ }
+}
diff --git a/test/files/pos/t8146a.scala b/test/files/pos/t8146a.scala
new file mode 100644
index 0000000000..e4eb8d3fd1
--- /dev/null
+++ b/test/files/pos/t8146a.scala
@@ -0,0 +1,9 @@
+trait M[+A]
+
+object Test {
+ type Inty = Int
+ def t1(
+ x: M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[Int @unchecked]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
+ ): M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[Inty @unchecked]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
+ = x
+}
diff --git a/test/files/pos/t8146b.scala b/test/files/pos/t8146b.scala
new file mode 100644
index 0000000000..dd031f66c8
--- /dev/null
+++ b/test/files/pos/t8146b.scala
@@ -0,0 +1,77 @@
+// non-deterministic type errors, non-termination.
+// seems to be due to inconsistent hashing/equality in SubTypePair
+
+import scala.language.{existentials, implicitConversions}
+import scala.annotation.unchecked.uncheckedVariance
+
+trait Column[T]
+
+// Turning this into a trait reduces (eliminates?) the likelihood of type errors (but not of non-termination)
+abstract class Shape[Level <: ShapeLevel, -Mixed_, Unpacked_, Packed_]
+
+trait ShapeLevel
+trait NestedShapeLevel extends ShapeLevel
+trait FlatShapeLevel extends NestedShapeLevel
+trait ColumnsShapeLevel extends FlatShapeLevel
+
+trait ProvenShape[U]
+
+object ProvenShape {
+ implicit def proveShapeOf[T, U](v: T)(implicit sh: Shape[_ <: FlatShapeLevel, T, U, _]): ProvenShape[U] = ???
+}
+
+sealed abstract class HList {
+ type Self <: HList
+ type :: [E] = HCons[E, Self]
+ final def :: [E](elem: E): :: [E] = ???
+}
+
+final class HCons[+H, +T <: HList](val head: H, val tail: T) extends HList {
+ type Self = HCons[H @uncheckedVariance, T @uncheckedVariance]
+}
+
+final object HNil extends HList {
+ type Self = HNil.type
+}
+
+// Success is more likely when not using these aliases
+object syntax {
+ type :: [+H, +T <: HList] = HCons[H, T]
+ type HNil = HNil.type
+}
+
+class HListBench {
+
+ import syntax._
+
+ implicit def columnShape[T, Level <: ShapeLevel]: Shape[Level, Column[T], T, Column[T]] = ???
+ implicit def provenShape[T, P](implicit shape: Shape[_ <: FlatShapeLevel, T, _, P]): Shape[FlatShapeLevel, ProvenShape[T], T, P] = ???
+ final class HListShape[Level <: ShapeLevel, M <: HList, U <: HList, P <: HList](val shapes: Seq[Shape[_ <: ShapeLevel, _, _, _]]) extends Shape[Level, M, U, P]
+ implicit def hnilShape[Level <: ShapeLevel] = new HListShape[Level, HNil.type, HNil.type, HNil.type](Nil)
+ implicit def hconsShape[Level <: ShapeLevel, M1, M2 <: HList, U1, U2 <: HList, P1, P2 <: HList]
+ (implicit s1: Shape[_ <: Level, M1, U1, P1], s2: HListShape[_ <: Level, M2, U2, P2]) =
+ new HListShape[Level, M1 :: M2, U1 :: U2, P1 :: P2](s1 +: s2.shapes)
+
+ trait A[T] {
+ def * : ProvenShape[T]
+ }
+
+ trait B extends A[
+ Int :: Int :: Int :: Int :: Int ::
+ Int :: Int :: Int :: Int :: Int ::
+ Int :: Int :: Int :: Int :: Int ::
+ Int :: Int :: Int :: Int :: Int ::
+ Int :: Int :: Int :: Int :: Int ::
+ Int :: Int :: HNil ] {
+
+ def c: Column[Int]
+
+ def * = c :: c :: c :: c :: c ::
+ c :: c :: c :: c :: c ::
+ c :: c :: c :: c :: c ::
+ c :: c :: c :: c :: c ::
+ c :: c :: c :: c :: c ::
+ c :: c :: HNil
+
+ }
+}
diff --git a/test/files/pos/t8152-performance.scala b/test/files/pos/t8152-performance.scala
new file mode 100644
index 0000000000..b6d2ecd823
--- /dev/null
+++ b/test/files/pos/t8152-performance.scala
@@ -0,0 +1,13 @@
+class HListBench {
+
+ class A[H, T]
+
+ type B[H, T] = A[H, T]
+
+ // was okay
+ type T1 = A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, A[Int, Nothing]]]]]]]]]]]]]]]]]]]]]]]]]]]]
+
+ // Took over a minute to validate variance in 2.10.3!
+ type T2 = B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, B[Int, Nothing]]]]]]]]]]]]]]]]]]]]]]]]]]]]
+
+} \ No newline at end of file
diff --git a/test/files/presentation/callcc-interpreter.check b/test/files/presentation/callcc-interpreter.check
index 3a08e2a2ea..9a92c40609 100644
--- a/test/files/presentation/callcc-interpreter.check
+++ b/test/files/presentation/callcc-interpreter.check
@@ -2,7 +2,7 @@ reload: CallccInterpreter.scala
askTypeCompletion at CallccInterpreter.scala(51,38)
================================================================================
-[response] aksTypeCompletion at (51,38)
+[response] askTypeCompletion at (51,38)
retrieved 64 members
[accessible: true] `class AddcallccInterpreter.Add`
[accessible: true] `class AppcallccInterpreter.App`
diff --git a/test/files/presentation/completion-implicit-chained.check b/test/files/presentation/completion-implicit-chained.check
new file mode 100644
index 0000000000..24417cfa46
--- /dev/null
+++ b/test/files/presentation/completion-implicit-chained.check
@@ -0,0 +1,29 @@
+reload: Completions.scala
+
+askTypeCompletion at Completions.scala(11,16)
+================================================================================
+[response] askTypeCompletion at (11,16)
+retrieved 24 members
+[accessible: true] `method !=(x$1: Any)Boolean`
+[accessible: true] `method !=(x$1: AnyRef)Boolean`
+[accessible: true] `method ##()Int`
+[accessible: true] `method ==(x$1: Any)Boolean`
+[accessible: true] `method ==(x$1: AnyRef)Boolean`
+[accessible: true] `method asInstanceOf[T0]=> T0`
+[accessible: true] `method eq(x$1: AnyRef)Boolean`
+[accessible: true] `method equals(x$1: Any)Boolean`
+[accessible: true] `method hashCode()Int`
+[accessible: true] `method isInstanceOf[T0]=> Boolean`
+[accessible: true] `method map(x: Int => Int)(implicit a: DummyImplicit)test.O.type`
+[accessible: true] `method ne(x$1: AnyRef)Boolean`
+[accessible: true] `method notify()Unit`
+[accessible: true] `method notifyAll()Unit`
+[accessible: true] `method synchronized[T0](x$1: T0)T0`
+[accessible: true] `method toString()String`
+[accessible: true] `method wait()Unit`
+[accessible: true] `method wait(x$1: Long)Unit`
+[accessible: true] `method wait(x$1: Long, x$2: Int)Unit`
+[accessible: true] `value prefix123Int`
+[accessible: false] `method clone()Object`
+[accessible: false] `method finalize()Unit`
+================================================================================
diff --git a/test/files/presentation/completion-implicit-chained/Test.scala b/test/files/presentation/completion-implicit-chained/Test.scala
new file mode 100644
index 0000000000..bec1131c4c
--- /dev/null
+++ b/test/files/presentation/completion-implicit-chained/Test.scala
@@ -0,0 +1,3 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest \ No newline at end of file
diff --git a/test/files/presentation/completion-implicit-chained/src/Completions.scala b/test/files/presentation/completion-implicit-chained/src/Completions.scala
new file mode 100644
index 0000000000..67922dfec0
--- /dev/null
+++ b/test/files/presentation/completion-implicit-chained/src/Completions.scala
@@ -0,0 +1,12 @@
+package test
+
+import scala.Predef.DummyImplicit // turn off other predef implicits for a cleaner .check file.
+
+object O {
+ def map(x: Int => Int)(implicit a: DummyImplicit): O.type = this
+ val prefix123 : Int = 0
+}
+
+class Foo {
+ O.map(x => x)./*!*/ // we want the presentation compiler to apply the implicit argument list.
+}
diff --git a/test/files/presentation/ide-bug-1000349.check b/test/files/presentation/ide-bug-1000349.check
index 44a3207d75..ada307d0b2 100644
--- a/test/files/presentation/ide-bug-1000349.check
+++ b/test/files/presentation/ide-bug-1000349.check
@@ -2,7 +2,7 @@ reload: CompletionOnEmptyArgMethod.scala
askTypeCompletion at CompletionOnEmptyArgMethod.scala(2,17)
================================================================================
-[response] aksTypeCompletion at (2,17)
+[response] askTypeCompletion at (2,17)
retrieved 37 members
[accessible: true] `method !=(x$1: Any)Boolean`
[accessible: true] `method !=(x$1: AnyRef)Boolean`
diff --git a/test/files/presentation/ide-bug-1000475.check b/test/files/presentation/ide-bug-1000475.check
index 34c3b557d8..07902727e3 100644
--- a/test/files/presentation/ide-bug-1000475.check
+++ b/test/files/presentation/ide-bug-1000475.check
@@ -2,7 +2,7 @@ reload: Foo.scala
askTypeCompletion at Foo.scala(3,7)
================================================================================
-[response] aksTypeCompletion at (3,7)
+[response] askTypeCompletion at (3,7)
retrieved 36 members
[accessible: true] `method !=(x$1: Any)Boolean`
[accessible: true] `method !=(x$1: AnyRef)Boolean`
@@ -40,7 +40,7 @@ retrieved 36 members
askTypeCompletion at Foo.scala(6,10)
================================================================================
-[response] aksTypeCompletion at (6,10)
+[response] askTypeCompletion at (6,10)
retrieved 36 members
[accessible: true] `method !=(x$1: Any)Boolean`
[accessible: true] `method !=(x$1: AnyRef)Boolean`
@@ -78,7 +78,7 @@ retrieved 36 members
askTypeCompletion at Foo.scala(7,7)
================================================================================
-[response] aksTypeCompletion at (7,7)
+[response] askTypeCompletion at (7,7)
retrieved 36 members
[accessible: true] `method !=(x$1: Any)Boolean`
[accessible: true] `method !=(x$1: AnyRef)Boolean`
diff --git a/test/files/presentation/ide-bug-1000531.check b/test/files/presentation/ide-bug-1000531.check
index 4be98a6b21..a28ecb3437 100644
--- a/test/files/presentation/ide-bug-1000531.check
+++ b/test/files/presentation/ide-bug-1000531.check
@@ -2,7 +2,7 @@ reload: CrashOnLoad.scala
askTypeCompletion at CrashOnLoad.scala(6,12)
================================================================================
-[response] aksTypeCompletion at (6,12)
+[response] askTypeCompletion at (6,12)
retrieved 126 members
[accessible: true] `class GroupedIteratorIterator[B]#GroupedIterator`
[accessible: true] `method !=(x$1: Any)Boolean`
diff --git a/test/files/presentation/ide-t1001388.check b/test/files/presentation/ide-t1001388.check
new file mode 100644
index 0000000000..d58f86d6c6
--- /dev/null
+++ b/test/files/presentation/ide-t1001388.check
@@ -0,0 +1 @@
+Test OK \ No newline at end of file
diff --git a/test/files/presentation/ide-t1001388/Test.scala b/test/files/presentation/ide-t1001388/Test.scala
new file mode 100644
index 0000000000..f6079cf0b2
--- /dev/null
+++ b/test/files/presentation/ide-t1001388/Test.scala
@@ -0,0 +1,28 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+import scala.reflect.internal.util.SourceFile
+import scala.tools.nsc.interactive.Response
+
+object Test extends InteractiveTest {
+ override def execute(): Unit = {
+ val sourceA = loadSourceAndWaitUntilTypechecked("A.scala")
+ checkPresent(sourceA)
+ }
+
+ private def loadSourceAndWaitUntilTypechecked(sourceName: String): SourceFile = {
+ val sourceFile = sourceFiles.find(_.file.name == sourceName).head
+ askLoadedTyped(sourceFile).get
+ /* The response to `askLoadedType` may return before `interactive.Global.waitLoadedType`
+ * fully executes. Because this test expects `waitLoadedType` is fully executed before
+ * calling `checkPresent`, with the below no-op presentation compiler request we make
+ * sure this requirement is fulfilled.
+ */
+ compiler.askForResponse(() => ()).get
+ sourceFile
+ }
+
+ private def checkPresent(source: SourceFile): Unit = compiler.getUnitOf(source) match {
+ case Some(unit) => reporter.println("Compilation Unit for " + source.file.name + " still loaded after askLoadedTyped")
+
+ case None => reporter.println("Test OK")
+ }
+}
diff --git a/test/files/presentation/ide-t1001388/src/a/A.scala b/test/files/presentation/ide-t1001388/src/a/A.scala
new file mode 100644
index 0000000000..be09097598
--- /dev/null
+++ b/test/files/presentation/ide-t1001388/src/a/A.scala
@@ -0,0 +1,6 @@
+package a
+
+object A {
+ val tagString = "foo"
+ Seq.empty[Byte].toArray.toSeq
+}
diff --git a/test/files/presentation/implicit-member.check b/test/files/presentation/implicit-member.check
index 05d6f61699..111d06dfa8 100644
--- a/test/files/presentation/implicit-member.check
+++ b/test/files/presentation/implicit-member.check
@@ -2,7 +2,7 @@ reload: ImplicitMember.scala
askTypeCompletion at ImplicitMember.scala(7,7)
================================================================================
-[response] aksTypeCompletion at (7,7)
+[response] askTypeCompletion at (7,7)
retrieved 39 members
[accessible: true] `class AppliedImplicitImplicit.AppliedImplicit`
[accessible: true] `method !=(x$1: Any)Boolean`
diff --git a/test/files/presentation/ping-pong.check b/test/files/presentation/ping-pong.check
index b666d51de5..f714c1b4da 100644
--- a/test/files/presentation/ping-pong.check
+++ b/test/files/presentation/ping-pong.check
@@ -2,7 +2,7 @@ reload: PingPong.scala
askTypeCompletion at PingPong.scala(10,23)
================================================================================
-[response] aksTypeCompletion at (10,23)
+[response] askTypeCompletion at (10,23)
retrieved 40 members
[accessible: true] `method !=(x$1: Any)Boolean`
[accessible: true] `method !=(x$1: AnyRef)Boolean`
@@ -43,7 +43,7 @@ retrieved 40 members
askTypeCompletion at PingPong.scala(19,20)
================================================================================
-[response] aksTypeCompletion at (19,20)
+[response] askTypeCompletion at (19,20)
retrieved 40 members
[accessible: true] `method !=(x$1: Any)Boolean`
[accessible: true] `method !=(x$1: AnyRef)Boolean`
diff --git a/test/files/presentation/scope-completion-1.check b/test/files/presentation/scope-completion-1.check
new file mode 100644
index 0000000000..93c637370d
--- /dev/null
+++ b/test/files/presentation/scope-completion-1.check
@@ -0,0 +1,19 @@
+reload: Completions.scala
+
+askScopeCompletion at Completions.scala(6,2)
+================================================================================
+[response] askScopeCompletion at (6,2)
+retrieved 3 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `constructor Completion1()test.Completion1`
+[accessible: true] `object Completion2test.Completion2.type`
+================================================================================
+
+askScopeCompletion at Completions.scala(10,2)
+================================================================================
+[response] askScopeCompletion at (10,2)
+retrieved 3 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `constructor Completion2()test.Completion2.type`
+[accessible: true] `object Completion2test.Completion2.type`
+================================================================================
diff --git a/test/files/presentation/scope-completion-1/Test.scala b/test/files/presentation/scope-completion-1/Test.scala
new file mode 100644
index 0000000000..bec1131c4c
--- /dev/null
+++ b/test/files/presentation/scope-completion-1/Test.scala
@@ -0,0 +1,3 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest \ No newline at end of file
diff --git a/test/files/presentation/scope-completion-1/src/Completions.scala b/test/files/presentation/scope-completion-1/src/Completions.scala
new file mode 100644
index 0000000000..c4eea6b261
--- /dev/null
+++ b/test/files/presentation/scope-completion-1/src/Completions.scala
@@ -0,0 +1,12 @@
+package test
+
+/* completion on empty class and object */
+
+class Completion1 {
+ /*_*/
+}
+
+object Completion2 {
+ /*_*/
+}
+
diff --git a/test/files/presentation/scope-completion-2.check b/test/files/presentation/scope-completion-2.check
new file mode 100644
index 0000000000..462671da40
--- /dev/null
+++ b/test/files/presentation/scope-completion-2.check
@@ -0,0 +1,33 @@
+reload: Completions.scala
+
+askScopeCompletion at Completions.scala(15,2)
+================================================================================
+[response] askScopeCompletion at (15,2)
+retrieved 10 members
+[accessible: true] `class Cc1Completion1.this.Cc1`
+[accessible: true] `class Co1test.Completion1.Co1`
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `constructor Completion1()test.Completion1`
+[accessible: true] `method fc1=> Int`
+[accessible: true] `method fo1=> Int`
+[accessible: true] `object Completion1test.Completion1.type`
+[accessible: true] `value ctest.Completion1`
+[accessible: true] `value vc1Int`
+[accessible: true] `value vo1Int`
+================================================================================
+
+askScopeCompletion at Completions.scala(29,2)
+================================================================================
+[response] askScopeCompletion at (29,2)
+retrieved 10 members
+[accessible: true] `class Cc1test.Completion1.c.Cc1`
+[accessible: true] `class Co1test.Completion1.Co1`
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `constructor Completion1()test.Completion1.type`
+[accessible: true] `method fc1=> Int`
+[accessible: true] `method fo1=> Int`
+[accessible: true] `object Completion1test.Completion1.type`
+[accessible: true] `value ctest.Completion1`
+[accessible: true] `value vc1Int`
+[accessible: true] `value vo1Int`
+================================================================================
diff --git a/test/files/presentation/scope-completion-2/Test.scala b/test/files/presentation/scope-completion-2/Test.scala
new file mode 100644
index 0000000000..bec1131c4c
--- /dev/null
+++ b/test/files/presentation/scope-completion-2/Test.scala
@@ -0,0 +1,3 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest \ No newline at end of file
diff --git a/test/files/presentation/scope-completion-2/src/Completions.scala b/test/files/presentation/scope-completion-2/src/Completions.scala
new file mode 100644
index 0000000000..f8d7cd6ba8
--- /dev/null
+++ b/test/files/presentation/scope-completion-2/src/Completions.scala
@@ -0,0 +1,31 @@
+package test
+
+/* private elements are visible in the companion class/object */
+
+class Completion1 {
+
+ import Completion1._
+
+ private val vc1 = 0
+ private def fc1 = 0
+
+ private class Cc1 {
+ }
+
+ /*_*/
+}
+
+object Completion1 {
+
+ val c = new Completion1()
+ import c._
+
+ private val vo1 = 0
+ private def fo1 = 0
+
+ private class Co1 {
+ }
+
+ /*_*/
+}
+
diff --git a/test/files/presentation/scope-completion-3.check b/test/files/presentation/scope-completion-3.check
new file mode 100644
index 0000000000..119fc1de5f
--- /dev/null
+++ b/test/files/presentation/scope-completion-3.check
@@ -0,0 +1,111 @@
+reload: Completions.scala
+
+askScopeCompletion at Completions.scala(75,2)
+================================================================================
+[response] askScopeCompletion at (75,2)
+retrieved 49 members
+[accessible: true] `class Base1test.Base1`
+[accessible: true] `class Cb1Completion1.this.Cb1`
+[accessible: true] `class Cc1Completion1.this.Cc1`
+[accessible: true] `class Cc2Completion1.this.Cc2`
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class Ct1Completion1.this.Ct1`
+[accessible: true] `constructor Completion1()test.Completion1`
+[accessible: true] `method fb1=> Int`
+[accessible: true] `method fb3=> Int`
+[accessible: true] `method fc1=> Int`
+[accessible: true] `method fc2=> Int`
+[accessible: true] `method ft1=> Int`
+[accessible: true] `method ft3=> Int`
+[accessible: true] `object Completion2test.Completion2.type`
+[accessible: true] `object Ob1Completion1.this.Ob1.type`
+[accessible: true] `object Oc1Completion1.this.Oc1.type`
+[accessible: true] `object Oc2Completion1.this.Oc2.type`
+[accessible: true] `object Ot1Completion1.this.Ot1.type`
+[accessible: true] `trait Trait1test.Trait1`
+[accessible: true] `type tb1Completion1.this.tb1`
+[accessible: true] `type tb3Completion1.this.tb3`
+[accessible: true] `type tc1Completion1.this.tc1`
+[accessible: true] `type tc2Completion1.this.tc2`
+[accessible: true] `type tt1Completion1.this.tt1`
+[accessible: true] `type tt3Completion1.this.tt3`
+[accessible: true] `value vb1Int`
+[accessible: true] `value vb3Int`
+[accessible: true] `value vc1Int`
+[accessible: true] `value vc2Int`
+[accessible: true] `value vt1Int`
+[accessible: true] `value vt3Int`
+[accessible: true] `variable rb1Int`
+[accessible: true] `variable rb3Int`
+[accessible: true] `variable rc1Int`
+[accessible: true] `variable rc2Int`
+[accessible: true] `variable rt1Int`
+[accessible: true] `variable rt3Int`
+[accessible: false] `class Cb2Completion1.this.Cb2`
+[accessible: false] `class Ct2Completion1.this.Ct2`
+[accessible: false] `method fb2=> Int`
+[accessible: false] `method ft2=> Int`
+[accessible: false] `object Ob2Completion1.this.Ob2.type`
+[accessible: false] `object Ot2Completion1.this.Ot2.type`
+[accessible: false] `type tb2Completion1.this.tb2`
+[accessible: false] `type tt2Completion1.this.tt2`
+[accessible: false] `value vb2Int`
+[accessible: false] `value vt2Int`
+[accessible: false] `variable rb2Int`
+[accessible: false] `variable rt2Int`
+================================================================================
+
+askScopeCompletion at Completions.scala(104,2)
+================================================================================
+[response] askScopeCompletion at (104,2)
+retrieved 49 members
+[accessible: true] `class Base1test.Base1`
+[accessible: true] `class Cb1test.Completion2.Cb1`
+[accessible: true] `class Co1test.Completion2.Co1`
+[accessible: true] `class Co2test.Completion2.Co2`
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class Ct1test.Completion2.Ct1`
+[accessible: true] `constructor Completion2()test.Completion2.type`
+[accessible: true] `method fb1=> Int`
+[accessible: true] `method fb3=> Int`
+[accessible: true] `method fo1=> Int`
+[accessible: true] `method fo2=> Int`
+[accessible: true] `method ft1=> Int`
+[accessible: true] `method ft3=> Int`
+[accessible: true] `object Completion2test.Completion2.type`
+[accessible: true] `object Ob1test.Completion2.Ob1.type`
+[accessible: true] `object Oo1test.Completion2.Oo1.type`
+[accessible: true] `object Oo2test.Completion2.Oo2.type`
+[accessible: true] `object Ot1test.Completion2.Ot1.type`
+[accessible: true] `trait Trait1test.Trait1`
+[accessible: true] `type tb1test.Completion2.tb1`
+[accessible: true] `type tb3test.Completion2.tb3`
+[accessible: true] `type to1test.Completion2.to1`
+[accessible: true] `type to2test.Completion2.to2`
+[accessible: true] `type tt1test.Completion2.tt1`
+[accessible: true] `type tt3test.Completion2.tt3`
+[accessible: true] `value vb1Int`
+[accessible: true] `value vb3Int`
+[accessible: true] `value vo1Int`
+[accessible: true] `value vo2Int`
+[accessible: true] `value vt1Int`
+[accessible: true] `value vt3Int`
+[accessible: true] `variable rb1Int`
+[accessible: true] `variable rb3Int`
+[accessible: true] `variable ro1Int`
+[accessible: true] `variable ro2Int`
+[accessible: true] `variable rt1Int`
+[accessible: true] `variable rt3Int`
+[accessible: false] `class Cb2test.Completion2.Cb2`
+[accessible: false] `class Ct2test.Completion2.Ct2`
+[accessible: false] `method fb2=> Int`
+[accessible: false] `method ft2=> Int`
+[accessible: false] `object Ob2test.Completion2.Ob2.type`
+[accessible: false] `object Ot2test.Completion2.Ot2.type`
+[accessible: false] `type tb2test.Completion2.tb2`
+[accessible: false] `type tt2test.Completion2.tt2`
+[accessible: false] `value vb2Int`
+[accessible: false] `value vt2Int`
+[accessible: false] `variable rb2Int`
+[accessible: false] `variable rt2Int`
+================================================================================
diff --git a/test/files/presentation/scope-completion-3/Test.scala b/test/files/presentation/scope-completion-3/Test.scala
new file mode 100644
index 0000000000..bec1131c4c
--- /dev/null
+++ b/test/files/presentation/scope-completion-3/Test.scala
@@ -0,0 +1,3 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest \ No newline at end of file
diff --git a/test/files/presentation/scope-completion-3/src/Completions.scala b/test/files/presentation/scope-completion-3/src/Completions.scala
new file mode 100644
index 0000000000..18cef1cefa
--- /dev/null
+++ b/test/files/presentation/scope-completion-3/src/Completions.scala
@@ -0,0 +1,106 @@
+package test
+
+/* check availability of members defined locally and in hierachy */
+
+abstract class Base1 {
+
+ type tb1 = Int
+ val vb1 = 0
+ var rb1 = 0
+ def fb1 = 0
+ class Cb1
+ object Ob1
+
+ private type tb2 = Int
+ private val vb2 = 0
+ private var rb2 = 0
+ private def fb2 = 0
+ private class Cb2
+ private object Ob2
+
+ type tb3
+ val vb3: Int
+ var rb3: Int
+ def fb3: Int
+}
+
+trait Trait1 {
+
+ type tt1 = Int
+ val vt1 = 0
+ var rt1 = 0
+ def ft1 = 0
+ class Ct1
+ object Ot1
+
+ private type tt2 = Int
+ private val vt2 = 0
+ private var rt2 = 0
+ private def ft2 = 0
+ private class Ct2
+ private object Ot2
+
+ type tt3
+ val vt3: Int
+ var rt3: Int
+ def ft3: Int
+}
+
+class Completion1 extends Base1 with Trait1 {
+
+ type tc1 = Int
+ val vc1 = 0
+ var rc1 = 0
+ def fc1 = 0
+ class Cc1
+ object Oc1
+
+ private type tc2 = Int
+ private val vc2 = 0
+ private var rc2 = 0
+ private def fc2 = 0
+ private class Cc2
+ private object Oc2
+
+ override type tb3 = Int
+ override val vb3 = 12
+ override var rb3 = 12
+ override def fb3 = 12
+
+ override type tt3 = Int
+ override val vt3 = 12
+ override var rt3 = 12
+ override def ft3 = 12
+
+ /*_*/
+}
+
+object Completion2 extends Base1 with Trait1 {
+
+ type to1 = Int
+ val vo1 = 0
+ var ro1 = 0
+ def fo1 = 0
+ class Co1
+ object Oo1
+
+ private type to2 = Int
+ private val vo2 = 0
+ private var ro2 = 0
+ private def fo2 = 0
+ private class Co2
+ private object Oo2
+
+ override type tb3 = Int
+ override val vb3 = 12
+ override var rb3 = 12
+ override def fb3 = 12
+
+ override type tt3 = Int
+ override val vt3 = 12
+ override var rt3 = 12
+ override def ft3 = 12
+
+ /*_*/
+}
+
diff --git a/test/files/presentation/scope-completion-4.check b/test/files/presentation/scope-completion-4.check
new file mode 100644
index 0000000000..f6241cf7f7
--- /dev/null
+++ b/test/files/presentation/scope-completion-4.check
@@ -0,0 +1,293 @@
+reload: Completions.scala
+
+askScopeCompletion at Completions.scala(12,8)
+================================================================================
+[response] askScopeCompletion at (12,8)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class fcfc`
+[accessible: true] `class ffcffc`
+[accessible: true] `constructor Completion1()test.Completion1`
+[accessible: true] `method f=> Unit`
+[accessible: true] `method ff=> Unit`
+[accessible: true] `method fff=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(15,6)
+================================================================================
+[response] askScopeCompletion at (15,6)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class fcfc`
+[accessible: true] `class ffcffc`
+[accessible: true] `constructor Completion1()test.Completion1`
+[accessible: true] `method f=> Unit`
+[accessible: true] `method ff=> Unit`
+[accessible: true] `method fff=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(18,8)
+================================================================================
+[response] askScopeCompletion at (18,8)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class fcfc`
+[accessible: true] `class ffcffc`
+[accessible: true] `constructor ffc()ffc`
+[accessible: true] `method f=> Unit`
+[accessible: true] `method ff=> Unit`
+[accessible: true] `method fff=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(21,6)
+================================================================================
+[response] askScopeCompletion at (21,6)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class fcfc`
+[accessible: true] `class ffcffc`
+[accessible: true] `constructor Completion1()test.Completion1`
+[accessible: true] `method f=> Unit`
+[accessible: true] `method ff=> Unit`
+[accessible: true] `method fff=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(24,4)
+================================================================================
+[response] askScopeCompletion at (24,4)
+retrieved 6 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class fcfc`
+[accessible: true] `constructor Completion1()test.Completion1`
+[accessible: true] `method f=> Unit`
+[accessible: true] `method ff=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(29,8)
+================================================================================
+[response] askScopeCompletion at (29,8)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class fccfc.this.fcc`
+[accessible: true] `class fcfc`
+[accessible: true] `constructor fc()fc`
+[accessible: true] `method f=> Unit`
+[accessible: true] `method fcf=> Unit`
+[accessible: true] `method ff=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(32,6)
+================================================================================
+[response] askScopeCompletion at (32,6)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class fccfc.this.fcc`
+[accessible: true] `class fcfc`
+[accessible: true] `constructor fc()fc`
+[accessible: true] `method f=> Unit`
+[accessible: true] `method fcf=> Unit`
+[accessible: true] `method ff=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(35,8)
+================================================================================
+[response] askScopeCompletion at (35,8)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class fccfc.this.fcc`
+[accessible: true] `class fcfc`
+[accessible: true] `constructor fcc()fc.this.fcc`
+[accessible: true] `method f=> Unit`
+[accessible: true] `method fcf=> Unit`
+[accessible: true] `method ff=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(38,6)
+================================================================================
+[response] askScopeCompletion at (38,6)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class fccfc.this.fcc`
+[accessible: true] `class fcfc`
+[accessible: true] `constructor fc()fc`
+[accessible: true] `method f=> Unit`
+[accessible: true] `method fcf=> Unit`
+[accessible: true] `method ff=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(41,4)
+================================================================================
+[response] askScopeCompletion at (41,4)
+retrieved 6 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class fcfc`
+[accessible: true] `constructor Completion1()test.Completion1`
+[accessible: true] `method f=> Unit`
+[accessible: true] `method ff=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(44,2)
+================================================================================
+[response] askScopeCompletion at (44,2)
+retrieved 4 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `constructor Completion1()test.Completion1`
+[accessible: true] `method f=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(51,8)
+================================================================================
+[response] askScopeCompletion at (51,8)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class ccc.this.cc`
+[accessible: true] `class ccccc.this.ccc`
+[accessible: true] `constructor ccc()cc.this.ccc`
+[accessible: true] `method ccf=> Unit`
+[accessible: true] `method cf=> Unit`
+[accessible: true] `method f=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(54,6)
+================================================================================
+[response] askScopeCompletion at (54,6)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class ccc.this.cc`
+[accessible: true] `class ccccc.this.ccc`
+[accessible: true] `constructor cc()c.this.cc`
+[accessible: true] `method ccf=> Unit`
+[accessible: true] `method cf=> Unit`
+[accessible: true] `method f=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(57,8)
+================================================================================
+[response] askScopeCompletion at (57,8)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class ccc.this.cc`
+[accessible: true] `class ccccc.this.ccc`
+[accessible: true] `constructor cc()c.this.cc`
+[accessible: true] `method ccf=> Unit`
+[accessible: true] `method cf=> Unit`
+[accessible: true] `method f=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(60,6)
+================================================================================
+[response] askScopeCompletion at (60,6)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class ccc.this.cc`
+[accessible: true] `class ccccc.this.ccc`
+[accessible: true] `constructor cc()c.this.cc`
+[accessible: true] `method ccf=> Unit`
+[accessible: true] `method cf=> Unit`
+[accessible: true] `method f=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(63,4)
+================================================================================
+[response] askScopeCompletion at (63,4)
+retrieved 6 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class ccc.this.cc`
+[accessible: true] `constructor c()Completion1.this.c`
+[accessible: true] `method cf=> Unit`
+[accessible: true] `method f=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(68,8)
+================================================================================
+[response] askScopeCompletion at (68,8)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class ccc.this.cc`
+[accessible: true] `class cfccfc`
+[accessible: true] `constructor cfc()cfc`
+[accessible: true] `method cf=> Unit`
+[accessible: true] `method cff=> Unit`
+[accessible: true] `method f=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(71,6)
+================================================================================
+[response] askScopeCompletion at (71,6)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class ccc.this.cc`
+[accessible: true] `class cfccfc`
+[accessible: true] `constructor c()Completion1.this.c`
+[accessible: true] `method cf=> Unit`
+[accessible: true] `method cff=> Unit`
+[accessible: true] `method f=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(74,8)
+================================================================================
+[response] askScopeCompletion at (74,8)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class ccc.this.cc`
+[accessible: true] `class cfccfc`
+[accessible: true] `constructor c()Completion1.this.c`
+[accessible: true] `method cf=> Unit`
+[accessible: true] `method cff=> Unit`
+[accessible: true] `method f=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(77,6)
+================================================================================
+[response] askScopeCompletion at (77,6)
+retrieved 8 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class ccc.this.cc`
+[accessible: true] `class cfccfc`
+[accessible: true] `constructor c()Completion1.this.c`
+[accessible: true] `method cf=> Unit`
+[accessible: true] `method cff=> Unit`
+[accessible: true] `method f=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(80,4)
+================================================================================
+[response] askScopeCompletion at (80,4)
+retrieved 6 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `class ccc.this.cc`
+[accessible: true] `constructor c()Completion1.this.c`
+[accessible: true] `method cf=> Unit`
+[accessible: true] `method f=> Unit`
+================================================================================
+
+askScopeCompletion at Completions.scala(83,2)
+================================================================================
+[response] askScopeCompletion at (83,2)
+retrieved 4 members
+[accessible: true] `class Completion1test.Completion1`
+[accessible: true] `class cCompletion1.this.c`
+[accessible: true] `constructor Completion1()test.Completion1`
+[accessible: true] `method f=> Unit`
+================================================================================
diff --git a/test/files/presentation/scope-completion-4/Test.scala b/test/files/presentation/scope-completion-4/Test.scala
new file mode 100644
index 0000000000..bec1131c4c
--- /dev/null
+++ b/test/files/presentation/scope-completion-4/Test.scala
@@ -0,0 +1,3 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest \ No newline at end of file
diff --git a/test/files/presentation/scope-completion-4/src/Completions.scala b/test/files/presentation/scope-completion-4/src/Completions.scala
new file mode 100644
index 0000000000..d11315720a
--- /dev/null
+++ b/test/files/presentation/scope-completion-4/src/Completions.scala
@@ -0,0 +1,84 @@
+package test
+
+/* check that members defined in sub-block are not visible*/
+
+class Completion1 {
+
+ def f {
+
+ def ff {
+
+ def fff {
+ /*_*/
+ }
+
+ /*_*/
+
+ class ffc {
+ /*_*/
+ }
+
+ /*_*/
+ }
+
+ /*_*/
+
+ class fc {
+
+ def fcf {
+ /*_*/
+ }
+
+ /*_*/
+
+ class fcc {
+ /*_*/
+ }
+
+ /*_*/
+ }
+
+ /*_*/
+ }
+
+ /*_*/
+
+ class c {
+
+ class cc {
+
+ class ccc {
+ /*_*/
+ }
+
+ /*_*/
+
+ def ccf {
+ /*_*/
+ }
+
+ /*_*/
+ }
+
+ /*_*/
+
+ def cf {
+
+ class cfc {
+ /*_*/
+ }
+
+ /*_*/
+
+ def cff {
+ /*_*/
+ }
+
+ /*_*/
+ }
+
+ /*_*/
+ }
+
+ /*_*/
+}
diff --git a/test/files/presentation/scope-completion-import.check b/test/files/presentation/scope-completion-import.check
new file mode 100644
index 0000000000..33b498c1ee
--- /dev/null
+++ b/test/files/presentation/scope-completion-import.check
@@ -0,0 +1,193 @@
+reload: Completions.scala
+
+askScopeCompletion at Completions.scala(23,4)
+================================================================================
+[response] askScopeCompletion at (23,4)
+retrieved 18 members
+[accessible: true] `class Ctest.C`
+[accessible: true] `class Foo_1test.Foo_1`
+[accessible: true] `class Foo_2test.Foo_2`
+[accessible: true] `class Foo_3test.Foo_3`
+[accessible: true] `class Footest.Foo`
+[accessible: true] `constructor Foo()test.Foo`
+[accessible: true] `method fCCC=> Int`
+[accessible: true] `method fOOO=> Int`
+[accessible: true] `object Otest.O.type`
+[accessible: true] `value otest.O.type`
+[accessible: true] `value vCCCInt`
+[accessible: true] `value vOOOInt`
+[accessible: true] `variable rCCCInt`
+[accessible: true] `variable rOOOInt`
+[accessible: false] `value pVCCCInt`
+[accessible: false] `value pVOOOInt`
+[accessible: false] `variable pRCCCInt`
+[accessible: false] `variable pROOOInt`
+================================================================================
+
+askScopeCompletion at Completions.scala(27,4)
+================================================================================
+[response] askScopeCompletion at (27,4)
+retrieved 17 members
+[accessible: true] `class Ctest.C`
+[accessible: true] `class Foo_1test.Foo_1`
+[accessible: true] `class Foo_2test.Foo_2`
+[accessible: true] `class Foo_3test.Foo_3`
+[accessible: true] `class Footest.Foo`
+[accessible: true] `constructor Foo()test.Foo`
+[accessible: true] `method fCCC=> Int`
+[accessible: true] `method fOOO=> Int`
+[accessible: true] `object Otest.O.type`
+[accessible: true] `value vCCCInt`
+[accessible: true] `value vOOOInt`
+[accessible: true] `variable rCCCInt`
+[accessible: true] `variable rOOOInt`
+[accessible: false] `value pVCCCInt`
+[accessible: false] `value pVOOOInt`
+[accessible: false] `variable pRCCCInt`
+[accessible: false] `variable pROOOInt`
+================================================================================
+
+askScopeCompletion at Completions.scala(32,4)
+================================================================================
+[response] askScopeCompletion at (32,4)
+retrieved 13 members
+[accessible: true] `class Ctest.C`
+[accessible: true] `class Foo_1test.Foo_1`
+[accessible: true] `class Foo_2test.Foo_2`
+[accessible: true] `class Foo_3test.Foo_3`
+[accessible: true] `class Footest.Foo`
+[accessible: true] `constructor Foo()test.Foo`
+[accessible: true] `method fCCC=> Int`
+[accessible: true] `object Otest.O.type`
+[accessible: true] `value ctest.C`
+[accessible: true] `value vCCCInt`
+[accessible: true] `variable rCCCInt`
+[accessible: false] `value pVCCCInt`
+[accessible: false] `variable pRCCCInt`
+================================================================================
+
+askScopeCompletion at Completions.scala(35,5)
+================================================================================
+[response] askScopeCompletion at (35,5)
+retrieved 8 members
+[accessible: true] `class Ctest.C`
+[accessible: true] `class Foo_1test.Foo_1`
+[accessible: true] `class Foo_2test.Foo_2`
+[accessible: true] `class Foo_3test.Foo_3`
+[accessible: true] `class Footest.Foo`
+[accessible: true] `constructor Foo()test.Foo`
+[accessible: true] `object Otest.O.type`
+[accessible: true] `value ctest.C`
+================================================================================
+
+askScopeCompletion at Completions.scala(38,5)
+================================================================================
+[response] askScopeCompletion at (38,5)
+retrieved 13 members
+[accessible: true] `class Ctest.C`
+[accessible: true] `class Foo_1test.Foo_1`
+[accessible: true] `class Foo_2test.Foo_2`
+[accessible: true] `class Foo_3test.Foo_3`
+[accessible: true] `class Footest.Foo`
+[accessible: true] `constructor Foo()test.Foo`
+[accessible: true] `method fCCC=> Int`
+[accessible: true] `object Otest.O.type`
+[accessible: true] `value ctest.C`
+[accessible: true] `value vCCCInt`
+[accessible: true] `variable rCCCInt`
+[accessible: false] `value pVCCCInt`
+[accessible: false] `variable pRCCCInt`
+================================================================================
+
+askScopeCompletion at Completions.scala(40,5)
+================================================================================
+[response] askScopeCompletion at (40,5)
+retrieved 18 members
+[accessible: true] `class Ctest.C`
+[accessible: true] `class Foo_1test.Foo_1`
+[accessible: true] `class Foo_2test.Foo_2`
+[accessible: true] `class Foo_3test.Foo_3`
+[accessible: true] `class Footest.Foo`
+[accessible: true] `constructor Foo()test.Foo`
+[accessible: true] `method fCCC=> Int`
+[accessible: true] `method fOOO=> Int`
+[accessible: true] `object Otest.O.type`
+[accessible: true] `value ctest.C`
+[accessible: true] `value vCCCInt`
+[accessible: true] `value vOOOInt`
+[accessible: true] `variable rCCCInt`
+[accessible: true] `variable rOOOInt`
+[accessible: false] `value pVCCCInt`
+[accessible: false] `value pVOOOInt`
+[accessible: false] `variable pRCCCInt`
+[accessible: false] `variable pROOOInt`
+================================================================================
+
+askScopeCompletion at Completions.scala(49,4)
+================================================================================
+[response] askScopeCompletion at (49,4)
+retrieved 18 members
+[accessible: true] `class Ctest.C`
+[accessible: true] `class Foo_1test.Foo_1`
+[accessible: true] `class Foo_2test.Foo_2`
+[accessible: true] `class Foo_3test.Foo_3`
+[accessible: true] `class Footest.Foo`
+[accessible: true] `constructor Foo_1()test.Foo_1`
+[accessible: true] `method bar=> Unit`
+[accessible: true] `method fCCC=> Int`
+[accessible: true] `method fOOO=> Int`
+[accessible: true] `object Otest.O.type`
+[accessible: true] `value vCCCInt`
+[accessible: true] `value vOOOInt`
+[accessible: true] `variable rCCCInt`
+[accessible: true] `variable rOOOInt`
+[accessible: false] `value pVCCCInt`
+[accessible: false] `value pVOOOInt`
+[accessible: false] `variable pRCCCInt`
+[accessible: false] `variable pROOOInt`
+================================================================================
+
+askScopeCompletion at Completions.scala(59,4)
+================================================================================
+[response] askScopeCompletion at (59,4)
+retrieved 19 members
+[accessible: true] `class Ctest.C`
+[accessible: true] `class Foo_1test.Foo_1`
+[accessible: true] `class Foo_2test.Foo_2`
+[accessible: true] `class Foo_3test.Foo_3`
+[accessible: true] `class Footest.Foo`
+[accessible: true] `constructor Foo_2()test.Foo_2`
+[accessible: true] `method bar=> Unit`
+[accessible: true] `method fCCC=> Int`
+[accessible: true] `method fOOO=> Int`
+[accessible: true] `object Otest.O.type`
+[accessible: true] `value otest.O.type`
+[accessible: true] `value vCCCInt`
+[accessible: true] `value vOOOInt`
+[accessible: true] `variable rCCCInt`
+[accessible: true] `variable rOOOInt`
+[accessible: false] `value pVCCCInt`
+[accessible: false] `value pVOOOInt`
+[accessible: false] `variable pRCCCInt`
+[accessible: false] `variable pROOOInt`
+================================================================================
+
+askScopeCompletion at Completions.scala(69,4)
+================================================================================
+[response] askScopeCompletion at (69,4)
+retrieved 14 members
+[accessible: true] `class Ctest.C`
+[accessible: true] `class Foo_1test.Foo_1`
+[accessible: true] `class Foo_2test.Foo_2`
+[accessible: true] `class Foo_3test.Foo_3`
+[accessible: true] `class Footest.Foo`
+[accessible: true] `constructor Foo_3()test.Foo_3`
+[accessible: true] `method bar=> Unit`
+[accessible: true] `method fCCC=> Int`
+[accessible: true] `object Otest.O.type`
+[accessible: true] `value ctest.C`
+[accessible: true] `value vCCCInt`
+[accessible: true] `variable rCCCInt`
+[accessible: false] `value pVCCCInt`
+[accessible: false] `variable pRCCCInt`
+================================================================================
diff --git a/test/files/presentation/scope-completion-import/Test.scala b/test/files/presentation/scope-completion-import/Test.scala
new file mode 100644
index 0000000000..bec1131c4c
--- /dev/null
+++ b/test/files/presentation/scope-completion-import/Test.scala
@@ -0,0 +1,3 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest \ No newline at end of file
diff --git a/test/files/presentation/scope-completion-import/src/Completions.scala b/test/files/presentation/scope-completion-import/src/Completions.scala
new file mode 100644
index 0000000000..d30aa0b4e3
--- /dev/null
+++ b/test/files/presentation/scope-completion-import/src/Completions.scala
@@ -0,0 +1,72 @@
+package test
+
+class C {
+ val vCCC : Int = 0
+ var rCCC : Int = 0
+ private val pVCCC : Int = 0
+ private var pRCCC : Int = 0
+ def fCCC : Int = 0
+}
+
+object O extends C {
+ val vOOO : Int = 0
+ var rOOO : Int = 0
+ private val pVOOO : Int = 0
+ private var pROOO : Int = 0
+ def fOOO : Int = 0
+}
+
+class Foo {
+ {
+ val o = O
+ import o._
+ /*_*/
+ }
+ {
+ import O._
+ /*_*/
+ }
+ {
+ val c = new C
+ import c._
+ /*_*/
+ }
+ {
+ f/*_*/
+ val c = new C
+ import c._
+ f/*_*/
+ import O._
+ f/*_*/
+ }
+}
+
+class Foo_1 {
+
+ import O._
+
+ def bar {
+ /*_*/
+ }
+}
+
+class Foo_2 {
+
+ val o = O
+ import o._
+
+ def bar {
+ /*_*/
+ }
+}
+
+class Foo_3 {
+
+ val c = new C
+ import c._
+
+ def bar {
+ /*_*/
+ }
+}
+
diff --git a/test/files/presentation/t5708.check b/test/files/presentation/t5708.check
index c6d4762635..fe43f83cf4 100644
--- a/test/files/presentation/t5708.check
+++ b/test/files/presentation/t5708.check
@@ -2,7 +2,7 @@ reload: Completions.scala
askTypeCompletion at Completions.scala(17,9)
================================================================================
-[response] aksTypeCompletion at (17,9)
+[response] askTypeCompletion at (17,9)
retrieved 44 members
[accessible: true] `lazy value fooInt`
[accessible: true] `method !=(x$1: Any)Boolean`
diff --git a/test/files/presentation/t7548.check b/test/files/presentation/t7548.check
new file mode 100644
index 0000000000..5bfb0d27fe
--- /dev/null
+++ b/test/files/presentation/t7548.check
@@ -0,0 +1 @@
+(x: Int)Unit
diff --git a/test/files/presentation/t7548/Test.scala b/test/files/presentation/t7548/Test.scala
new file mode 100644
index 0000000000..94a6048056
--- /dev/null
+++ b/test/files/presentation/t7548/Test.scala
@@ -0,0 +1,17 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest {
+ override protected def loadSources() { /* don't parse or typecheck sources */ }
+
+ import compiler._
+
+ override def runDefaultTests() {
+ val res = new Response[Tree]
+ val pos = compiler.rangePos(sourceFiles.head, 102,102,102)
+ compiler.askTypeAt(pos, res)
+ res.get match {
+ case Left(tree) => compiler.ask(() => reporter.println(tree.tpe))
+ case Right(ex) => reporter.println(ex)
+ }
+ }
+}
diff --git a/test/files/presentation/t7548/src/Foo.scala b/test/files/presentation/t7548/src/Foo.scala
new file mode 100644
index 0000000000..cc997f6e5f
--- /dev/null
+++ b/test/files/presentation/t7548/src/Foo.scala
@@ -0,0 +1,7 @@
+object Foo {
+ def foo(x: Int) = {}
+ def foo(x: String) = {}
+ def foo(x: Int, y: String) = {}
+
+ foo(2)
+} \ No newline at end of file
diff --git a/test/files/presentation/t7548b.check b/test/files/presentation/t7548b.check
new file mode 100644
index 0000000000..35445fedf6
--- /dev/null
+++ b/test/files/presentation/t7548b.check
@@ -0,0 +1 @@
+Foo.this.I2BI(Foo.this.I).+: (other: Foo.BI.type)Unit
diff --git a/test/files/presentation/t7548b/Test.scala b/test/files/presentation/t7548b/Test.scala
new file mode 100644
index 0000000000..0c022df839
--- /dev/null
+++ b/test/files/presentation/t7548b/Test.scala
@@ -0,0 +1,17 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest {
+ override protected def loadSources() { /* don't parse or typecheck sources */ }
+
+ import compiler._
+
+ override def runDefaultTests() {
+ val res = new Response[Tree]
+ val pos = compiler.rangePos(sourceFiles.head, 191, 191, 191) // +
+ compiler.askTypeAt(pos, res)
+ res.get match {
+ case Left(tree) => compiler.ask(() => reporter.println(s"$tree: ${tree.tpe}"))
+ case Right(ex) => reporter.println(ex)
+ }
+ }
+}
diff --git a/test/files/presentation/t7548b/src/Foo.scala b/test/files/presentation/t7548b/src/Foo.scala
new file mode 100644
index 0000000000..5cf0a4ef4e
--- /dev/null
+++ b/test/files/presentation/t7548b/src/Foo.scala
@@ -0,0 +1,12 @@
+import language._
+
+object Foo {
+ object I {
+ def +(other: I.type) : Unit = ()
+ }
+ object BI {
+ def +(other: BI.type): Unit = ()
+ }
+ implicit def I2BI(i: I.type): BI.type = BI
+ I.+(BI)
+}
diff --git a/test/files/presentation/t7915.check b/test/files/presentation/t7915.check
new file mode 100644
index 0000000000..b18b4ddb55
--- /dev/null
+++ b/test/files/presentation/t7915.check
@@ -0,0 +1,11 @@
+reload: Foo.scala
+
+askHyperlinkPos for `Bar` at (7,11) Foo.scala
+================================================================================
+[response] found askHyperlinkPos for `Bar` at (1,7) Foo.scala
+================================================================================
+
+askHyperlinkPos for `bar` at (7,22) Foo.scala
+================================================================================
+[response] found askHyperlinkPos for `bar` at (2,7) Foo.scala
+================================================================================
diff --git a/test/files/presentation/t7915/Test.scala b/test/files/presentation/t7915/Test.scala
new file mode 100644
index 0000000000..c2f89bdb17
--- /dev/null
+++ b/test/files/presentation/t7915/Test.scala
@@ -0,0 +1,8 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest {
+ override def runDefaultTests() {
+ sourceFiles foreach (src => askLoadedTyped(src).get)
+ super.runDefaultTests()
+ }
+}
diff --git a/test/files/presentation/t7915/src/Foo.scala b/test/files/presentation/t7915/src/Foo.scala
new file mode 100644
index 0000000000..a4166ae5b4
--- /dev/null
+++ b/test/files/presentation/t7915/src/Foo.scala
@@ -0,0 +1,9 @@
+class Bar {
+ def bar(b: Int = 2) {}
+}
+
+class Foo {
+ def foo() {
+ new Bar/*#*/().bar/*#*/()
+ }
+}
diff --git a/test/files/presentation/t8085.check b/test/files/presentation/t8085.check
new file mode 100644
index 0000000000..79c1b2aa17
--- /dev/null
+++ b/test/files/presentation/t8085.check
@@ -0,0 +1,3 @@
+reload: NodeScalaSuite.scala
+open package module: package nodescala
+Test OK
diff --git a/test/files/presentation/t8085.flags b/test/files/presentation/t8085.flags
new file mode 100644
index 0000000000..ec35b223d8
--- /dev/null
+++ b/test/files/presentation/t8085.flags
@@ -0,0 +1 @@
+-sourcepath src
diff --git a/test/files/presentation/t8085/Test.scala b/test/files/presentation/t8085/Test.scala
new file mode 100644
index 0000000000..e46b7ab8c8
--- /dev/null
+++ b/test/files/presentation/t8085/Test.scala
@@ -0,0 +1,27 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+import scala.reflect.internal.util.SourceFile
+import scala.tools.nsc.interactive.Response
+
+object Test extends InteractiveTest {
+
+ override def execute(): Unit = {
+ val src = loadSourceAndWaitUntilTypechecked("NodeScalaSuite.scala")
+ checkErrors(src)
+ }
+
+ private def loadSourceAndWaitUntilTypechecked(sourceName: String): SourceFile = {
+ val sourceFile = sourceFiles.find(_.file.name == sourceName).head
+ askReload(List(sourceFile)).get
+ askLoadedTyped(sourceFile).get
+ sourceFile
+ }
+
+ private def checkErrors(source: SourceFile): Unit = compiler.getUnitOf(source) match {
+ case Some(unit) =>
+ val problems = unit.problems.toList
+ if(problems.isEmpty) reporter.println("Test OK")
+ else problems.foreach(problem => reporter.println(problem.msg))
+
+ case None => reporter.println("No compilation unit found for " + source.file.name)
+ }
+}
diff --git a/test/files/presentation/t8085/src/nodescala/Foo.scala b/test/files/presentation/t8085/src/nodescala/Foo.scala
new file mode 100644
index 0000000000..19efdb65dd
--- /dev/null
+++ b/test/files/presentation/t8085/src/nodescala/Foo.scala
@@ -0,0 +1,3 @@
+package nodescala
+
+class Foo
diff --git a/test/files/presentation/t8085/src/nodescala/NodeScalaSuite.scala b/test/files/presentation/t8085/src/nodescala/NodeScalaSuite.scala
new file mode 100644
index 0000000000..45e43c7afb
--- /dev/null
+++ b/test/files/presentation/t8085/src/nodescala/NodeScalaSuite.scala
@@ -0,0 +1,10 @@
+package nodescala
+
+class NodeScalaSuite {
+ "".rich
+
+ // This is here only to prove that the presentation compiler is instantiated with the
+ // correct `sourcepath` value (if it wasn't, you would see a `not found: type Foo` in
+ // the test's output
+ println(new Foo())
+}
diff --git a/test/files/presentation/t8085/src/nodescala/package.scala b/test/files/presentation/t8085/src/nodescala/package.scala
new file mode 100644
index 0000000000..26fb9f08e4
--- /dev/null
+++ b/test/files/presentation/t8085/src/nodescala/package.scala
@@ -0,0 +1,7 @@
+import scala.Some // <-- if you move the import *inside* the package object, then it all works fine!!
+
+package object nodescala {
+ implicit class StringOps(val f: String) {
+ def rich = 0
+ }
+}
diff --git a/test/files/presentation/t8085b.check b/test/files/presentation/t8085b.check
new file mode 100644
index 0000000000..79c1b2aa17
--- /dev/null
+++ b/test/files/presentation/t8085b.check
@@ -0,0 +1,3 @@
+reload: NodeScalaSuite.scala
+open package module: package nodescala
+Test OK
diff --git a/test/files/presentation/t8085b.flags b/test/files/presentation/t8085b.flags
new file mode 100644
index 0000000000..ec35b223d8
--- /dev/null
+++ b/test/files/presentation/t8085b.flags
@@ -0,0 +1 @@
+-sourcepath src
diff --git a/test/files/presentation/t8085b/Test.scala b/test/files/presentation/t8085b/Test.scala
new file mode 100644
index 0000000000..e46b7ab8c8
--- /dev/null
+++ b/test/files/presentation/t8085b/Test.scala
@@ -0,0 +1,27 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+import scala.reflect.internal.util.SourceFile
+import scala.tools.nsc.interactive.Response
+
+object Test extends InteractiveTest {
+
+ override def execute(): Unit = {
+ val src = loadSourceAndWaitUntilTypechecked("NodeScalaSuite.scala")
+ checkErrors(src)
+ }
+
+ private def loadSourceAndWaitUntilTypechecked(sourceName: String): SourceFile = {
+ val sourceFile = sourceFiles.find(_.file.name == sourceName).head
+ askReload(List(sourceFile)).get
+ askLoadedTyped(sourceFile).get
+ sourceFile
+ }
+
+ private def checkErrors(source: SourceFile): Unit = compiler.getUnitOf(source) match {
+ case Some(unit) =>
+ val problems = unit.problems.toList
+ if(problems.isEmpty) reporter.println("Test OK")
+ else problems.foreach(problem => reporter.println(problem.msg))
+
+ case None => reporter.println("No compilation unit found for " + source.file.name)
+ }
+}
diff --git a/test/files/presentation/t8085b/src/p1/nodescala/Foo.scala b/test/files/presentation/t8085b/src/p1/nodescala/Foo.scala
new file mode 100644
index 0000000000..8ed1ada6b6
--- /dev/null
+++ b/test/files/presentation/t8085b/src/p1/nodescala/Foo.scala
@@ -0,0 +1,4 @@
+package p1
+package nodescala
+
+class Foo
diff --git a/test/files/presentation/t8085b/src/p1/nodescala/NodeScalaSuite.scala b/test/files/presentation/t8085b/src/p1/nodescala/NodeScalaSuite.scala
new file mode 100644
index 0000000000..f6da67bdc7
--- /dev/null
+++ b/test/files/presentation/t8085b/src/p1/nodescala/NodeScalaSuite.scala
@@ -0,0 +1,11 @@
+package p1
+package nodescala
+
+class NodeScalaSuite {
+ "".rich
+
+ // This is here only to prove that the presentation compiler is instantiated with the
+ // correct `sourcepath` value (if it wasn't, you would see a `not found: type Foo` in
+ // the test's output
+ println(new Foo())
+}
diff --git a/test/files/presentation/t8085b/src/p1/nodescala/package.scala b/test/files/presentation/t8085b/src/p1/nodescala/package.scala
new file mode 100644
index 0000000000..cc383f1bab
--- /dev/null
+++ b/test/files/presentation/t8085b/src/p1/nodescala/package.scala
@@ -0,0 +1,9 @@
+import scala.Some // <-- if you move the import *inside* the package object, then it all works fine!!
+
+package p1 {
+ package object nodescala {
+ implicit class StringOps(val f: String) {
+ def rich = 0
+ }
+ }
+}
diff --git a/test/files/presentation/visibility.check b/test/files/presentation/visibility.check
index 3026e58f7e..221e3fc6a0 100644
--- a/test/files/presentation/visibility.check
+++ b/test/files/presentation/visibility.check
@@ -2,7 +2,7 @@ reload: Completions.scala
askTypeCompletion at Completions.scala(14,12)
================================================================================
-[response] aksTypeCompletion at (14,12)
+[response] askTypeCompletion at (14,12)
retrieved 42 members
[accessible: true] `method !=(x$1: Any)Boolean`
[accessible: true] `method !=(x$1: AnyRef)Boolean`
@@ -46,7 +46,7 @@ retrieved 42 members
askTypeCompletion at Completions.scala(16,11)
================================================================================
-[response] aksTypeCompletion at (16,11)
+[response] askTypeCompletion at (16,11)
retrieved 42 members
[accessible: true] `method !=(x$1: Any)Boolean`
[accessible: true] `method !=(x$1: AnyRef)Boolean`
@@ -90,7 +90,7 @@ retrieved 42 members
askTypeCompletion at Completions.scala(22,11)
================================================================================
-[response] aksTypeCompletion at (22,11)
+[response] askTypeCompletion at (22,11)
retrieved 42 members
[accessible: true] `method !=(x$1: Any)Boolean`
[accessible: true] `method !=(x$1: AnyRef)Boolean`
@@ -134,7 +134,7 @@ retrieved 42 members
askTypeCompletion at Completions.scala(28,10)
================================================================================
-[response] aksTypeCompletion at (28,10)
+[response] askTypeCompletion at (28,10)
retrieved 42 members
[accessible: true] `method !=(x$1: Any)Boolean`
[accessible: true] `method !=(x$1: AnyRef)Boolean`
@@ -178,7 +178,7 @@ retrieved 42 members
askTypeCompletion at Completions.scala(37,8)
================================================================================
-[response] aksTypeCompletion at (37,8)
+[response] askTypeCompletion at (37,8)
retrieved 42 members
[accessible: true] `method !=(x$1: Any)Boolean`
[accessible: true] `method !=(x$1: AnyRef)Boolean`
diff --git a/test/files/run/dynamic-applyDynamic.check b/test/files/run/dynamic-applyDynamic.check
new file mode 100644
index 0000000000..89a0d55282
--- /dev/null
+++ b/test/files/run/dynamic-applyDynamic.check
@@ -0,0 +1,14 @@
+[[syntax trees at end of typer]] // newSource1.scala
+[0:67]package [0:0]<empty> {
+ [0:67]object X extends [9:67][67]scala.AnyRef {
+ [9]def <init>(): [9]X.type = [9]{
+ [9][9][9]X.super.<init>();
+ [9]()
+ };
+ [17:30]private[this] val d: [21]D = [25:30][25:30][25:30]new [29:30]D();
+ [21]<stable> <accessor> def d: [21]D = [21][21]X.this.d;
+ [37:49][37:38][37:38][37]X.this.d.applyDynamic(<39:45>"method")([46:48]10);
+ [56:61]<56:57><56:57>[56]X.this.d.applyDynamic(<56:57>"apply")([58:60]10)
+ }
+}
+
diff --git a/test/files/run/dynamic-applyDynamic.scala b/test/files/run/dynamic-applyDynamic.scala
new file mode 100644
index 0000000000..b06041194c
--- /dev/null
+++ b/test/files/run/dynamic-applyDynamic.scala
@@ -0,0 +1,26 @@
+import scala.tools.partest.DirectTest
+
+object Test extends DirectTest {
+
+ override def extraSettings: String =
+ s"-usejavacp -Xprint-pos -Xprint:typer -Yrangepos -Ystop-after:typer -d ${testOutput.path}"
+
+ override def code = """
+ object X {
+ val d = new D
+ d.method(10)
+ d(10)
+ }
+ """.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
+
+import language.dynamics
+class D extends Dynamic {
+ def applyDynamic(name: String)(value: Any) = ???
+} \ No newline at end of file
diff --git a/test/files/run/dynamic-applyDynamicNamed.check b/test/files/run/dynamic-applyDynamicNamed.check
new file mode 100644
index 0000000000..17fa496646
--- /dev/null
+++ b/test/files/run/dynamic-applyDynamicNamed.check
@@ -0,0 +1,14 @@
+[[syntax trees at end of typer]] // newSource1.scala
+[0:97]package [0:0]<empty> {
+ [0:97]object X extends [9:97][97]scala.AnyRef {
+ [9]def <init>(): [9]X.type = [9]{
+ [9][9][9]X.super.<init>();
+ [9]()
+ };
+ [17:30]private[this] val d: [21]D = [25:30][25:30][25:30]new [29:30]D();
+ [21]<stable> <accessor> def d: [21]D = [21][21]X.this.d;
+ [37:70][37:38][37:38][37]X.this.d.applyDynamicNamed(<39:43>"meth")([44:55][44][44][44]scala.this.Tuple2.apply[[44]String, [44]Int]([44:50]"value1", [53:55]10), [57:69][57][57][57]scala.this.Tuple2.apply[[57]String, [57]Int]([57:63]"value2", [66:69]100));
+ [77:91]<77:78><77:78>[77]X.this.d.applyDynamicNamed(<77:78>"apply")([79:90][79][79][79]scala.this.Tuple2.apply[[79]String, [79]Int]([79:85]"value1", [88:90]10))
+ }
+}
+
diff --git a/test/files/run/dynamic-applyDynamicNamed.scala b/test/files/run/dynamic-applyDynamicNamed.scala
new file mode 100644
index 0000000000..cc59f9058b
--- /dev/null
+++ b/test/files/run/dynamic-applyDynamicNamed.scala
@@ -0,0 +1,26 @@
+import scala.tools.partest.DirectTest
+
+object Test extends DirectTest {
+
+ override def extraSettings: String =
+ s"-usejavacp -Xprint-pos -Xprint:typer -Yrangepos -Ystop-after:typer -d ${testOutput.path}"
+
+ override def code = """
+ object X {
+ val d = new D
+ d.meth(value1 = 10, value2 = 100)
+ d(value1 = 10)
+ }
+ """.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
+
+import language.dynamics
+class D extends Dynamic {
+ def applyDynamicNamed(name: String)(value: (String, Any)*) = ???
+}
diff --git a/test/files/run/dynamic-selectDynamic.check b/test/files/run/dynamic-selectDynamic.check
new file mode 100644
index 0000000000..7f95ed3d19
--- /dev/null
+++ b/test/files/run/dynamic-selectDynamic.check
@@ -0,0 +1,13 @@
+[[syntax trees at end of typer]] // newSource1.scala
+[0:50]package [0:0]<empty> {
+ [0:50]object X extends [9:50][50]scala.AnyRef {
+ [9]def <init>(): [9]X.type = [9]{
+ [9][9][9]X.super.<init>();
+ [9]()
+ };
+ [17:30]private[this] val d: [21]D = [25:30][25:30][25:30]new [29:30]D();
+ [21]<stable> <accessor> def d: [21]D = [21][21]X.this.d;
+ [37:38][37:38][37]X.this.d.selectDynamic(<39:44>"field")
+ }
+}
+
diff --git a/test/files/run/dynamic-selectDynamic.scala b/test/files/run/dynamic-selectDynamic.scala
new file mode 100644
index 0000000000..bd6c138c50
--- /dev/null
+++ b/test/files/run/dynamic-selectDynamic.scala
@@ -0,0 +1,25 @@
+import scala.tools.partest.DirectTest
+
+object Test extends DirectTest {
+
+ override def extraSettings: String =
+ s"-usejavacp -Xprint-pos -Xprint:typer -Yrangepos -Ystop-after:typer -d ${testOutput.path}"
+
+ override def code = """
+ object X {
+ val d = new D
+ d.field
+ }
+ """.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
+
+import language.dynamics
+class D extends Dynamic {
+ def selectDynamic(name: String) = ???
+}
diff --git a/test/files/run/dynamic-updateDynamic.check b/test/files/run/dynamic-updateDynamic.check
new file mode 100644
index 0000000000..3e21b7dfdc
--- /dev/null
+++ b/test/files/run/dynamic-updateDynamic.check
@@ -0,0 +1,14 @@
+[[syntax trees at end of typer]] // newSource1.scala
+[0:69]package [0:0]<empty> {
+ [0:69]object X extends [9:69][69]scala.AnyRef {
+ [9]def <init>(): [9]X.type = [9]{
+ [9][9][9]X.super.<init>();
+ [9]()
+ };
+ [17:30]private[this] val d: [21]D = [25:30][25:30][25:30]new [29:30]D();
+ [21]<stable> <accessor> def d: [21]D = [21][21]X.this.d;
+ [37:49][37:38][37:38][37]X.this.d.updateDynamic(<39:44>"field")([47:49]10);
+ [56:57][56:57][56]X.this.d.selectDynamic(<58:63>"field")
+ }
+}
+
diff --git a/test/files/run/dynamic-updateDynamic.scala b/test/files/run/dynamic-updateDynamic.scala
new file mode 100644
index 0000000000..80fe0ea35f
--- /dev/null
+++ b/test/files/run/dynamic-updateDynamic.scala
@@ -0,0 +1,28 @@
+import scala.tools.partest.DirectTest
+
+object Test extends DirectTest {
+
+ override def extraSettings: String =
+ s"-usejavacp -Xprint-pos -Xprint:typer -Yrangepos -Ystop-after:typer -d ${testOutput.path}"
+
+ override def code = """
+ object X {
+ val d = new D
+ d.field = 10
+ d.field
+ }
+ """.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
+
+import language.dynamics
+class D extends Dynamic {
+ def selectDynamic(name: String): Any = ???
+ def updateDynamic(name: String)(value: Any): Unit = ???
+}
+
diff --git a/test/files/run/large_code.check b/test/files/run/large_code.check
new file mode 100644
index 0000000000..6ad50967bc
--- /dev/null
+++ b/test/files/run/large_code.check
@@ -0,0 +1,3 @@
+newSource1.scala:1: error: Could not write class BigEnoughToFail because it exceeds JVM code size limits. Method tooLong's code too large!
+class BigEnoughToFail {
+ ^
diff --git a/test/files/run/large_code.scala b/test/files/run/large_code.scala
new file mode 100644
index 0000000000..f9d7f8c95b
--- /dev/null
+++ b/test/files/run/large_code.scala
@@ -0,0 +1,24 @@
+import scala.tools.partest._
+import java.io.{Console => _, _}
+
+// a cold run of partest takes about 15s for this test on my laptop
+object Test extends DirectTest {
+ override def extraSettings: String = "-usejavacp -d " + testOutput.path
+
+ // test that we hit the code size limit and error out gracefully
+ // 5958 is the magic number (2^16/11 -- each `a(1,2,3,4,5,6)` is 11 bytes of bytecode)
+ override def code
+ = s"""
+ |class BigEnoughToFail {
+ | def a(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int): Unit = {}
+ | def tooLong: Unit = {
+ | ${(1 to 5958) map (_ => "a(1,2,3,4,5,6)") mkString(";")}
+ | }
+ |}""".stripMargin.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
diff --git a/test/files/run/t4542.check b/test/files/run/t4542.check
index cd7a2905e2..5c293a8d80 100644
--- a/test/files/run/t4542.check
+++ b/test/files/run/t4542.check
@@ -11,9 +11,6 @@ defined class Foo
scala> val f = new Foo
<console>:8: warning: class Foo is deprecated: foooo
val f = new Foo
- ^
-<console>:8: warning: class Foo is deprecated: foooo
- val f = new Foo
^
f: Foo = Bippy
diff --git a/test/files/run/t6546.flags b/test/files/run/t6546.flags
new file mode 100644
index 0000000000..eb4d19bcb9
--- /dev/null
+++ b/test/files/run/t6546.flags
@@ -0,0 +1 @@
+-optimise \ No newline at end of file
diff --git a/test/files/run/t6546/A_1.scala b/test/files/run/t6546/A_1.scala
new file mode 100644
index 0000000000..bd086c08f8
--- /dev/null
+++ b/test/files/run/t6546/A_1.scala
@@ -0,0 +1,6 @@
+final class Opt {
+ @inline def getOrElse(x: => String): String = ""
+}
+class A_1 {
+ def f(x: Opt): String = x getOrElse null
+}
diff --git a/test/files/run/t6546/B_2.scala b/test/files/run/t6546/B_2.scala
new file mode 100644
index 0000000000..64ec966f75
--- /dev/null
+++ b/test/files/run/t6546/B_2.scala
@@ -0,0 +1,8 @@
+import scala.tools.partest.BytecodeTest
+
+object Test extends BytecodeTest {
+ def show: Unit = {
+ val node = loadClassNode("A_1")
+ assert(node.innerClasses.isEmpty, node.innerClasses)
+ }
+}
diff --git a/test/files/run/t7439.check b/test/files/run/t7439.check
new file mode 100644
index 0000000000..ce9e8b52ff
--- /dev/null
+++ b/test/files/run/t7439.check
@@ -0,0 +1 @@
+pos: NoPosition Class A_1 not found - continuing with a stub. WARNING
diff --git a/test/files/run/t7439/A_1.java b/test/files/run/t7439/A_1.java
new file mode 100644
index 0000000000..4accd95d57
--- /dev/null
+++ b/test/files/run/t7439/A_1.java
@@ -0,0 +1,3 @@
+public class A_1 {
+
+} \ No newline at end of file
diff --git a/test/files/run/t7439/B_1.java b/test/files/run/t7439/B_1.java
new file mode 100644
index 0000000000..5dd3b93d6f
--- /dev/null
+++ b/test/files/run/t7439/B_1.java
@@ -0,0 +1,3 @@
+public class B_1 {
+ public void b(A_1[] a) {}
+}
diff --git a/test/files/run/t7439/Test_2.scala b/test/files/run/t7439/Test_2.scala
new file mode 100644
index 0000000000..e00e9d1b68
--- /dev/null
+++ b/test/files/run/t7439/Test_2.scala
@@ -0,0 +1,31 @@
+import scala.tools.partest._
+import java.io.File
+
+object Test extends StoreReporterDirectTest {
+ def code = ???
+
+ def compileCode(code: String) = {
+ val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator")
+ compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code)
+ }
+
+ def C = """
+ class C {
+ new B_1
+ }
+ """
+
+ def show(): Unit = {
+ //compileCode(C)
+ assert(filteredInfos.isEmpty, filteredInfos)
+
+ // blow away the entire package
+ val a1Class = new File(testOutput.path, "A_1.class")
+ assert(a1Class.exists)
+ assert(a1Class.delete())
+
+ // bad symbolic reference error expected (but no stack trace!)
+ compileCode(C)
+ println(storeReporter.infos.mkString("\n")) // Included a NullPointerException before.
+ }
+}
diff --git a/test/files/run/t7912.scala b/test/files/run/t7912.scala
new file mode 100644
index 0000000000..3d603e0e97
--- /dev/null
+++ b/test/files/run/t7912.scala
@@ -0,0 +1,16 @@
+case object A { override def toString = ??? }
+
+object Test {
+ def foo: Int = (A: Any) match {
+ case 0 => 0
+ }
+ def main(args: Array[String]): Unit = {
+ try {
+ foo
+ sys.error("no exception")
+ } catch {
+ case me: MatchError => assert(me.getMessage == "an instance of class A$", me.getMessage)
+ case ex: Throwable => sys.error("not a match error: " + ex.getClass)
+ }
+ }
+}
diff --git a/test/files/run/t8010.scala b/test/files/run/t8010.scala
new file mode 100644
index 0000000000..8636bbd12e
--- /dev/null
+++ b/test/files/run/t8010.scala
@@ -0,0 +1,22 @@
+trait Base {
+ def t = 1
+ def t(n: Int) = n
+ def bt = 2
+ def bt(n: Int) = n
+}
+trait Derived extends Base {
+ // was: double defintion error
+ override def t = 1 + super.t
+ override def t(n: Int) = 1 + super.t(n)
+ override def bt = 1 + super.bt
+ override def bt(n: Int) = 1 + super.bt(n)
+}
+
+object Test extends App {
+ val d = new Derived {}
+ // not the focus of thie bug, but let's just check the runtime behaviour while we're here.
+ assert(d.t == 2)
+ assert(d.t(1) == 2)
+ assert(d.bt == 3)
+ assert(d.bt(1) == 2)
+}
diff --git a/test/files/run/t8029.scala b/test/files/run/t8029.scala
new file mode 100644
index 0000000000..dbd5c41387
--- /dev/null
+++ b/test/files/run/t8029.scala
@@ -0,0 +1,57 @@
+import scala.tools.partest._
+import scala.tools.nsc._
+
+object Test extends DirectTest {
+
+ override def extraSettings: String = "-usejavacp -nowarn -Ystop-after:typer"
+
+ override def code = "" // not used
+
+ def code1 = """
+package object p1 {
+ trait A
+ object A
+}
+ """
+
+ def code2 = """
+package object p2 {
+ class A
+ object A
+}
+ """
+
+ def code3 = """
+package object p3 {
+ object A
+ trait A
+}
+ """
+
+ def code4 = """
+package object p4 {
+ object A
+ trait A
+}
+ """
+
+ def show() {
+ val global = newCompiler()
+ import global._
+ def typecheck(code: String): Unit = {
+ val r = new Run
+ val sourceFile = newSources(code).head
+ global.reporter.reset()
+ r.compileSources(sourceFile :: Nil)
+ assert(!global.reporter.hasErrors)
+ }
+
+ def typecheckTwice(code: String): Unit = {
+ typecheck(code)
+ typecheck(code)
+ }
+
+ // was: illegal cyclic reference involving package ...
+ Seq(code1, code2, code3, code4) foreach typecheckTwice
+ }
+}
diff --git a/test/files/run/t8114.scala b/test/files/run/t8114.scala
new file mode 100644
index 0000000000..ecbca37d2a
--- /dev/null
+++ b/test/files/run/t8114.scala
@@ -0,0 +1,15 @@
+class AbstractTable[T] { type TableElementType }
+class Table[T] extends AbstractTable[T] { type TableElementType = T }
+
+class Query[E, U]
+class TableQuery[E <: AbstractTable[_]] extends Query[E, E#TableElementType]
+
+object Test extends App {
+ object MyTable extends TableQuery[Table[Long]]
+
+ def list[R](q: Query[_, R]): List[R] = Nil
+ list/*[Long]*/(MyTable) collect { case x => x }
+
+ // Generates a redundant bridge method (double definition error)
+ // in 2.10.x due to (at least) the bug in erasure fixed in SI-7120
+}
diff --git a/test/files/run/toolbox_rangepos.check b/test/files/run/toolbox_rangepos.check
new file mode 100644
index 0000000000..b536d3fde1
--- /dev/null
+++ b/test/files/run/toolbox_rangepos.check
@@ -0,0 +1 @@
+RangePosition(<toolbox>, 0, 2, 5)
diff --git a/test/files/run/toolbox_rangepos.scala b/test/files/run/toolbox_rangepos.scala
new file mode 100644
index 0000000000..41fe6daa03
--- /dev/null
+++ b/test/files/run/toolbox_rangepos.scala
@@ -0,0 +1,8 @@
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val toolbox = cm.mkToolBox(options = "-Yrangepos")
+ val tree = toolbox.parse("2 + 2")
+ println(tree.pos)
+}