Skip to content

Commit

Permalink
Merge branch '2.13.x' into specification-pdf-wkhtmltopdf-katex
Browse files Browse the repository at this point in the history
  • Loading branch information
sake92 committed Jan 12, 2019
2 parents 5e56097 + 972ccdd commit 3c21433
Show file tree
Hide file tree
Showing 501 changed files with 12,022 additions and 5,125 deletions.
31 changes: 24 additions & 7 deletions CONTRIBUTING.md
Expand Up @@ -36,7 +36,9 @@ The kind of code we can accept depends on the life cycle for the release you're

#### Bug Fix

At the end of the commit message, include "Fixes scala/bug#NNNN", where https://github.com/scala/bug/issues/NNNN tracks the bug you're fixing. We also recommend naming your branch after the ticket number.
At the end of the PR description, which is autofilled with the commit message if there is only one commit, add the phrase, "Fixes scala/bug#NNNN", where `https://github.com/scala/bug/issues/NNNN` tracks the bug you're fixing. Github will turn your bug number into a link.

We also recommend naming your branch after the ticket number.

Please make sure the ticket's milestone corresponds to the upcoming milestone for the branch your PR targets. The CI automation will automatically assign the milestone after you open the PR.

Expand Down Expand Up @@ -79,7 +81,11 @@ root> junit/testQuick

It might take a few minutes the first time you run `junit/testQuick`, but from the second time onwards
sbt will only run the tests that is affected by the code change since the last run.
See `test/junit/` for the examples of JUnit tests.
See `test/junit/` for examples of JUnit tests.

JUnit tests will be compiled with the `starr` compiler, and run against the `quick` library. Some JUnit tests (search for `BytecodeTest`) invoke the compiler programmatically and test its behavior or output, these tests use the `quick` compiler.

