Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static all the things #22

Closed
wants to merge 85 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
cb5daf3
SI-9665 Backquoted vbar in extractor pattern
som-snytt Feb 21, 2016
5fd8483
Added applyOrElse to MapLike
kilotaras Mar 20, 2016
9ec6278
SI-9760 Fix for higher-kinded GADT refinement
milessabin Apr 19, 2016
fa65623
Added missing result type to test.
milessabin Apr 20, 2016
5faad77
Added pos test with multiple cases; added neg tests.
milessabin May 6, 2016
b58634e
Improves the test cases for the scala-concurrent-tck
viktorklang Apr 5, 2016
45e607d
SI-9361 fixed assert allowing display of improved error message.
milessabin May 14, 2016
139f9a0
Make Range.Partial a value class
xuwei-k May 17, 2016
883fdd7
SI-5463 Check .jars before using them
May 10, 2016
214ea82
SI-9656 Range.toString distinguishes Numeric step
Feb 27, 2016
3cddeaa
SI-7916: ScriptEngine support
som-snytt Sep 14, 2015
80d996b
Include missing web assets in scaladoc
jodersky Apr 11, 2016
6be9fc6
SI-9781 Don't convert erroneous expression to assignment
liff May 19, 2016
481a390
Improvements to scala.concurrent.Future
viktorklang May 13, 2016
f7b575d
Merge pull request #5093 from jodersky/scaladoc-include-assets
szeiger May 20, 2016
72a59d9
Rename nsc.backend.jvm.CodeGenTools to testing.BytecodeTesting
lrytz May 19, 2016
5d5a6aa
Better abstraction for bytecode tests. Also organize some imports.
lrytz May 20, 2016
d9ce4dc
Better abstraction for JUnit run tests
lrytz May 20, 2016
ba510ab
Clean up bytecode testing methods.
lrytz May 20, 2016
0e7964a
Small cleanup in JUnit test
lrytz May 20, 2016
46d523b
Cleanup in BytecodeTest
lrytz May 20, 2016
2537027
Split RunTest and BytecodeTest into parts, put in matching packages.
lrytz May 20, 2016
64fdae8
All JUnit tests pass without bootstrap (when run in intellij, sbt)
lrytz May 20, 2016
e26835c
Adapt naming convention for collection.convert null safety test
lrytz May 20, 2016
1ea1916
Merge pull request #4819 from som-snytt/issue/7916-ScriptEngine-deferred
szeiger May 20, 2016
eeef260
SI-8044 Allow binding backquoted varid in patterns
som-snytt Jan 31, 2016
2eb1cc2
SI-8044 Test for quoted not-a-varid
som-snytt Jan 31, 2016
1e565d8
SI-8044 Allow any id in explicit pattern binding
som-snytt Mar 15, 2016
a79b9b7
Merge pull request #4988 from som-snytt/issue/backtick-bar
adriaanm May 21, 2016
2e40aa5
Merge pull request #5180 from lrytz/junit-pass
retronym May 23, 2016
093c934
SI-9776: Fix type of PriorityQueue.newBuilder and improve performance
chrisokasaki May 23, 2016
95f5760
Merge pull request #5168 from xuwei-k/range-value-class
lrytz May 23, 2016
03d2de2
SI-9121 test case (fixed in new optimizer), SI-9179 test case
lrytz Apr 25, 2016
8e92ba0
Merge pull request #5153 from petermz/ticket/5463
lrytz May 23, 2016
82d9551
Merge pull request #5162 from milessabin/t9361
lrytz May 23, 2016
7645c7f
Merge pull request #5122 from lrytz/t9121
szeiger May 23, 2016
90ca3fd
Group Console and AnsiColor entities and add usage examples
janekdb May 23, 2016
d169d48
Merge pull request #5173 from janekdb/topic/2.12.x-scaladoc-AnsiColour
lrytz May 23, 2016
095295a
Merge pull request #5164 from viktorklang/wip-future-docs-√
adriaanm May 23, 2016
755fff0
Merge pull request #5181 from chrisokasaki/issue/9776
adriaanm May 23, 2016
0659af2
Merge pull request #5106 from milessabin/topic/hkgadt
adriaanm May 24, 2016
207e32d
Merge pull request #5179 from liff/topic/SI-9781
adriaanm May 24, 2016
892a6d6
SI-2712 Add support for higher order unification
milessabin May 20, 2016
bf47808
-Xexperimental mode now only includes -Ypartial-unification
milessabin May 20, 2016
4d28084
Merge pull request #5175 from som-snytt/issue/9656-range-toString
szeiger May 24, 2016
60f28f9
SI-9522 release key reference when deleting from OpenHashMap
performantdata Apr 25, 2016
808f3d0
Merge pull request #4935 from som-snytt/issue/8044-tickvar
adriaanm May 24, 2016
dd3a90e
Fix Scaladoc link syntax on java.util.Formatter references
janekdb May 24, 2016
1db58b5
Debug flag to print a summary of the inliner's work
lrytz May 24, 2016
c17ef77
Merge pull request #5124 from performantdata/bug/SI-9522
lrytz May 25, 2016
eaefb10
Merge pull request #5185 from janekdb/topic/2.12.x-scaladoc-java-link…
lrytz May 25, 2016
734c5ad
Merge pull request #5052 from kilotaras/topic/map-applyOrElse
lrytz May 25, 2016
450df0e
Use full braces style in AnsiColor example
janekdb May 25, 2016
65642d9
Merge pull request #5188 from janekdb/topic/2.12.x-scaladoc-AnsiColour-2
lrytz May 25, 2016
b85c9a7
Rename -Yopt to -opt, -Yopt-warnings to -opt-warnings
lrytz May 25, 2016
54dff81
SI-9382 Privatize enhanced x in Tuple2Zipped.Ops
som-snytt May 25, 2016
3873fcf
Fully qualify types in REPL generated code
dwijnand May 24, 2016
edbf2c4
Merge pull request #5189 from lrytz/y-not
adriaanm May 26, 2016
0b79f4b
SI-9382 Zippy clean-up in aisle 2 & 3
som-snytt May 26, 2016
fd6386a
SI-9794 Error advice uses decoded method name
som-snytt May 27, 2016
a09ed48
Merge pull request #5192 from dwijnand/wip/scala-repl-no-imports
retronym May 27, 2016
79ec0f3
Merge pull request #5186 from lrytz/inlinerM5
retronym May 27, 2016
6b2037a
Merge pull request #5102 from milessabin/2.12.x
retronym May 27, 2016
981e3c5
SI-9483 Add `since` to `@deprecatedName`
soc Apr 2, 2016
673350e
SI-9084 Add `since` (if available) to deprecation warnings
soc Apr 2, 2016
5562e1a
Lower-case spelling of @deprecated messages
soc May 19, 2016
be38ebb
Add since arg to deprecationWarning and use it
soc Apr 2, 2016
85057d5
Add documentation to @deprecated
soc May 19, 2016
a45509c
Don't pass -opt to starr / locker build in the bootstrap script
lrytz May 30, 2016
6265eb8
Merge pull request #5200 from lrytz/bootstrap-opt-options
lrytz May 30, 2016
7d5a0b3
Merge pull request #5193 from som-snytt/issue/9794
lrytz May 30, 2016
9edbe3d
Merge pull request #5191 from som-snytt/issue/9382
lrytz May 30, 2016
8f567bc
Merge pull request #5076 from soc/topic/deprecations-since
lrytz May 30, 2016
7b132f3
Avoid tree sharing with substituteThis
retronym May 31, 2016
0533a3d
Lambda impl methods static and more stably named
retronym May 4, 2016
f01d061
Treat self parameter as non-null in the optimizer
lrytz May 13, 2016
7a589e0
Remove nonsensical body for trait getter
retronym May 19, 2016
b33e4a0
Better diagnostic for optimizer crashes
retronym May 9, 2016
f882d16
Remove stray .class file from version control
retronym May 31, 2016
c61795a
Don't minimize parents of java defined syms.
retronym May 31, 2016
4499c32
Revert pruning of redundant Java parents
retronym May 17, 2016
0cb67d1
clear all flags when resetting a symbol
lrytz May 25, 2016
e82e457
SI-9256 check companions in same compilation unit only if same run
lrytz May 25, 2016
e791790
Emit trait method bodies in statics
retronym May 4, 2016
3787426
Add impl restriction related to invokespecial to Java parents
retronym May 5, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions bincompat-forward.whitelist.conf
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ filter {
{
matchName="scala.concurrent.impl.Promise$DefaultPromise"
problemName=MissingTypesProblem
},
{
matchName="scala.reflect.runtime.Settings.YpartialUnification"
problemName=MissingMethodProblem
}
]
}
2 changes: 1 addition & 1 deletion build-ant-macros.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<attribute name="name"/>
<sequential>
<antcall target="@{name}">
<param name="scalac.args.optimise" value="-Yopt:l:classpath"/>
<param name="scalac.args.optimise" value="-opt:l:classpath"/>
</antcall>
</sequential>
</macrodef>
Expand Down
5 changes: 3 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ val scalaXmlDep = withoutScalaLang("org.scala-lang.modules" %% "scala-xml" % ver
val partestDep = withoutScalaLang("org.scala-lang.modules" %% "scala-partest" % versionNumber("partest"))
val junitDep = "junit" % "junit" % "4.11"
val junitIntefaceDep = "com.novocode" % "junit-interface" % "0.11" % "test"
val jolDep = "org.openjdk.jol" % "jol-core" % "0.5"
val asmDep = "org.scala-lang.modules" % "scala-asm" % versionProps("scala-asm.version")
val jlineDep = "jline" % "jline" % versionProps("jline.version")
val antDep = "org.apache.ant" % "ant" % "1.9.4"
Expand Down Expand Up @@ -507,7 +508,7 @@ lazy val scaladoc = configureAsSubproject(project)
name := "scala-compiler-doc",
description := "Scala Documentation Generator",
libraryDependencies ++= Seq(scalaXmlDep, scalaParserCombinatorsDep, partestDep),
includeFilter in unmanagedResources in Compile := "*.html" | "*.css" | "*.gif" | "*.png" | "*.js" | "*.txt"
includeFilter in unmanagedResources in Compile := "*.html" | "*.css" | "*.gif" | "*.png" | "*.js" | "*.txt" | "*.svg" | "*.eot" | "*.woff" | "*.ttf"
)
.dependsOn(compiler)

