summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-02-02 11:13:23 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-02-02 11:13:23 +1000
commit70f960cfd1d43ee1b873c22a471c8350a966b2a7 (patch)
tree99be5b41a9b55236ef2abb9e6978a90eb12184a8 /spec
parent8b5f2b435b4b14089806406c8923f7e845d10ef6 (diff)
parent41766537c03e5ed953cc806c2a8629b115097996 (diff)
downloadscala-70f960cfd1d43ee1b873c22a471c8350a966b2a7.tar.gz
scala-70f960cfd1d43ee1b873c22a471c8350a966b2a7.tar.bz2
scala-70f960cfd1d43ee1b873c22a471c8350a966b2a7.zip
Merge pull request #4272 from retronym/merge/2.11.x-to-2.12.x-20150129
Merge 2.11.x to 2.12.x
Diffstat (limited to 'spec')
-rw-r--r--spec/01-lexical-syntax.md6
-rw-r--r--spec/02-identifiers-names-and-scopes.md2
-rw-r--r--spec/03-types.md14
-rw-r--r--spec/04-basic-declarations-and-definitions.md4
-rw-r--r--spec/05-classes-and-objects.md2
-rw-r--r--spec/06-expressions.md23
-rw-r--r--spec/08-pattern-matching.md6
-rw-r--r--spec/09-top-level-definitions.md2
-rw-r--r--spec/10-xml-expressions-and-patterns.md2
-rw-r--r--spec/12-the-scala-standard-library.md2
-rw-r--r--spec/13-syntax-summary.md4
-rw-r--r--spec/index.md2
12 files changed, 41 insertions, 28 deletions
diff --git a/spec/01-lexical-syntax.md b/spec/01-lexical-syntax.md
index d5752bbdf0..945dedf99b 100644
--- a/spec/01-lexical-syntax.md
+++ b/spec/01-lexical-syntax.md
@@ -323,14 +323,12 @@ Literal ::= [‘-’] integerLiteral
### Integer Literals
```ebnf
-integerLiteral ::= (decimalNumeral | hexNumeral | octalNumeral)
+integerLiteral ::= (decimalNumeral | hexNumeral)
[‘L’ | ‘l’]
decimalNumeral ::= ‘0’ | nonZeroDigit {digit}
-hexNumeral ::= ‘0’ ‘x’ hexDigit {hexDigit}
-octalNumeral ::= ‘0’ octalDigit {octalDigit}
+hexNumeral ::= ‘0’ (‘x’ | ‘X’) hexDigit {hexDigit}
digit ::= ‘0’ | nonZeroDigit
nonZeroDigit ::= ‘1’ | … | ‘9’
-octalDigit ::= ‘0’ | … | ‘7’
```
Integer literals are usually of type `Int`, or of type
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 80200cdf33..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
@@ -864,15 +864,15 @@ transitive relation that satisfies the following conditions.
if $T$ conforms to one of the [type instances](#existential-types)
of `$U$ forSome {$\,Q\,$}`.
- If
- $T_i \equiv T'_i$ for $i \in \{ 1 , \ldots , n\}$ and $U$ conforms to $U'$
+ $T_i \equiv T_i'$ for $i \in \{ 1 , \ldots , n\}$ and $U$ conforms to $U'$
then the method type $(p_1:T_1 , \ldots , p_n:T_n) U$ conforms to
- $(p'_1:T'_1 , \ldots , p'_n:T'_n) U'$.
+ $(p_1':T_1' , \ldots , p_n':T_n') U'$.
- The polymorphic type
$[a_1 >: L_1 <: U_1 , \ldots , a_n >: L_n <: U_n] T$ conforms to the
polymorphic type
- $[a_1 >: L'_1 <: U'_1 , \ldots , a_n >: L'_n <: U'_n] T'$ if, assuming
- $L'_1 <: a_1 <: U'_1 , \ldots , L'_n <: a_n <: U'_n$
- one has $T <: T'$ and $L_i <: L'_i$ and $U'_i <: U_i$
+ $[a_1 >: L_1' <: U_1' , \ldots , a_n >: L_n' <: U_n'] T'$ if, assuming
+ $L_1' <: a_1 <: U_1' , \ldots , L_n' <: a_n <: U_n'$
+ one has $T <: T'$ and $L_i <: L_i'$ and $U_i' <: U_i$
for $i \in \{ 1 , \ldots , n \}$.
- Type constructors $T$ and $T'$ follow a similar discipline. We characterize
$T$ and $T'$ by their type parameter clauses
@@ -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..65d79dd5f4 100644
--- a/spec/04-basic-declarations-and-definitions.md
+++ b/spec/04-basic-declarations-and-definitions.md
@@ -631,7 +631,7 @@ For every parameter $p_{i,j}$ with a default argument a method named
expression. Here, $n$ denotes the parameter's position in the method
declaration. These methods are parametrized by the type parameter clause
`[$\mathit{tps}\,$]` and all value parameter clauses
-`($\mathit{ps}_1$)$\ldots$($\mathit{ps}_{i-1}$)` preceeding $p_{i,j}$.
+`($\mathit{ps}_1$)$\ldots$($\mathit{ps}_{i-1}$)` preceding $p_{i,j}$.
The `$f\$$default$\$$n` methods are inaccessible for
user programs.
@@ -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/05-classes-and-objects.md b/spec/05-classes-and-objects.md
index ef854b2abb..fd20d6ae2c 100644
--- a/spec/05-classes-and-objects.md
+++ b/spec/05-classes-and-objects.md
@@ -128,7 +128,7 @@ consists of the following steps.
occurrence in the linearization.
- Finally the statement sequence $\mathit{stats}\,$ is evaluated.
-###### Delayed Initializaton
+###### Delayed Initialization
The initialization code of an object or class (but not a trait) that follows
the superclass
constructor invocation and the mixin-evaluation of the template's base
diff --git a/spec/06-expressions.md b/spec/06-expressions.md
index 03b8065f4b..bb6cc2a89a 100644
--- a/spec/06-expressions.md
+++ b/spec/06-expressions.md
@@ -410,6 +410,19 @@ The final result of the transformation is a block of the form
}
```
+### Signature Polymorphic Methods
+
+For invocations of signature polymorphic methods of the target platform `$f$($e_1 , \ldots , e_m$)`,
+the invoked function has a different method type `($p_1$:$T_1 , \ldots , p_n$:$T_n$)$U$` at each call
+site. The parameter types `$T_ , \ldots , T_n$` are the types of the argument expressions
+`$e_1 , \ldots , e_m$` and `$U$` is the expected type at the call site. If the expected type is
+undefined then `$U$` is `scala.AnyRef`. The parameter names `$p_1 , \ldots , p_n$` are fresh.
+
+###### Note
+
+On the Java platform version 7 and later, the methods `invoke` and `invokeExact` in class
+`java.lang.invoke.MethodHandle` are signature polymorphic.
+
## Method Values
```ebnf
@@ -666,7 +679,7 @@ followed by operators starting with ``|`', etc.
There's one exception to this rule, which concerns
[_assignment operators_](#assignment-operators).
-The precedence of an assigment operator is the same as the one
+The precedence of an assignment operator is the same as the one
of simple assignment `(=)`. That is, it is lower than the
precedence of any other operator.
@@ -1571,7 +1584,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 +1621,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 +1763,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
@@ -1761,7 +1774,7 @@ trait Dynamic {
```
Assume a selection of the form $e.x$ where the type of $e$ conforms to `scala.Dynamic`.
-Further assuming the selection is not followed by any function arguments, such an expression can be rewitten under the conditions given [here](#implicit-conversions) to:
+Further assuming the selection is not followed by any function arguments, such an expression can be rewritten under the conditions given [here](#implicit-conversions) to:
```scala
$e$.applyDynamic("$x$")
diff --git a/spec/08-pattern-matching.md b/spec/08-pattern-matching.md
index 8e224de8d2..e75bddc096 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
@@ -609,7 +609,7 @@ case class If[T](c: Term[Boolean],
There are terms to represent numeric literals, incrementation, a zero
test, and a conditional. Every term carries as a type parameter the
-type of the expression it representes (either `Int` or `Boolean`).
+type of the expression it represents (either `Int` or `Boolean`).
A type-safe evaluator for such terms can be written as follows.
diff --git a/spec/09-top-level-definitions.md b/spec/09-top-level-definitions.md
index 847fab548d..e3185d8b7d 100644
--- a/spec/09-top-level-definitions.md
+++ b/spec/09-top-level-definitions.md
@@ -159,7 +159,7 @@ The `main` method of a program can be directly defined in the
object, or it can be inherited. The scala library defines a special class
`scala.App` whose body acts as a `main` method.
An objects $m$ inheriting from this class is thus a program,
-which executes the initializaton code of the object $m$.
+which executes the initialization code of the object $m$.
###### Example
The following example will create a hello world program by defining
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/spec/13-syntax-summary.md b/spec/13-syntax-summary.md
index 86efcf70a8..2b9571cc73 100644
--- a/spec/13-syntax-summary.md
+++ b/spec/13-syntax-summary.md
@@ -41,7 +41,7 @@ idrest ::= {letter | digit} [‘_’ op]
integerLiteral ::= (decimalNumeral | hexNumeral) [‘L’ | ‘l’]
decimalNumeral ::= ‘0’ | nonZeroDigit {digit}
-hexNumeral ::= ‘0’ ‘x’ hexDigit {hexDigit}
+hexNumeral ::= ‘0’ (‘x’ | ‘X’) hexDigit {hexDigit}
digit ::= ‘0’ | nonZeroDigit
nonZeroDigit ::= ‘1’ | … | ‘9’
@@ -210,7 +210,7 @@ grammar.
ClassParams ::= ClassParam {‘,’ ClassParam}
ClassParam ::= {Annotation} {Modifier} [(`val' | `var')]
id ‘:’ ParamType [‘=’ Expr]
- Bindings ::= ‘(’ Binding {‘,’ Binding ‘)’
+ Bindings ::= ‘(’ Binding {‘,’ Binding} ‘)’
Binding ::= (id | ‘_’) [‘:’ Type]
Modifier ::= LocalModifier
diff --git a/spec/index.md b/spec/index.md
index 3815265ad5..ee9c2a5f78 100644
--- a/spec/index.md
+++ b/spec/index.md
@@ -6,6 +6,8 @@ layout: toc
# The Scala Language Specification
# Version 2.11
+### Maintained online at [https://github.com/scala/scala/tree/2.11.x/spec](https://github.com/scala/scala/tree/2.11.x/spec)
+
### Martin Odersky, Philippe Altherr, Vincent Cremet, Gilles Dubochet, Burak Emir, Philipp Haller, Stéphane Micheloud, Nikolay Mihaylov, Adriaan Moors, Lukas Rytz, Michel Schinz, Erik Stenman, Matthias Zenger
### Markdown Conversion by Iain McGinniss.