Skip to content

Commit

Permalink
Merge branch '2.13.x' into update/asm-9.4
Browse files Browse the repository at this point in the history
  • Loading branch information
SethTisue committed Nov 1, 2022
2 parents 31d48a9 + c385bf3 commit 0b899c8
Show file tree
Hide file tree
Showing 81 changed files with 778 additions and 224 deletions.
8 changes: 8 additions & 0 deletions .mailmap
Expand Up @@ -24,16 +24,19 @@ Christopher Vogt <vogt@epfl.ch> <github.com.nsp@cvogt.org>
Damien Obristi <damien.obrist@gmail.com>
Daniel C. Sobral <dcsobral@gmail.com>
Daniel C. Sobral <dcsobral@gmail.com> <dcs@dcs-132-CK-NF79.(none)>
Daniel Esik <e.danicheg@yandex.ru>
Daniel Lorch <lorch@epfl.ch>
Darcy Shen <da@tubi.tv>
Diego E. Alonso Blas <diesalbla@gmail.com>
Diego E. Alonso Blas <diego.e.a@47deg.com>
Eric Huang <ericdx.hung@gmail.com>
Erik Stenman <stenman@epfl.ch>
Eugene Burmako <xeno.by@gmail.com>
Eugene Burmako <xeno.by@gmail.com> <burmako@epfl.ch>
Eugene Vigdorchik <eugenevigdorchik@epfl.ch> <eugene.vigdorchik@gmail.com>
François Garillot <francois@garillot.net>
Geoff Reedy <geoff@programmer-monk.net> <gereedy@sandia.gov>
Gilad Hoch <giladhoch@gmail.com>
Harrison Houghton <hora.rhino@gmail.com> <hhoughton@learningobjects.com>
Ilya Sergei <ilyas@epfl.ch>
Ingo Maier <ingo.maier@epfl.ch>
Expand All @@ -45,6 +48,8 @@ Josh Suereth <joshua.suereth@gmail.com>
Josh Suereth <joshua.suereth@gmail.com> <Joshua.Suereth@gmail.com>
Julien Eberle <jeberle@epfl.ch>
Kenji Yoshida <6b656e6a69@gmail.com>
Liang Yan <35164941+liang3zy22@users.noreply.github.com>
Liang Yan <ckgppl_yan@sina.cn>
Luc Bourlier <luc.bourlier@typesafe.com>
Luc Bourlier <luc.bourlier@typesafe.com> <skyluc@epfl.ch>
Luc Bourlier <skyluc@epfl.ch>
Expand Down Expand Up @@ -90,3 +95,6 @@ Vincent Cremet <cremet@epfl.ch>
Vladimir Nikolaev <vladimir.nikolaev9@gmail.com>
Vojin Jovanovic <vojin.jovanovic@epfl.ch>
Vojin Jovanovic <vojin.jovanovic@epfl.ch> <gvojin@gmail.com>
Zhang Zhipeng <pc175@uow.edu.au>
jxnu-liguobin <dreamylost@outlook.com>
philwalk <philwalk9@gmail.com>
29 changes: 17 additions & 12 deletions .scala-steward.conf
Expand Up @@ -2,17 +2,22 @@
# either. hopefully this is a reasonable compromise value?
pullRequests.frequency = "14 days"