Expand Down Expand Up @@ -544,7 +545,7 @@ lazy val junit = project.in(file("test") / "junit")
.settings(disablePublishing: _*)
.settings(
fork in Test := true,
libraryDependencies ++= Seq(junitDep, junitIntefaceDep),
libraryDependencies ++= Seq(junitDep, junitIntefaceDep, jolDep),
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
unmanagedSourceDirectories in Test := List(baseDirectory.value)
)
Expand Down
11 changes: 6 additions & 5 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ant $antArgs $scalacArgs $targets

antArgs tend to be:
-Darchives.skipxz=true
-Dscalac.args.optimise=-Yopt:l:classpath
-Dscalac.args.optimise=-opt:l:classpath

scalacArgs examples:
"-Dscalac.args=\"-Yrangepos\" -Dpartest.scalac_opts=\"-Yrangepos\""
Expand Down Expand Up @@ -79,13 +79,13 @@ TODO:
<target name="publish-opt-nodocs" description="Publishes Scala (optimized) without generating docs/testing (library/reflect/compiler/swing).">
<antcall target="publish">
<param name="docs.skip" value="1"/>
<param name="scalac.args.optimise" value="-Yopt:l:classpath"/>
<param name="scalac.args.optimise" value="-opt:l:classpath"/>
</antcall>
</target>
<target name="publish-core-opt-nodocs" description="Builds an untested, undocumented optimised core (library/reflect/compiler) and publishes to maven.">
<antcall target="publish-core">
<param name="docs.skip" value="1"/>
<param name="scalac.args.optimise" value="-Yopt:l:classpath"/>
<param name="scalac.args.optimise" value="-opt:l:classpath"/>
</antcall>
</target>
<target name="publish-core-local-nodocs" description="Builds an untested, undocumented core (library/reflect/compiler) and locally publishes to maven">
Expand Down Expand Up @@ -277,6 +277,7 @@ TODO:
<property name="junit.version" value="4.12"/>
<artifact:dependencies pathId="junit.classpath" filesetId="junit.fileset">
<dependency groupId="junit" artifactId="junit" version="${junit.version}"/>
<dependency groupId="org.openjdk.jol" artifactId="jol-core" version="0.5"/>
</artifact:dependencies>
<copy-deps project="junit"/>

