summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--bincompat-backward.whitelist.conf9
-rw-r--r--bincompat-forward.whitelist.conf97
-rw-r--r--build.number2
-rwxr-xr-xbuild.xml54
-rw-r--r--docs/development/scala.tools.nsc/zipfile-bug.txt93
-rw-r--r--spec/02-identifiers-names-and-scopes.md2
-rw-r--r--spec/03-types.md4
-rw-r--r--spec/04-basic-declarations-and-definitions.md2
-rw-r--r--spec/06-expressions.md6
-rw-r--r--spec/08-pattern-matching.md4
-rw-r--r--spec/10-xml-expressions-and-patterns.md2
-rw-r--r--spec/12-the-scala-standard-library.md2
-rw-r--r--src/compiler/scala/reflect/macros/compiler/DefaultMacroCompiler.scala2
-rw-r--r--src/compiler/scala/reflect/macros/compiler/Errors.scala1
-rw-r--r--src/compiler/scala/reflect/macros/compiler/Resolvers.scala6
-rw-r--r--src/compiler/scala/reflect/macros/compiler/Validators.scala2
-rw-r--r--src/compiler/scala/reflect/macros/util/Helpers.scala6
-rw-r--r--src/compiler/scala/reflect/quasiquotes/Parsers.scala2
-rw-r--r--src/compiler/scala/reflect/quasiquotes/Reifiers.scala1
-rw-r--r--src/compiler/scala/reflect/reify/Reifier.scala1
-rw-r--r--src/compiler/scala/reflect/reify/codegen/GenUtils.scala4
-rw-r--r--src/compiler/scala/tools/nsc/CompilationUnits.scala1
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala12
-rw-r--r--src/compiler/scala/tools/nsc/Parsing.scala1
-rw-r--r--src/compiler/scala/tools/nsc/Reporting.scala1
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala18
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala24
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala1
-rw-r--r--src/compiler/scala/tools/nsc/settings/MutableSettings.scala26
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala7
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaVersion.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Delambdafy.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala3
-rw-r--r--src/compiler/scala/tools/nsc/transform/Flatten.scala7
-rw-r--r--src/compiler/scala/tools/nsc/transform/OverridingPairs.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala24
-rw-r--r--src/compiler/scala/tools/nsc/transform/Statics.scala3
-rw-r--r--src/compiler/scala/tools/nsc/transform/TailCalls.scala41
-rw-r--r--src/compiler/scala/tools/nsc/transform/TypeAdaptingTransformer.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala10
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala9
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala7
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Tags.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Unapplies.scala25
-rw-r--r--src/intellij-14/README12
-rw-r--r--src/intellij-14/actors.iml.SAMPLE14
-rw-r--r--src/intellij-14/asm.iml.SAMPLE12
-rw-r--r--src/intellij-14/compiler.iml.SAMPLE16
-rwxr-xr-xsrc/intellij-14/diff.sh8
-rw-r--r--src/intellij-14/forkjoin.iml.SAMPLE11
-rw-r--r--src/intellij-14/interactive.iml.SAMPLE16
-rw-r--r--src/intellij-14/library.iml.SAMPLE13
-rw-r--r--src/intellij-14/manual.iml.SAMPLE15
-rw-r--r--src/intellij-14/partest-extras.iml.SAMPLE18
-rw-r--r--src/intellij-14/partest-javaagent.iml.SAMPLE13
-rw-r--r--src/intellij-14/reflect.iml.SAMPLE13
-rw-r--r--src/intellij-14/repl.iml.SAMPLE16
-rw-r--r--src/intellij-14/scala.iml.SAMPLE11
-rw-r--r--src/intellij-14/scala.ipr.SAMPLE261
-rw-r--r--src/intellij-14/scaladoc.iml.SAMPLE17
-rw-r--r--src/intellij-14/scalap.iml.SAMPLE15
-rwxr-xr-xsrc/intellij-14/setup.sh14
-rw-r--r--src/intellij-14/test-junit.iml.SAMPLE22
-rw-r--r--src/intellij-14/test.iml.SAMPLE22
-rwxr-xr-xsrc/intellij-14/update.sh22
-rw-r--r--src/interactive/scala/tools/nsc/interactive/Global.scala15
-rw-r--r--src/library/scala/collection/TraversableLike.scala2
-rw-r--r--src/library/scala/collection/immutable/List.scala1
-rw-r--r--src/library/scala/collection/immutable/Stream.scala24
-rw-r--r--src/library/scala/collection/mutable/AnyRefMap.scala4
-rw-r--r--src/library/scala/collection/mutable/BitSet.scala8
-rw-r--r--src/library/scala/collection/mutable/LongMap.scala4
-rw-r--r--src/library/scala/reflect/ClassTag.scala3
-rw-r--r--src/reflect/scala/reflect/internal/AnnotationInfos.scala1
-rw-r--r--src/reflect/scala/reflect/internal/Definitions.scala10
-rw-r--r--src/reflect/scala/reflect/internal/Internals.scala1
-rw-r--r--src/reflect/scala/reflect/internal/Printers.scala2
-rw-r--r--src/reflect/scala/reflect/internal/ReificationSupport.scala3
-rw-r--r--src/reflect/scala/reflect/internal/StdNames.scala1
-rw-r--r--src/reflect/scala/reflect/internal/SymbolPairs.scala1
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala64
-rw-r--r--src/reflect/scala/reflect/internal/Trees.scala1
-rw-r--r--src/reflect/scala/reflect/internal/transform/PostErasure.scala1
-rw-r--r--src/reflect/scala/reflect/macros/Typers.scala2
-rw-r--r--src/reflect/scala/reflect/runtime/JavaUniverse.scala2
-rw-r--r--src/reflect/scala/reflect/runtime/SymbolTable.scala2
-rw-r--r--src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala3
-rw-r--r--test/files/neg/t7636.check2
-rw-r--r--test/files/pos/t3439.scala26
-rw-r--r--test/files/pos/t5454.scala10
-rw-r--r--test/files/pos/t8893.scala129
-rw-r--r--test/files/pos/t8900.scala11
-rw-r--r--test/files/pos/t8934a/A_1.scala18
-rw-r--r--test/files/pos/t8934a/Test_2.flags1
-rw-r--r--test/files/pos/t8934a/Test_2.scala12
-rw-r--r--test/files/presentation/private-case-class-members.check1
-rw-r--r--test/files/presentation/private-case-class-members/Test.scala34
-rw-r--r--test/files/presentation/private-case-class-members/src/State.scala5
-rw-r--r--test/files/presentation/quasiquotes.flags0
-rw-r--r--test/files/presentation/t8934.check2
-rw-r--r--test/files/presentation/t8934/Runner.scala27
-rw-r--r--test/files/presentation/t8934/src/Source.scala10
-rw-r--r--test/files/presentation/t8941.check7
-rw-r--r--test/files/presentation/t8941/Runner.scala11
-rw-r--r--test/files/presentation/t8941/src/Source.scala8
-rw-r--r--test/files/presentation/t8941b/IdempotencyTest.scala73
-rw-r--r--test/files/presentation/t8941b/Test.scala53
-rw-r--r--test/files/res/t6613.check5
-rw-r--r--test/files/res/t6613.res3
-rw-r--r--test/files/res/t6613/Broken.scala1
-rw-r--r--test/files/res/t6613/Enummy.java1
-rw-r--r--test/files/res/t8871.check5
-rw-r--r--test/files/res/t8871.res4
-rw-r--r--test/files/res/t8871/tag.scala3
-rw-r--r--test/files/res/t8871/usetag.scala6
-rw-r--r--test/files/run/global-showdef.check8
-rw-r--r--test/files/run/global-showdef.scala52
-rw-r--r--test/files/run/t4332.scala2
-rw-r--r--test/files/run/t4950.check9
-rw-r--r--test/files/run/t4950.scala12
-rw-r--r--test/files/run/t6541-option.scala19
-rw-r--r--test/files/run/t6541.flags1
-rw-r--r--test/files/run/t6541.scala25
-rw-r--r--test/files/run/t8893.scala40
-rw-r--r--test/files/run/t8893b.scala15
-rw-r--r--test/files/run/t8907.scala39
-rw-r--r--test/files/run/xMigration.check49
-rw-r--r--test/files/run/xMigration.scala19
-rw-r--r--test/junit/scala/collection/immutable/StreamTest.scala18
-rw-r--r--test/junit/scala/collection/mutable/BitSetTest.scala22
-rw-r--r--test/junit/scala/issues/BytecodeTests.scala41
-rw-r--r--test/junit/scala/reflect/internal/PrintersTest.scala7
-rw-r--r--test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala18
-rw-r--r--test/junit/scala/tools/nsc/settings/SettingsTest.scala16
-rw-r--r--test/osgi/src/BasicLibrary.scala15
-rw-r--r--test/osgi/src/BasicReflection.scala15
-rw-r--r--test/osgi/src/BasicTest.scala15
-rw-r--r--test/osgi/src/ReflectionToolboxTest.scala15
-rw-r--r--test/osgi/src/ScalaOsgiHelper.scala6
-rw-r--r--test/pending/pos/t3439.scala2
144 files changed, 1687 insertions, 522 deletions
diff --git a/.gitignore b/.gitignore
index 32a1665721..20d700dd12 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,9 +39,9 @@
# eclipse, intellij
/.classpath
/.project
-/src/intellij/*.iml
-/src/intellij/*.ipr
-/src/intellij/*.iws
+/src/intellij*/*.iml
+/src/intellij*/*.ipr
+/src/intellij*/*.iws
**/.cache
/.idea
/.settings
diff --git a/bincompat-backward.whitelist.conf b/bincompat-backward.whitelist.conf
index 6c98dc62a1..076b9bb9aa 100644
--- a/bincompat-backward.whitelist.conf
+++ b/bincompat-backward.whitelist.conf
@@ -186,15 +186,6 @@ filter {
matchName="scala.reflect.runtime.SynchronizedOps.newNestedScope"
problemName=MissingMethodProblem
},
- // see github.com/scala/scala/pull/3925, SI-8627, SI-6440
- {
- matchName="scala.collection.TraversableLike.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.filteredTail"
- problemName=MissingMethodProblem
- },
// https://github.com/scala/scala/pull/3848 -- SI-8680
{
matchName="scala.collection.immutable.Stream.scala$collection$immutable$Stream$$loop$6"
diff --git a/bincompat-forward.whitelist.conf b/bincompat-forward.whitelist.conf
index 87a59f2d53..53401eefad 100644
--- a/bincompat-forward.whitelist.conf
+++ b/bincompat-forward.whitelist.conf
@@ -272,103 +272,6 @@ filter {
matchName="scala.reflect.api.PredefTypeCreator"
problemName=MissingClassProblem
},
- // see github.com/scala/scala/pull/3925, SI-8627, SI-6440
- {
- matchName="scala.collection.IterableViewLike#AbstractTransformed.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.AbstractTraversable.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.TraversableViewLike#AbstractTransformed.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.TraversableLike.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.SeqViewLike#AbstractTransformed.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.TreeSet.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.filteredTail"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.Stream.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.StringOps.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.immutable.TreeMap.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.concurrent.TrieMap.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofByte.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofLong.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofUnit.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofInt.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofChar.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofRef.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofDouble.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofFloat.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofBoolean.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.ArrayOps#ofShort.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.collection.mutable.TreeSet.filterImpl"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.io.AbstractFile.filterImpl"
- problemName=MissingMethodProblem
- },
// https://github.com/scala/scala/pull/3848 -- SI-8680
{
matchName="scala.collection.immutable.Stream.scala$collection$immutable$Stream$$loop$6"
diff --git a/build.number b/build.number
index 21ce660958..dc85ecb777 100644
--- a/build.number
+++ b/build.number
@@ -1,7 +1,7 @@
#Tue Sep 11 19:21:09 CEST 2007
version.major=2
version.minor=11
-version.patch=3
+version.patch=5
# 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 eb86b4fb1a..cb72b05e3e 100755
--- a/build.xml
+++ b/build.xml
@@ -272,28 +272,36 @@ TODO:
</artifact:dependencies>
<!-- JUnit -->
- <property name="junit.version" value="4.10"/>
+ <property name="junit.version" value="4.11"/>
<artifact:dependencies pathId="junit.classpath" filesetId="junit.fileset">
<dependency groupId="junit" artifactId="junit" version="${junit.version}"/>
</artifact:dependencies>
<copy-deps project="junit"/>
<!-- Pax runner -->
- <property name="pax.exam.version" value="2.6.0"/>
+ <property name="pax.exam.version" value="3.5.0"/><!-- Last version which supports Java 6 -->
+ <property name="osgi.felix.version" value="4.0.3"/>
+ <property name="osgi.equinox.version" value="3.7.1"/>
<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-container-native" version="${pax.exam.version}">
+ <exclusion groupId="org.osgi" artifactId="org.osgi.core"/><!-- Avoid dragging in a dependency which requires Java >6 -->
+ </dependency>
<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}"/>
- <!-- 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"/>
+ <dependency groupId="org.ops4j.pax.url" artifactId="pax-url-aether" version="2.2.0"/>
+ <dependency groupId="org.ops4j.pax.swissbox" artifactId="pax-swissbox-tracker" version="1.8.0"/>
+ <dependency groupId="ch.qos.logback" artifactId="logback-core" version="1.1.2"/>
+ <dependency groupId="ch.qos.logback" artifactId="logback-classic" version="1.1.2"/>
<dependency groupId="junit" artifactId="junit" version="${junit.version}"/>
- <dependency groupId="org.apache.felix" artifactId="org.apache.felix.framework" version="3.2.2"/>
</artifact:dependencies>
+ <artifact:dependencies pathId="osgi.framework.felix">
+ <dependency groupId="org.apache.felix" artifactId="org.apache.felix.framework" version="${osgi.felix.version}"/>
+ </artifact:dependencies>
+
+ <artifact:dependencies pathId="osgi.framework.equinox">
+ <dependency groupId="org.eclipse.osgi" artifactId="org.eclipse.osgi" version="${osgi.equinox.version}"/>
+ </artifact:dependencies>
<artifact:remoteRepository id="sonatype-release" url="https://oss.sonatype.org/content/repositories/releases"/>
<artifact:remoteRepository id="extra-repo" url="${extra.repo.url}"/>
@@ -984,6 +992,16 @@ TODO:
<path refid="forkjoin.classpath"/>
</path>
+ <path id="test.osgi.compiler.build.path.felix">
+ <path refid="test.osgi.compiler.build.path"/>
+ <path refid="osgi.framework.felix"/>
+ </path>
+
+ <path id="test.osgi.compiler.build.path.equinox">
+ <path refid="test.osgi.compiler.build.path"/>
+ <path refid="osgi.framework.equinox"/>
+ </path>
+
<path id="test.positions.sub.build.path" path="${build-quick.dir}/classes/library"/>
<!-- TODO: consolidate *.includes -->
@@ -1351,7 +1369,7 @@ TODO:
srcdir="${test.osgi.src}"
jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
- <compilationpath refid="test.osgi.compiler.build.path"/>
+ <compilationpath refid="test.osgi.compiler.build.path.felix"/>
</scalacfork>
<touch file="${build-osgi.dir}/test-compile.complete" verbose="no"/>
<stopwatch name="test.osgi.compiler.timer" action="total"/>
@@ -1365,8 +1383,20 @@ TODO:
<stopwatch name="test.osgi.timer"/>
<mkdir dir="${test.osgi.classes}"/>
+ <echo message="Test pass 1 of 2 using Apache Felix ${osgi.felix.version}"/>
+ <junit fork="yes" haltonfailure="yes">
+ <classpath refid="test.osgi.compiler.build.path.felix"/>
+ <batchtest fork="yes" todir="${build-osgi.dir}">
+ <fileset dir="${test.osgi.classes}">
+ <include name="**/*Test.class"/>
+ </fileset>
+ </batchtest>
+ <formatter type="xml" />
+ </junit>
+
+ <echo message="Test pass 2 of 2 using Eclipse Equinox ${osgi.equinox.version}"/>
<junit fork="yes" haltonfailure="yes">
- <classpath refid="test.osgi.compiler.build.path"/>
+ <classpath refid="test.osgi.compiler.build.path.equinox"/>
<batchtest fork="yes" todir="${build-osgi.dir}">
<fileset dir="${test.osgi.classes}">
<include name="**/*Test.class"/>
diff --git a/docs/development/scala.tools.nsc/zipfile-bug.txt b/docs/development/scala.tools.nsc/zipfile-bug.txt
deleted file mode 100644
index 3838318564..0000000000
--- a/docs/development/scala.tools.nsc/zipfile-bug.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-// Some stack traces of a bug which has been hitting me regularly
-// for over a year (as of oct 2010.) Manifestation: partest hangs.
-// These are some of the regulars among the thread dumps.
-
-"main" prio=5 tid=101801000 nid=0x100501000 in Object.wait() [1004ff000]
- java.lang.Thread.State: WAITING (on object monitor)
- at java.lang.Object.wait(Native Method)
- - waiting on <112bcc7c0> (a scala.actors.ActorProxy)
- at java.lang.Object.wait(Object.java:485)
- at scala.actors.Actor$class.liftedTree1$1(Actor.scala:644)
- at scala.actors.Actor$class.scala$actors$Actor$$suspendActor(Actor.scala:643)
- - locked <112bcc7c0> (a scala.actors.ActorProxy)
- at scala.actors.Actor$blocker$.block(Actor.scala:634)
- at scala.actors.scheduler.ForkJoinScheduler$$anon$2.block(ForkJoinScheduler.scala:145)
- at scala.concurrent.forkjoin.ForkJoinPool.awaitBlocker(ForkJoinPool.java:1791)
- at scala.concurrent.forkjoin.ForkJoinPool.managedBlock(ForkJoinPool.java:1781)
- at scala.actors.scheduler.ForkJoinScheduler.managedBlock(ForkJoinScheduler.scala:144)
- at scala.actors.scheduler.DelegatingScheduler$class.managedBlock(DelegatingScheduler.scala:73)
- at scala.actors.Scheduler$.managedBlock(Scheduler.scala:21)
- at scala.actors.Actor$class.receiveWithin(Actor.scala:576)
- - locked <112bcc7c0> (a scala.actors.ActorProxy)
- at scala.actors.ActorProxy.receiveWithin(ActorProxy.scala:20)
- at scala.actors.Actor$.receiveWithin(Actor.scala:204)
- at scala.tools.partest.nest.DirectRunner$$anonfun$runTestsForFiles$1.apply(DirectRunner.scala:65)
- at scala.tools.partest.nest.DirectRunner$$anonfun$runTestsForFiles$1.apply(DirectRunner.scala:64)
-
-
-"ForkJoinPool-4-worker-11" daemon prio=5 tid=19b680000 nid=0x19d50d000 runnable [19d50b000]
- java.lang.Thread.State: RUNNABLE
- at java.util.zip.ZipFile.getNextEntry(Native Method)
- at java.util.zip.ZipFile.access$400(ZipFile.java:29)
- at java.util.zip.ZipFile$2.nextElement(ZipFile.java:313)
- - locked <12581d1e0> (a java.util.zip.ZipFile)
- at java.util.zip.ZipFile$2.nextElement(ZipFile.java:299)
- at scala.collection.JavaConversions$JEnumerationWrapper.next(JavaConversions.scala:573)
- at scala.collection.Iterator$class.foreach(Iterator.scala:631)
- at scala.collection.JavaConversions$JEnumerationWrapper.foreach(JavaConversions.scala:571)
- at scala.collection.IterableLike$class.foreach(IterableLike.scala:79)
- at scala.tools.nsc.io.ZipArchive$$anon$1.foreach(ZipArchive.scala:246)
- at scala.tools.nsc.io.ZipContainer$ZipRootCreator.apply(ZipArchive.scala:143)
- at scala.tools.nsc.io.ZipArchive.root(ZipArchive.scala:204)
- - locked <12581d240> (a scala.tools.nsc.io.ZipArchive)
- at scala.tools.nsc.io.ZipContainer$class.iterator(ZipArchive.scala:170)
- at scala.tools.nsc.io.ZipArchive.iterator(ZipArchive.scala:197)
- at scala.collection.IterableLike$class.foreach(IterableLike.scala:79)
- at scala.tools.nsc.io.AbstractFile.foreach(AbstractFile.scala:84)
- at scala.collection.TraversableLike$class.collect(TraversableLike.scala:271)
- at scala.tools.nsc.io.AbstractFile.collect(AbstractFile.scala:84)
- at scala.tools.nsc.util.DirectoryClassPath.classes(ClassPath.scala:315)
- - locked <12581d2c8> (a scala.tools.nsc.util.DirectoryClassPath)
- at scala.tools.nsc.util.MergedClassPath$$anonfun$classes$3.apply(ClassPath.scala:342)
- at scala.tools.nsc.util.MergedClassPath$$anonfun$classes$3.apply(ClassPath.scala:342)
- at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
- at scala.collection.immutable.List.foreach(List.scala:45)
- at scala.tools.nsc.util.MergedClassPath.classes(ClassPath.scala:342)
- - locked <12581d390> (a scala.tools.nsc.util.JavaClassPath)
- at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader.doComplete(SymbolLoaders.scala:150)
- at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:58)
- at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:32)
- at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:730)
- at scala.tools.nsc.symtab.Definitions$definitions$.init(Definitions.scala:827)
- at scala.tools.nsc.Global$Run.<init>(Global.scala:626)
-
-
-at java.util.zip.ZipFile.getNextEntry(Native Method)
-at java.util.zip.ZipFile.access$400(ZipFile.java:29)
-at java.util.zip.ZipFile$2.nextElement(ZipFile.java:313)
-- locked <113014f40> (a java.util.zip.ZipFile)
-at java.util.zip.ZipFile$2.nextElement(ZipFile.java:299)
-at scala.collection.JavaConversions$JEnumerationWrapper.next(JavaConversions.scala:556)
-at scala.collection.Iterator$class.foreach(Iterator.scala:631)
-at scala.collection.JavaConversions$JEnumerationWrapper.foreach(JavaConversions.scala:554)
-at scala.collection.IterableLike$class.foreach(IterableLike.scala:79)
-at scala.tools.nsc.io.ZipArchive$$anon$1.foreach(ZipArchive.scala:246)
-at scala.tools.nsc.io.ZipContainer$ZipRootCreator.apply(ZipArchive.scala:143)
- at scala.tools.nsc.io.ZipArchive.root(ZipArchive.scala:204)
-- locked <113018658> (a scala.tools.nsc.io.ZipArchive)
-at scala.tools.nsc.io.ZipContainer$class.iterator(ZipArchive.scala:170)
-at scala.tools.nsc.io.ZipArchive.iterator(ZipArchive.scala:197)
-at scala.collection.IterableLike$class.foreach(IterableLike.scala:79)
-at scala.tools.nsc.io.AbstractFile.foreach(AbstractFile.scala:84)
-at scala.collection.TraversableLike$class.collect(TraversableLike.scala:271)
-at scala.tools.nsc.io.AbstractFile.collect(AbstractFile.scala:84)
-at scala.tools.nsc.util.DirectoryClassPath.classes(ClassPath.scala:315)
-- locked <1130186e0> (a scala.tools.nsc.util.DirectoryClassPath)
-at scala.tools.nsc.util.MergedClassPath$$anonfun$classes$3.apply(ClassPath.scala:342)
-at scala.tools.nsc.util.MergedClassPath$$anonfun$classes$3.apply(ClassPath.scala:342)
-at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
-at scala.collection.immutable.List.foreach(List.scala:45)
-at scala.tools.nsc.util.MergedClassPath.classes(ClassPath.scala:342)
-- locked <1130187a8> (a scala.tools.nsc.util.JavaClassPath)
-at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader.doComplete(SymbolLoaders.scala:150)
- +
diff --git a/spec/02-identifiers-names-and-scopes.md b/spec/02-identifiers-names-and-scopes.md
index afa97c136c..62d326934f 100644
--- a/spec/02-identifiers-names-and-scopes.md
+++ b/spec/02-identifiers-names-and-scopes.md
@@ -71,7 +71,7 @@ The type of $e.x$ is the member type of the referenced entity in $T$.
### Example
-Assume the following two definitions of a objects named `X` in packages `P` and `Q`.
+Assume the following two definitions of objects named `X` in packages `P` and `Q`.
```scala
package P {
diff --git a/spec/03-types.md b/spec/03-types.md
index 2cc5facc4e..d067d45ab2 100644
--- a/spec/03-types.md
+++ b/spec/03-types.md
@@ -821,7 +821,7 @@ the following holds:
parameters by another, the result types as well as variances, lower and upper
bounds of corresponding type parameters are equivalent.
-[^congruence]: A congruence is an equivalence relation which is closed under formation of contexts
+[^congruence]: A congruence is an equivalence relation which is closed under formation of contexts.
[^implicit]: A method type is implicit if the parameter section that defines it starts with the `implicit` keyword.
### Conformance
@@ -939,7 +939,7 @@ limit [^4].
The least upper bound or greatest lower bound might also not be
unique. For instance `A with B` and `B with A` are both
-greatest lower of `A` and `B`. If there are several
+greatest lower bounds of `A` and `B`. If there are several
least upper bounds or greatest lower bounds, the Scala compiler is
free to pick any one of them.
diff --git a/spec/04-basic-declarations-and-definitions.md b/spec/04-basic-declarations-and-definitions.md
index ed7e4c625e..aca1c63d22 100644
--- a/spec/04-basic-declarations-and-definitions.md
+++ b/spec/04-basic-declarations-and-definitions.md
@@ -720,7 +720,7 @@ variable number of integer arguments.
```scala
def sum(args: Int*) = {
var result = 0
- for (arg <- args) result += arg * arg
+ for (arg <- args) result += arg
result
}
```
diff --git a/spec/06-expressions.md b/spec/06-expressions.md
index 03b8065f4b..afd1492744 100644
--- a/spec/06-expressions.md
+++ b/spec/06-expressions.md
@@ -1571,7 +1571,7 @@ $T$ is a value type; if it is a method type we apply
means finding a substitution $\sigma$ of types $T_i$ for the type
parameters $a_i$ such that
-- None of inferred types $T_i$ is a [singleton type](03-types.html#singleton-types)
+- None of the inferred types $T_i$ is a [singleton type](03-types.html#singleton-types)
- All type parameter bounds are respected, i.e.
$\sigma L_i <: \sigma a_i$ and $\sigma a_i <: \sigma U_i$ for $i = 1 , \ldots , n$.
- The expression's type conforms to the expected type, i.e.
@@ -1608,7 +1608,7 @@ constraint system means
finding a substitution $\sigma$ of types $T_i$ for the type parameters
$a_i$ such that
-- None of inferred types $T_i$ is a [singleton type](03-types.html#singleton-types)
+- None of the inferred types $T_i$ is a [singleton type](03-types.html#singleton-types)
- All type parameter bounds are respected, i.e. $\sigma L_i <: \sigma a_i$ and
$\sigma a_i <: \sigma U_i$ for $i = 1 , \ldots , n$.
- The method's result type $T'$ conforms to the expected type, i.e. $\sigma T' <: \sigma \mathit{pt}$.
@@ -1750,7 +1750,7 @@ a sub-expression of parameterless method type, is not evaluated in the expanded
### Dynamic Member Selection
The standard Scala library defines a trait `scala.Dynamic` which defines a member
-\@invokeDynamic@ as follows:
+`applyDynamic` as follows:
```scala
package scala
diff --git a/spec/08-pattern-matching.md b/spec/08-pattern-matching.md
index 8e224de8d2..3538457b5c 100644
--- a/spec/08-pattern-matching.md
+++ b/spec/08-pattern-matching.md
@@ -115,7 +115,7 @@ type of the pattern. The pattern matches any value $v$ such that
To resolve the syntactic overlap with a variable pattern, a
stable identifier pattern may not be a simple name starting with a lower-case
-letter. However, it is possible to enclose a such a variable name in
+letter. However, it is possible to enclose such a variable name in
backquotes; then it is treated as a stable identifier pattern.
###### Example
@@ -283,7 +283,7 @@ shorthand for the constructor or extractor pattern $\mathit{op}(p, q_1
A pattern alternative `$p_1$ | $\ldots$ | $p_n$`
consists of a number of alternative patterns $p_i$. All alternative
patterns are type checked with the expected type of the pattern. They
-may no bind variables other than wildcards. The alternative pattern
+may not bind variables other than wildcards. The alternative pattern
matches a value $v$ if at least one its alternatives matches $v$.
### XML Patterns
diff --git a/spec/10-xml-expressions-and-patterns.md b/spec/10-xml-expressions-and-patterns.md
index 069f499ce9..407b2b9a67 100644
--- a/spec/10-xml-expressions-and-patterns.md
+++ b/spec/10-xml-expressions-and-patterns.md
@@ -59,7 +59,7 @@ sequence of XML nodes (an instance of a subclass of
`scala.Seq[scala.xml.Node]`).
If an XML expression is an entity reference, CDATA section, processing
-instructions or a comments, it is represented by an instance of the
+instruction, or a comment, it is represented by an instance of the
corresponding Scala runtime class.
By default, beginning and trailing whitespace in element content is removed,
diff --git a/spec/12-the-scala-standard-library.md b/spec/12-the-scala-standard-library.md
index 2b3ac1742c..988d9804ec 100644
--- a/spec/12-the-scala-standard-library.md
+++ b/spec/12-the-scala-standard-library.md
@@ -332,7 +332,7 @@ The `toString` method returns `"()"`.
## Standard Reference Classes
This section presents some standard Scala reference classes which are
-treated in a special way in Scala compiler -- either Scala provides
+treated in a special way by the Scala compiler -- either Scala provides
syntactic sugar for them, or the Scala compiler generates special code
for their operations. Other classes in the standard Scala library are
documented in the Scala library documentation by HTML pages.
diff --git a/src/compiler/scala/reflect/macros/compiler/DefaultMacroCompiler.scala b/src/compiler/scala/reflect/macros/compiler/DefaultMacroCompiler.scala
index a13a778b2f..b8384851da 100644
--- a/src/compiler/scala/reflect/macros/compiler/DefaultMacroCompiler.scala
+++ b/src/compiler/scala/reflect/macros/compiler/DefaultMacroCompiler.scala
@@ -12,7 +12,7 @@ abstract class DefaultMacroCompiler extends Resolvers
import treeInfo._
import definitions._
val runDefinitions = currentRun.runDefinitions
- import runDefinitions.{Predef_???, _}
+ import runDefinitions.Predef_???
val typer: global.analyzer.Typer
val context = typer.context
diff --git a/src/compiler/scala/reflect/macros/compiler/Errors.scala b/src/compiler/scala/reflect/macros/compiler/Errors.scala
index cc4508e696..98fd091e9c 100644
--- a/src/compiler/scala/reflect/macros/compiler/Errors.scala
+++ b/src/compiler/scala/reflect/macros/compiler/Errors.scala
@@ -11,7 +11,6 @@ trait Errors extends Traces {
import analyzer._
import definitions._
import treeInfo._
- import typer.TyperErrorGen._
import typer.infer.InferErrorGen._
import runDefinitions._
def globalSettings = global.settings
diff --git a/src/compiler/scala/reflect/macros/compiler/Resolvers.scala b/src/compiler/scala/reflect/macros/compiler/Resolvers.scala
index 4484c234aa..d3f49390ea 100644
--- a/src/compiler/scala/reflect/macros/compiler/Resolvers.scala
+++ b/src/compiler/scala/reflect/macros/compiler/Resolvers.scala
@@ -1,18 +1,12 @@
package scala.reflect.macros
package compiler
-import scala.reflect.internal.Flags._
-import scala.reflect.macros.TypecheckException
-
trait Resolvers {
self: DefaultMacroCompiler =>
import global._
import analyzer._
- import definitions._
import treeInfo._
- import gen._
- import runDefinitions._
trait Resolver {
self: MacroImplRefCompiler =>
diff --git a/src/compiler/scala/reflect/macros/compiler/Validators.scala b/src/compiler/scala/reflect/macros/compiler/Validators.scala
index a146818ae3..fc932f2b18 100644
--- a/src/compiler/scala/reflect/macros/compiler/Validators.scala
+++ b/src/compiler/scala/reflect/macros/compiler/Validators.scala
@@ -9,7 +9,7 @@ trait Validators {
import global._
import analyzer._
import definitions._
- import runDefinitions.{Predef_???, _}
+ import runDefinitions.Predef_???
trait Validator {
self: MacroImplRefCompiler =>
diff --git a/src/compiler/scala/reflect/macros/util/Helpers.scala b/src/compiler/scala/reflect/macros/util/Helpers.scala
index bddc42d1f9..961c41dab5 100644
--- a/src/compiler/scala/reflect/macros/util/Helpers.scala
+++ b/src/compiler/scala/reflect/macros/util/Helpers.scala
@@ -54,14 +54,10 @@ trait Helpers {
*
* @see Metalevels.scala for more information and examples about metalevels
*/
- def increaseMetalevel(pre: Type, tp: Type): Type = {
- val runDefinitions = currentRun.runDefinitions
- import runDefinitions._
-
+ def increaseMetalevel(pre: Type, tp: Type): Type =
transparentShallowTransform(RepeatedParamClass, tp) {
case tp => typeRef(pre, MacroContextExprClass, List(tp))
}
- }
/** Transforms c.Expr[T] types into c.Tree and leaves the rest unchanged.
*/
diff --git a/src/compiler/scala/reflect/quasiquotes/Parsers.scala b/src/compiler/scala/reflect/quasiquotes/Parsers.scala
index 007bac27da..97ec7dbfc3 100644
--- a/src/compiler/scala/reflect/quasiquotes/Parsers.scala
+++ b/src/compiler/scala/reflect/quasiquotes/Parsers.scala
@@ -90,7 +90,7 @@ trait Parsers { self: Quasiquotes =>
case _ => super.makePatDef(mods, pat, rhs)
}
}
- import treeBuilder.{global => _, unit => _, _}
+ import treeBuilder.{global => _, unit => _}
// q"def foo($x)"
override def param(owner: Name, implicitmod: Int, caseParam: Boolean): ValDef =
diff --git a/src/compiler/scala/reflect/quasiquotes/Reifiers.scala b/src/compiler/scala/reflect/quasiquotes/Reifiers.scala
index 07becdc3c6..cc98717c4e 100644
--- a/src/compiler/scala/reflect/quasiquotes/Reifiers.scala
+++ b/src/compiler/scala/reflect/quasiquotes/Reifiers.scala
@@ -8,7 +8,6 @@ import scala.reflect.internal.Flags._
trait Reifiers { self: Quasiquotes =>
import global._
import global.build._
- import global.treeInfo._
import global.definitions._
import Rank._
import universeTypes._
diff --git a/src/compiler/scala/reflect/reify/Reifier.scala b/src/compiler/scala/reflect/reify/Reifier.scala
index b1cc797389..a3e0f02dcc 100644
--- a/src/compiler/scala/reflect/reify/Reifier.scala
+++ b/src/compiler/scala/reflect/reify/Reifier.scala
@@ -21,7 +21,6 @@ abstract class Reifier extends States
import global._
import definitions._
private val runDefinitions = currentRun.runDefinitions
- import runDefinitions._
val typer: global.analyzer.Typer
val universe: Tree
diff --git a/src/compiler/scala/reflect/reify/codegen/GenUtils.scala b/src/compiler/scala/reflect/reify/codegen/GenUtils.scala
index 4512b2cb6f..de9fec0df5 100644
--- a/src/compiler/scala/reflect/reify/codegen/GenUtils.scala
+++ b/src/compiler/scala/reflect/reify/codegen/GenUtils.scala
@@ -5,10 +5,6 @@ trait GenUtils {
self: Reifier =>
import global._
- import treeInfo._
- import definitions._
- private val runDefinitions = currentRun.runDefinitions
- import runDefinitions._
def reifyList(xs: List[Any]): Tree =
mkList(xs map reify)
diff --git a/src/compiler/scala/tools/nsc/CompilationUnits.scala b/src/compiler/scala/tools/nsc/CompilationUnits.scala
index 0a356ed7b6..1a6843a249 100644
--- a/src/compiler/scala/tools/nsc/CompilationUnits.scala
+++ b/src/compiler/scala/tools/nsc/CompilationUnits.scala
@@ -8,7 +8,6 @@ package scala.tools.nsc
import scala.reflect.internal.util.{ SourceFile, NoSourceFile, FreshNameCreator }
import scala.collection.mutable
import scala.collection.mutable.{ LinkedHashSet, ListBuffer }
-import scala.tools.nsc.reporters.Reporter
trait CompilationUnits { global: Global =>
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 452081cff1..9cc9712b44 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -9,17 +9,16 @@ package nsc
import java.io.{ File, FileOutputStream, PrintWriter, IOException, FileNotFoundException }
import java.nio.charset.{ Charset, CharsetDecoder, IllegalCharsetNameException, UnsupportedCharsetException }
-import java.util.UUID._
import scala.compat.Platform.currentTime
import scala.collection.{ mutable, immutable }
import io.{ SourceReader, AbstractFile, Path }
import reporters.{ Reporter, ConsoleReporter }
-import util.{ ClassPath, MergedClassPath, StatisticsInfo, returning, stackTraceString }
+import util.{ ClassPath, StatisticsInfo, returning, stackTraceString }
import scala.reflect.ClassTag
import scala.reflect.internal.util.{ OffsetPosition, SourceFile, NoSourceFile, BatchSourceFile, ScriptSourceFile }
import scala.reflect.internal.pickling.{ PickleBuffer, PickleFormat }
import scala.reflect.io.VirtualFile
-import symtab.{ Flags, SymbolTable, SymbolLoaders, SymbolTrackers }
+import symtab.{ Flags, SymbolTable, SymbolTrackers }
import symtab.classfile.Pickler
import plugins.Plugins
import ast._
@@ -28,7 +27,7 @@ import typechecker._
import transform.patmat.PatternMatching
import transform._
import backend.icode.{ ICodes, GenICode, ICodeCheckers }
-import backend.{ ScalaPrimitives, Platform, JavaPlatform }
+import backend.{ ScalaPrimitives, JavaPlatform }
import backend.jvm.GenBCode
import backend.jvm.GenASM
import backend.opt.{ Inliners, InlineExceptionHandlers, ConstantOptimization, ClosureElimination, DeadCodeElimination }
@@ -1232,13 +1231,12 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
/** does this run compile given class, module, or case factory? */
// NOTE: Early initialized members temporarily typechecked before the enclosing class, see typedPrimaryConstrBody!
- // Here we work around that wrinkle by claiming that a top-level, early-initialized member is compiled in
+ // Here we work around that wrinkle by claiming that a early-initialized member is compiled in
// *every* run. This approximation works because this method is exclusively called with `this` == `currentRun`.
def compiles(sym: Symbol): Boolean =
if (sym == NoSymbol) false
else if (symSource.isDefinedAt(sym)) true
- else if (sym.isTopLevel && sym.isEarlyInitialized) true
- else if (!sym.isTopLevel) compiles(sym.enclosingTopLevelClass)
+ else if (!sym.isTopLevel) compiles(sym.enclosingTopLevelClassOrDummy)
else if (sym.isModuleClass) compiles(sym.sourceModule)
else false
diff --git a/src/compiler/scala/tools/nsc/Parsing.scala b/src/compiler/scala/tools/nsc/Parsing.scala
index 4dd3c3f378..9e5999ce4f 100644
--- a/src/compiler/scala/tools/nsc/Parsing.scala
+++ b/src/compiler/scala/tools/nsc/Parsing.scala
@@ -7,7 +7,6 @@ package scala
package tools.nsc
import scala.reflect.internal.Positions
-import scala.tools.nsc.reporters.Reporter
/** Similar to Reporting: gather global functionality specific to parsing.
*/
diff --git a/src/compiler/scala/tools/nsc/Reporting.scala b/src/compiler/scala/tools/nsc/Reporting.scala
index c9782de7c8..4d7e9e753f 100644
--- a/src/compiler/scala/tools/nsc/Reporting.scala
+++ b/src/compiler/scala/tools/nsc/Reporting.scala
@@ -7,7 +7,6 @@ package scala
package tools
package nsc
-import reporters.{ Reporter, ConsoleReporter }
import scala.collection.{ mutable, immutable }
import scala.reflect.internal.util.StringOps.countElementsAsString
diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
index f9551697d2..ad1975ef23 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
@@ -300,14 +300,16 @@ trait BasicBlocks {
if (!closed)
instructionList = instructionList map (x => map.getOrElse(x, x))
else
- instrs.zipWithIndex collect {
- case (oldInstr, i) if map contains oldInstr =>
- // SI-6288 clone important here because `replaceInstruction` assigns
- // a position to `newInstr`. Without this, a single instruction can
- // be added twice, and the position last position assigned clobbers
- // all previous positions in other usages.
- val newInstr = map(oldInstr).clone()
- code.touched |= replaceInstruction(i, newInstr)
+ instrs.iterator.zipWithIndex foreach {
+ case (oldInstr, i) =>
+ if (map contains oldInstr) {
+ // SI-6288 clone important here because `replaceInstruction` assigns
+ // a position to `newInstr`. Without this, a single instruction can
+ // be added twice, and the position last position assigned clobbers
+ // all previous positions in other usages.
+ val newInstr = map(oldInstr).clone()
+ code.touched |= replaceInstruction(i, newInstr)
+ }
}
////////////////////// Emit //////////////////////
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala
index 4285858bf8..328ec8a033 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala
@@ -6,7 +6,6 @@
package scala.tools.nsc.backend.jvm
import scala.tools.nsc.Global
-import PartialFunction._
/**
* This trait contains code shared between GenBCode and GenASM that depends on types defined in
@@ -19,7 +18,7 @@ final class BCodeAsmCommon[G <: Global](val global: G) {
val ExcludedForwarderFlags = {
import scala.tools.nsc.symtab.Flags._
// Should include DEFERRED but this breaks findMember.
- ( SPECIALIZED | LIFTED | PROTECTED | STATIC | EXPANDEDNAME | BridgeAndPrivateFlags | MACRO )
+ SPECIALIZED | LIFTED | PROTECTED | STATIC | EXPANDEDNAME | BridgeAndPrivateFlags | MACRO
}
/**
@@ -30,10 +29,10 @@ final class BCodeAsmCommon[G <: Global](val global: G) {
*/
def isAnonymousOrLocalClass(classSym: Symbol): Boolean = {
assert(classSym.isClass, s"not a class: $classSym")
- val res = (classSym.isAnonymousClass || !classSym.originalOwner.isClass)
- // lambda classes are always top-level classes.
- if (res) assert(!classSym.isDelambdafyFunction)
- res
+ // Here used to be an `assert(!classSym.isDelambdafyFunction)`: delambdafy lambda classes are
+ // always top-level. However, SI-8900 shows an example where the weak name-based implementation
+ // of isDelambdafyFunction failed (for a function declared in a package named "lambda").
+ classSym.isAnonymousClass || !classSym.originalOwner.isClass
}
/**
@@ -147,9 +146,16 @@ final class BCodeAsmCommon[G <: Global](val global: G) {
annot.args.isEmpty
}
- def isRuntimeVisible(annot: AnnotationInfo): Boolean =
- annot.atp.typeSymbol.getAnnotation(AnnotationRetentionAttr)
- .exists(_.assocs.contains((nme.value -> LiteralAnnotArg(Constant(AnnotationRetentionPolicyRuntimeValue)))))
+ def isRuntimeVisible(annot: AnnotationInfo): Boolean = {
+ annot.atp.typeSymbol.getAnnotation(AnnotationRetentionAttr) match {
+ case Some(retentionAnnot) =>
+ retentionAnnot.assocs.contains(nme.value -> LiteralAnnotArg(Constant(AnnotationRetentionPolicyRuntimeValue)))
+ case _ =>
+ // SI-8926: if the annotation class symbol doesn't have a @RetentionPolicy annotation, the
+ // annotation is emitted with visibility `RUNTIME`
+ true
+ }
+ }
private def retentionPolicyOf(annot: AnnotationInfo): Symbol =
annot.atp.typeSymbol.getAnnotation(AnnotationRetentionAttr).map(_.assocs).map(assoc =>
diff --git a/src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala b/src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala
index 1fadcb8920..c6e699373b 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala
@@ -7,7 +7,6 @@ package scala
package tools.nsc
package backend.opt
-import scala.tools.nsc.backend.icode.analysis.LubException
import scala.annotation.tailrec
/**
diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
index 23611bb629..b4987e1240 100644
--- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
@@ -229,7 +229,8 @@ class MutableSettings(val errorFn: String => Unit)
def OutputSetting(outputDirs: OutputDirs, default: String) = add(new OutputSetting(outputDirs, default))
def PhasesSetting(name: String, descr: String, default: String = "") = add(new PhasesSetting(name, descr, default))
def StringSetting(name: String, arg: String, descr: String, default: String) = add(new StringSetting(name, arg, descr, default))
- def ScalaVersionSetting(name: String, arg: String, descr: String, default: ScalaVersion) = add(new ScalaVersionSetting(name, arg, descr, default))
+ def ScalaVersionSetting(name: String, arg: String, descr: String, initial: ScalaVersion, default: Option[ScalaVersion] = None) =
+ add(new ScalaVersionSetting(name, arg, descr, initial, default))
def PathSetting(name: String, descr: String, default: String): PathSetting = {
val prepend = StringSetting(name + "/p", "", "", "").internalOnly()
val append = StringSetting(name + "/a", "", "", "").internalOnly()
@@ -506,28 +507,35 @@ class MutableSettings(val errorFn: String => Unit)
withHelpSyntax(name + " <" + arg + ">")
}
- /** A setting represented by a Scala version, (`default` unless set) */
+ /** A setting represented by a Scala version.
+ * The `initial` value is used if the setting is not specified.
+ * The `default` value is used if the option is specified without argument (e.g., `-Xmigration`).
+ */
class ScalaVersionSetting private[nsc](
name: String,
val arg: String,
descr: String,
- default: ScalaVersion)
+ initial: ScalaVersion,
+ default: Option[ScalaVersion])
extends Setting(name, descr) {
type T = ScalaVersion
- protected var v: T = NoScalaVersion
+ protected var v: T = initial
+ // This method is invoked if there are no colonated args. In this case the default value is
+ // used. No arguments are consumed.
override def tryToSet(args: List[String]) = {
- value = default
+ default match {
+ case Some(d) => value = d
+ case None => errorFn(s"$name requires an argument, the syntax is $helpSyntax")
+ }
Some(args)
}
override def tryToSetColon(args: List[String]) = args match {
- case Nil => value = default; Some(Nil)
- case x :: xs => value = ScalaVersion(x, errorFn) ; Some(xs)
+ case x :: xs => value = ScalaVersion(x, errorFn); Some(xs)
+ case nil => Some(nil)
}
- override def tryToSetFromPropertyValue(s: String) = tryToSet(List(s))
-
def unparse: List[String] = if (value == NoScalaVersion) Nil else List(s"${name}:${value.unparse}")
withHelpSyntax(s"${name}:<${arg}>")
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index 850534f2cc..c59d56d8f8 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -92,7 +92,8 @@ trait ScalaSettings extends AbsScalaSettings
* The previous "-source" option is intended to be used mainly
* though this helper.
*/
- lazy val isScala211: Boolean = (source.value >= ScalaVersion("2.11.0"))
+ def isScala211: Boolean = source.value >= ScalaVersion("2.11.0")
+ def isScala212: Boolean = source.value >= ScalaVersion("2.12.0")
/**
* -X "Advanced" settings
@@ -111,7 +112,7 @@ trait ScalaSettings extends AbsScalaSettings
val logFreeTerms = BooleanSetting ("-Xlog-free-terms", "Print a message when reification creates a free term.")
val logFreeTypes = BooleanSetting ("-Xlog-free-types", "Print a message when reification resorts to generating a free type.")
val maxClassfileName = IntSetting ("-Xmax-classfile-name", "Maximum filename length for generated classes", 255, Some((72, 255)), _ => None)
- val Xmigration = ScalaVersionSetting ("-Xmigration", "version", "Warn about constructs whose behavior may have changed since version.", AnyScalaVersion)
+ val Xmigration = ScalaVersionSetting ("-Xmigration", "version", "Warn about constructs whose behavior may have changed since version.", initial = NoScalaVersion, default = Some(AnyScalaVersion))
val nouescape = BooleanSetting ("-Xno-uescape", "Disable handling of \\u unicode escapes.")
val Xnojline = BooleanSetting ("-Xnojline", "Do not use JLine for editing.")
val Xverify = BooleanSetting ("-Xverify", "Verify generic signatures in generated bytecode (asm backend only.)")
@@ -133,7 +134,7 @@ trait ScalaSettings extends AbsScalaSettings
val showPhases = BooleanSetting ("-Xshow-phases", "Print a synopsis of compiler phases.")
val sourceReader = StringSetting ("-Xsource-reader", "classname", "Specify a custom method for reading source files.", "")
val strictInference = BooleanSetting ("-Xstrict-inference", "Don't infer known-unsound types")
- val source = ScalaVersionSetting ("-Xsource", "version", "Treat compiler input as Scala source for the specified version, see SI-8126.", ScalaVersion("2.11")) withPostSetHook ( _ => isScala211)
+ val source = ScalaVersionSetting ("-Xsource", "version", "Treat compiler input as Scala source for the specified version, see SI-8126.", initial = ScalaVersion("2.11"))
val XnoPatmatAnalysis = BooleanSetting ("-Xno-patmat-analysis", "Don't perform exhaustivity/unreachability analysis. Also, ignore @switch annotation.")
val XfullLubs = BooleanSetting ("-Xfull-lubs", "Retains pre 2.10 behavior of less aggressive truncation of least upper bounds.")
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaVersion.scala b/src/compiler/scala/tools/nsc/settings/ScalaVersion.scala
index 4f45043c5e..43bdad5882 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaVersion.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaVersion.scala
@@ -34,7 +34,7 @@ case object NoScalaVersion extends ScalaVersion {
* to segregate builds
*/
case class SpecificScalaVersion(major: Int, minor: Int, rev: Int, build: ScalaBuild) extends ScalaVersion {
- def unparse = s"${major}.${minor}.${rev}.${build.unparse}"
+ def unparse = s"${major}.${minor}.${rev}${build.unparse}"
def compare(that: ScalaVersion): Int = that match {
case SpecificScalaVersion(thatMajor, thatMinor, thatRev, thatBuild) =>
diff --git a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
index 835d338ab3..f7b1021ea2 100644
--- a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
+++ b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
@@ -30,7 +30,6 @@ import scala.collection.mutable.LinkedHashMap
abstract class Delambdafy extends Transform with TypingTransformers with ast.TreeDSL with TypeAdaptingTransformer {
import global._
import definitions._
- import CODE._
val analyzer: global.analyzer.type = global.analyzer
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 3d8b2f02f3..db639d0868 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -98,7 +98,7 @@ abstract class Erasure extends AddInterfaces
val len = sig.length
val copy: Array[Char] = sig.toCharArray
var changed = false
- while (i < sig.length) {
+ while (i < len) {
val ch = copy(i)
if (ch == '.' && last != '>') {
copy(i) = '$'
@@ -410,7 +410,6 @@ abstract class Erasure extends AddInterfaces
def fulldef(sym: Symbol) =
if (sym == NoSymbol) sym.toString
else s"$sym: ${sym.tpe} in ${sym.owner}"
- var noclash = true
val clashErrors = mutable.Buffer[(Position, String)]()
def clashError(what: String) = {
val pos = if (member.owner == root) member.pos else root.pos
diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala
index fa53ef48b5..4662ef6224 100644
--- a/src/compiler/scala/tools/nsc/transform/Flatten.scala
+++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala
@@ -77,8 +77,11 @@ abstract class Flatten extends InfoTransform {
if (sym.isTerm && !sym.isStaticModule) {
decls1 enter sym
if (sym.isModule) {
- // Nested, non-static moduls are transformed to methods.
- assert(sym.isMethod, s"Non-static $sym should have the lateMETHOD flag from RefChecks")
+ // In theory, we could assert(sym.isMethod), because nested, non-static moduls are
+ // transformed to methods (lateMETHOD flag added in RefChecks). But this requires
+ // forcing sym.info (see comment on isModuleNotMethod), which forces stub symbols
+ // too eagerly (SI-8907).
+
// Note that module classes are not entered into the 'decls' of the ClassInfoType
// of the outer class, only the module symbols are. So the current loop does
// not visit module classes. Therefore we set the LIFTED flag here for module
diff --git a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
index bbd11efa7e..c1c025ad48 100644
--- a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
+++ b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
@@ -6,7 +6,6 @@
package scala.tools.nsc
package transform
-import symtab.Flags._
import scala.reflect.internal.SymbolPairs
/** A class that yields a kind of iterator (`Cursor`),
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
index 908aa69310..9c81e31ad9 100644
--- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
+++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -861,11 +861,6 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
debuglog("%s expands to %s in %s".format(sym, specMember.name.decode, pp(env)))
info(specMember) = NormalizedMember(sym)
newOverload(sym, specMember, env)
- // if this is a class, we insert the normalized member in scope,
- // if this is a method, there's no attached scope for it (EmptyScope)
- val decls = owner.info.decls
- if (decls != EmptyScope)
- decls.enter(specMember)
specMember
}
}
@@ -1504,20 +1499,13 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
val residualTargs = symbol.info.typeParams zip baseTargs collect {
case (tvar, targ) if !env.contains(tvar) || !isPrimitiveValueClass(env(tvar).typeSymbol) => targ
}
- // See SI-5583. Don't know why it happens now if it didn't before.
- if (specMember.info.typeParams.isEmpty && residualTargs.nonEmpty) {
- devWarning("Type args to be applied, but symbol says no parameters: " + ((specMember.defString, residualTargs)))
- baseTree
- }
- else {
- ifDebug(assert(residualTargs.length == specMember.info.typeParams.length,
- "residual: %s, tparams: %s, env: %s".format(residualTargs, specMember.info.typeParams, env))
- )
+ ifDebug(assert(residualTargs.length == specMember.info.typeParams.length,
+ "residual: %s, tparams: %s, env: %s".format(residualTargs, specMember.info.typeParams, env))
+ )
- val tree1 = gen.mkTypeApply(specTree, residualTargs)
- debuglog("rewrote " + tree + " to " + tree1)
- localTyper.typedOperator(atPos(tree.pos)(tree1)) // being polymorphic, it must be a method
- }
+ val tree1 = gen.mkTypeApply(specTree, residualTargs)
+ debuglog("rewrote " + tree + " to " + tree1)
+ localTyper.typedOperator(atPos(tree.pos)(tree1)) // being polymorphic, it must be a method
}
curTree = tree
diff --git a/src/compiler/scala/tools/nsc/transform/Statics.scala b/src/compiler/scala/tools/nsc/transform/Statics.scala
index e2508b8d08..4673be6de7 100644
--- a/src/compiler/scala/tools/nsc/transform/Statics.scala
+++ b/src/compiler/scala/tools/nsc/transform/Statics.scala
@@ -1,9 +1,6 @@
package scala.tools.nsc
package transform
-import symtab._
-import Flags._
-
import collection.mutable.Buffer
abstract class Statics extends Transform with ast.TreeDSL {
diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
index ef534f70fd..16ea3ea90f 100644
--- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala
+++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
@@ -129,6 +129,13 @@ abstract class TailCalls extends Transform {
}
override def toString = s"${method.name} tparams=$tparams tailPos=$tailPos label=$label label info=${label.info}"
+ final def noTailContext() = clonedTailContext(false)
+ final def yesTailContext() = clonedTailContext(true)
+ protected def clonedTailContext(tailPos: Boolean): TailContext = this match {
+ case _ if this.tailPos == tailPos => this
+ case clone: ClonedTailContext => clone.that.clonedTailContext(tailPos)
+ case _ => new ClonedTailContext(this, tailPos)
+ }
}
object EmptyTailContext extends TailContext {
@@ -174,7 +181,7 @@ abstract class TailCalls extends Transform {
}
def containsRecursiveCall(t: Tree) = t exists isRecursiveCall
}
- class ClonedTailContext(that: TailContext, override val tailPos: Boolean) extends TailContext {
+ class ClonedTailContext(val that: TailContext, override val tailPos: Boolean) extends TailContext {
def method = that.method
def tparams = that.tparams
def methodPos = that.methodPos
@@ -183,9 +190,6 @@ abstract class TailCalls extends Transform {
}
private var ctx: TailContext = EmptyTailContext
- private def noTailContext() = new ClonedTailContext(ctx, tailPos = false)
- private def yesTailContext() = new ClonedTailContext(ctx, tailPos = true)
-
override def transformUnit(unit: CompilationUnit): Unit = {
try {
@@ -206,16 +210,16 @@ abstract class TailCalls extends Transform {
finally this.ctx = saved
}
- def yesTailTransform(tree: Tree): Tree = transform(tree, yesTailContext())
- def noTailTransform(tree: Tree): Tree = transform(tree, noTailContext())
+ def yesTailTransform(tree: Tree): Tree = transform(tree, ctx.yesTailContext())
+ def noTailTransform(tree: Tree): Tree = transform(tree, ctx.noTailContext())
def noTailTransforms(trees: List[Tree]) = {
- val nctx = noTailContext()
- trees map (t => transform(t, nctx))
+ val nctx = ctx.noTailContext()
+ trees mapConserve (t => transform(t, nctx))
}
override def transform(tree: Tree): Tree = {
/* A possibly polymorphic apply to be considered for tail call transformation. */
- def rewriteApply(target: Tree, fun: Tree, targs: List[Tree], args: List[Tree]) = {
+ def rewriteApply(target: Tree, fun: Tree, targs: List[Tree], args: List[Tree], mustTransformArgs: Boolean = true) = {
val receiver: Tree = fun match {
case Select(qual, _) => qual
case _ => EmptyTree
@@ -223,7 +227,7 @@ abstract class TailCalls extends Transform {
def receiverIsSame = ctx.enclosingType.widen =:= receiver.tpe.widen
def receiverIsSuper = ctx.enclosingType.widen <:< receiver.tpe.widen
def isRecursiveCall = (ctx.method eq fun.symbol) && ctx.tailPos
- def transformArgs = noTailTransforms(args)
+ def transformArgs = if (mustTransformArgs) noTailTransforms(args) else args
def matchesTypeArgs = ctx.tparams sameElements (targs map (_.tpe.typeSymbol))
/* Records failure reason in Context for reporting.
@@ -265,6 +269,10 @@ abstract class TailCalls extends Transform {
!(sym.hasAccessorFlag || sym.isConstructor)
}
+ // intentionally shadowing imports from definitions for performance
+ val runDefinitions = currentRun.runDefinitions
+ import runDefinitions.{Boolean_or, Boolean_and}
+
tree match {
case ValDef(_, _, _, _) =>
if (tree.symbol.isLazy && tree.symbol.hasAnnotation(TailrecClass))
@@ -312,8 +320,13 @@ abstract class TailCalls extends Transform {
// the assumption is once we encounter a case, the remainder of the block will consist of cases
// the prologue may be empty, usually it is the valdef that stores the scrut
val (prologue, cases) = stats span (s => !s.isInstanceOf[LabelDef])
+ val transformedPrologue = noTailTransforms(prologue)
+ val transformedCases = transformTrees(cases)
+ val transformedStats =
+ if ((prologue eq transformedPrologue) && (cases eq transformedCases)) stats // allow reuse of `tree` if the subtransform was an identity
+ else transformedPrologue ++ transformedCases
treeCopy.Block(tree,
- noTailTransforms(prologue) ++ transformTrees(cases),
+ transformedStats,
transform(expr)
)
@@ -380,7 +393,7 @@ abstract class TailCalls extends Transform {
if (res ne arg)
treeCopy.Apply(tree, fun, res :: Nil)
else
- rewriteApply(fun, fun, Nil, args)
+ rewriteApply(fun, fun, Nil, args, mustTransformArgs = false)
case Apply(fun, args) =>
rewriteApply(fun, fun, Nil, args)
@@ -421,6 +434,10 @@ abstract class TailCalls extends Transform {
def traverseNoTail(tree: Tree) = traverse(tree, maybeTailNew = false)
def traverseTreesNoTail(trees: List[Tree]) = trees foreach traverseNoTail
+ // intentionally shadowing imports from definitions for performance
+ private val runDefinitions = currentRun.runDefinitions
+ import runDefinitions.{Boolean_or, Boolean_and}
+
override def traverse(tree: Tree) = tree match {
// we're looking for label(x){x} in tail position, since that means `a` is in tail position in a call `label(a)`
case LabelDef(_, List(arg), body@Ident(_)) if arg.symbol == body.symbol =>
diff --git a/src/compiler/scala/tools/nsc/transform/TypeAdaptingTransformer.scala b/src/compiler/scala/tools/nsc/transform/TypeAdaptingTransformer.scala
index f83b6f857e..3b23306386 100644
--- a/src/compiler/scala/tools/nsc/transform/TypeAdaptingTransformer.scala
+++ b/src/compiler/scala/tools/nsc/transform/TypeAdaptingTransformer.scala
@@ -1,7 +1,6 @@
package scala.tools.nsc
package transform
-import scala.reflect.internal._
import scala.tools.nsc.ast.TreeDSL
import scala.tools.nsc.Global
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala b/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala
index 79f5e3bee8..8924394b72 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala
@@ -73,9 +73,7 @@ trait ScalacPatternExpanders {
* Unfortunately the MethodType does not carry the information of whether
* it was unapplySeq, so we have to funnel that information in separately.
*/
- def unapplyMethodTypes(method: Type, isSeq: Boolean): Extractor = {
- val whole = firstParamType(method)
- val result = method.finalResultType
+ def unapplyMethodTypes(whole: Type, result: Type, isSeq: Boolean): Extractor = {
val expanded = (
if (result =:= BooleanTpe) Nil
else typeOfMemberNamedGet(result) match {
@@ -124,11 +122,11 @@ trait ScalacPatternExpanders {
case _ => sel
}
val patterns = newPatterns(args)
- val isSeq = sel.symbol.name == nme.unapplySeq
val isUnapply = sel.symbol.name == nme.unapply
+
val extractor = sel.symbol.name match {
- case nme.unapply => unapplyMethodTypes(fn.tpe, isSeq = false)
- case nme.unapplySeq => unapplyMethodTypes(fn.tpe, isSeq = true)
+ case nme.unapply => unapplyMethodTypes(firstParamType(fn.tpe), sel.tpe, isSeq = false)
+ case nme.unapplySeq => unapplyMethodTypes(firstParamType(fn.tpe), sel.tpe, isSeq = true)
case _ => applyMethodTypes(fn.tpe)
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
index ba183fe3e6..0aa62d771e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
@@ -212,7 +212,9 @@ trait MethodSynthesis {
List(cd, mdef)
case _ =>
// Shouldn't happen, but let's give ourselves a reasonable error when it does
- abort("No synthetics for " + meth + ": synthetics contains " + context.unit.synthetics.keys.mkString(", "))
+ context.error(cd.pos, s"Internal error: Symbol for synthetic factory method not found among ${context.unit.synthetics.keys.mkString(", ")}")
+ // Soldier on for the sake of the presentation compiler
+ List(cd)
}
case _ =>
stat :: Nil
@@ -355,8 +357,9 @@ trait MethodSynthesis {
def derivedSym: Symbol = {
// Only methods will do! Don't want to pick up any stray
// companion objects of the same name.
- val result = enclClass.info decl name suchThat (x => x.isMethod && x.isSynthetic)
- assert(result != NoSymbol, "not found: "+name+" in "+enclClass+" "+enclClass.info.decls)
+ val result = enclClass.info decl name filter (x => x.isMethod && x.isSynthetic)
+ if (result == NoSymbol || result.isOverloaded)
+ context.error(tree.pos, s"Internal error: Unable to find the synthetic factory method corresponding to implicit class $name in $enclClass / ${enclClass.info.decls}")
result
}
def derivedTree: DefDef =
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index e876d4a6af..a1de5e303b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -296,7 +296,7 @@ trait Namers extends MethodSynthesis {
}
tree.symbol match {
case NoSymbol => try dispatch() catch typeErrorHandler(tree, this.context)
- case sym => enterExistingSym(sym)
+ case sym => enterExistingSym(sym, tree)
}
}
@@ -413,6 +413,7 @@ trait Namers extends MethodSynthesis {
if (isRedefinition) {
updatePosFlags(existing, tree.pos, tree.mods.flags)
setPrivateWithin(tree, existing)
+ clearRenamedCaseAccessors(existing)
existing
}
else assignAndEnterSymbol(tree) setFlag inConstructorFlag
@@ -736,7 +737,9 @@ trait Namers extends MethodSynthesis {
}
// Hooks which are overridden in the presentation compiler
- def enterExistingSym(sym: Symbol): Context = this.context
+ def enterExistingSym(sym: Symbol, tree: Tree): Context = {
+ this.context
+ }
def enterIfNotThere(sym: Symbol) { }
def enterSyntheticSym(tree: Tree): Symbol = {
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index bedca88974..1daff02c23 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -54,6 +54,9 @@ trait SyntheticMethods extends ast.TreeDSL {
/** Does not force the info of `caseclazz` */
final def caseAccessorName(caseclazz: Symbol, paramName: TermName) =
(renamedCaseAccessors get caseclazz).fold(paramName)(_(paramName))
+ final def clearRenamedCaseAccessors(caseclazz: Symbol): Unit = {
+ renamedCaseAccessors -= caseclazz
+ }
/** Add the synthetic methods to case classes.
*/
diff --git a/src/compiler/scala/tools/nsc/typechecker/Tags.scala b/src/compiler/scala/tools/nsc/typechecker/Tags.scala
index 90ec3a89b8..57dc74d2a0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Tags.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Tags.scala
@@ -11,7 +11,6 @@ trait Tags {
self: Typer =>
private val runDefinitions = currentRun.runDefinitions
- import runDefinitions._
private def resolveTag(pos: Position, taggedTp: Type, allowMaterialization: Boolean) = enteringTyper {
def wrapper (tree: => Tree): Tree = if (allowMaterialization) (context.withMacrosEnabled[Tree](tree)) else (context.withMacrosDisabled[Tree](tree))
@@ -66,7 +65,7 @@ trait Tags {
// if someone requests a type tag, but scala-reflect.jar isn't on the library classpath, then bail
if (pre == NoType && ApiUniverseClass == NoSymbol) EmptyTree
else {
- val tagSym = if (concrete) TypeTagClass else WeakTypeTagClass
+ val tagSym = if (concrete) runDefinitions.TypeTagClass else runDefinitions.WeakTypeTagClass
val tagTp = if (pre == NoType) TypeRef(ApiUniverseClass.toTypeConstructor, tagSym, List(tp)) else singleType(pre, pre member tagSym.name)
val taggedTp = appliedType(tagTp, List(tp))
resolveTag(pos, taggedTp, allowMaterialization)
diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
index 1dac27639c..0f90c6a478 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
@@ -607,7 +607,7 @@ trait TypeDiagnostics {
if (!c.owner.exists || c.owner.isClass || c.owner.isMethod || (c.owner.isType && !c.owner.isParameter)) c
else enclClassOrMethodOrTypeMember(c.outer)
- val tt = tparams.filter(_.name != typeNames.WILDCARD).foreach { tp =>
+ tparams.filter(_.name != typeNames.WILDCARD).foreach { tp =>
// we don't care about type params shadowing other type params in the same declaration
enclClassOrMethodOrTypeMember(context).outer.lookupSymbol(tp.name, s => s != tp.symbol && s.hasRawInfo && reallyExists(s)) match {
case LookupSucceeded(_, sym2) => context.warning(tp.pos,
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index aae2d24b32..70acb03584 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1516,7 +1516,9 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
val cbody1 = treeCopy.Block(cbody, preSuperStats, superCall1)
val clazz = context.owner
assert(clazz != NoSymbol, templ)
- val cscope = context.outer.makeNewScope(ctor, context.outer.owner)
+ val dummy = context.outer.owner.newLocalDummy(templ.pos)
+ val cscope = context.outer.makeNewScope(ctor, dummy)
+ if (dummy.isTopLevel) currentRun.symSource(dummy) = currentUnit.source.file
val cbody2 = { // called both during completion AND typing.
val typer1 = newTyper(cscope)
// XXX: see about using the class's symbol....
diff --git a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala
index cc2d9141ce..fc1f45e358 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala
@@ -142,17 +142,30 @@ trait Unapplies extends ast.TreeDSL {
/** The unapply method corresponding to a case class
*/
def caseModuleUnapplyMeth(cdef: ClassDef): DefDef = {
- val tparams = constrTparamsInvariant(cdef)
- val method = constrParamss(cdef) match {
+ val tparams = constrTparamsInvariant(cdef)
+ val method = constrParamss(cdef) match {
case xs :: _ if xs.nonEmpty && isRepeatedParamType(xs.last.tpt) => nme.unapplySeq
case _ => nme.unapply
}
- val cparams = List(ValDef(Modifiers(PARAM | SYNTHETIC), unapplyParamName, classType(cdef, tparams), EmptyTree))
- val ifNull = if (constrParamss(cdef).head.isEmpty) FALSE else REF(NoneModule)
- val body = nullSafe({ case Ident(x) => caseClassUnapplyReturnValue(x, cdef) }, ifNull)(Ident(unapplyParamName))
+ val cparams = List(ValDef(Modifiers(PARAM | SYNTHETIC), unapplyParamName, classType(cdef, tparams), EmptyTree))
+ val resultType = if (!settings.isScala212) TypeTree() else { // fix for SI-6541 under -Xsource:2.12
+ def repeatedToSeq(tp: Tree) = tp match {
+ case AppliedTypeTree(Select(_, tpnme.REPEATED_PARAM_CLASS_NAME), tps) => AppliedTypeTree(gen.rootScalaDot(tpnme.Seq), tps)
+ case _ => tp
+ }
+ constrParamss(cdef) match {
+ case Nil | Nil :: _ =>
+ gen.rootScalaDot(tpnme.Boolean)
+ case params :: _ =>
+ val constrParamTypes = params.map(param => repeatedToSeq(param.tpt))
+ AppliedTypeTree(gen.rootScalaDot(tpnme.Option), List(treeBuilder.makeTupleType(constrParamTypes)))
+ }
+ }
+ val ifNull = if (constrParamss(cdef).head.isEmpty) FALSE else REF(NoneModule)
+ val body = nullSafe({ case Ident(x) => caseClassUnapplyReturnValue(x, cdef) }, ifNull)(Ident(unapplyParamName))
atPos(cdef.pos.focus)(
- DefDef(caseMods, method, tparams, List(cparams), TypeTree(), body)
+ DefDef(caseMods, method, tparams, List(cparams), resultType, body)
)
}
diff --git a/src/intellij-14/README b/src/intellij-14/README
new file mode 100644
index 0000000000..310a766a20
--- /dev/null
+++ b/src/intellij-14/README
@@ -0,0 +1,12 @@
+Use the latest IntelliJ IDEA release and install the Scala plugin from within the IDE.
+
+Compilation withing IDEA is performed in "-Dlocker.skip=1" mode: the sources are built
+directly using the STARR compiler.
+
+The following steps are required to use IntelliJ IDEA on Scala trunk
+ - Run "ant init". This will download some JARs from to ./build/deps, which are
+ included in IntelliJ's classpath.
+ - Run src/intellij-14/setup.sh
+ - Open ./src/intellij-14/scala.ipr in IntelliJ
+ - File, Project Settings, Project, SDK. Create an SDK entry named "1.6" containing the
+ Java 1.6 SDK
diff --git a/src/intellij-14/actors.iml.SAMPLE b/src/intellij-14/actors.iml.SAMPLE
new file mode 100644
index 0000000000..3da7a5f777
--- /dev/null
+++ b/src/intellij-14/actors.iml.SAMPLE
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../actors">
+ <sourceFolder url="file://$MODULE_DIR$/../actors" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="forkjoin" />
+ <orderEntry type="module" module-name="library" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/asm.iml.SAMPLE b/src/intellij-14/asm.iml.SAMPLE
new file mode 100644
index 0000000000..9b2fd58ce7
--- /dev/null
+++ b/src/intellij-14/asm.iml.SAMPLE
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../asm">
+ <sourceFolder url="file://$MODULE_DIR$/../asm/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/../asm" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/compiler.iml.SAMPLE b/src/intellij-14/compiler.iml.SAMPLE
new file mode 100644
index 0000000000..858ca2f2c2
--- /dev/null
+++ b/src/intellij-14/compiler.iml.SAMPLE
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../compiler">
+ <sourceFolder url="file://$MODULE_DIR$/../compiler" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="asm" />
+ <orderEntry type="module" module-name="library" />
+ <orderEntry type="module" module-name="reflect" />
+ <orderEntry type="library" name="ant" level="project" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/diff.sh b/src/intellij-14/diff.sh
new file mode 100755
index 0000000000..54f9248608
--- /dev/null
+++ b/src/intellij-14/diff.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+#
+# Diffs the SAMPLE files against the working project config.
+#
+export SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
+for f in "$SCRIPT_DIR"/*.{iml,ipr}; do
+ echo $f; diff -u $f.SAMPLE $f;
+done
diff --git a/src/intellij-14/forkjoin.iml.SAMPLE b/src/intellij-14/forkjoin.iml.SAMPLE
new file mode 100644
index 0000000000..42507b2911
--- /dev/null
+++ b/src/intellij-14/forkjoin.iml.SAMPLE
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../forkjoin">
+ <sourceFolder url="file://$MODULE_DIR$/../forkjoin" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/interactive.iml.SAMPLE b/src/intellij-14/interactive.iml.SAMPLE
new file mode 100644
index 0000000000..db12a7dc9b
--- /dev/null
+++ b/src/intellij-14/interactive.iml.SAMPLE
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../interactive">
+ <sourceFolder url="file://$MODULE_DIR$/../interactive" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="compiler" />
+ <orderEntry type="module" module-name="library" />
+ <orderEntry type="module" module-name="reflect" />
+ <orderEntry type="module" module-name="scaladoc" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/library.iml.SAMPLE b/src/intellij-14/library.iml.SAMPLE
new file mode 100644
index 0000000000..08cccba4b9
--- /dev/null
+++ b/src/intellij-14/library.iml.SAMPLE
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../library">
+ <sourceFolder url="file://$MODULE_DIR$/../library" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="forkjoin" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/manual.iml.SAMPLE b/src/intellij-14/manual.iml.SAMPLE
new file mode 100644
index 0000000000..2e67076e28
--- /dev/null
+++ b/src/intellij-14/manual.iml.SAMPLE
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../manual">
+ <sourceFolder url="file://$MODULE_DIR$/../manual" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="library" />
+ <orderEntry type="library" name="ant" level="project" />
+ <orderEntry type="library" name="scaladoc-deps" level="project" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/partest-extras.iml.SAMPLE b/src/intellij-14/partest-extras.iml.SAMPLE
new file mode 100644
index 0000000000..b3537a949a
--- /dev/null
+++ b/src/intellij-14/partest-extras.iml.SAMPLE
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../partest-extras">
+ <sourceFolder url="file://$MODULE_DIR$/../partest-extras" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="asm" />
+ <orderEntry type="module" module-name="compiler" />
+ <orderEntry type="module" module-name="library" />
+ <orderEntry type="module" module-name="reflect" />
+ <orderEntry type="module" module-name="repl" />
+ <orderEntry type="library" name="partest" level="project" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/partest-javaagent.iml.SAMPLE b/src/intellij-14/partest-javaagent.iml.SAMPLE
new file mode 100644
index 0000000000..3a387aab0f
--- /dev/null
+++ b/src/intellij-14/partest-javaagent.iml.SAMPLE
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../partest-javaagent">
+ <sourceFolder url="file://$MODULE_DIR$/../partest-javaagent" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="asm" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/reflect.iml.SAMPLE b/src/intellij-14/reflect.iml.SAMPLE
new file mode 100644
index 0000000000..87da13777b
--- /dev/null
+++ b/src/intellij-14/reflect.iml.SAMPLE
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../reflect">
+ <sourceFolder url="file://$MODULE_DIR$/../reflect" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="library" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/repl.iml.SAMPLE b/src/intellij-14/repl.iml.SAMPLE
new file mode 100644
index 0000000000..2437aaae2d
--- /dev/null
+++ b/src/intellij-14/repl.iml.SAMPLE
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../repl">
+ <sourceFolder url="file://$MODULE_DIR$/../repl" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="library" />
+ <orderEntry type="module" module-name="compiler" />
+ <orderEntry type="module" module-name="reflect" />
+ <orderEntry type="library" name="repl-deps" level="project" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/scala.iml.SAMPLE b/src/intellij-14/scala.iml.SAMPLE
new file mode 100644
index 0000000000..9e8718dd45
--- /dev/null
+++ b/src/intellij-14/scala.iml.SAMPLE
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../..">
+ <excludeFolder url="file://$MODULE_DIR$/../../build" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/scala.ipr.SAMPLE b/src/intellij-14/scala.ipr.SAMPLE
new file mode 100644
index 0000000000..7c2022f3a9
--- /dev/null
+++ b/src/intellij-14/scala.ipr.SAMPLE
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions />
+ <wildcardResourcePatterns>
+ <entry name="!?*.java" />
+ <entry name="!?*.form" />
+ <entry name="!?*.class" />
+ <entry name="!?*.groovy" />
+ <entry name="!?*.scala" />
+ <entry name="!?*.flex" />
+ <entry name="!?*.kt" />
+ <entry name="!?*.clj" />
+ </wildcardResourcePatterns>
+ <annotationProcessing>
+ <profile default="true" name="Default" enabled="false">
+ <processorPath useClasspath="true" />
+ </profile>
+ </annotationProcessing>
+ </component>
+ <component name="CopyrightManager" default="" />
+ <component name="DaemonCodeAnalyzer">
+ <disable_hints />
+ </component>
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+ <component name="EntryPointsManager">
+ <entry_points version="2.0" />
+ </component>
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+ <OptionsSetting value="true" id="Add" />
+ <OptionsSetting value="true" id="Remove" />
+ <OptionsSetting value="true" id="Checkout" />
+ <OptionsSetting value="true" id="Update" />
+ <OptionsSetting value="true" id="Status" />
+ <OptionsSetting value="true" id="Edit" />
+ <ConfirmationsSetting value="0" id="Add" />
+ <ConfirmationsSetting value="0" id="Remove" />
+ </component>
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/actors.iml" filepath="$PROJECT_DIR$/actors.iml" />
+ <module fileurl="file://$PROJECT_DIR$/asm.iml" filepath="$PROJECT_DIR$/asm.iml" />
+ <module fileurl="file://$PROJECT_DIR$/compiler.iml" filepath="$PROJECT_DIR$/compiler.iml" />
+ <module fileurl="file://$PROJECT_DIR$/forkjoin.iml" filepath="$PROJECT_DIR$/forkjoin.iml" />
+ <module fileurl="file://$PROJECT_DIR$/interactive.iml" filepath="$PROJECT_DIR$/interactive.iml" />
+ <module fileurl="file://$PROJECT_DIR$/library.iml" filepath="$PROJECT_DIR$/library.iml" />
+ <module fileurl="file://$PROJECT_DIR$/manual.iml" filepath="$PROJECT_DIR$/manual.iml" />
+ <module fileurl="file://$PROJECT_DIR$/partest-extras.iml" filepath="$PROJECT_DIR$/partest-extras.iml" />
+ <module fileurl="file://$PROJECT_DIR$/partest-javaagent.iml" filepath="$PROJECT_DIR$/partest-javaagent.iml" />
+ <module fileurl="file://$PROJECT_DIR$/reflect.iml" filepath="$PROJECT_DIR$/reflect.iml" />
+ <module fileurl="file://$PROJECT_DIR$/repl.iml" filepath="$PROJECT_DIR$/repl.iml" />
+ <module fileurl="file://$PROJECT_DIR$/scala.iml" filepath="$PROJECT_DIR$/scala.iml" />
+ <module fileurl="file://$PROJECT_DIR$/scaladoc.iml" filepath="$PROJECT_DIR$/scaladoc.iml" />
+ <module fileurl="file://$PROJECT_DIR$/scalap.iml" filepath="$PROJECT_DIR$/scalap.iml" />
+ <module fileurl="file://$PROJECT_DIR$/test.iml" filepath="$PROJECT_DIR$/test.iml" />
+ <module fileurl="file://$PROJECT_DIR$/test-junit.iml" filepath="$PROJECT_DIR$/test-junit.iml" />
+ </modules>
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
+ <output url="file://$PROJECT_DIR$/../../out" />
+ </component>
+ <component name="PropertiesComponent">
+ <property name="GoToClass.includeLibraries" value="false" />
+ <property name="GoToClass.toSaveIncludeLibraries" value="false" />
+ <property name="GoToFile.includeJavaFiles" value="false" />
+ <property name="MemberChooser.sorted" value="false" />
+ <property name="MemberChooser.showClasses" value="true" />
+ <property name="MemberChooser.copyJavadoc" value="false" />
+ <property name="options.lastSelected" value="configurable.group.appearance" />
+ <property name="options.splitter.main.proportions" value="0.3" />
+ <property name="options.splitter.details.proportions" value="0.2" />
+ <property name="options.searchVisible" value="true" />
+ </component>
+ <component name="RunManager">
+ <configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
+ <module name="" />
+ <option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
+ <option name="PROGRAM_PARAMETERS" />
+ <method />
+ </configuration>
+ <configuration default="true" type="Remote" factoryName="Remote">
+ <option name="USE_SOCKET_TRANSPORT" value="true" />
+ <option name="SERVER_MODE" value="false" />
+ <option name="SHMEM_ADDRESS" value="javadebug" />
+ <option name="HOST" value="localhost" />
+ <option name="PORT" value="5005" />
+ <method />
+ </configuration>
+ <configuration default="true" type="Applet" factoryName="Applet">
+ <module name="" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="HTML_FILE_NAME" />
+ <option name="HTML_USED" value="false" />
+ <option name="WIDTH" value="400" />
+ <option name="HEIGHT" value="300" />
+ <option name="POLICY_FILE" value="$CARDEA_HOME$/bin/appletviewer.policy" />
+ <option name="VM_PARAMETERS" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <method />
+ </configuration>
+ <configuration default="true" type="TestNG" factoryName="TestNG">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+ <module name="" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="SUITE_NAME" />
+ <option name="PACKAGE_NAME" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="METHOD_NAME" />
+ <option name="GROUP_NAME" />
+ <option name="TEST_OBJECT" value="CLASS" />
+ <option name="VM_PARAMETERS" value="-ea" />
+ <option name="PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="ANNOTATION_TYPE" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <option name="TEST_SEARCH_SCOPE">
+ <value defaultName="moduleWithDependencies" />
+ </option>
+ <option name="USE_DEFAULT_REPORTERS" value="false" />
+ <option name="PROPERTIES_FILE" />
+ <envs />
+ <properties />
+ <listeners />
+ <method />
+ </configuration>
+ <configuration default="true" type="Application" factoryName="Application">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="VM_PARAMETERS" />
+ <option name="PROGRAM_PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="ENABLE_SWING_INSPECTOR" value="false" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <module name="" />
+ <envs />
+ <method />
+ </configuration>
+ <configuration default="true" type="JUnit" factoryName="JUnit">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+ <module name="" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="PACKAGE_NAME" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="METHOD_NAME" />
+ <option name="TEST_OBJECT" value="class" />
+ <option name="VM_PARAMETERS" value="-ea" />
+ <option name="PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <option name="TEST_SEARCH_SCOPE">
+ <value defaultName="moduleWithDependencies" />
+ </option>
+ <envs />
+ <patterns />
+ <method />
+ </configuration>
+ <list size="0" />
+ <configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
+ <Host>localhost</Host>
+ <Port>5050</Port>
+ </configuration>
+ </component>
+ <component name="ScalaCompilerConfiguration">
+ <parameters>
+ <parameter value="-sourcepath" />
+ <parameter value="$PROJECT_DIR$/../library" />
+ </parameters>
+ </component>
+ <component name="VcsContentAnnotationSettings">
+ <option name="myLimit" value="2678400000" />
+ </component>
+ <component name="VcsDirectoryMappings">
+ <mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
+ </component>
+ <component name="VcsManagerConfiguration">
+ <option name="myTodoPanelSettings">
+ <TodoPanelSettings />
+ </option>
+ </component>
+ <component name="libraryTable">
+ <library name="ant">
+ <CLASSES>
+ <root url="jar://$PROJECT_DIR$/../../lib/ant/ant.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ <library name="junit">
+ <CLASSES>
+ <root url="file://$PROJECT_DIR$/../../build/deps/junit" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ <jarDirectory url="file://$PROJECT_DIR$/../../build/deps/junit" recursive="false" />
+ </library>
+ <library name="partest">
+ <CLASSES>
+ <root url="file://$PROJECT_DIR$/../../build/deps/partest" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ <jarDirectory url="file://$PROJECT_DIR$/../../build/deps/partest" recursive="false" />
+ </library>
+ <library name="repl-deps">
+ <CLASSES>
+ <root url="file://$PROJECT_DIR$/../../build/deps/repl" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ <jarDirectory url="file://$PROJECT_DIR$/../../build/deps/repl" recursive="false" />
+ </library>
+ <library name="scaladoc-deps">
+ <CLASSES>
+ <root url="file://$PROJECT_DIR$/../../build/deps/scaladoc" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ <jarDirectory url="file://$PROJECT_DIR$/../../build/deps/scaladoc" recursive="false" />
+ </library>
+ <library name="starr" type="Scala">
+ <properties>
+ <compiler-classpath>
+ <root url="file://$PROJECT_DIR$/../../build/deps/starr/scala-compiler-2.11.2.jar" />
+ <root url="file://$PROJECT_DIR$/../../build/deps/starr/scala-library-2.11.2.jar" />
+ <root url="file://$PROJECT_DIR$/../../build/deps/starr/scala-reflect-2.11.2.jar" />
+ </compiler-classpath>
+ </properties>
+ <CLASSES>
+ <root url="jar://$PROJECT_DIR$/../../build/deps/starr/scala-library-2.11.2.jar!/" />
+ <root url="jar://$PROJECT_DIR$/../../build/deps/starr/scala-reflect-2.11.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ <library name="starr-no-deps" type="Scala">
+ <properties>
+ <compiler-classpath>
+ <root url="file://$PROJECT_DIR$/../../build/deps/starr/scala-compiler-2.11.2.jar" />
+ <root url="file://$PROJECT_DIR$/../../build/deps/starr/scala-library-2.11.2.jar" />
+ <root url="file://$PROJECT_DIR$/../../build/deps/starr/scala-reflect-2.11.2.jar" />
+ </compiler-classpath>
+ </properties>
+ <CLASSES />
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </component>
+</project> \ No newline at end of file
diff --git a/src/intellij-14/scaladoc.iml.SAMPLE b/src/intellij-14/scaladoc.iml.SAMPLE
new file mode 100644
index 0000000000..1e7621ffed
--- /dev/null
+++ b/src/intellij-14/scaladoc.iml.SAMPLE
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../scaladoc">
+ <sourceFolder url="file://$MODULE_DIR$/../scaladoc" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="compiler" />
+ <orderEntry type="module" module-name="library" />
+ <orderEntry type="module" module-name="reflect" />
+ <orderEntry type="library" name="scaladoc-deps" level="project" />
+ <orderEntry type="library" name="partest" level="project" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/scalap.iml.SAMPLE b/src/intellij-14/scalap.iml.SAMPLE
new file mode 100644
index 0000000000..e09b8d11b6
--- /dev/null
+++ b/src/intellij-14/scalap.iml.SAMPLE
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../scalap">
+ <sourceFolder url="file://$MODULE_DIR$/../scalap" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="compiler" />
+ <orderEntry type="module" module-name="library" />
+ <orderEntry type="module" module-name="reflect" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/setup.sh b/src/intellij-14/setup.sh
new file mode 100755
index 0000000000..ec303778ed
--- /dev/null
+++ b/src/intellij-14/setup.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#
+# Generates IntelliJ IDEA project files based on the checked-in samples.
+#
+
+set -e
+export SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
+echo "About to delete .ipr and .iml files and replace with the .SAMPLE files. Press enter to continue or CTRL-C to cancel."
+read
+
+for f in "$SCRIPT_DIR"/*.SAMPLE; do
+ g=${f%.SAMPLE}
+ cp $f $g
+done
diff --git a/src/intellij-14/test-junit.iml.SAMPLE b/src/intellij-14/test-junit.iml.SAMPLE
new file mode 100644
index 0000000000..786f02e2e2
--- /dev/null
+++ b/src/intellij-14/test-junit.iml.SAMPLE
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../../test/junit">
+ <sourceFolder url="file://$MODULE_DIR$/../../test/junit" isTestSource="true" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="junit" level="project" />
+ <orderEntry type="library" name="scaladoc-deps" level="project" />
+ <orderEntry type="module" module-name="actors" />
+ <orderEntry type="module" module-name="asm" />
+ <orderEntry type="module" module-name="compiler" />
+ <orderEntry type="module" module-name="forkjoin" />
+ <orderEntry type="module" module-name="library" />
+ <orderEntry type="module" module-name="partest-extras" />
+ <orderEntry type="module" module-name="reflect" />
+ <orderEntry type="module" module-name="repl" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/test.iml.SAMPLE b/src/intellij-14/test.iml.SAMPLE
new file mode 100644
index 0000000000..a384d72266
--- /dev/null
+++ b/src/intellij-14/test.iml.SAMPLE
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../../test">
+ <excludeFolder url="file://$MODULE_DIR$/../../test/junit" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="actors" />
+ <orderEntry type="module" module-name="asm" />
+ <orderEntry type="module" module-name="compiler" />
+ <orderEntry type="module" module-name="forkjoin" />
+ <orderEntry type="module" module-name="library" />
+ <orderEntry type="module" module-name="partest-extras" />
+ <orderEntry type="module" module-name="reflect" />
+ <orderEntry type="module" module-name="repl" />
+ <orderEntry type="library" name="partest" level="project" />
+ <orderEntry type="library" name="scaladoc-deps" level="project" />
+ <orderEntry type="library" name="starr-no-deps" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/src/intellij-14/update.sh b/src/intellij-14/update.sh
new file mode 100755
index 0000000000..eb6fea782f
--- /dev/null
+++ b/src/intellij-14/update.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+#
+# Updates the .SAMPLE files with the current project files.
+#
+
+set -e
+export SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
+
+echo "About to create overwrite the .ipr.SAMPLE and .iml.SAMPLE files with the current project files. Press enter to continue or CTRL-C to cancel."
+read
+
+for f in "$SCRIPT_DIR"/*.{iml,ipr}; do
+ cp $f $f.SAMPLE
+done
+
+for f in "$SCRIPT_DIR"/*.SAMPLE; do
+ g=${f%.SAMPLE}
+ if [[ ! -f $g ]]; then
+ echo "Stale sample file, deleting $f"
+ rm $f
+ fi
+done
diff --git a/src/interactive/scala/tools/nsc/interactive/Global.scala b/src/interactive/scala/tools/nsc/interactive/Global.scala
index 174254d523..7df809b6ff 100644
--- a/src/interactive/scala/tools/nsc/interactive/Global.scala
+++ b/src/interactive/scala/tools/nsc/interactive/Global.scala
@@ -64,7 +64,9 @@ trait InteractiveAnalyzer extends Analyzer {
// that case the definitions that were already attributed as
// well as any default parameters of such methods need to be
// re-entered in the current scope.
- override def enterExistingSym(sym: Symbol): Context = {
+ //
+ // Tested in test/files/presentation/t8941b
+ override def enterExistingSym(sym: Symbol, tree: Tree): Context = {
if (sym != null && sym.owner.isTerm) {
enterIfNotThere(sym)
if (sym.isLazy)
@@ -72,8 +74,13 @@ trait InteractiveAnalyzer extends Analyzer {
for (defAtt <- sym.attachments.get[DefaultsOfLocalMethodAttachment])
defAtt.defaultGetters foreach enterIfNotThere
+ } else if (sym != null && sym.isClass && sym.isImplicit) {
+ val owningInfo = sym.owner.info
+ val existingDerivedSym = owningInfo.decl(sym.name.toTermName).filter(sym => sym.isSynthetic && sym.isMethod)
+ existingDerivedSym.alternatives foreach (owningInfo.decls.unlink)
+ enterImplicitWrapper(tree.asInstanceOf[ClassDef])
}
- super.enterExistingSym(sym)
+ super.enterExistingSym(sym, tree)
}
override def enterIfNotThere(sym: Symbol) {
val scope = context.scope
@@ -732,7 +739,7 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
}
}
- private def reloadSource(source: SourceFile) {
+ private[interactive] def reloadSource(source: SourceFile) {
val unit = new RichCompilationUnit(source)
unitOfFile(source.file) = unit
toBeRemoved -= source.file
@@ -781,7 +788,7 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
}
/** A fully attributed tree located at position `pos` */
- private def typedTreeAt(pos: Position): Tree = getUnit(pos.source) match {
+ private[interactive] def typedTreeAt(pos: Position): Tree = getUnit(pos.source) match {
case None =>
reloadSources(List(pos.source))
try typedTreeAt(pos)
diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala
index a8731a51b1..d3a7db6968 100644
--- a/src/library/scala/collection/TraversableLike.scala
+++ b/src/library/scala/collection/TraversableLike.scala
@@ -253,7 +253,7 @@ trait TraversableLike[+A, +Repr] extends Any
b.result
}
- private[scala] def filterImpl(p: A => Boolean, isFlipped: Boolean): Repr = {
+ private def filterImpl(p: A => Boolean, isFlipped: Boolean): Repr = {
val b = newBuilder
for (x <- this)
if (p(x) != isFlipped) b += x
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala
index aa9dec2761..9bfefc3de2 100644
--- a/src/library/scala/collection/immutable/List.scala
+++ b/src/library/scala/collection/immutable/List.scala
@@ -290,7 +290,6 @@ sealed abstract class List[+A] extends AbstractSeq[A]
if (this eq Nil) Nil.asInstanceOf[That] else {
var rest = this
var h: ::[B] = null
- var x: A = null.asInstanceOf[A]
// Special case for first element
do {
val x: Any = pf.applyOrElse(rest.head, List.partialNotApplied)
diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala
index 91a4e1c43d..714d5117d3 100644
--- a/src/library/scala/collection/immutable/Stream.scala
+++ b/src/library/scala/collection/immutable/Stream.scala
@@ -499,16 +499,6 @@ self =>
)
else super.flatMap(f)(bf)
- override private[scala] def filterImpl(p: A => Boolean, isFlipped: Boolean): Stream[A] = {
- // optimization: drop leading prefix of elems for which f returns false
- // var rest = this dropWhile (!p(_)) - forget DRY principle - GC can't collect otherwise
- var rest = this
- while (!rest.isEmpty && p(rest.head) == isFlipped) rest = rest.tail
- // private utility func to avoid `this` on stack (would be needed for the lazy arg)
- if (rest.nonEmpty) Stream.filteredTail(rest, p, isFlipped)
- else Stream.Empty
- }
-
/** Returns all the elements of this `Stream` that satisfy the predicate `p`
* in a new `Stream` - i.e., it is still a lazy data structure. The order of
* the elements is preserved
@@ -522,7 +512,15 @@ self =>
* // produces
* }}}
*/
- override def filter(p: A => Boolean): Stream[A] = filterImpl(p, isFlipped = false) // This override is only left in 2.11 because of binary compatibility, see PR #3925
+ override def filter(p: A => Boolean): Stream[A] = {
+ // optimization: drop leading prefix of elems for which f returns false
+ // var rest = this dropWhile (!p(_)) - forget DRY principle - GC can't collect otherwise
+ var rest = this
+ while (!rest.isEmpty && !p(rest.head)) rest = rest.tail
+ // private utility func to avoid `this` on stack (would be needed for the lazy arg)
+ if (rest.nonEmpty) Stream.filteredTail(rest, p)
+ else Stream.Empty
+ }
override final def withFilter(p: A => Boolean): StreamWithFilter = new StreamWithFilter(p)
@@ -1286,8 +1284,8 @@ object Stream extends SeqFactory[Stream] {
else cons(start, range(start + step, end, step))
}
- private[immutable] def filteredTail[A](stream: Stream[A], p: A => Boolean, isFlipped: Boolean) = {
- cons(stream.head, stream.tail.filterImpl(p, isFlipped))
+ private[immutable] def filteredTail[A](stream: Stream[A], p: A => Boolean) = {
+ cons(stream.head, stream.tail filter p)
}
private[immutable] def collectedTail[A, B, That](head: B, stream: Stream[A], pf: PartialFunction[A, B], bf: CanBuildFrom[Stream[A], B, That]) = {
diff --git a/src/library/scala/collection/mutable/AnyRefMap.scala b/src/library/scala/collection/mutable/AnyRefMap.scala
index 47fb66744e..fccc9d83e6 100644
--- a/src/library/scala/collection/mutable/AnyRefMap.scala
+++ b/src/library/scala/collection/mutable/AnyRefMap.scala
@@ -224,7 +224,7 @@ extends AbstractMap[K, V]
override def put(key: K, value: V): Option[V] = {
val h = hashOf(key)
val k = key
- var i = seekEntryOrOpen(h, k)
+ val i = seekEntryOrOpen(h, k)
if (i < 0) {
val j = i & IndexMask
_hashes(j) = h
@@ -251,7 +251,7 @@ extends AbstractMap[K, V]
override def update(key: K, value: V): Unit = {
val h = hashOf(key)
val k = key
- var i = seekEntryOrOpen(h, k)
+ val i = seekEntryOrOpen(h, k)
if (i < 0) {
val j = i & IndexMask
_hashes(j) = h
diff --git a/src/library/scala/collection/mutable/BitSet.scala b/src/library/scala/collection/mutable/BitSet.scala
index 43d23acc1a..faa4155317 100644
--- a/src/library/scala/collection/mutable/BitSet.scala
+++ b/src/library/scala/collection/mutable/BitSet.scala
@@ -110,7 +110,7 @@ class BitSet(protected final var elems: Array[Long]) extends AbstractSet[Int]
* @return the bitset itself.
*/
def |= (other: BitSet): this.type = {
- ensureCapacity(other.nwords)
+ ensureCapacity(other.nwords - 1)
for (i <- 0 until other.nwords)
elems(i) = elems(i) | other.word(i)
this
@@ -121,7 +121,7 @@ class BitSet(protected final var elems: Array[Long]) extends AbstractSet[Int]
* @return the bitset itself.
*/
def &= (other: BitSet): this.type = {
- ensureCapacity(other.nwords)
+ ensureCapacity(other.nwords - 1)
for (i <- 0 until other.nwords)
elems(i) = elems(i) & other.word(i)
this
@@ -132,7 +132,7 @@ class BitSet(protected final var elems: Array[Long]) extends AbstractSet[Int]
* @return the bitset itself.
*/
def ^= (other: BitSet): this.type = {
- ensureCapacity(other.nwords)
+ ensureCapacity(other.nwords - 1)
for (i <- 0 until other.nwords)
elems(i) = elems(i) ^ other.word(i)
this
@@ -143,7 +143,7 @@ class BitSet(protected final var elems: Array[Long]) extends AbstractSet[Int]
* @return the bitset itself.
*/
def &~= (other: BitSet): this.type = {
- ensureCapacity(other.nwords)
+ ensureCapacity(other.nwords - 1)
for (i <- 0 until other.nwords)
elems(i) = elems(i) & ~other.word(i)
this
diff --git a/src/library/scala/collection/mutable/LongMap.scala b/src/library/scala/collection/mutable/LongMap.scala
index ef488a3697..5fafe23d9f 100644
--- a/src/library/scala/collection/mutable/LongMap.scala
+++ b/src/library/scala/collection/mutable/LongMap.scala
@@ -81,7 +81,7 @@ extends AbstractMap[Long, V]
private def toIndex(k: Long): Int = {
// Part of the MurmurHash3 32 bit finalizer
val h = ((k ^ (k >>> 32)) & 0xFFFFFFFFL).toInt
- var x = (h ^ (h >>> 16)) * 0x85EBCA6B
+ val x = (h ^ (h >>> 16)) * 0x85EBCA6B
(x ^ (x >>> 13)) & mask
}
@@ -311,7 +311,7 @@ extends AbstractMap[Long, V]
}
}
else {
- var i = seekEntryOrOpen(key)
+ val i = seekEntryOrOpen(key)
if (i < 0) {
val j = i & IndexMask
_keys(j) = key
diff --git a/src/library/scala/reflect/ClassTag.scala b/src/library/scala/reflect/ClassTag.scala
index bced505273..2f4aa9cb84 100644
--- a/src/library/scala/reflect/ClassTag.scala
+++ b/src/library/scala/reflect/ClassTag.scala
@@ -2,8 +2,7 @@ package scala
package reflect
import java.lang.{ Class => jClass }
-import scala.language.{implicitConversions, existentials}
-import scala.runtime.ScalaRunTime.{ arrayClass, arrayElementClass }
+import scala.runtime.ScalaRunTime.arrayElementClass
/**
*
diff --git a/src/reflect/scala/reflect/internal/AnnotationInfos.scala b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
index fcef4dd6be..6863cdfd82 100644
--- a/src/reflect/scala/reflect/internal/AnnotationInfos.scala
+++ b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
@@ -15,7 +15,6 @@ import scala.language.postfixOps
/** AnnotationInfo and its helpers */
trait AnnotationInfos extends api.Annotations { self: SymbolTable =>
import definitions._
- import treeInfo._
// Common annotation code between Symbol and Type.
// For methods altering the annotation list, on Symbol it mutates
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala
index 70375d974c..e2ee6a9076 100644
--- a/src/reflect/scala/reflect/internal/Definitions.scala
+++ b/src/reflect/scala/reflect/internal/Definitions.scala
@@ -905,12 +905,14 @@ trait Definitions extends api.StandardDefinitions {
)
}
- def EnumType(sym: Symbol) =
+ def EnumType(sym: Symbol) = {
// given (in java): "class A { enum E { VAL1 } }"
// - sym: the symbol of the actual enumeration value (VAL1)
// - .owner: the ModuleClassSymbol of the enumeration (object E)
// - .linkedClassOfClass: the ClassSymbol of the enumeration (class E)
- sym.owner.linkedClassOfClass.tpe
+ // SI-6613 Subsequent runs of the resident compiler demand the phase discipline here.
+ enteringPhaseNotLaterThan(picklerPhase)(sym.owner.linkedClassOfClass).tpe
+ }
/** Given a class symbol C with type parameters T1, T2, ... Tn
* which have upper/lower bounds LB1/UB1, LB1/UB2, ..., LBn/UBn,
@@ -1437,6 +1439,10 @@ trait Definitions extends api.StandardDefinitions {
lazy val isUnbox = unboxMethod.values.toSet[Symbol]
lazy val isBox = boxMethod.values.toSet[Symbol]
+ lazy val Boolean_and = definitions.Boolean_and
+ lazy val Boolean_or = definitions.Boolean_or
+ lazy val Boolean_not = definitions.Boolean_not
+
lazy val Option_apply = getMemberMethod(OptionModule, nme.apply)
lazy val List_apply = DefinitionsClass.this.List_apply
diff --git a/src/reflect/scala/reflect/internal/Internals.scala b/src/reflect/scala/reflect/internal/Internals.scala
index 26f3bfd9d0..ad4cec5b4d 100644
--- a/src/reflect/scala/reflect/internal/Internals.scala
+++ b/src/reflect/scala/reflect/internal/Internals.scala
@@ -9,7 +9,6 @@ import scala.ref.WeakReference
import scala.reflect.api.Universe
import scala.reflect.macros.Attachments
import scala.reflect.internal.util.FreshNameCreator
-import scala.reflect.internal.Flags._
import scala.reflect.internal.util.ListOfNil
trait Internals extends api.Internals {
diff --git a/src/reflect/scala/reflect/internal/Printers.scala b/src/reflect/scala/reflect/internal/Printers.scala
index 2ce861898f..c4953b2c1f 100644
--- a/src/reflect/scala/reflect/internal/Printers.scala
+++ b/src/reflect/scala/reflect/internal/Printers.scala
@@ -761,7 +761,7 @@ trait Printers extends api.Printers { self: SymbolTable =>
val build.SyntacticClassDef(_, _, _, ctorMods, vparamss, earlyDefs, parents, selfType, body) = cl
// constructor's modifier
- if (ctorMods.hasFlag(AccessFlags)) {
+ if (ctorMods.hasFlag(AccessFlags) || ctorMods.hasAccessBoundary) {
print(" ")
printModifiers(ctorMods, primaryCtorParam = false)
}
diff --git a/src/reflect/scala/reflect/internal/ReificationSupport.scala b/src/reflect/scala/reflect/internal/ReificationSupport.scala
index 759bd2e791..c418321234 100644
--- a/src/reflect/scala/reflect/internal/ReificationSupport.scala
+++ b/src/reflect/scala/reflect/internal/ReificationSupport.scala
@@ -7,7 +7,6 @@ import util._
trait ReificationSupport { self: SymbolTable =>
import definitions._
- import internal._
class ReificationSupportImpl extends ReificationSupportApi {
def selectType(owner: Symbol, name: String): TypeSymbol =
@@ -123,7 +122,7 @@ trait ReificationSupport { self: SymbolTable =>
if (vd.rhs.nonEmpty) newmods |= DEFAULTPARAM
copyValDef(vd)(mods = newmods | extraFlags)
case _ =>
- throw new IllegalArgumentException(s"$tree is not valid represenation of a parameter, " +
+ throw new IllegalArgumentException(s"$tree is not valid representation of a parameter, " +
"""consider reformatting it into q"val $name: $T = $default" shape""")
}
diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala
index 99ff6a10b4..f2517fff54 100644
--- a/src/reflect/scala/reflect/internal/StdNames.scala
+++ b/src/reflect/scala/reflect/internal/StdNames.scala
@@ -128,6 +128,7 @@ trait StdNames {
final val AnyRef: NameType = "AnyRef"
final val Array: NameType = "Array"
final val List: NameType = "List"
+ final val Option: NameType = "Option"
final val Seq: NameType = "Seq"
final val Symbol: NameType = "Symbol"
final val WeakTypeTag: NameType = "WeakTypeTag"
diff --git a/src/reflect/scala/reflect/internal/SymbolPairs.scala b/src/reflect/scala/reflect/internal/SymbolPairs.scala
index c088e8f57c..4763e77a34 100644
--- a/src/reflect/scala/reflect/internal/SymbolPairs.scala
+++ b/src/reflect/scala/reflect/internal/SymbolPairs.scala
@@ -8,7 +8,6 @@ package reflect
package internal
import scala.collection.mutable
-import Flags._
import util.HashSet
import scala.annotation.tailrec
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index b0c23ef45d..51f06b1d6d 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -173,7 +173,6 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
with HasFlags
with Annotatable[Symbol]
with Attachable {
-
// makes sure that all symbols that runtime reflection deals with are synchronized
private def isSynchronized = this.isInstanceOf[scala.reflect.runtime.SynchronizedSymbols#SynchronizedSymbol]
private def isAprioriThreadsafe = isThreadsafe(AllOps)
@@ -735,31 +734,31 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
final def hasGetter = isTerm && nme.isLocalName(name)
- /** A little explanation for this confusing situation.
- * Nested modules which have no static owner when ModuleDefs
- * are eliminated (refchecks) are given the lateMETHOD flag,
- * which makes them appear as methods after refchecks.
- * Here's an example where one can see all four of FF FT TF TT
- * for (isStatic, isMethod) at various phases.
+ /**
+ * Nested modules which have no static owner when ModuleDefs are eliminated (refchecks) are
+ * given the lateMETHOD flag, which makes them appear as methods after refchecks.
+ *
+ * Note: the lateMETHOD flag is added lazily in the info transformer of the RefChecks phase.
+ * This means that forcing the `sym.info` may change the value of `sym.isMethod`. Forcing the
+ * info is in the responsability of the caller. Doing it eagerly here was tried (0ccdb151f) but
+ * has proven to lead to bugs (SI-8907).
+ *
+ * Here's an example where one can see all four of FF FT TF TT for (isStatic, isMethod) at
+ * various phases.
*
- * trait A1 { case class Quux() }
- * object A2 extends A1 { object Flax }
- * // -- namer object Quux in trait A1
- * // -M flatten object Quux in trait A1
- * // S- flatten object Flax in object A2
- * // -M posterasure object Quux in trait A1
- * // -M jvm object Quux in trait A1
- * // SM jvm object Quux in object A2
+ * trait A1 { case class Quux() }
+ * object A2 extends A1 { object Flax }
+ * // -- namer object Quux in trait A1
+ * // -M flatten object Quux in trait A1
+ * // S- flatten object Flax in object A2
+ * // -M posterasure object Quux in trait A1
+ * // -M jvm object Quux in trait A1
+ * // SM jvm object Quux in object A2
*
- * So "isModuleNotMethod" exists not for its achievement in
- * brevity, but to encapsulate the relevant condition.
+ * So "isModuleNotMethod" exists not for its achievement in brevity, but to encapsulate the
+ * relevant condition.
*/
- def isModuleNotMethod = {
- if (isModule) {
- if (phase.refChecked) this.info // force completion to make sure lateMETHOD is there.
- !isMethod
- } else false
- }
+ def isModuleNotMethod = isModule && !isMethod
// After RefChecks, the `isStatic` check is mostly redundant: all non-static modules should
// be methods (and vice versa). There's a corner case on the vice-versa with mixed-in module
@@ -1592,13 +1591,11 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
assert(isCompilerUniverse)
if (infos == null || runId(infos.validFrom) == currentRunId) {
infos
- } else if (isPackageClass) {
- // SI-7801 early phase package scopes are mutated in new runs (Namers#enterPackage), so we have to
- // discard transformed infos, rather than just marking them as from this run.
- val oldest = infos.oldest
- oldest.validFrom = validTo
- this.infos = oldest
- oldest
+ } else if (infos ne infos.oldest) {
+ // SI-8871 Discard all but the first element of type history. Specialization only works in the resident
+ // compiler / REPL if re-run its info transformer in this run to correctly populate its
+ // per-run caches, e.g. typeEnv
+ adaptInfos(infos.oldest)
} else {
val prev1 = adaptInfos(infos.prev)
if (prev1 ne infos.prev) prev1
@@ -2157,6 +2154,12 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
if (isClass) this else moduleClass
} else owner.enclosingTopLevelClass
+ /** The top-level class or local dummy symbol containing this symbol. */
+ def enclosingTopLevelClassOrDummy: Symbol =
+ if (isTopLevel) {
+ if (isClass) this else moduleClass.orElse(this)
+ } else owner.enclosingTopLevelClassOrDummy
+
/** Is this symbol defined in the same scope and compilation unit as `that` symbol? */
def isCoDefinedWith(that: Symbol) = (
!rawInfoIsNoType
@@ -3505,6 +3508,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
override def enclClassChain = Nil
override def enclClass: Symbol = this
override def enclosingTopLevelClass: Symbol = this
+ override def enclosingTopLevelClassOrDummy: Symbol = this
override def enclosingPackageClass: Symbol = this
override def enclMethod: Symbol = this
override def associatedFile = NoAbstractFile
diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala
index 9dc4baee32..2f07cef315 100644
--- a/src/reflect/scala/reflect/internal/Trees.scala
+++ b/src/reflect/scala/reflect/internal/Trees.scala
@@ -8,7 +8,6 @@ package reflect
package internal
import Flags._
-import pickling.PickleFormat._
import scala.collection.{ mutable, immutable }
import util.Statistics
diff --git a/src/reflect/scala/reflect/internal/transform/PostErasure.scala b/src/reflect/scala/reflect/internal/transform/PostErasure.scala
index f0c7d0f050..dd4f044818 100644
--- a/src/reflect/scala/reflect/internal/transform/PostErasure.scala
+++ b/src/reflect/scala/reflect/internal/transform/PostErasure.scala
@@ -5,7 +5,6 @@ package transform
trait PostErasure {
val global: SymbolTable
import global._
- import definitions._
object elimErasedValueType extends TypeMap {
def apply(tp: Type) = tp match {
diff --git a/src/reflect/scala/reflect/macros/Typers.scala b/src/reflect/scala/reflect/macros/Typers.scala
index d0dccb469d..a69c4f3a31 100644
--- a/src/reflect/scala/reflect/macros/Typers.scala
+++ b/src/reflect/scala/reflect/macros/Typers.scala
@@ -2,8 +2,6 @@ package scala
package reflect
package macros
-import scala.reflect.internal.{Mode => InternalMode}
-
/**
* <span class="badge badge-red" style="float: right;">EXPERIMENTAL</span>
*
diff --git a/src/reflect/scala/reflect/runtime/JavaUniverse.scala b/src/reflect/scala/reflect/runtime/JavaUniverse.scala
index fe39e1f245..7848753e69 100644
--- a/src/reflect/scala/reflect/runtime/JavaUniverse.scala
+++ b/src/reflect/scala/reflect/runtime/JavaUniverse.scala
@@ -5,7 +5,7 @@ package runtime
import scala.reflect.internal.{TreeInfo, SomePhase}
import scala.reflect.internal.{SymbolTable => InternalSymbolTable}
import scala.reflect.runtime.{SymbolTable => RuntimeSymbolTable}
-import scala.reflect.api.{TreeCreator, TypeCreator, Universe}
+import scala.reflect.api.{TypeCreator, Universe}
/** An implementation of [[scala.reflect.api.Universe]] for runtime reflection using JVM classloaders.
*
diff --git a/src/reflect/scala/reflect/runtime/SymbolTable.scala b/src/reflect/scala/reflect/runtime/SymbolTable.scala
index 02155578f8..092bbd711f 100644
--- a/src/reflect/scala/reflect/runtime/SymbolTable.scala
+++ b/src/reflect/scala/reflect/runtime/SymbolTable.scala
@@ -2,8 +2,6 @@ package scala
package reflect
package runtime
-import scala.reflect.internal.Flags._
-
/**
* This symbol table trait fills in the definitions so that class information is obtained by refection.
* It can be used either from a reflexive universe (class scala.reflect.runtime.JavaUniverse), or else from
diff --git a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala
index f5e16c6640..6d0cb0df45 100644
--- a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala
+++ b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala
@@ -2,8 +2,7 @@ package scala
package reflect
package runtime
-import scala.reflect.io.AbstractFile
-import scala.collection.{ immutable, mutable }
+import scala.collection.immutable
import scala.reflect.internal.Flags._
private[reflect] trait SynchronizedSymbols extends internal.Symbols { self: SymbolTable =>
diff --git a/test/files/neg/t7636.check b/test/files/neg/t7636.check
index f70d50bee3..12391cccc8 100644
--- a/test/files/neg/t7636.check
+++ b/test/files/neg/t7636.check
@@ -4,7 +4,7 @@ t7636.scala:3: error: illegal inheritance;
^
t7636.scala:3: error: type mismatch;
found : Either[_$2,_$3(in constructor C)] where type _$3(in constructor C), type _$2
- required: Either[_, _$3(in object Main)] where type _$3(in object Main)
+ required: Either[_, _$3(in value <local Main>)] where type _$3(in value <local Main>)
class C extends ResultTable(Left(5):Either[_,_])(5)
^
two errors found
diff --git a/test/files/pos/t3439.scala b/test/files/pos/t3439.scala
new file mode 100644
index 0000000000..ccc75cc4cf
--- /dev/null
+++ b/test/files/pos/t3439.scala
@@ -0,0 +1,26 @@
+class Base[M](i: Int)
+
+// was "implicit modifier not allowed on top level objects"
+class D1()(implicit i: Int) extends Base({println(i); 0})
+
+// what "no implicit value of type Int found"
+class D2()(implicit i: Int) extends Base(implicitly[Int])
+
+
+abstract class ParametricMessage[M: Manifest](msg: M) { def message = msg }
+case class ParametricMessage1[M: Manifest](msg: M, p1: Class[_]) extends ParametricMessage(msg)
+
+
+class Wrap {
+ class Base[M](i: Int)
+
+ // was "implicit modifier not allowed on top level objects"
+ class D1()(implicit i: Int) extends Base({println(i); 0})
+
+ // what "no implicit value of type Int found"
+ class D2()(implicit i: Int) extends Base(implicitly[Int])
+
+
+ abstract class ParametricMessage[M: Manifest](msg: M) { def message = msg }
+ case class ParametricMessage1[M: Manifest](msg: M, p1: Class[_]) extends ParametricMessage(msg)
+}
diff --git a/test/files/pos/t5454.scala b/test/files/pos/t5454.scala
new file mode 100644
index 0000000000..4045f3b57b
--- /dev/null
+++ b/test/files/pos/t5454.scala
@@ -0,0 +1,10 @@
+object IllegalInheritance {
+ trait A
+ implicit def a = new A {} // def => val
+ //val r = implicitly[A] // uncomment
+
+ class B[T](t : T)(implicit a : A) // remove implicit param block
+
+ class C extends B/*[Int]*/(23) // uncomment
+ val c = new C // comment
+}
diff --git a/test/files/pos/t8893.scala b/test/files/pos/t8893.scala
new file mode 100644
index 0000000000..b87c8bdd3c
--- /dev/null
+++ b/test/files/pos/t8893.scala
@@ -0,0 +1,129 @@
+// Took > 10 minutes to run the tail call phase.
+object Test {
+ def a(): Option[String] = Some("a")
+
+ def main(args: Array[String]) {
+ a() match {
+ case Some(b1) =>
+ a() match {
+ case Some(b2) =>
+ a() match {
+ case Some(b3) =>
+ a() match {
+ case Some(b4) =>
+ a() match {
+ case Some(b5) =>
+ a() match {
+ case Some(b6) =>
+ a() match {
+ case Some(b7) =>
+ a() match {
+ case Some(b8) =>
+ a() match {
+ case Some(b9) =>
+ a() match {
+ case Some(b10) =>
+ a() match {
+ case Some(b11) =>
+ a() match {
+ case Some(b12) =>
+ a() match {
+ case Some(b13) =>
+ a() match {
+ case Some(b14) =>
+ a() match {
+ case Some(b15) =>
+ a() match {
+ case Some(b16) =>
+ a() match {
+ case Some(b17) =>
+ a() match {
+ case Some(b18) =>
+ a() match {
+ case Some(b19) =>
+ a() match {
+ case Some(b20) =>
+ a() match {
+ case Some(b21) =>
+ a() match {
+ case Some(b22) =>
+ a() match {
+ case Some(b23) =>
+ a() match {
+ case Some(b24) =>
+ a() match {
+ case Some(b25) =>
+ a() match {
+ case Some(b26) =>
+ a() match {
+ case Some(b27) =>
+ a() match {
+ case Some(b28) =>
+ a() match {
+ case Some(b29) =>
+ a() match {
+ case Some(b30) =>
+ println("yay")
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ case None => None
+ }
+ }
+}
+
diff --git a/test/files/pos/t8900.scala b/test/files/pos/t8900.scala
new file mode 100644
index 0000000000..376bd786f2
--- /dev/null
+++ b/test/files/pos/t8900.scala
@@ -0,0 +1,11 @@
+package foo
+package lambdaking
+
+class Test {
+ def byname(b: => Any) = ???
+ def foo: Any = {
+ def bar: Any = {
+ byname(bar)
+ }
+ }
+}
diff --git a/test/files/pos/t8934a/A_1.scala b/test/files/pos/t8934a/A_1.scala
new file mode 100644
index 0000000000..6c1f29d030
--- /dev/null
+++ b/test/files/pos/t8934a/A_1.scala
@@ -0,0 +1,18 @@
+import language.experimental.macros
+import reflect.macros.whitebox.Context
+
+object Unapply {
+ def impl1(c: Context)(a: c.Tree): c.Tree = {
+ import c.universe._
+ q"(new { def unapply[T](a: String): Option[(Int, String)] = ??? }).unapply($a)"
+ }
+ def unapply(a: Any): Any = macro impl1
+}
+
+object UnapplySeq {
+ def impl1(c: Context)(a: c.Tree): c.Tree = {
+ import c.universe._
+ q"(new { def unapplySeq[T](a: String): Option[(Int, Seq[String])] = ??? }).unapplySeq($a)"
+ }
+ def unapplySeq(a: Any): Any = macro impl1
+}
diff --git a/test/files/pos/t8934a/Test_2.flags b/test/files/pos/t8934a/Test_2.flags
new file mode 100644
index 0000000000..618dfe2b75
--- /dev/null
+++ b/test/files/pos/t8934a/Test_2.flags
@@ -0,0 +1 @@
+-Ystop-after:typer -Ymacro-expand:discard -nowarn
diff --git a/test/files/pos/t8934a/Test_2.scala b/test/files/pos/t8934a/Test_2.scala
new file mode 100644
index 0000000000..e1792ed3c5
--- /dev/null
+++ b/test/files/pos/t8934a/Test_2.scala
@@ -0,0 +1,12 @@
+object Test {
+ "" match {
+ case Unapply(a, b) =>
+ a: Int
+ b: String
+ case UnapplySeq(a, b1, b2) =>
+ a: Int
+ b1: String
+ b2: String
+ }
+}
+// These used to fail `too many patterns` under -Ymacro-expand:discard
diff --git a/test/files/presentation/private-case-class-members.check b/test/files/presentation/private-case-class-members.check
new file mode 100644
index 0000000000..678f9a34e6
--- /dev/null
+++ b/test/files/presentation/private-case-class-members.check
@@ -0,0 +1 @@
+Test OK
diff --git a/test/files/presentation/private-case-class-members/Test.scala b/test/files/presentation/private-case-class-members/Test.scala
new file mode 100644
index 0000000000..e64c8238ea
--- /dev/null
+++ b/test/files/presentation/private-case-class-members/Test.scala
@@ -0,0 +1,34 @@
+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 source = loadSourceAndWaitUntilTypechecked("State.scala")
+ checkErrors(source)
+ }
+
+ private def loadSourceAndWaitUntilTypechecked(sourceName: String): SourceFile = {
+ val sourceFile = sourceFiles.find(_.file.name == sourceName).head
+ compiler.askToDoFirst(sourceFile)
+ val res = new Response[Unit]
+ compiler.askReload(List(sourceFile), res)
+ res.get
+ askLoadedTyped(sourceFile).get
+ // the second round of type-checking makes it fail
+ compiler.askReload(List(sourceFile), res)
+ res.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/private-case-class-members/src/State.scala b/test/files/presentation/private-case-class-members/src/State.scala
new file mode 100644
index 0000000000..c31817076c
--- /dev/null
+++ b/test/files/presentation/private-case-class-members/src/State.scala
@@ -0,0 +1,5 @@
+object State
+case class State(private val foo: Int)
+
+case class State2(private val foo: Int)
+object State2
diff --git a/test/files/presentation/quasiquotes.flags b/test/files/presentation/quasiquotes.flags
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/presentation/quasiquotes.flags
diff --git a/test/files/presentation/t8934.check b/test/files/presentation/t8934.check
new file mode 100644
index 0000000000..0ece87f808
--- /dev/null
+++ b/test/files/presentation/t8934.check
@@ -0,0 +1,2 @@
+reload: Source.scala
+Test OK
diff --git a/test/files/presentation/t8934/Runner.scala b/test/files/presentation/t8934/Runner.scala
new file mode 100644
index 0000000000..944f458391
--- /dev/null
+++ b/test/files/presentation/t8934/Runner.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("Source.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/t8934/src/Source.scala b/test/files/presentation/t8934/src/Source.scala
new file mode 100644
index 0000000000..769c8fd38b
--- /dev/null
+++ b/test/files/presentation/t8934/src/Source.scala
@@ -0,0 +1,10 @@
+class Quasi {
+ import reflect.runtime.universe._
+
+ def test: Unit = {
+ (null: Any) match {
+ case q"$foo($bar)" =>
+ }
+ ()
+ }
+}
diff --git a/test/files/presentation/t8941.check b/test/files/presentation/t8941.check
new file mode 100644
index 0000000000..341804903a
--- /dev/null
+++ b/test/files/presentation/t8941.check
@@ -0,0 +1,7 @@
+reload: Source.scala
+
+askType at Source.scala(6,7)
+================================================================================
+[response] askTypeAt (6,7)
+scala.this.Predef.???
+================================================================================
diff --git a/test/files/presentation/t8941/Runner.scala b/test/files/presentation/t8941/Runner.scala
new file mode 100644
index 0000000000..0a8923a583
--- /dev/null
+++ b/test/files/presentation/t8941/Runner.scala
@@ -0,0 +1,11 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest {
+ override def runDefaultTests() {
+ // make sure typer is done.. the virtual pattern matcher might translate
+ // some trees and mess up positions. But we'll catch it red handed!
+ // sourceFiles foreach (src => askLoadedTyped(src).get)
+ super.runDefaultTests()
+ }
+
+}
diff --git a/test/files/presentation/t8941/src/Source.scala b/test/files/presentation/t8941/src/Source.scala
new file mode 100644
index 0000000000..7438cccb03
--- /dev/null
+++ b/test/files/presentation/t8941/src/Source.scala
@@ -0,0 +1,8 @@
+object Foo {
+ implicit class MatCreator(val ctx: StringContext) extends AnyVal {
+ def m(args: Any*): Unit = {
+ ctx.checkLengths(args)
+ }
+ ???/*?*/
+ }
+}
diff --git a/test/files/presentation/t8941b/IdempotencyTest.scala b/test/files/presentation/t8941b/IdempotencyTest.scala
new file mode 100644
index 0000000000..af01b36898
--- /dev/null
+++ b/test/files/presentation/t8941b/IdempotencyTest.scala
@@ -0,0 +1,73 @@
+package scala.tools.nsc
+package interactive
+package tests.core
+
+import reporters.{Reporter => CompilerReporter}
+import scala.tools.nsc.interactive.InteractiveReporter
+import scala.reflect.internal.util.SourceFile
+
+/** Determistically interrupts typechecking of `code` when a defintion named
+ * `MagicInterruptionMarker` is typechecked, and then performs a targetted
+ * typecheck of the tree at the specal comment marker marker
+ */
+abstract class IdempotencyTest { self =>
+ private val settings = new Settings
+ settings.usejavacp.value = true
+
+ private object Break extends scala.util.control.ControlThrowable
+
+ private val compilerReporter: CompilerReporter = new InteractiveReporter {
+ override def compiler = self.compiler
+ }
+
+ object compiler extends Global(settings, compilerReporter) {
+ override def checkForMoreWork(pos: Position) {
+ }
+ override def signalDone(context: Context, old: Tree, result: Tree) {
+ // println("signalDone: " + old.toString.take(50).replaceAll("\n", "\\n"))
+ if (!interrupted && analyzer.lockedCount == 0 && interruptsEnabled && shouldInterrupt(result)) {
+ interrupted = true
+ val typed = typedTreeAt(markerPosition)
+ checkTypedTree(typed)
+ throw Break
+ }
+ super.signalDone(context, old, result)
+ }
+
+ // we're driving manually using our own thread, disable the check here.
+ override def assertCorrectThread() {}
+ }
+
+ import compiler._
+
+ private var interrupted = false
+
+ // Extension points
+ protected def code: String
+ protected def shouldInterrupt(tree: Tree): Boolean = {
+ tree.symbol != null && tree.symbol.name.toString == "MagicInterruptionMarker"
+ }
+ protected def checkTypedTree(tree: Tree): Unit = {}
+
+
+ private val source: SourceFile = newSourceFile(code)
+ private def markerPosition: Position = source.position(code.indexOf("/*?*/"))
+
+ def assertNoProblems() {
+ val problems = getUnit(source).get.problems
+ assert(problems.isEmpty, problems.mkString("\n"))
+ }
+
+ def show() {
+ reloadSource(source)
+ try {
+ typedTree(source, true)
+ assert(false, "Expected to break out of typechecking.")
+ } catch {
+ case Break => // expected
+ }
+ assertNoProblems()
+ }
+
+ def main(args: Array[String]) { show() }
+}
diff --git a/test/files/presentation/t8941b/Test.scala b/test/files/presentation/t8941b/Test.scala
new file mode 100644
index 0000000000..7269a14286
--- /dev/null
+++ b/test/files/presentation/t8941b/Test.scala
@@ -0,0 +1,53 @@
+import scala.tools.nsc.interactive.tests.core.IdempotencyTest
+
+// At the time of writing this test, removing any part of `enterExistingSym`
+// leads to a failure.
+object Test {
+ def main(args: Array[String]) {
+ test("""
+ object Foo {
+ def term {
+ def foo(c: String = "") = c
+ class MagicInterruptionMarker
+ foo()/*?*/
+ }
+ }
+ """)
+
+ test("""
+ object Foo {
+ def term {
+ def foo = 42
+ class MagicInterruptionMarker
+ foo/*?*/
+ }
+ }
+ """)
+
+ test("""
+ object Foo {
+ def term {
+ lazy val foo = 42
+ class MagicInterruptionMarker
+ foo/*?*/
+ }
+ }
+ """)
+
+ test("""
+ object Foo {
+ implicit class C(val a: String) extends AnyVal
+ class MagicInterruptionMarker
+ ""/*?*/
+ }
+ """)
+ }
+
+ def test(code0: String) {
+ val t = new IdempotencyTest {
+ def code = code0
+ }
+ t.show()
+ }
+}
+
diff --git a/test/files/res/t6613.check b/test/files/res/t6613.check
new file mode 100644
index 0000000000..bbd9331b16
--- /dev/null
+++ b/test/files/res/t6613.check
@@ -0,0 +1,5 @@
+
+nsc>
+nsc>
+nsc>
+nsc>
diff --git a/test/files/res/t6613.res b/test/files/res/t6613.res
new file mode 100644
index 0000000000..e3fa000fdd
--- /dev/null
+++ b/test/files/res/t6613.res
@@ -0,0 +1,3 @@
+t6613/Enummy.java
+t6613/Broken.scala
+t6613/Broken.scala
diff --git a/test/files/res/t6613/Broken.scala b/test/files/res/t6613/Broken.scala
new file mode 100644
index 0000000000..9bcd12dbe1
--- /dev/null
+++ b/test/files/res/t6613/Broken.scala
@@ -0,0 +1 @@
+class Broken() { def broken() = Enummy.Broke.CHIP }
diff --git a/test/files/res/t6613/Enummy.java b/test/files/res/t6613/Enummy.java
new file mode 100644
index 0000000000..1863ef1297
--- /dev/null
+++ b/test/files/res/t6613/Enummy.java
@@ -0,0 +1 @@
+public class Enummy { public enum Broke { SHARD, CHIP } }
diff --git a/test/files/res/t8871.check b/test/files/res/t8871.check
new file mode 100644
index 0000000000..bbd9331b16
--- /dev/null
+++ b/test/files/res/t8871.check
@@ -0,0 +1,5 @@
+
+nsc>
+nsc>
+nsc>
+nsc>
diff --git a/test/files/res/t8871.res b/test/files/res/t8871.res
new file mode 100644
index 0000000000..9b1a5fb57f
--- /dev/null
+++ b/test/files/res/t8871.res
@@ -0,0 +1,4 @@
+t8871/tag.scala
+t8871/usetag.scala
+t8871/usetag.scala
+
diff --git a/test/files/res/t8871/tag.scala b/test/files/res/t8871/tag.scala
new file mode 100644
index 0000000000..1a1803b77d
--- /dev/null
+++ b/test/files/res/t8871/tag.scala
@@ -0,0 +1,3 @@
+class Tag {
+ @inline def apply[@specialized A, T](a: A): A = a
+}
diff --git a/test/files/res/t8871/usetag.scala b/test/files/res/t8871/usetag.scala
new file mode 100644
index 0000000000..139d768552
--- /dev/null
+++ b/test/files/res/t8871/usetag.scala
@@ -0,0 +1,6 @@
+trait Foo
+
+object Test {
+ val y = new Tag().apply[Double, Foo](3.3)
+ // under FSC, this gave t8871/usetag.scala:4: error: wrong number of type parameters for method apply$mDc$sp: [T](a: Double)Double
+}
diff --git a/test/files/run/global-showdef.check b/test/files/run/global-showdef.check
index 4c2fd41a1a..4ac96b4315 100644
--- a/test/files/run/global-showdef.check
+++ b/test/files/run/global-showdef.check
@@ -1,14 +1,14 @@
<<-- class foo.bar.Bippy after phase 'typer' -->>
def showdefTestMemberClass1: Int
+<<-- object foo.bar.Bippy after phase 'typer' -->>
+ def showdefTestMemberObject2: String
<<-- type foo.bar.Bippy.BippyType after phase 'typer' -->>
def showdefTestMemberType1: Unit
+<<-- object foo.bar.Bippy.Boppity.Boo after phase 'typer' -->>
+ def showdefTestMemberObject1: String
<<-- type foo.bar.Bippy.BippyType after phase 'typer' -->>
def showdefTestMemberType2: Unit
<<-- class foo.bar.Bippy.Boppity after phase 'typer' -->>
def showdefTestMemberClass2: Int
<<-- class foo.bar.Bippy.Boppity.Boo after phase 'typer' -->>
def showdefTestMemberClass3: Int
-<<-- object foo.bar.Bippy after phase 'typer' -->>
- def showdefTestMemberObject2: String
-<<-- object foo.bar.Bippy.Boppity.Boo after phase 'typer' -->>
- def showdefTestMemberObject1: String
diff --git a/test/files/run/global-showdef.scala b/test/files/run/global-showdef.scala
index 1d4891fd1f..276fcc1e7c 100644
--- a/test/files/run/global-showdef.scala
+++ b/test/files/run/global-showdef.scala
@@ -1,11 +1,10 @@
-import scala.tools.nsc._
-import scala.reflect.io.AbstractFile
+import scala.tools.partest.DirectTest
import scala.tools.nsc.util.stringFromStream
-import scala.reflect.internal.util.{ SourceFile, BatchSourceFile }
-import scala.tools.nsc.reporters.ConsoleReporter
-object Test {
- val src: SourceFile = new BatchSourceFile("src", """
+object Test extends DirectTest {
+ override def extraSettings: String = "-usejavacp -Yshow:typer -Ystop-after:typer"
+
+ override def code = """
package foo.bar
class Bippy {
@@ -32,39 +31,28 @@ object Bippy {
def showdefTestMemberObject2 = "abc"
}
- """)
+ """
+
+ override def show(): Unit = {
+ val classes = List("Bippy", "Bippy#BippyType", "Bippy.BippyType", "Bippy#Boppity", "Bippy#Boppity#Boo")
+ val objects = List("Bippy", "Bippy#Boppity#Boo")
+
+ def interesting(line: String) = (line contains "def showdefTestMember") || (line startsWith "<<-- ")
- def mkCompiler(args: String*) = {
- val settings = new Settings()
- val command = new CompilerCommand("-usejavacp" :: args.toList, settings)
+ def run(args: String*) = slurp(args: _*).lines filter interesting foreach println
- new Global(settings)
+ classes.zipAll(objects, "", "") foreach {
+ case (c, "") => run("-Xshow-class", c)
+ case (c, o) => run("-Xshow-class", c, "-Xshow-object", o)
+ }
}
- def slurp(body: => Unit): String = stringFromStream { stream =>
+ // slurp the compilation result
+ def slurp(args: String*): String = stringFromStream { stream =>
Console.withOut(stream) {
Console.withErr(stream) {
- body
+ compile(args: _*)
}
}
}
- def lines(args: String*): List[String] = {
- val output = slurp {
- val compiler = mkCompiler(args: _*)
- val run = new compiler.Run()
- run.compileSources(List(src))
- }
- output.lines.toList
- }
- def showClass(name: String) = lines("-Yshow:typer", "-Xshow-class", name)
- def showObject(name: String) = lines("-Yshow:typer", "-Xshow-object", name)
-
- def show(xs: List[String]) = {
- xs filter (x => (x contains "def showdefTestMember") || (x startsWith "<<-- ")) foreach println
- }
-
- def main(args: Array[String]) {
- show(List("Bippy", "Bippy#BippyType", "Bippy.BippyType", "Bippy#Boppity", "Bippy#Boppity#Boo") flatMap showClass)
- show(List("Bippy", "Bippy#Boppity#Boo") flatMap showObject)
- }
}
diff --git a/test/files/run/t4332.scala b/test/files/run/t4332.scala
index 1c7e7d73de..5a67922911 100644
--- a/test/files/run/t4332.scala
+++ b/test/files/run/t4332.scala
@@ -12,7 +12,7 @@ object Test extends DirectTest {
}
def isExempt(sym: Symbol) = {
- val exempt = Set("view", "repr", "sliceWithKnownDelta", "sliceWithKnownBound", "transform", "filterImpl")
+ val exempt = Set("view", "repr", "sliceWithKnownDelta", "sliceWithKnownBound", "transform")
(exempt contains sym.name.decoded)
}
diff --git a/test/files/run/t4950.check b/test/files/run/t4950.check
new file mode 100644
index 0000000000..3f3a302b62
--- /dev/null
+++ b/test/files/run/t4950.check
@@ -0,0 +1,9 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> val 1 = 2
+scala.MatchError: 2 (of class java.lang.Integer)
+
+scala> val List(1) = List(1)
+
+scala> :quit
diff --git a/test/files/run/t4950.scala b/test/files/run/t4950.scala
new file mode 100644
index 0000000000..cef06027bf
--- /dev/null
+++ b/test/files/run/t4950.scala
@@ -0,0 +1,12 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ // Filter out the abbreviated stacktrace "... X elided"
+ // because the number seems to differ between versions/platforms/...
+ override def show = eval() filterNot (_ contains "elided") foreach println
+ def code =
+"""
+val 1 = 2
+val List(1) = List(1)
+"""
+}
diff --git a/test/files/run/t6541-option.scala b/test/files/run/t6541-option.scala
new file mode 100644
index 0000000000..2c10c9e09d
--- /dev/null
+++ b/test/files/run/t6541-option.scala
@@ -0,0 +1,19 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+:setting -Xsource:2.12
+case class C12(clazz: Class[_])
+val o: Option[Class[T] forSome { type T}] = C12.unapply(C12(classOf[String]))
+
+:setting -Xsource:2.11
+import scala.language.existentials
+case class C11(clazz: Class[_])
+val o: Option[Class[T]] forSome { type T } = C11.unapply(C11(classOf[String]))
+ """
+
+ override def show() = {
+ val r = eval().mkString("\n")
+ assert(!(r.contains("warning") || r.contains("error")), r)
+ }
+}
diff --git a/test/files/run/t6541.flags b/test/files/run/t6541.flags
new file mode 100644
index 0000000000..68d0ddfec2
--- /dev/null
+++ b/test/files/run/t6541.flags
@@ -0,0 +1 @@
+-feature -Xfatal-warnings -Xsource:2.12 \ No newline at end of file
diff --git a/test/files/run/t6541.scala b/test/files/run/t6541.scala
new file mode 100644
index 0000000000..f127143691
--- /dev/null
+++ b/test/files/run/t6541.scala
@@ -0,0 +1,25 @@
+class A
+class B[T](x: T)
+case class C(a: A, b: B[_])
+
+case class D(a: A, b: B[_]*)
+
+case class E(c: Class[_])
+
+object Test extends App {
+ def f1(c: C) = c match {
+ case C(a, b) => ()
+ }
+
+ def f2(d: D) = d match {
+ case D(a, b1, b2) => ()
+ }
+
+ def f3(e: E) = e match {
+ case E(c) => ()
+ }
+
+ f1(C(new A, new B(1)))
+ f2(D(new A, new B(1), new B(2)))
+ f3(E(classOf[E]))
+}
diff --git a/test/files/run/t8893.scala b/test/files/run/t8893.scala
new file mode 100644
index 0000000000..6fef8ae912
--- /dev/null
+++ b/test/files/run/t8893.scala
@@ -0,0 +1,40 @@
+import annotation.tailrec
+
+object Test {
+ def a(): Option[String] = Some("a")
+
+ def test1: Any = {
+ a() match {
+ case Some(b1) =>
+ a() match {
+ case Some(b2) =>
+ @tailrec
+ def tick(i: Int): Unit = if (i < 0) () else tick(i - 1)
+ tick(10000000) // testing that this doesn't SOE
+ case None => None
+ }
+ case None => None
+ }
+ }
+
+ def test2: Any = {
+ a() match {
+ case Some(b1) =>
+ a() match {
+ case Some(b2) =>
+ @tailrec
+ def tick(i: Int): Unit = if (i < 0) () else tick(i - 1)
+ tick(10000000) // testing that this doesn't SOE
+ case None => test1
+ }
+ case None =>
+ test1 // not a tail call
+ test1
+ }
+ }
+
+ def main(args: Array[String]) {
+ test1
+ test2
+ }
+}
diff --git a/test/files/run/t8893b.scala b/test/files/run/t8893b.scala
new file mode 100644
index 0000000000..19120871aa
--- /dev/null
+++ b/test/files/run/t8893b.scala
@@ -0,0 +1,15 @@
+// Testing that recursive calls in tail positions are replaced with
+// jumps, even though the method contains recursive calls outside
+// of the tail position.
+object Test {
+ def tick(i : Int): Unit =
+ if (i == 0) ()
+ else if (i == 42) {
+ tick(0) /*not in tail posiiton*/
+ tick(i - 1)
+ } else tick(i - 1)
+
+ def main(args: Array[String]): Unit = {
+ tick(1000000)
+ }
+}
diff --git a/test/files/run/t8907.scala b/test/files/run/t8907.scala
new file mode 100644
index 0000000000..7952ac82d9
--- /dev/null
+++ b/test/files/run/t8907.scala
@@ -0,0 +1,39 @@
+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 show(): Unit = {
+ compileCode("""
+ class C { class Inner }
+
+ class D {
+ object O {
+ def foo(c: C)(i: c.Inner): c.Inner = ???
+ }
+ }
+ """)
+ assert(filteredInfos.isEmpty, filteredInfos)
+ deleteClass("C")
+ compileCode("""
+ class E {
+ def foo = {
+ (null: D).toString
+ }
+ }
+ """)
+ assert(storeReporter.infos.isEmpty, storeReporter.infos.mkString("\n")) // Included a MissingRequirementError before.
+ }
+
+ def deleteClass(name: String) {
+ val classFile = new File(testOutput.path, name + ".class")
+ assert(classFile.exists)
+ assert(classFile.delete())
+ }
+}
diff --git a/test/files/run/xMigration.check b/test/files/run/xMigration.check
new file mode 100644
index 0000000000..378f7bb6c3
--- /dev/null
+++ b/test/files/run/xMigration.check
@@ -0,0 +1,49 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> Map(1 -> "eis").values // no warn
+res0: Iterable[String] = MapLike(eis)
+
+scala> :setting -Xmigration:none
+
+scala> Map(1 -> "eis").values // no warn
+res1: Iterable[String] = MapLike(eis)
+
+scala> :setting -Xmigration:any
+
+scala> Map(1 -> "eis").values // warn
+<console>:8: warning: method values in trait MapLike has changed semantics in version 2.8.0:
+`values` returns `Iterable[B]` rather than `Iterator[B]`.
+ Map(1 -> "eis").values // warn
+ ^
+res2: Iterable[String] = MapLike(eis)
+
+scala> :setting -Xmigration:2.8
+
+scala> Map(1 -> "eis").values // no warn
+res3: Iterable[String] = MapLike(eis)
+
+scala> :setting -Xmigration:2.7
+
+scala> Map(1 -> "eis").values // warn
+<console>:8: warning: method values in trait MapLike has changed semantics in version 2.8.0:
+`values` returns `Iterable[B]` rather than `Iterator[B]`.
+ Map(1 -> "eis").values // warn
+ ^
+res4: Iterable[String] = MapLike(eis)
+
+scala> :setting -Xmigration:2.11
+
+scala> Map(1 -> "eis").values // no warn
+res5: Iterable[String] = MapLike(eis)
+
+scala> :setting -Xmigration // same as :any
+
+scala> Map(1 -> "eis").values // warn
+<console>:8: warning: method values in trait MapLike has changed semantics in version 2.8.0:
+`values` returns `Iterable[B]` rather than `Iterator[B]`.
+ Map(1 -> "eis").values // warn
+ ^
+res6: Iterable[String] = MapLike(eis)
+
+scala> :quit
diff --git a/test/files/run/xMigration.scala b/test/files/run/xMigration.scala
new file mode 100644
index 0000000000..688e878397
--- /dev/null
+++ b/test/files/run/xMigration.scala
@@ -0,0 +1,19 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+Map(1 -> "eis").values // no warn
+:setting -Xmigration:none
+Map(1 -> "eis").values // no warn
+:setting -Xmigration:any
+Map(1 -> "eis").values // warn
+:setting -Xmigration:2.8
+Map(1 -> "eis").values // no warn
+:setting -Xmigration:2.7
+Map(1 -> "eis").values // warn
+:setting -Xmigration:2.11
+Map(1 -> "eis").values // no warn
+:setting -Xmigration // same as :any
+Map(1 -> "eis").values // warn
+ """
+}
diff --git a/test/junit/scala/collection/immutable/StreamTest.scala b/test/junit/scala/collection/immutable/StreamTest.scala
deleted file mode 100644
index 6dc1c79a48..0000000000
--- a/test/junit/scala/collection/immutable/StreamTest.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-package scala.collection.immutable
-
-import org.junit.runner.RunWith
-import org.junit.runners.JUnit4
-import org.junit.Test
-import org.junit.Assert._
-
-@RunWith(classOf[JUnit4])
-class StreamTest {
-
- @Test
- def t6727_and_t6440(): Unit = {
- assertTrue(Stream.continually(()).filter(_ => true).take(2) == Seq((), ()))
- assertTrue(Stream.continually(()).filterNot(_ => false).take(2) == Seq((), ()))
- assertTrue(Stream(1,2,3,4,5).filter(_ < 4) == Seq(1,2,3))
- assertTrue(Stream(1,2,3,4,5).filterNot(_ > 4) == Seq(1,2,3,4))
- }
-}
diff --git a/test/junit/scala/collection/mutable/BitSetTest.scala b/test/junit/scala/collection/mutable/BitSetTest.scala
new file mode 100644
index 0000000000..8d164b50d4
--- /dev/null
+++ b/test/junit/scala/collection/mutable/BitSetTest.scala
@@ -0,0 +1,22 @@
+package scala.collection.mutable
+
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.junit.{Test, Ignore}
+
+@RunWith(classOf[JUnit4])
+class BitSetTest {
+ // Test for SI-8910
+ @Test def capacityExpansionTest() {
+ val bitSet = BitSet.empty
+ val size = bitSet.toBitMask.length
+ bitSet ^= bitSet
+ assert(bitSet.toBitMask.length == size, "Capacity of bitset changed after ^=")
+ bitSet |= bitSet
+ assert(bitSet.toBitMask.length == size, "Capacity of bitset changed after |=")
+ bitSet &= bitSet
+ assert(bitSet.toBitMask.length == size, "Capacity of bitset changed after &=")
+ bitSet &~= bitSet
+ assert(bitSet.toBitMask.length == size, "Capacity of bitset changed after &~=")
+ }
+}
diff --git a/test/junit/scala/issues/BytecodeTests.scala b/test/junit/scala/issues/BytecodeTests.scala
index 7a05472277..d4ed063a03 100644
--- a/test/junit/scala/issues/BytecodeTests.scala
+++ b/test/junit/scala/issues/BytecodeTests.scala
@@ -4,6 +4,7 @@ import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.junit.Test
import scala.tools.asm.Opcodes
+import scala.tools.nsc.backend.jvm.AsmUtils
import scala.tools.nsc.backend.jvm.CodeGenTools._
import org.junit.Assert._
import scala.collection.JavaConverters._
@@ -36,4 +37,44 @@ class BytecodeTests {
assertTrue(getSingleMethod(c, "f").instructions.count(_.isInstanceOf[TableSwitch]) == 1)
assertTrue(getSingleMethod(c, "g").instructions.count(_.isInstanceOf[LookupSwitch]) == 1)
}
+
+ @Test
+ def t8926(): Unit = {
+ import scala.reflect.internal.util.BatchSourceFile
+
+ // this test cannot be implemented using partest because of its mixed-mode compilation strategy:
+ // partest first compiles all files with scalac, then the java files, and then again the scala
+ // using the output classpath. this shadows the bug SI-8926.
+
+ val annotA =
+ """import java.lang.annotation.Retention;
+ |import java.lang.annotation.RetentionPolicy;
+ |@Retention(RetentionPolicy.RUNTIME)
+ |public @interface AnnotA { }
+ """.stripMargin
+ val annotB = "public @interface AnnotB { }"
+
+ val scalaSrc =
+ """@AnnotA class A
+ |@AnnotB class B
+ """.stripMargin
+
+ val compiler = newCompiler()
+ val run = new compiler.Run()
+ run.compileSources(List(new BatchSourceFile("AnnotA.java", annotA), new BatchSourceFile("AnnotB.java", annotB), new BatchSourceFile("Test.scala", scalaSrc)))
+ val outDir = compiler.settings.outputDirs.getSingleOutput.get
+ val outfiles = (for (f <- outDir.iterator if !f.isDirectory) yield (f.name, f.toByteArray)).toList
+
+ def check(classfile: String, annotName: String) = {
+ val f = (outfiles collect { case (`classfile`, bytes) => AsmUtils.readClass(bytes) }).head
+ val descs = f.visibleAnnotations.asScala.map(_.desc).toList
+ assertTrue(descs.toString, descs exists (_ contains annotName))
+ }
+
+ check("A.class", "AnnotA")
+
+ // known issue SI-8928: the visibility of AnnotB should be CLASS, but annotation classes without
+ // a @Retention annotation are currently emitted as RUNTIME.
+ check("B.class", "AnnotB")
+ }
}
diff --git a/test/junit/scala/reflect/internal/PrintersTest.scala b/test/junit/scala/reflect/internal/PrintersTest.scala
index ca9b4671b2..7043c26d5e 100644
--- a/test/junit/scala/reflect/internal/PrintersTest.scala
+++ b/test/junit/scala/reflect/internal/PrintersTest.scala
@@ -354,6 +354,13 @@ trait ClassPrintTests {
| def y = "test"
|}""")
+ @Test def testClassConstructorModifiers = assertPrintedCode("class X private (x: scala.Int)")
+
+ @Test def testClassConstructorModifierVisibility = assertPrintedCode(sm"""
+ |object A {
+ | class X protected[A] (x: scala.Int)
+ |}""")
+
@Test def testClassWithPublicParams = assertPrintedCode("class X(val x: scala.Int, val s: scala.Predef.String)")
@Test def testClassWithParams1 = assertPrintedCode("class X(x: scala.Int, s: scala.Predef.String)")
diff --git a/test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala b/test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala
new file mode 100644
index 0000000000..77a2da828e
--- /dev/null
+++ b/test/junit/scala/tools/nsc/settings/ScalaVersionTest.scala
@@ -0,0 +1,18 @@
+package scala.tools.nsc
+package settings
+
+import org.junit.Assert._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import scala.tools.testing.AssertUtil.assertThrows
+
+@RunWith(classOf[JUnit4])
+class ScalaVersionTest {
+ // SI-8711
+ @Test def versionUnparse() {
+ val v = "2.11.3"
+
+ assertEquals(ScalaVersion(v).unparse, v)
+ }
+}
diff --git a/test/junit/scala/tools/nsc/settings/SettingsTest.scala b/test/junit/scala/tools/nsc/settings/SettingsTest.scala
index eda0c27834..96f83c4c2f 100644
--- a/test/junit/scala/tools/nsc/settings/SettingsTest.scala
+++ b/test/junit/scala/tools/nsc/settings/SettingsTest.scala
@@ -164,4 +164,20 @@ class SettingsTest {
assertThrows[IllegalArgumentException](check("-m:a,b,-ab")(_ => true), _ contains "'ab' cannot be negated")
assertThrows[IllegalArgumentException](check("-m:a,ac,-uber,uber")(_ => true), _ contains "'uber' cannot be negated")
}
+
+ @Test def xSourceTest(): Unit = {
+ def check(expected: String, args: String*): Unit = {
+ val s = new MutableSettings(msg => throw new IllegalArgumentException(msg))
+ val (_, residual) = s.processArguments(args.toList, processAll = true)
+ assert(residual.isEmpty)
+ assertTrue(s.source.value == ScalaVersion(expected))
+ }
+ check(expected = "2.11.0") // default
+ check(expected = "2.11.0", "-Xsource:2.11")
+ check(expected = "2.10", "-Xsource:2.10.0")
+ check(expected = "2.12", "-Xsource:2.12")
+ assertThrows[IllegalArgumentException](check(expected = "2.11", "-Xsource"), _ == "-Xsource requires an argument, the syntax is -Xsource:<version>")
+ assertThrows[IllegalArgumentException](check(expected = "2.11", "-Xsource", "2.11"), _ == "-Xsource requires an argument, the syntax is -Xsource:<version>")
+ assertThrows[IllegalArgumentException](check(expected = "2.11", "-Xsource:2.invalid"), _ contains "There was a problem parsing 2.invalid")
+ }
}
diff --git a/test/osgi/src/BasicLibrary.scala b/test/osgi/src/BasicLibrary.scala
index 6618f02102..ee8b7634ff 100644
--- a/test/osgi/src/BasicLibrary.scala
+++ b/test/osgi/src/BasicLibrary.scala
@@ -7,19 +7,16 @@ import org.ops4j.pax.exam.CoreOptions._
import org.junit.Test
import org.junit.runner.RunWith
import org.ops4j.pax.exam
-import org.ops4j.pax.exam.junit.{
- Configuration,
- ExamReactorStrategy,
- JUnit4TestRunner
-}
-import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory
-import org.ops4j.pax.swissbox.framework.ServiceLookup
+import org.ops4j.pax.exam.Configuration
+import org.ops4j.pax.exam.junit.PaxExam
+import org.ops4j.pax.exam.spi.reactors.{ ExamReactorStrategy, PerMethod }
+import org.ops4j.pax.swissbox.tracker.ServiceLookup
import org.osgi.framework.BundleContext
-@RunWith(classOf[JUnit4TestRunner])
-@ExamReactorStrategy(Array(classOf[AllConfinedStagedReactorFactory]))
+@RunWith(classOf[PaxExam])
+@ExamReactorStrategy(Array(classOf[PerMethod]))
class BasicLibraryTest extends ScalaOsgiHelper {
@Configuration
def config(): Array[exam.Option] =
diff --git a/test/osgi/src/BasicReflection.scala b/test/osgi/src/BasicReflection.scala
index d601f04f89..53ab7e5345 100644
--- a/test/osgi/src/BasicReflection.scala
+++ b/test/osgi/src/BasicReflection.scala
@@ -10,13 +10,10 @@ import org.ops4j.pax.exam.CoreOptions._
import org.junit.Test
import org.junit.runner.RunWith
import org.ops4j.pax.exam
-import org.ops4j.pax.exam.junit.{
- Configuration,
- ExamReactorStrategy,
- JUnit4TestRunner
-}
-import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory
-import org.ops4j.pax.swissbox.framework.ServiceLookup
+import org.ops4j.pax.exam.Configuration
+import org.ops4j.pax.exam.junit.PaxExam
+import org.ops4j.pax.exam.spi.reactors.{ ExamReactorStrategy, PerMethod }
+import org.ops4j.pax.swissbox.tracker.ServiceLookup
import org.osgi.framework.BundleContext
@@ -38,8 +35,8 @@ class C {
object M
-@RunWith(classOf[JUnit4TestRunner])
-@ExamReactorStrategy(Array(classOf[AllConfinedStagedReactorFactory]))
+@RunWith(classOf[PaxExam])
+@ExamReactorStrategy(Array(classOf[PerMethod]))
class BasicReflectionTest extends ScalaOsgiHelper {
@Configuration
diff --git a/test/osgi/src/BasicTest.scala b/test/osgi/src/BasicTest.scala
index 109b7b911a..5adf87ecc1 100644
--- a/test/osgi/src/BasicTest.scala
+++ b/test/osgi/src/BasicTest.scala
@@ -6,21 +6,18 @@ import org.ops4j.pax.exam.CoreOptions._
import org.junit.Test
import org.junit.runner.RunWith
import org.ops4j.pax.exam
-import org.ops4j.pax.exam.junit.{
- Configuration,
- ExamReactorStrategy,
- JUnit4TestRunner
-}
-import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory
-import org.ops4j.pax.swissbox.framework.ServiceLookup
+import org.ops4j.pax.exam.Configuration
+import org.ops4j.pax.exam.junit.PaxExam
+import org.ops4j.pax.exam.spi.reactors.{ ExamReactorStrategy, PerMethod }
+import org.ops4j.pax.swissbox.tracker.ServiceLookup
import org.osgi.framework.BundleContext
-@RunWith(classOf[JUnit4TestRunner])
-@ExamReactorStrategy(Array(classOf[AllConfinedStagedReactorFactory]))
+@RunWith(classOf[PaxExam])
+@ExamReactorStrategy(Array(classOf[PerMethod]))
class BasicTest extends ScalaOsgiHelper {
@Configuration
def config(): Array[exam.Option] = {
diff --git a/test/osgi/src/ReflectionToolboxTest.scala b/test/osgi/src/ReflectionToolboxTest.scala
index bb48078e95..a23de18d07 100644
--- a/test/osgi/src/ReflectionToolboxTest.scala
+++ b/test/osgi/src/ReflectionToolboxTest.scala
@@ -8,13 +8,10 @@ import org.ops4j.pax.exam.CoreOptions._
import org.junit.Test
import org.junit.runner.RunWith
import org.ops4j.pax.exam
-import org.ops4j.pax.exam.junit.{
- Configuration,
- ExamReactorStrategy,
- JUnit4TestRunner
-}
-import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory
-import org.ops4j.pax.swissbox.framework.ServiceLookup
+import org.ops4j.pax.exam.Configuration
+import org.ops4j.pax.exam.junit.PaxExam
+import org.ops4j.pax.exam.spi.reactors.{ ExamReactorStrategy, PerMethod }
+import org.ops4j.pax.swissbox.tracker.ServiceLookup
import org.osgi.framework.BundleContext
@@ -22,8 +19,8 @@ class C {
val f1 = 2
}
-@RunWith(classOf[JUnit4TestRunner])
-@ExamReactorStrategy(Array(classOf[AllConfinedStagedReactorFactory]))
+@RunWith(classOf[PaxExam])
+@ExamReactorStrategy(Array(classOf[PerMethod]))
class ReflectionToolBoxTest extends ScalaOsgiHelper {
@Configuration
diff --git a/test/osgi/src/ScalaOsgiHelper.scala b/test/osgi/src/ScalaOsgiHelper.scala
index 084afe8643..7ba8883bb8 100644
--- a/test/osgi/src/ScalaOsgiHelper.scala
+++ b/test/osgi/src/ScalaOsgiHelper.scala
@@ -20,19 +20,19 @@ trait ScalaOsgiHelper {
def standardOptions: Array[exam.Option] = {
val bundles = (allBundleFiles map makeBundle)
- bundles ++ Array[exam.Option](felix(), equinox(), junitBundles())
+ bundles ++ Array[exam.Option](junitBundles())
// to change the local repo used (for some operations, but not all -- which is why I didn't bother):
// systemProperty("org.ops4j.pax.url.mvn.localRepository").value(sys.props("maven.repo.local")))
}
def justReflectionOptions: Array[exam.Option] = {
val bundles = filteredBundleFiles("scala-library", "scala-reflect")
- bundles ++ Array[exam.Option](felix(), equinox(), junitBundles())
+ bundles ++ Array[exam.Option](junitBundles())
}
def justCoreLibraryOptions: Array[exam.Option] = {
val bundles = filteredBundleFiles("scala-library")
- bundles ++ Array[exam.Option](felix(), equinox(), junitBundles())
+ bundles ++ Array[exam.Option](junitBundles())
}
}
diff --git a/test/pending/pos/t3439.scala b/test/pending/pos/t3439.scala
deleted file mode 100644
index 425f1aeeb5..0000000000
--- a/test/pending/pos/t3439.scala
+++ /dev/null
@@ -1,2 +0,0 @@
-abstract class ParametricMessage[M: Manifest](msg: M) { def message = msg }
-case class ParametricMessage1[M: Manifest](msg: M, p1: Class[_]) extends ParametricMessage(msg)