# only used internally, and they aren't ours (we aren't dogfooding
# them), and updates are unlikely to benefit us, so there's really no
# need to keep them current
updates.ignore = [ { groupId = "com.fasterxml.jackson.core"} ]
updates.ignore = [ { groupId = "org.slf4j"} ]
updates.ignore = [ { groupId = "org.eclipse.jgit"} ]
updates.ignore = [ { groupId = "org.openjdk.jol"} ]
updates.ignore = [

# Ant support is deprecated, so leave the version where it is
updates.ignore = [ { groupId = "org.apache.ant"} ]
# only used internally, and they aren't ours (we aren't dogfooding
# them), and updates are unlikely to benefit us, so there's really no
# need to keep them current
{ groupId = "com.fasterxml.jackson.core" },
{ groupId = "com.fasterxml.jackson.dataformat" },
{ groupId = "org.slf4j" },
{ groupId = "org.eclipse.jgit" },
{ groupId = "org.openjdk.jol" },

# OSGi stuff is fragile and we suspect it is little-used,
# so let's prefer stability
updates.ignore = [ { groupId = "biz.aQute.bnd"} ]
# Ant support is deprecated, so leave the version where it is
{ groupId = "org.apache.ant" },

# OSGi stuff is fragile and we suspect it is little-used,
# so let's prefer stability
{ groupId = "biz.aQute.bnd" }

]
2 changes: 1 addition & 1 deletion build.sbt
Expand Up @@ -73,7 +73,7 @@ lazy val publishSettings : Seq[Setting[_]] = Seq(
// should not be set directly. It is the same as the Maven version and derived automatically from `baseVersion` and
// `baseVersionSuffix`.
globalVersionSettings
Global / baseVersion := "2.13.10"
Global / baseVersion := "2.13.11"
Global / baseVersionSuffix := "SNAPSHOT"
ThisBuild / organization := "org.scala-lang"
ThisBuild / homepage := Some(url("https://www.scala-lang.org"))
Expand Down
2 changes: 1 addition & 1 deletion project/MimaFilters.scala
Expand Up @@ -13,7 +13,7 @@ object MimaFilters extends AutoPlugin {
import autoImport._

override val globalSettings = Seq(
mimaReferenceVersion := Some("2.13.9"),
mimaReferenceVersion := Some("2.13.10"),
)

val mimaFilters: Seq[ProblemFilter] = Seq[ProblemFilter](
Expand Down
2 changes: 1 addition & 1 deletion project/Osgi.scala
Expand Up @@ -3,7 +3,7 @@ package scala.build
import aQute.bnd.osgi.Builder
import aQute.bnd.osgi.Constants._
import java.util.jar.Attributes
import sbt._
import sbt.{License => _, _}
import sbt.Keys._
import collection.JavaConverters._
import VersionUtil.versionProperties
Expand Down
2 changes: 1 addition & 1 deletion project/PartestUtil.scala
Expand Up @@ -36,7 +36,7 @@ object PartestUtil {
val knownUnaryOptions = List(
"--pos", "--neg", "--run", "--jvm", "--res", "--ant", "--scalap", "--specialized",
"--instrumented", "--presentation", "--failed", "--update-check", "--no-exec",
"--show-diff", "--show-log", "--verbose", "--terse", "--debug", "--version", "--help")
"--show-diff", "--show-log", "--verbose", "--terse", "--debug", "--realeasy", "--version", "--help")
val srcPathOption = "--srcpath"
val compilerPathOption = "--compilerpath"
val grepOption = "--grep"
Expand Down
2 changes: 1 addition & 1 deletion project/ScaladocSettings.scala
Expand Up @@ -7,7 +7,7 @@ object ScaladocSettings {

// when this changes, the integrity check in HtmlFactory.scala also needs updating
val webjarResources = Seq(
"org.webjars" % "jquery" % "3.6.0"
"org.webjars" % "jquery" % "3.6.1"
)

def extractResourcesFromWebjar = Def.task {
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version=1.7.1
sbt.version=1.7.3
2 changes: 1 addition & 1 deletion project/plugins.sbt
Expand Up @@ -17,7 +17,7 @@ buildInfoKeys := Seq[BuildInfoKey](buildClasspath)

buildInfoPackage := "scalabuild"

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1")

libraryDependencies ++= Seq(
"org.eclipse.jgit" % "org.eclipse.jgit" % "4.11.9.201909030838-r",
Expand Down
67 changes: 28 additions & 39 deletions spec/02-identifiers-names-and-scopes.md
Expand Up @@ -14,16 +14,17 @@ collectively called _entities_. Names are introduced by local
[package clauses](09-top-level-definitions.html#packagings)
which are collectively called _bindings_.

Bindings of different kinds have precedence defined on them:
Bindings of each kind are assigned a precedence which determines
whether one binding can shadow another:

1. Definitions and declarations that are local, inherited, or made
available by a package clause and also defined in the same compilation unit
as the reference to them, have the highest precedence.
1. Explicit imports have the next highest precedence.
1. Wildcard imports have the next highest precedence.
1. Definitions made available by a package clause, but not also defined in the
same compilation unit as the reference to them, as well as imports which
are supplied by the compiler but not explicitly written in source code,
1. Bindings made available by a package clause, but not also defined in the
same compilation unit as the reference to them, as well as bindings
supplied by the compiler but not explicitly written in source code,
have the lowest precedence.

There are two different name spaces, one for [types](03-types.html#types)
Expand Down Expand Up @@ -72,8 +73,8 @@ In particular, imported names have higher precedence than names, defined in othe
that might otherwise be visible because they are defined in
either the current package or an enclosing package.

Note that a package definition is taken as lowest precedence, since packages
are open and can be defined across arbitrary compilation units.
Note that a binding introduced by a packaging is taken as lowest precedence,
since packages are open and can be defined across arbitrary compilation units.

```scala
package util {
Expand All @@ -85,59 +86,47 @@ package util {
}
```

The compiler supplies imports in a preamble to every source file. This preamble
conceptually has the following form, where braces indicate nested scopes:
The compiler supplies bindings from well-known packages and objects, called "root contexts".
The standard locations for these bindings are:

```scala
import java.lang._
{
import scala._
{
import Predef._
{ /* source */ }
}
}
```
1. The object `scala.Predef`.
1. The package `scala`.
1. The package `java.lang`.

These imports are taken as lowest precedence, so that they are always shadowed
These bindings are taken as lowest precedence, so that they are always shadowed
by user code, which may contain competing imports and definitions.
They also increase the nesting depth as shown, so that later imports
shadow earlier ones.

As a convenience, multiple bindings of a type identifier to the same
underlying type is permitted. This is possible when import clauses introduce
a binding of a member type alias with the same binding precedence, typically
through wildcard imports. This allows redundant type aliases to be imported
without introducing an ambiguity.
A binding is available from a root context if it would also be available
using an ordinary import clause. In particular, ordinary access restrictions apply.

A binding from an earlier root context shadows a binding of the same name from a later one.
For example, `scala.Predef.String` shadows `java.lang.String`, for which it is a type alias.

Multiple binding of a type identifier to the same underlying type is permitted.
This is possible when import clauses introduce a binding of a member type alias
with the same binding precedence, typically through wildcard imports.
This allows redundant type aliases to be imported without introducing an ambiguity.

```scala
object X { type T = annotation.tailrec }
object Y { type T = annotation.tailrec }
object Z {
import X._, Y._, annotation.{tailrec => T} // OK, all T mean tailrec
@T def f: Int = { f ; 42 } // error, f is not tail recursive
import X._, Y._ // OK, both T mean tailrec
@T def f: Int = { f ; 42 } // the annotation worked: error, f is not tail recursive
}
```

Similarly, imported aliases of names introduced by package statements are
allowed, even though the names are strictly ambiguous:
Similarly, imported aliases of names introduced by package statements are permitted:

```scala
// c.scala
package p { class C }

// xy.scala
import p._
package p { class X extends C }
package q { class Y extends C }
package p { class X extends C } // not ambiguous (compiles without the import)
package q { class Y extends C } // requires the import
```

The reference to `C` in the definition of `X` is strictly ambiguous
because `C` is available by virtue of the package clause in
a different file, and can't shadow the imported name. But because
the references are the same, the definition is taken as though it
did shadow the import.

###### Example

Assume the following two definitions of objects named `X` in packages `p` and `q`
Expand Down
8 changes: 5 additions & 3 deletions src/compiler/scala/reflect/reify/Errors.scala
Expand Up @@ -10,10 +10,12 @@
* additional information regarding copyright ownership.
*/

package scala.reflect.reify
package scala.reflect
package reify

import scala.reflect.macros.ReificationException
import scala.reflect.macros.UnexpectedReificationException
import internal.util.StringContextStripMarginOps
import macros.ReificationException
import macros.UnexpectedReificationException

trait Errors {
self: Reifier =>
Expand Down
19 changes: 16 additions & 3 deletions src/compiler/scala/tools/nsc/Global.scala
Expand Up @@ -135,9 +135,22 @@ class Global(var currentSettings: Settings, reporter0: Reporter)

type ThisPlatform = JavaPlatform { val global: Global.this.type }
lazy val platform: ThisPlatform = new GlobalPlatform
/* A hook for the REPL to add a classpath entry containing products of previous runs to inliner's bytecode repository*/
// Fixes scala/bug#8779
def optimizerClassPath(base: ClassPath): ClassPath = base

/* Create a class path for the backend, based on the given class path.
* Used to make classes available to the inliner's bytecode repository.
*
* In particular, if ct.sym is used for compilation, replace it with jrt.
*
* See ReplGlobal, which appends a classpath entry containing products of previous runs. (Fixes scala/bug#8779.)
*/
def optimizerClassPath(base: ClassPath): ClassPath =
base match {
case AggregateClassPath(entries) if entries.head.isInstanceOf[CtSymClassPath] =>
JrtClassPath(release = None, closeableRegistry)
.map(jrt => AggregateClassPath(entries.drop(1).prepended(jrt)))
.getOrElse(base)
case _ => base
}

def classPath: ClassPath = platform.classPath

Expand Down
6 changes: 6 additions & 0 deletions src/compiler/scala/tools/nsc/package.scala
Expand Up @@ -12,6 +12,8 @@

package scala.tools

import scala.reflect.internal.util.StringContextStripMarginOps

package object nsc {
type Mode = scala.reflect.internal.Mode
val Mode = scala.reflect.internal.Mode
Expand All @@ -32,4 +34,8 @@ package object nsc {

@deprecated("Use scala.reflect.internal.util.ListOfNil", "2.11.0")
lazy val ListOfNil = scala.reflect.internal.util.ListOfNil

/** Adds the `sm` interpolator to a [[scala.StringContext]].
*/
implicit val `strip margin`: StringContext => StringContextStripMarginOps = StringContextStripMarginOps
}
15 changes: 8 additions & 7 deletions src/compiler/scala/tools/nsc/profile/ExtendedThreadMxBean.java
Expand Up @@ -260,13 +260,14 @@ public SunThreadMxBean(ThreadMXBean underlying) {
super(underlying);
this.real = underlying;
try {
getThreadUserTimeMethod = real.getClass().getMethod("getThreadUserTime", long[].class);
isThreadAllocatedMemoryEnabledMethod = real.getClass().getMethod("isThreadAllocatedMemoryEnabled");
setThreadAllocatedMemoryEnabledMethod = real.getClass().getMethod("setThreadAllocatedMemoryEnabled", Boolean.TYPE);
getThreadAllocatedBytesMethod1 = real.getClass().getMethod("getThreadAllocatedBytes", Long.TYPE);
getThreadAllocatedBytesMethod2 = real.getClass().getMethod("getThreadAllocatedBytes", long[].class);
isThreadAllocatedMemorySupportedMethod = real.getClass().getMethod("isThreadAllocatedMemorySupported");
getThreadCpuTimeMethod = real.getClass().getMethod("getThreadCpuTime", long[].class);
Class<?> cls = Class.forName("com.sun.management.ThreadMXBean");
getThreadUserTimeMethod = cls.getMethod("getThreadUserTime", long[].class);
isThreadAllocatedMemoryEnabledMethod = cls.getMethod("isThreadAllocatedMemoryEnabled");
setThreadAllocatedMemoryEnabledMethod = cls.getMethod("setThreadAllocatedMemoryEnabled", Boolean.TYPE);
getThreadAllocatedBytesMethod1 = cls.getMethod("getThreadAllocatedBytes", Long.TYPE);
getThreadAllocatedBytesMethod2 = cls.getMethod("getThreadAllocatedBytes", long[].class);
isThreadAllocatedMemorySupportedMethod = cls.getMethod("isThreadAllocatedMemorySupported");
getThreadCpuTimeMethod = cls.getMethod("getThreadCpuTime", long[].class);

getThreadUserTimeMethod.setAccessible(true);
isThreadAllocatedMemoryEnabledMethod.setAccessible(true);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/settings/Warnings.scala
Expand Up @@ -205,7 +205,7 @@ trait Warnings {
val Serial = LintWarning("serial", "@SerialVersionUID on traits and non-serializable classes.")
val ValPattern = LintWarning("valpattern", "Enable pattern checks in val definitions.")
val EtaZero = LintWarning("eta-zero", "Usage `f` of parameterless `def f()` resulted in eta-expansion, not empty application `f()`.")
val EtaSam = LintWarning("eta-sam", "The Java-defined target interface for eta-expansion was not annotated @FunctionalInterface.")
val EtaSam = LintWarning("eta-sam", "A method reference was eta-expanded but the expected SAM type was not annotated @FunctionalInterface.")
val Deprecation = LintWarning("deprecation", "Enable -deprecation and also check @deprecated annotations.")
val ByNameImplicit = LintWarning("byname-implicit", "Block adapted by implicit with by-name parameter.")
val RecurseWithDefault = LintWarning("recurse-with-default", "Recursive call used default argument.")
Expand Down
Expand Up @@ -10,7 +10,8 @@
* additional information regarding copyright ownership.
*/

package scala.tools.nsc.transform.patmat
package scala.tools.nsc
package transform.patmat

/** Translate typed Trees that represent pattern matches into the patternmatching IR, defined by TreeMakers.
*/
Expand Down

0 comments on commit 0b899c8

Please sign in to comment.