Expand Down Expand Up @@ -1042,7 +1043,7 @@ TODO:
<antcall target="publish-core-local">
<param name="maven.version.suffix" value="-STARR-${git.commit.sha}-SNAPSHOT"/>
<param name="docs.skip" value="1"/>
<param name="scalac.args.optimise" value="-Yopt:l:classpath"/>
<param name="scalac.args.optimise" value="-opt:l:classpath"/>
<param name="update.starr.version" value="alright then"/>
</antcall>
</target>
Expand Down Expand Up @@ -1163,7 +1164,7 @@ TODO:
</pre>
<!-- JSR-223 support introduced in 2.11 -->
<jar-opts>
<service type="javax.script.ScriptEngineFactory" provider="scala.tools.nsc.interpreter.IMain$Factory"/>
<service type="javax.script.ScriptEngineFactory" provider="scala.tools.nsc.interpreter.Scripted$Factory"/>
</jar-opts>
</staged-pack>
</target>
Expand Down
4 changes: 2 additions & 2 deletions project/ScalaOptionParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ object ScalaOptionParser {
"-Yeta-expand-keeps-star", "-Yide-debug", "-Yinfer-argument-types", "-Yinfer-by-name",
"-Yissue-debug", "-Ylog-classpath", "-Ymacro-debug-lite", "-Ymacro-debug-verbose", "-Ymacro-no-expand",
"-Yno-completion", "-Yno-generic-signatures", "-Yno-imports", "-Yno-predef",
"-Yoverride-objects", "-Yoverride-vars", "-Ypatmat-debug", "-Yno-adapted-args", "-Ypos-debug", "-Ypresentation-debug",
"-Yoverride-objects", "-Yoverride-vars", "-Ypatmat-debug", "-Yno-adapted-args", "-Ypartial-unification", "-Ypos-debug", "-Ypresentation-debug",
"-Ypresentation-strict", "-Ypresentation-verbose", "-Yquasiquote-debug", "-Yrangepos", "-Yreify-copypaste", "-Yreify-debug", "-Yrepl-class-based",
"-Yrepl-sync", "-Yshow-member-pos", "-Yshow-symkinds", "-Yshow-symowners", "-Yshow-syms", "-Yshow-trees", "-Yshow-trees-compact", "-Yshow-trees-stringified", "-Ytyper-debug",
"-Ywarn-adapted-args", "-Ywarn-dead-code", "-Ywarn-inaccessible", "-Ywarn-infer-any", "-Ywarn-nullary-override", "-Ywarn-nullary-unit", "-Ywarn-numeric-widen", "-Ywarn-unused", "-Ywarn-unused-import", "-Ywarn-value-discard",
Expand All @@ -108,7 +108,7 @@ object ScalaOptionParser {
private def multiChoiceSettingNames = Map[String, List[String]](
"-Xlint" -> List("adapted-args", "nullary-unit", "inaccessible", "nullary-override", "infer-any", "missing-interpolator", "doc-detached", "private-shadow", "type-parameter-shadow", "poly-implicit-overload", "option-implicit", "delayedinit-select", "by-name-right-associative", "package-object-classes", "unsound-match", "stars-align"),
"-language" -> List("help", "_", "dynamics", "postfixOps", "reflectiveCalls", "implicitConversions", "higherKinds", "existentials", "experimental.macros"),
"-Yopt" -> List("l:none", "l:default", "l:method", "l:project", "l:classpath", "unreachable-code", "simplify-jumps", "empty-line-numbers", "empty-labels", "compact-locals", "nullness-tracking", "closure-elimination", "inline-project", "inline-global"),
"-opt" -> List("l:none", "l:default", "l:method", "l:project", "l:classpath", "unreachable-code", "simplify-jumps", "empty-line-numbers", "empty-labels", "compact-locals", "nullness-tracking", "closure-elimination", "inline-project", "inline-global"),
"-Ystatistics" -> List("parser", "typer", "patmat", "erasure", "cleanup", "jvm")
)
private def scalaVersionSettings = List("-Xmigration", "-Xsource")
Expand Down
4 changes: 1 addition & 3 deletions scripts/jobs/integrate/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,6 @@ bootstrap() {
-Dremote.snapshot.repository=NOPE\
-Dremote.release.repository=$releaseTempRepoUrl\
-Drepository.credentials.id=$releaseTempRepoCred\
-Dscalac.args.optimise=-Yopt:l:classpath\
-Ddocs.skip=1\
-Dlocker.skip=1\
$publishStarrPrivateTask >> $baseDir/logs/builds 2>&1
Expand All @@ -516,7 +515,6 @@ bootstrap() {
$SET_STARR\
-Dremote.release.repository=$releaseTempRepoUrl\
-Drepository.credentials.id=$releaseTempRepoCred\
-Dscalac.args.optimise=-Yopt:l:classpath\
-Ddocs.skip=1\
-Dlocker.skip=1\
$publishLockerPrivateTask >> $baseDir/logs/builds 2>&1
Expand Down Expand Up @@ -555,7 +553,7 @@ bootstrap() {
-Dremote.snapshot.repository=NOPE\
-Dremote.release.repository=$releaseTempRepoUrl\
-Drepository.credentials.id=$releaseTempRepoCred\
-Dscalac.args.optimise=-Yopt:l:classpath\
-Dscalac.args.optimise=-opt:l:classpath\
$antBuildTask $publishPrivateTask

# clear ivy cache (and to be sure, local as well), so the next round of sbt builds sees the fresh scala
Expand Down
2 changes: 1 addition & 1 deletion scripts/jobs/validate/test
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ case $prDryRun in
# build quick using STARR built upstream, as specified by scalaVersion
# (in that sense it's locker, since it was built with starr by that upstream job)
ant -Dstarr.version=$scalaVersion \
-Dscalac.args.optimise=-Yopt:l:classpath \
-Dscalac.args.optimise=-opt:l:classpath \
-Dlocker.skip=1 -Dextra.repo.url=$prRepoUrl \
$testExtraArgs ${testTarget-test.core docs.done}
;;
Expand Down
2 changes: 2 additions & 0 deletions spec/01-lexical-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ classes (Unicode general category given in parentheses):
```ebnf
op ::= opchar {opchar}
varid ::= lower idrest
boundvarid ::= varid
| ‘`’ varid ‘`’
plainid ::= upper idrest
| varid
| op
Expand Down
6 changes: 3 additions & 3 deletions spec/08-pattern-matching.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ chapter: 8

```ebnf
Pattern ::= Pattern1 { ‘|’ Pattern1 }
Pattern1 ::= varid ‘:’ TypePat
Pattern1 ::= boundvarid ‘:’ TypePat
| ‘_’ ‘:’ TypePat
| Pattern2
Pattern2 ::= varid [‘@’ Pattern3]
Pattern2 ::= id [‘@’ Pattern3]
| Pattern3
Pattern3 ::= SimplePattern
| SimplePattern {id [nl] SimplePattern}
Expand All @@ -22,7 +22,7 @@ chapter: 8
| Literal
| StableId
| StableId ‘(’ [Patterns] ‘)’
| StableId ‘(’ [Patterns ‘,’] [varid ‘@’] ‘_’ ‘*’ ‘)’
| StableId ‘(’ [Patterns ‘,’] [id ‘@’] ‘_’ ‘*’ ‘)’
| ‘(’ [Patterns] ‘)’
| XmlPattern
Patterns ::= Pattern {‘,’ Patterns}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/CompilationUnits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ trait CompilationUnits { global: Global =>
final def warning(pos: Position, msg: String): Unit = reporter.warning(pos, msg)

@deprecated("Call global.currentRun.reporting.deprecationWarning directly instead.", "2.11.2")
final def deprecationWarning(pos: Position, msg: String): Unit = currentRun.reporting.deprecationWarning(pos, msg)
final def deprecationWarning(pos: Position, msg: String, since: String): Unit = currentRun.reporting.deprecationWarning(pos, msg, since)
@deprecated("Call global.currentRun.reporting.uncheckedWarning directly instead.", "2.11.2")
final def uncheckedWarning(pos: Position, msg: String): Unit = currentRun.reporting.uncheckedWarning(pos, msg)

Expand Down
8 changes: 4 additions & 4 deletions src/compiler/scala/tools/nsc/Global.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1054,9 +1054,9 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
var currentUnit: CompilationUnit = NoCompilationUnit

// used in sbt
def uncheckedWarnings: List[(Position, String)] = reporting.uncheckedWarnings
def uncheckedWarnings: List[(Position, String)] = reporting.uncheckedWarnings.map{case (pos, (msg, since)) => (pos, msg)}
// used in sbt
def deprecationWarnings: List[(Position, String)] = reporting.deprecationWarnings
def deprecationWarnings: List[(Position, String)] = reporting.deprecationWarnings.map{case (pos, (msg, since)) => (pos, msg)}

private class SyncedCompilationBuffer { self =>
private val underlying = new mutable.ArrayBuffer[CompilationUnit]
Expand Down Expand Up @@ -1267,11 +1267,11 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
private def warnDeprecatedAndConflictingSettings(unit: CompilationUnit) {
// issue warnings for any usage of deprecated settings
settings.userSetSettings filter (_.isDeprecated) foreach { s =>
currentRun.reporting.deprecationWarning(NoPosition, s.name + " is deprecated: " + s.deprecationMessage.get)
currentRun.reporting.deprecationWarning(NoPosition, s.name + " is deprecated: " + s.deprecationMessage.get, "")
}
val supportedTarget = "jvm-1.8"
if (settings.target.value != supportedTarget) {
currentRun.reporting.deprecationWarning(NoPosition, settings.target.name + ":" + settings.target.value + " is deprecated and has no effect, setting to " + supportedTarget)
currentRun.reporting.deprecationWarning(NoPosition, settings.target.name + ":" + settings.target.value + " is deprecated and has no effect, setting to " + supportedTarget, "2.12.0")
settings.target.value = supportedTarget
}
settings.conflictWarning.foreach(reporter.warning(NoPosition, _))
Expand Down
44 changes: 31 additions & 13 deletions src/compiler/scala/tools/nsc/Reporting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,33 @@ trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions w
def this(what: String, booleanSetting: Settings#BooleanSetting) {
this(what, () => booleanSetting, booleanSetting)
}
val warnings = mutable.LinkedHashMap[Position, String]()
def warn(pos: Position, msg: String) =
val warnings = mutable.LinkedHashMap[Position, (String, String)]()
def warn(pos: Position, msg: String, since: String = "") =
if (doReport()) reporter.warning(pos, msg)
else if (!(warnings contains pos)) warnings += ((pos, msg))
else if (!(warnings contains pos)) warnings += ((pos, (msg, since)))
def summarize() =
if (warnings.nonEmpty && (setting.isDefault || doReport())) {
val numWarnings = warnings.size
val warningVerb = if (numWarnings == 1) "was" else "were"
val warningCount = countElementsAsString(numWarnings, s"$what warning")

reporter.warning(NoPosition, s"there $warningVerb $warningCount; re-run with ${setting.name} for details")
val sinceAndAmount = mutable.TreeMap[String, Int]()
warnings.valuesIterator.foreach { case (_, since) =>
val value = sinceAndAmount.get(since)
if (value.isDefined) sinceAndAmount += ((since, value.get + 1))
else sinceAndAmount += ((since, 1))
}
val deprecationSummary = sinceAndAmount.size > 1
sinceAndAmount.foreach { case (since, amount) =>
val numWarnings = amount
val warningsSince = if (since.nonEmpty) s" (since $since)" else ""
val warningVerb = if (numWarnings == 1) "was" else "were"
val warningCount = countElementsAsString(numWarnings, s"$what warning")
val rerun = if (deprecationSummary) "" else s"; re-run with ${setting.name} for details"
reporter.warning(NoPosition, s"there $warningVerb $warningCount$warningsSince$rerun")
}
if (deprecationSummary) {
val numWarnings = warnings.size
val warningVerb = if (numWarnings == 1) "was" else "were"
val warningCount = countElementsAsString(numWarnings, s"$what warning")
reporter.warning(NoPosition, s"there $warningVerb $warningCount in total; re-run with ${setting.name} for details")
}
}
}

Expand All @@ -49,11 +65,11 @@ trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions w
private val _deprecationWarnings = new ConditionalWarning("deprecation", settings.deprecation)
private val _uncheckedWarnings = new ConditionalWarning("unchecked", settings.unchecked)
private val _featureWarnings = new ConditionalWarning("feature", settings.feature)
private val _inlinerWarnings = new ConditionalWarning("inliner", () => !settings.YoptWarningsSummaryOnly, settings.YoptWarnings)
private val _inlinerWarnings = new ConditionalWarning("inliner", () => !settings.optWarningsSummaryOnly, settings.optWarnings)
private val _allConditionalWarnings = List(_deprecationWarnings, _uncheckedWarnings, _featureWarnings, _inlinerWarnings)

// TODO: remove in favor of the overload that takes a Symbol, give that argument a default (NoSymbol)
def deprecationWarning(pos: Position, msg: String): Unit = _deprecationWarnings.warn(pos, msg)
def deprecationWarning(pos: Position, msg: String, since: String): Unit = _deprecationWarnings.warn(pos, msg, since)
def uncheckedWarning(pos: Position, msg: String): Unit = _uncheckedWarnings.warn(pos, msg)
def featureWarning(pos: Position, msg: String): Unit = _featureWarnings.warn(pos, msg)
def inlinerWarning(pos: Position, msg: String): Unit = _inlinerWarnings.warn(pos, msg)
Expand All @@ -66,10 +82,12 @@ trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions w
def allConditionalWarnings = _allConditionalWarnings flatMap (_.warnings)

// behold! the symbol that caused the deprecation warning (may not be deprecated itself)
def deprecationWarning(pos: Position, sym: Symbol, msg: String): Unit = _deprecationWarnings.warn(pos, msg)
def deprecationWarning(pos: Position, sym: Symbol, msg: String, since: String): Unit = _deprecationWarnings.warn(pos, msg, since)
def deprecationWarning(pos: Position, sym: Symbol): Unit = {
val suffix = sym.deprecationMessage match { case Some(msg) => ": "+ msg case _ => "" }
deprecationWarning(pos, sym, s"$sym${sym.locationString} is deprecated$suffix")
val version = sym.deprecationVersion.getOrElse("")
val since = if (version.isEmpty) version else s" (since $version)"
val message = sym.deprecationMessage match { case Some(msg) => s": $msg" case _ => "" }
deprecationWarning(pos, sym, s"$sym${sym.locationString} is deprecated$since$message", version)
}

private[this] var reportedFeature = Set[Symbol]()
Expand Down
Loading