`starr` is the Scala release used to build the compiler and library, usually the last release. `quick` is the result of that compilation. See also ["Build Setup"](https://github.com/scala/scala#build-setup) in the README.

#### ScalaCheck

Expand Down Expand Up @@ -109,8 +115,14 @@ To run a single negative test from sbt shell:
root> partest --verbose test/files/neg/delayed-init-ref.scala
```

To specify specific flags such as `-deprecation -Xlint -Xfatal-warnings`, you can put them in
`test/files/neg/<test>.flags`. This could be used to test specific behavior under `-deprecation` flag etc.
To specify compiler flags such as `-deprecation -Xlint -Xfatal-warnings`, you can add a comment
at the top of your source file of the form: `// scalac: -deprecation -Xlint -Xfatal-warnings`.

To test that no warnings are emitted, use `-Xfatal-warnings`. That will fail a `pos` test if there
are warnings. Note that `pos` tests do not have `.check` files.

To test that warnings are correctly emitted, use `-Xfatal-warnings` with a `neg` test and `.check` file.
The usual way to create a `.check` file is `partest --update-check`.

To run all tests in `neg` categories from sbt shell:

Expand Down Expand Up @@ -147,8 +159,11 @@ See `--help` for more info:
root> partest --help
```

If you're fixing a bug in the compiler, you would typically start with Partest;
If you're fixing a bug or implementing new features in the library, consider using JUnit and/or ScalaCheck.
Partests are compiled by the `quick` compiler (and `run` partests executed with the `quick` library),
and therefore:

* if you're working on the compiler, you must write a partest, or a `BytecodeTest` JUnit test which invokes the compiler programmatically; however
* if you're working on the library, a JUnit and/or ScalaCheck is better.

#### exploring with REPL

Expand Down Expand Up @@ -206,7 +221,9 @@ by the commit on the code base, so use the active voice and the
present tense. That also makes the commit subjects easy to reuse in
release notes.

For a bugfix, the end of the commit message should say "Fixes scala/bug#NNNN".
For a bugfix, the end of the PR description (that is, the first comment on the PR) should say, "Fixes scala/bug#NNNN", as mentioned above.

NOTE: it's best not to add the issue reference to your commit message, as github will pollute the conversation on the ticket with notifications every time you commit.

If a commit purely refactors and is not intended to change behaviour,
say so.
Expand Down
22 changes: 11 additions & 11 deletions build.sbt
Expand Up @@ -40,9 +40,9 @@ import VersionUtil._
import scala.tools.nsc.util.ScalaClassLoader.URLClassLoader

// Non-Scala dependencies:
val junitDep = "junit" % "junit" % "4.11"
val junitDep = "junit" % "junit" % "4.12"
val junitInterfaceDep = "com.novocode" % "junit-interface" % "0.11" % "test"
val jolDep = "org.openjdk.jol" % "jol-core" % "0.5"
val jolDep = "org.openjdk.jol" % "jol-core" % "0.9"
val asmDep = "org.scala-lang.modules" % "scala-asm" % versionProps("scala-asm.version")
val jlineDep = "jline" % "jline" % versionProps("jline.version")
val testInterfaceDep = "org.scala-sbt" % "test-interface" % "1.0"
Expand Down Expand Up @@ -151,6 +151,7 @@ lazy val commonSettings = instanceSettings ++ clearSourceAndResourceDirectories
cleanFiles += (classDirectory in Compile).value,
cleanFiles += (target in Compile in doc).value,
fork in run := true,
connectInput in run := true,
//scalacOptions in Compile += "-Xlint:-nullary-override,-inaccessible,-nonlocal-return,_",
//scalacOptions ++= Seq("-Xmaxerrs", "5", "-Xmaxwarns", "5"),
scalacOptions in Compile in doc ++= Seq(
Expand All @@ -161,7 +162,7 @@ lazy val commonSettings = instanceSettings ++ clearSourceAndResourceDirectories
"-doc-version", versionProperties.value.canonicalVersion,
"-doc-title", description.value,
"-sourcepath", (baseDirectory in ThisBuild).value.toString,
"-doc-source-url", s"https://github.com/scala/scala/tree/${versionProperties.value.githubTree}€{FILE_PATH}.scala#L1"
"-doc-source-url", s"https://github.com/scala/scala/tree/${versionProperties.value.githubTree}€{FILE_PATH_EXT}#L€{FILE_LINE}"
),
//maxErrors := 10,
setIncOptions,
Expand Down Expand Up @@ -361,8 +362,7 @@ lazy val library = configureAsSubproject(project)
mimaPreviousArtifacts := mimaReferenceVersion.value.map(organization.value % name.value % _).toSet,
mimaCheckDirection := "both"
)
.settings(filterDocSources("*.scala" -- (regexFileFilter(".*/runtime/.*\\$\\.scala") ||
regexFileFilter(".*/runtime/ScalaRunTime\\.scala"))))
.settings(filterDocSources("*.scala" -- regexFileFilter(".*/scala/runtime/.*")))

lazy val reflect = configureAsSubproject(project)
.settings(generatePropertiesFileSettings)
Expand Down Expand Up @@ -397,12 +397,12 @@ lazy val compilerOptionsExporter = Project("compilerOptionsExporter", file(".")
.settings(disablePublishing)
.settings(
libraryDependencies ++= Seq(
"com.fasterxml.jackson.core" % "jackson-core" % "2.9.5",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.9.5",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.9.5",
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % "2.9.5"
"com.fasterxml.jackson.core" % "jackson-core" % "2.9.7",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.9.7",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.9.7",
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % "2.9.7"
// TODO: implement without Scala dependency. Not available when STARR has a new binary verison.
// "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.9.5"
// "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.9.7"
)
)

Expand All @@ -425,7 +425,7 @@ lazy val compiler = configureAsSubproject(project)
// (with strings) to deal with mutual recursion
products in Compile in packageBin :=
(products in Compile in packageBin).value ++
Seq((dependencyClasspath in Compile).value.find(_.get(moduleID.key) == Some(asmDep)).get.data) ++
Seq((dependencyClasspath in Compile).value.find(_.get(moduleID.key).map(id => (id.organization, id.name, id.revision)).contains((asmDep.organization, asmDep.name, asmDep.revision))).get.data) ++
(products in Compile in packageBin in LocalProject("interactive")).value ++
(products in Compile in packageBin in LocalProject("scaladoc")).value ++
(products in Compile in packageBin in LocalProject("repl")).value ++
Expand Down
2 changes: 1 addition & 1 deletion project/GenerateAnyVals.scala
Expand Up @@ -147,7 +147,7 @@ import scala.language.implicitConversions"""
def mkCoercions = numeric map (x => "def to%s: %s".format(x, x))
def mkUnaryOps = unaryOps map (x => "%s\n def unary_%s : %s".format(x.doc, x.op, this opType I))
def mkStringOps = List(
"""@deprecated("Adding a number and a String is deprecated. Use the string interpolation `s\"$num$str\"`", "2.13.0") def +(x: String): String"""
"@deprecated(\"Adding a number and a String is deprecated. Use the string interpolation `s\\\"$num$str\\\"`\", \"2.13.0\")\n def +(x: String): String"
)
def mkShiftOps = (
for (op <- shiftOps ; arg <- List(I, L)) yield {
Expand Down
2 changes: 1 addition & 1 deletion project/ScalaOptionParser.scala
Expand Up @@ -82,7 +82,7 @@ object ScalaOptionParser {
}

// TODO retrieve this data programmatically, ala https://github.com/scala/scala-tool-support/blob/master/bash-completion/src/main/scala/BashCompletion.scala
private def booleanSettingNames = List("-X", "-Xcheckinit", "-Xdev", "-Xdisable-assertions", "-Xexperimental", "-Xfatal-warnings", "-Xfuture", "-Xlog-free-terms", "-Xlog-free-types", "-Xlog-implicit-conversions", "-Xlog-implicits", "-Xlog-reflective-calls",
private def booleanSettingNames = List("-X", "-Xcheckinit", "-Xdev", "-Xdisable-assertions", "-Xexperimental", "-Xfatal-warnings", "-Xlog-free-terms", "-Xlog-free-types", "-Xlog-implicit-conversions", "-Xlog-implicits", "-Xlog-reflective-calls",
"-Xno-forwarders", "-Xno-patmat-analysis", "-Xno-uescape", "-Xnojline", "-Xprint-pos", "-Xprint-types", "-Xprompt", "-Xresident", "-Xshow-phases", "-Xverify", "-Y",
"-Ybreak-cycles", "-Ydebug", "-Ycompact-trees", "-YdisableFlatCpCaching", "-Ydoc-debug",
"-Yide-debug",
Expand Down
2 changes: 1 addition & 1 deletion project/VersionUtil.scala
Expand Up @@ -33,7 +33,7 @@ object VersionUtil {
| / __/ __// _ | / / / _ |
| __\ \/ /__/ __ |/ /__/ __ |
| /____/\___/_/ |_/____/_/ | |
| |/ %s""".stripMargin.linesIterator.drop(1).map(s => s"${ "%n" }${ s }").mkString,
| |/ %s""".stripMargin.linesIterator.mkString("%n"),
resourceGenerators in Compile += generateVersionPropertiesFile.map(file => Seq(file)).taskValue,
generateVersionPropertiesFile := generateVersionPropertiesFileImpl.value
)
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version=1.2.3
sbt.version=1.2.7
2 changes: 1 addition & 1 deletion scripts/common
Expand Up @@ -11,7 +11,7 @@ else
fi

SBT_CMD=${SBT_CMD-sbt}
SBT_CMD="$SBT_CMD -sbt-version 1.2.3"
SBT_CMD="$SBT_CMD -sbt-version 1.2.7"

# repo to publish builds
integrationRepoUrl=${integrationRepoUrl-"https://scala-ci.typesafe.com/artifactory/scala-integration/"}
Expand Down
13 changes: 9 additions & 4 deletions spec/01-lexical-syntax.md
Expand Up @@ -333,14 +333,16 @@ digit ::= ‘0’ | nonZeroDigit
nonZeroDigit ::= ‘1’ | … | ‘9’
```

Integer literals are usually of type `Int`, or of type
`Long` when followed by a `L` or
`l` suffix. Values of type `Int` are all integer
Values of type `Int` are all integer
numbers between ´-2\^{31}´ and ´2\^{31}-1´, inclusive. Values of
type `Long` are all integer numbers between ´-2\^{63}´ and
´2\^{63}-1´, inclusive. A compile-time error occurs if an integer literal
denotes a number outside these ranges.

Integer literals are usually of type `Int`, or of type
`Long` when followed by a `L` or `l` suffix.
(Lowercase `l` is deprecated for reasons of legibility.)

However, if the expected type [_pt_](06-expressions.html#expression-typing) of a literal
in an expression is either `Byte`, `Short`, or `Char`
and the integer number fits in the numeric range defined by the type,
Expand All @@ -353,8 +355,11 @@ is _pt_. The numeric ranges given by these types are:
|`Short` | ´-2\^{15}´ to ´2\^{15}-1´|
|`Char` | ´0´ to ´2\^{16}-1´ |

The digits of a numeric literal may be separated by
arbitrarily many underscores for purposes of legibility.

> ```scala
> 0 21 0xFFFFFFFF -42L
> 0 21_000 0x7F -42L 0xFFFF_FFFF
> ```
### Floating Point Literals
Expand Down
13 changes: 7 additions & 6 deletions spec/05-classes-and-objects.md
Expand Up @@ -63,14 +63,15 @@ The _least proper supertype_ of a template is the class type or
class types.

The statement sequence ´\mathit{stats}´ contains member definitions that
define new members or overwrite members in the parent classes. If the
template forms part of an abstract class or trait definition, the
statement part ´\mathit{stats}´ may also contain declarations of abstract
members. If the template forms part of a concrete class definition,
define new members or override members in the parent classes. If the
template forms part of an abstract class or trait definition, then
´\mathit{stats}´ may also contain declarations of abstract members.
If the template forms part of a concrete class definition,
´\mathit{stats}´ may still contain declarations of abstract type members, but
not of abstract term members. Furthermore, ´\mathit{stats}´ may in any case
also contain expressions; these are executed in the order they are
given as part of the initialization of a template.
also contain strictly evaluated expressions: these are executed in the order they are
given as part of the initialization of a template, even if they appear in
the definition of overridden members.

The sequence of template statements may be prefixed with a formal
parameter definition and an arrow, e.g. `´x´ =>`, or
Expand Down
15 changes: 8 additions & 7 deletions spec/06-expressions.md
Expand Up @@ -931,7 +931,8 @@ be implemented in different ways for different carrier types.

The translation scheme is as follows. In a first step, every
generator `´p´ <- ´e´`, where ´p´ is not [irrefutable](08-pattern-matching.html#patterns)
for the type of ´e´ is replaced by
for the type of ´e´, and ´p´ is some pattern other than a simple name
or a name followed by a colon and a type, is replaced by

```scala
´p´ <- ´e´.withFilter { case ´p´ => true; case _ => false }
Expand Down Expand Up @@ -1270,7 +1271,7 @@ include at least the expressions of the following forms:

```ebnf
BlockStat ::= Import
| {Annotation} [‘implicit’ | ‘lazy’] Def
| {Annotation} [‘implicit’] [‘lazy’] Def
| {Annotation} {LocalModifier} TmplDef
| Expr1
|
Expand Down Expand Up @@ -1396,16 +1397,16 @@ type ´T´ by evaluating the expression to which ´m´ is bound.
If the method takes only implicit parameters, implicit
arguments are passed following the rules [here](07-implicits.html#implicit-parameters).

###### Empty Application
Otherwise, if ´e´ has method type ´()T´, it is implicitly applied to the empty
argument list, yielding ´e()´.

###### Eta Expansion
Otherwise, if the method is not a constructor,
and the expected type ´\mathit{pt}´ is a function type
and the expected type ´\mathit{pt}´ is a function type (potentially after sam conversion)
´(\mathit{Ts}') \Rightarrow T'´, [eta-expansion](#eta-expansion)
is performed on the expression ´e´.

###### Empty Application
Otherwise, if ´e´ has method type ´()T´, it is implicitly applied to the empty
argument list, yielding ´e()´.

### Overloading Resolution

If an identifier or selection ´e´ references several members of a
Expand Down
23 changes: 18 additions & 5 deletions spec/09-top-level-definitions.md
Expand Up @@ -123,8 +123,14 @@ Like all other references, package references are relative. That is,
a package reference starting in a name ´p´ will be looked up in the
closest enclosing scope that defines a member named ´p´.

The special predefined name `_root_` refers to the
outermost root package which contains all top-level packages.
If a package name is shadowed, it's possible to refer to its
fully-qualified name by prefixing it with
the special predefined name `_root_`, which refers to the
outermost root package that contains all top-level packages.

The name `_root_` has this special denotation only when
used as the first element of a qualifier; it is an ordinary
identifier otherwise.

###### Example
Consider the following program:
Expand All @@ -134,11 +140,18 @@ package b {
class B
}

package a.b {
class A {
val x = new _root_.b.B
package a {
package b {
class A {
val x = new _root_.b.B
}
class C {
import _root_.b._
def y = new B
}
}
}

```

Here, the reference `_root_.b.B` refers to class `B` in the
Expand Down

0 comments on commit 3c21433

Please sign in to comment.