summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-03-13 17:09:33 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-03-13 17:13:32 -0700
commite6ecfd0de12ecda56cc23f887c807c3ae096c82d (patch)
treefb9ef0529c5b92e552e28be711b5b2379e3a2230
parentd8a09e207cb207f185cae035247bdcc6d71cbfca (diff)
downloadscala-e6ecfd0de12ecda56cc23f887c807c3ae096c82d.tar.gz
scala-e6ecfd0de12ecda56cc23f887c807c3ae096c82d.tar.bz2
scala-e6ecfd0de12ecda56cc23f887c807c3ae096c82d.zip
That was fun: fix internal links.
After some dirty grepping, regexing and perling, I present to you: internal links! I wish there was a way to make this more robust, these will only work on the html version, and assume we don't change filenames...
-rw-r--r--03-lexical-syntax.md20
-rw-r--r--04-identifiers-names-and-scopes.md14
-rw-r--r--05-types.md30
-rw-r--r--06-basic-declarations-and-definitions.md30
-rw-r--r--07-classes-and-objects.md38
-rw-r--r--08-expressions.md68
-rw-r--r--09-implicit-parameters-and-views.md20
-rw-r--r--10-pattern-matching.md26
-rw-r--r--11-top-level-definitions.md2
-rw-r--r--12-xml-expressions-and-patterns.md6
-rw-r--r--13-user-defined-annotations.md2
-rw-r--r--14-the-scala-standard-library.md12
12 files changed, 134 insertions, 134 deletions
diff --git a/03-lexical-syntax.md b/03-lexical-syntax.md
index 95c110afff..0e9cc0b495 100644
--- a/03-lexical-syntax.md
+++ b/03-lexical-syntax.md
@@ -190,23 +190,23 @@ that a semicolon in place of the newline would be illegal in every one
of these cases):
- between the condition of a
- [conditional expression](#conditional-expressions)
- or [while loop](#while-loop-expressions) and the next
+ [conditional expression](08-expressions.html#conditional-expressions)
+ or [while loop](08-expressions.html#while-loop-expressions) and the next
following expression,
- between the enumerators of a
- [for-comprehension](#for-comprehensions-and-for-loops)
+ [for-comprehension](08-expressions.html#for-comprehensions-and-for-loops)
and the next following expression, and
- after the initial `type` keyword in a
- [type definition or declaration](#type-declarations-and-type-aliases).
+ [type definition or declaration](06-basic-declarations-and-definitions.html#type-declarations-and-type-aliases).
A single new line token is accepted
- in front of an opening brace ‘{’, if that brace is a legal
continuation of the current statement or expression,
-- after an [infix operator](#prefix-infix-and-postfix-operations),
+- after an [infix operator](08-expressions.html#prefix-infix-and-postfix-operations),
if the first token on the next line can start an expression,
-- in front of a [parameter clause](#function-declarations-and-definitions), and
-- after an [annotation](#user-defined-annotations).
+- in front of a [parameter clause](06-basic-declarations-and-definitions.html#function-declarations-and-definitions), and
+- after an [annotation](13-user-defined-annotations.html#user-defined-annotations).
###### Example: four well-formed statements, each on two lines
@@ -344,7 +344,7 @@ 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.
-However, if the expected type [_pt_](#expression-typing) of a literal
+However, if the expected type [_pt_](08-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,
then the number is converted to type _pt_ and the literal's type
@@ -507,7 +507,7 @@ lines.
Method `stripMargin` is defined in class
[scala.collection.immutable.StringLike](http://www.scala-lang.org/api/current/index.html#scala.collection.immutable.StringLike).
Because there is a predefined
-[implicit conversion](#implicit-conversions) from `String` to
+[implicit conversion](08-expressions.html#implicit-conversions) from `String` to
`StringLike`, the method is applicable to all strings.
@@ -542,7 +542,7 @@ symbolLiteral ::= ‘'’ plainid
```
A symbol literal `'x` is a shorthand for the expression
-`scala.Symbol("x")`. `Symbol` is a [case class](#case-classes),
+`scala.Symbol("x")`. `Symbol` is a [case class](07-classes-and-objects.html#case-classes),
which is defined as follows.
```
diff --git a/04-identifiers-names-and-scopes.md b/04-identifiers-names-and-scopes.md
index 19f875f4e5..45798b82e2 100644
--- a/04-identifiers-names-and-scopes.md
+++ b/04-identifiers-names-and-scopes.md
@@ -7,10 +7,10 @@ layout: default
Names in Scala identify types, values, methods, and classes which are
collectively called _entities_. Names are introduced by local
-[definitions and declarations](#basic-declarations-and-definitions),
-[inheritance](#class-members),
-[import clauses](#import-clauses), or
-[package clauses](#packagings)
+[definitions and declarations](06-basic-declarations-and-definitions.html#basic-declarations-and-definitions),
+[inheritance](07-classes-and-objects.html#class-members),
+[import clauses](06-basic-declarations-and-definitions.html#import-clauses), or
+[package clauses](11-top-level-definitions.html#packagings)
which are collectively called _bindings_.
Bindings of different kinds have a precedence defined on them:
@@ -24,8 +24,8 @@ Bindings of different kinds have a precedence defined on them:
compilation unit where the definition occurs have lowest precedence.
-There are two different name spaces, one for [types](#types)
-and one for [terms](#expressions). The same name may designate a
+There are two different name spaces, one for [types](05-types.html#types)
+and one for [terms](08-expressions.html#expressions). The same name may designate a
type and a term, depending on the context where the name is used.
A binding has a _scope_ in which the entity defined by a single
@@ -103,6 +103,6 @@ object A {
A reference to a qualified (type- or term-) identifier $e.x$ refers to
the member of the type $T$ of $e$ which has the name $x$ in the same
namespace as the identifier. It is an error if $T$ is not a
-[value type](#value-types). The type of $e.x$ is the member type of the
+[value type](05-types.html#value-types). The type of $e.x$ is the member type of the
referenced entity in $T$.
diff --git a/05-types.md b/05-types.md
index 3ffe103db2..1e7e422422 100644
--- a/05-types.md
+++ b/05-types.md
@@ -34,15 +34,15 @@ Value types are either _concrete_ or _abstract_.
Every concrete value type can be represented as a _class type_, i.e. a
[type designator](#type-designators) that refers to a
-[class or a trait](#class-definitions) [^1], or as a
+[class or a trait](07-classes-and-objects.html#class-definitions) [^1], or as a
[compound type](#compound-types) representing an
intersection of types, possibly with a [refinement](#compound-types)
that further constrains the types of its members.
<!--
A shorthand exists for denoting [function types](#function-types)
-->
-Abstract value types are introduced by [type parameters](#type-parameters)
-and [abstract type bindings](#type-declarations-and-type-aliases).
+Abstract value types are introduced by [type parameters](06-basic-declarations-and-definitions.html#type-parameters)
+and [abstract type bindings](06-basic-declarations-and-definitions.html#type-declarations-and-type-aliases).
Parentheses in types can be used for grouping.
[^1]: We assume that objects and packages also implicitly
@@ -107,7 +107,7 @@ SimpleType ::= Path ‘.’ type
```
A singleton type is of the form `$p$.type`, where $p$ is a
-path pointing to a value expected to [conform](#expression-typing)
+path pointing to a value expected to [conform](08-expressions.html#expression-typing)
to `scala.AnyRef`. The type denotes the set of values
consisting of `null` and the value denoted by $p$.
@@ -258,7 +258,7 @@ AnnotType ::= SimpleType {Annotation}
```
An annotated type $T$ `$a_1 , \ldots , a_n$`
-attaches [annotations](#user-defined-annotations)
+attaches [annotations](13-user-defined-annotations.html#user-defined-annotations)
$a_1 , \ldots , a_n$ to the type $T$.
###### Example: annotated type
@@ -287,7 +287,7 @@ $T_1 , \ldots , T_n$ and the refinement `{ $R$ }`. A refinement
`{ $R$ }` contains declarations and type definitions.
If a declaration or definition overrides a declaration or definition in
one of the component types $T_1 , \ldots , T_n$, the usual rules for
-[overriding](#overriding) apply; otherwise the declaration
+[overriding](07-classes-and-objects.html#overriding) apply; otherwise the declaration
or definition is said to be “structural” [^2].
[^2]: A reference to a structurally defined member (method call or access
@@ -354,10 +354,10 @@ $T_2$. The type is equivalent to the type application
`$\mathit{op}$[$T_1$, $T_2$]`. The infix operator $\mathit{op}$ may be an
arbitrary identifier,
except for `*`, which is reserved as a postfix modifier
-denoting a [repeated parameter type](#repeated-parameters).
+denoting a [repeated parameter type](06-basic-declarations-and-definitions.html#repeated-parameters).
All type infix operators have the same precedence; parentheses have to
-be used for grouping. The [associativity](#prefix-infix-and-postfix-operations)
+be used for grouping. The [associativity](08-expressions.html#prefix-infix-and-postfix-operations)
of a type operator is determined as for term operators: type operators
ending in a colon ‘:’ are right-associative; all other
operators are left-associative.
@@ -384,7 +384,7 @@ values that take arguments of types $T1 , \ldots , Tn$ and yield
results of type $U$. In the case of exactly one argument type
$T \Rightarrow U$ is a shorthand for $(T) \Rightarrow U$.
An argument type of the form $\Rightarrow T$
-represents a [call-by-name parameter](#by-name-parameters) of type $T$.
+represents a [call-by-name parameter](06-basic-declarations-and-definitions.html#by-name-parameters) of type $T$.
Function types associate to the right, e.g.
$S \Rightarrow T \Rightarrow U$ is the same as
@@ -404,7 +404,7 @@ trait Function_n[-T1 , … , -T$_n$, +R] {
}
```
-Hence, function types are [covariant](#variance-annotations) in their
+Hence, function types are [covariant](06-basic-declarations-and-definitions.html#variance-annotations) in their
result type and contravariant in their argument types.
### Existential Types
@@ -419,7 +419,7 @@ ExistentialDcl ::= ‘type’ TypeDcl
An existential type has the form `$T$ forSome { $Q$ }`
where $Q$ is a sequence of
-[type declarations](#type-declarations-and-type-aliases).
+[type declarations](06-basic-declarations-and-definitions.html#type-declarations-and-type-aliases).
Let
$t_1[\mathit{tps}_1] >: L_1 <: U_1 , \ldots , t_n[\mathit{tps}_n] >: L_n <: U_n$
@@ -461,7 +461,7 @@ is equivalent to
1. An existential type `$T$ forSome { $Q$ }` where $Q$ contains
a clause `type $t[\mathit{tps}] >: L <: U$` is equivalent
to the type `$T'$ forSome { $Q$ }` where $T'$ results from $T$ by replacing
-every [covariant occurrence](#variance-annotations) of $t$ in $T$ by $U$ and by
+every [covariant occurrence](06-basic-declarations-and-definitions.html#variance-annotations) of $t$ in $T$ by $U$ and by
replacing every contravariant occurrence of $t$ in $T$ by $L$.
@@ -590,7 +590,7 @@ that are re-evaluated each time the parameterless method name is
referenced.
Method types do not exist as types of values. If a method name is used
-as a value, its type is [implicitly converted](#implicit-conversions) to a
+as a value, its type is [implicitly converted](08-expressions.html#implicit-conversions) to a
corresponding function type.
###### Example
@@ -644,8 +644,8 @@ union : [A >: Nothing <: Comparable[A]] (x: Set[A], xs: Set[A]) Set[A] .
A type constructor is represented internally much like a polymorphic method type.
`[$\pm$ $a_1$ >: $L_1$ <: $U_1 , \ldots , \pm a_n$ >: $L_n$ <: $U_n$] $T$`
represents a type that is expected by a
-[type constructor parameter](#type-parameters) or an
-[abstract type constructor binding](#type-declarations-and-type-aliases) with
+[type constructor parameter](06-basic-declarations-and-definitions.html#type-parameters) or an
+[abstract type constructor binding](06-basic-declarations-and-definitions.html#type-declarations-and-type-aliases) with
the corresponding type parameter clause.
###### Example
diff --git a/06-basic-declarations-and-definitions.md b/06-basic-declarations-and-definitions.md
index 6f3af4b590..de718bb6b0 100644
--- a/06-basic-declarations-and-definitions.md
+++ b/06-basic-declarations-and-definitions.md
@@ -20,8 +20,8 @@ Def ::= PatVarDef
```
A _declaration_ introduces names and assigns them types. It can
-form part of a [class definition](#templates) or of a
-refinement in a [compound type](#compound-types).
+form part of a [class definition](07-classes-and-objects.html#templates) or of a
+refinement in a [compound type](05-types.html#compound-types).
A _definition_ introduces names that denote terms or types. It can
form part of an object or class definition or it can be local to a
@@ -115,7 +115,7 @@ type $T$.
A value definition `val $x$: $T$ = $e$` defines $x$ as a
name of the value that results from the evaluation of $e$.
If the value definition is not recursive, the type
-$T$ may be omitted, in which case the [packed type](#expression-typing) of
+$T$ may be omitted, in which case the [packed type](08-expressions.html#expression-typing) of
expression $e$ is assumed. If a type $T$ is given, then $e$ is expected to
conform to it.
@@ -131,13 +131,13 @@ A _constant value definition_ is of the form
final val x = e
```
-where `e` is a [constant expression](#constant-expressions).
+where `e` is a [constant expression](08-expressions.html#constant-expressions).
The `final` modifier must be
present and no type annotation may be given. References to the
constant value `x` are themselves treated as constant expressions; in the
generated code they are replaced by the definition's right-hand side `e`.
-Value definitions can alternatively have a [pattern](#patterns)
+Value definitions can alternatively have a [pattern](10-pattern-matching.html#patterns)
as left-hand side. If $p$ is some pattern other
than a simple name or a name followed by a colon and a type, then the
value definition `val $p$ = $e$` is expanded as follows:
@@ -222,9 +222,9 @@ A variable definition `var $x$: $T$ = $e$` introduces a
mutable variable with type $T$ and initial value as given by the
expression $e$. The type $T$ can be omitted, in which case the type of
$e$ is assumed. If $T$ is given, then $e$ is expected to
-[conform to it](#expression-typing).
+[conform to it](08-expressions.html#expression-typing).
-Variable definitions can alternatively have a [pattern](#patterns)
+Variable definitions can alternatively have a [pattern](10-pattern-matching.html#patterns)
as left-hand side. A variable definition
`var $p$ = $e$` where $p$ is a pattern other
than a simple name or a name followed by a colon and a type is expanded in the same way
@@ -325,7 +325,7 @@ the top type `scala.Any` is assumed.
A type constructor declaration imposes additional restrictions on the
concrete types for which $t$ may stand. Besides the bounds $L$ and
$U$, the type parameter clause may impose higher-order bounds and
-variances, as governed by the [conformance of type constructors](#conformance).
+variances, as governed by the [conformance of type constructors](05-types.html#conformance).
The scope of a type parameter extends over the bounds `>: $L$ <: $U$` and the type parameter clause $\mathit{tps}$ itself. A
higher-order type parameter clause (of an abstract type constructor
@@ -413,7 +413,7 @@ function definitions. In this section we consider only type parameter
definitions with lower bounds `>: $L$` and upper bounds
`<: $U$` whereas a discussion of context bounds
`: $U$` and view bounds `<% $U$`
-is deferred to [here](#context-bounds-and-view-bounds).
+is deferred to [here](09-implicit-parameters-and-views.html#context-bounds-and-view-bounds).
The most general form of a first-order type parameter is
`$@a_1 \ldots @a_n$ $\pm$ $t$ >: $L$ <: $U$`.
@@ -467,7 +467,7 @@ The following type parameter clauses are illegal:
## Variance Annotations
Variance annotations indicate how instances of parameterized types
-vary with respect to [subtyping](#conformance). A
+vary with respect to [subtyping](05-types.html#conformance). A
‘+’ variance indicates a covariant dependency, a
‘-’ variance indicates a contravariant dependency, and a
missing variance indication indicates an invariant dependency.
@@ -510,7 +510,7 @@ changes at the following constructs.
<!-- TODO: handle type aliases -->
References to the type parameters in
-[object-private or object-protected values, types, variables, or methods](#modifiers) of the class are not
+[object-private or object-protected values, types, variables, or methods](07-classes-and-objects.html#modifiers) of the class are not
checked for their variance position. In these members the type parameter may
appear anywhere without restricting its legal variance annotations.
@@ -617,7 +617,7 @@ followed by zero or more value parameter clauses
introduces a value with a (possibly polymorphic) method type whose
parameter types and result type are as given.
-The type of the function body is expected to [conform](#expression-typing)
+The type of the function body is expected to [conform](08-expressions.html#expression-typing)
to the function's declared
result type, if one is given. If the function definition is not
recursive, the result type may be omitted, in which case it is
@@ -687,7 +687,7 @@ The by-name modifier is disallowed for parameters of classes that
carry a `val` or `var` prefix, including parameters of case
classes for which a `val` prefix is implicitly generated. The
by-name modifier is also disallowed for
-[implicit parameters](#implicit-parameters).
+[implicit parameters](09-implicit-parameters-and-views.html#implicit-parameters).
###### Example
The declaration
@@ -867,10 +867,10 @@ ImportSelector ::= id [‘=>’ id | ‘=>’ ‘_’]
```
An import clause has the form `import $p$.$I$` where $p$ is a
-[stable identifier](#paths) and $I$ is an import expression.
+[stable identifier](05-types.html#paths) and $I$ is an import expression.
The import expression determines a set of names of importable members of $p$
which are made available without qualification. A member $m$ of $p$ is
-_importable_ if it is not [object-private](#modifiers).
+_importable_ if it is not [object-private](07-classes-and-objects.html#modifiers).
The most general form of an import expression is a list of _import selectors_
```
diff --git a/07-classes-and-objects.md b/07-classes-and-objects.md
index 75c8894617..1b3072a801 100644
--- a/07-classes-and-objects.md
+++ b/07-classes-and-objects.md
@@ -59,7 +59,7 @@ chain in the inheritance hierarchy which starts with the template's
superclass.
The _least proper supertype_ of a template is the class type or
-[compound type](#compound-types) consisting of all its parent
+[compound type](05-types.html#compound-types) consisting of all its parent
class types.
The statement sequence $\mathit{stats}$ contains member definitions that
@@ -158,10 +158,10 @@ objects created by an instance creation expression, or of parts of an
object's definition which are inherited by a class or object
definition. A constructor invocation is a function application
`$x$.$c$[$\mathit{targs}$]($\mathit{args}_1$)$\ldots$($\mathit{args}_n$)`, where $x$ is a
-[stable identifier](#paths), $c$ is a type name which either designates a
+[stable identifier](05-types.html#paths), $c$ is a type name which either designates a
class or defines an alias type for one, $\mathit{targs}$ is a type argument
list, $\mathit{args}_1 , \ldots , \mathit{args}_n$ are argument lists, and there is a
-constructor of that class which is [applicable](#function-applications)
+constructor of that class which is [applicable](08-expressions.html#function-applications)
to the given arguments. If the constructor invocation uses named or
default arguments, it is transformed into a block expression using the
same transformation as described [here](sec:named-default).
@@ -169,7 +169,7 @@ same transformation as described [here](sec:named-default).
The prefix ``$x$.`' can be omitted. A type argument list
can be given only if the class $c$ takes type parameters. Even then
it can be omitted, in which case a type argument list is synthesized
-using [local type inference](#local-type-inference). If no explicit
+using [local type inference](08-expressions.html#local-type-inference). If no explicit
arguments are given, an empty list `()` is implicitly supplied.
An evaluation of a constructor invocation
@@ -305,7 +305,7 @@ linearization of $C$) the class in which $M'$ is defined.
It is an error if a template directly defines two matching members. It
is also an error if a template contains two members (directly defined
-or inherited) with the same name and the same [erased type](#type-erasure).
+or inherited) with the same name and the same [erased type](05-types.html#type-erasure).
Finally, a template is not allowed to contain two methods (directly
defined or inherited) with the same name which both define default arguments.
@@ -332,7 +332,7 @@ trait `B`.
A member $M$ of class $C$ that [matches](#class-members)
a non-private member $M'$ of a
base class of $C$ is said to _override_ that member. In this case
-the binding of the overriding member $M$ must [subsume](#conformance)
+the binding of the overriding member $M$ must [subsume](05-types.html#conformance)
the binding of the overridden member $M'$.
Furthermore, the following restrictions on modifiers apply to $M$ and
$M'$:
@@ -364,7 +364,7 @@ class Y extends X { override var stable = 1 } // error
```
Another restriction applies to abstract type members: An abstract type
-member with a [volatile type](#volatile-types) as its upper
+member with a [volatile type](05-types.html#volatile-types) as its upper
bound may not override an abstract type member which does not have a
volatile upper bound.
@@ -592,7 +592,7 @@ the validity and meaning of a modifier are as follows.
- The `abstract` modifier is used in class definitions. It is
redundant for traits, and mandatory for all other classes which have
incomplete members. Abstract classes cannot be
- [instantiated](#instance-creation-expressions) with a constructor invocation
+ [instantiated](08-expressions.html#instance-creation-expressions) with a constructor invocation
unless followed by mixins and/or a refinement which override all
incomplete members of the class. Only abstract classes and traits can have
abstract term members.
@@ -607,7 +607,7 @@ the validity and meaning of a modifier are as follows.
a template. `final` is redundant for object definitions. Members
of final classes or objects are implicitly also final, so the
`final` modifier is generally redundant for them, too. Note, however, that
- [constant value definitions](#value-declarations-and-definitions) do require
+ [constant value definitions](06-basic-declarations-and-definitions.html#value-declarations-and-definitions) do require
an explicit `final` modifier, even if they are defined in a final class or
object. `final` may not be applied to incomplete members, and it may not be
combined in one modifier list with `sealed`.
@@ -708,7 +708,7 @@ Here,
parameter section is called _polymorphic_, otherwise it is called
_monomorphic_.
- $as$ is a possibly empty sequence of
- [annotations](#user-defined-annotations).
+ [annotations](13-user-defined-annotations.html#user-defined-annotations).
If any annotations are given, they apply to the primary constructor of the
class.
- $m$ is an [access modifier](#modifiers) such as
@@ -723,16 +723,16 @@ Here,
If no formal parameter sections are given, an empty parameter section `()` is assumed.
If a formal parameter declaration $x: T$ is preceded by a `val`
- or `var` keyword, an accessor (getter) [definition](#variable-declarations-and-definitions)
+ or `var` keyword, an accessor (getter) [definition](06-basic-declarations-and-definitions.html#variable-declarations-and-definitions)
for this parameter is implicitly added to the class.
The getter introduces a value member $x$ of class $c$ that is defined as an alias of the parameter.
- If the introducing keyword is `var`, a setter accessor [`$x$_=`](#variable-declarations-and-definitions) is also implicitly added to the class.
+ If the introducing keyword is `var`, a setter accessor [`$x$_=`](06-basic-declarations-and-definitions.html#variable-declarations-and-definitions) is also implicitly added to the class.
In invocation of that setter `$x$_=($e$)` changes the value of the parameter to the result of evaluating $e$.
The formal parameter declaration may contain modifiers, which then carry over to the accessor definition(s).
When access modifiers are given for a parameter, but no `val` or `var` keyword, `val` is assumed.
- A formal parameter prefixed by `val` or `var` may not at the same time be a [call-by-name parameter](#by-name-parameters).
+ A formal parameter prefixed by `val` or `var` may not at the same time be a [call-by-name parameter](06-basic-declarations-and-definitions.html#by-name-parameters).
- $t$ is a [template](#templates) of the form
@@ -818,7 +818,7 @@ If there are auxiliary constructors of a class $C$, they form together
with $C$'s primary [constructor](#class-definitions)
an overloaded constructor
definition. The usual rules for
-[overloading resolution](#overloading-resolution)
+[overloading resolution](08-expressions.html#overloading-resolution)
apply for constructor invocations of $C$,
including for the self constructor invocations in the constructor
expressions themselves. However, unlike other methods, constructors
@@ -866,7 +866,7 @@ definition for the parameter is [generated](#class-definitions).
A case class definition of `$c$[$\mathit{tps}\,$]($\mathit{ps}_1\,$)$\ldots$($\mathit{ps}_n$)` with type
parameters $\mathit{tps}$ and value parameters $\mathit{ps}$ implicitly
-generates an [extractor object](#extractor-patterns) which is
+generates an [extractor object](10-pattern-matching.html#extractor-patterns) which is
defined as follows:
```
@@ -900,7 +900,7 @@ def unapply[$\mathit{tps}\,$]($x$: $c$[$\mathit{tps}\,$]) = x ne null
The name of the `unapply` method is changed to `unapplySeq` if the first
parameter section $\mathit{ps}_1$ of $c$ ends in a
-[repeated parameter](#repeated-parameters).
+[repeated parameter](06-basic-declarations-and-definitions.html#repeated-parameters).
If a companion object $c$ exists already, no new object is created,
but the `apply` and `unapply` methods are added to the existing
object instead.
@@ -921,7 +921,7 @@ In all cases `$x_{i,j}$` and `$T_{i,j}$` refer to the name and type of the corre
`$\mathit{ps}_{i,j}$`.
Every case class implicitly overrides some method definitions of class
-[`scala.AnyRef`](#root-classes) unless a definition of the same
+[`scala.AnyRef`](14-the-scala-standard-library.html#root-classes) unless a definition of the same
method is already given in the case class itself or a concrete
definition of the same method is given in some base class of the case
class different from `AnyRef`. In particular:
@@ -998,7 +998,7 @@ Assume a trait $D$ defines some aspect of an instance $x$ of
type $C$ (i.e.\ $D$ is a base class of $C$). Then the _actual
supertype_ of $D$ in $x$ is the compound type consisting of all the
base classes in $\mathcal{L}(C)$ that succeed $D$. The actual supertype gives
-the context for resolving a [`super` reference](#this-and-super) in a trait.
+the context for resolving a [`super` reference](08-expressions.html#this-and-super) in a trait.
Note that the actual supertype depends
on the type to which the trait is added in a mixin composition; it is not
statically known at the time the trait is defined.
@@ -1130,7 +1130,7 @@ constructor is being evaluated block until evaluation is complete.
The expansion given above is not accurate for top-level objects. It
cannot be because variable and method definition cannot appear on the
-top-level outside of a [package object](#package-objects). Instead,
+top-level outside of a [package object](11-top-level-definitions.html#package-objects). Instead,
top-level objects are translated to static fields.
###### Example
diff --git a/08-expressions.md b/08-expressions.md
index 0c685f28e9..03475bbf4a 100644
--- a/08-expressions.md
+++ b/08-expressions.md
@@ -61,7 +61,7 @@ $T$.
The following skolemization rule is applied universally for every
expression: If the type of an expression would be an existential type
$T$, then the type of the expression is assumed instead to be a
-[skolemization](#existential-types) of $T$.
+[skolemization](05-types.html#existential-types) of $T$.
Skolemization is reversed by type packing. Assume an expression $e$ of
type $T$ and let $t_1[\mathit{tps}_1] >: L_1 <: U_1 , \ldots , t_n[\mathit{tps}_n] >: L_n <: U_n$ be
@@ -79,7 +79,7 @@ $T$ forSome { type $t_1[\mathit{tps}_1] >: L_1 <: U_1$; $\ldots$; type $t_n[\mat
SimpleExpr ::= Literal
```
-Typing of literals is as described [here](#literals); their
+Typing of literals is as described [here](03-lexical-syntax.html#literals); their
evaluation is immediate.
@@ -95,7 +95,7 @@ implements methods in class `scala.AnyRef` as follows:
- `ne($x\,$)` and `!=($x\,$)` return true iff the
argument x is not also the ``null'' object.
- `isInstanceOf[$T\,$]` always returns `false`.
-- `asInstanceOf[$T\,$]` returns the [default value](#value-declarations-and-definitions) of type $T$.
+- `asInstanceOf[$T\,$]` returns the [default value](06-basic-declarations-and-definitions.html#value-declarations-and-definitions) of type $T$.
- `##` returns ``0``.
A reference to any other member of the ``null'' object causes a
@@ -113,14 +113,14 @@ A designator refers to a named term. It can be a _simple name_ or
a _selection_.
A simple name $x$ refers to a value as specified
-[here](#identifiers-names-and-scopes).
+[here](04-identifiers-names-and-scopes.html#identifiers-names-and-scopes).
If $x$ is bound by a definition or declaration in an enclosing class
or object $C$, it is taken to be equivalent to the selection
`$C$.this.$x$` where $C$ is taken to refer to the class containing $x$
-even if the type name $C$ is [shadowed](#identifiers-names-and-scopes) at the
+even if the type name $C$ is [shadowed](04-identifiers-names-and-scopes.html#identifiers-names-and-scopes) at the
occurrence of $x$.
-If $r$ is a [stable identifier](#paths) of type $T$, the selection $r.x$ refers
+If $r$ is a [stable identifier](05-types.html#paths) of type $T$, the selection $r.x$ refers
statically to a term member $m$ of $r$ that is identified in $T$ by
the name $x$.
@@ -134,8 +134,8 @@ $y$.
The expected type of a designator's prefix is always undefined. The
type of a designator is the type $T$ of the entity it refers to, with
-the following exception: The type of a [path](#paths) $p$
-which occurs in a context where a [stable type](#singleton-types)
+the following exception: The type of a [path](05-types.html#paths) $p$
+which occurs in a context where a [stable type](05-types.html#singleton-types)
is required is the singleton type `$p$.type`.
The contexts where a stable type is required are those that satisfy
@@ -310,7 +310,7 @@ and the argument passed to the function is `$y_i$()`.
The last argument in an application may be marked as a sequence
argument, e.g.\ `$e$: _*`. Such an argument must correspond
-to a [repeated parameter](#repeated-parameters) of type
+to a [repeated parameter](06-basic-declarations-and-definitions.html#repeated-parameters) of type
`$S$*` and it must be the only argument matching this
parameter (i.e.\ the number of formal parameters and actual arguments
must be the same). Furthermore, the type of $e$ must conform to
@@ -398,7 +398,7 @@ positional arguments and to $e'_i$ for named arguments of the form
`$x_i=e'_i$`. Then, for every parameter which is not specified
by the argument list, a value definition using a fresh name $z_i$ is created,
which is initialized using the method computing the
-[default argument](#function-declarations-and-definitions) of
+[default argument](06-basic-declarations-and-definitions.html#function-declarations-and-definitions) of
this parameter.
Let $\mathit{args}$ be a permutation of the generated names $y_i$ and $z_i$ such such
@@ -503,11 +503,11 @@ SimpleExpr ::= `new' (ClassTemplate | TemplateBody)
A simple instance creation expression is of the form
`new $c$`
-where $c$ is a [constructor invocation](#constructor-invocations). Let $T$ be
+where $c$ is a [constructor invocation](07-classes-and-objects.html#constructor-invocations). Let $T$ be
the type of $c$. Then $T$ must
denote a (a type instance of) a non-abstract subclass of
`scala.AnyRef`. Furthermore, the _concrete self type_ of the
-expression must conform to the [self type](#templates) of the class denoted by
+expression must conform to the [self type](07-classes-and-objects.html#templates) of the class denoted by
$T$. The concrete self type is normally
$T$, except if the expression `new $c$` appears as the
right hand side of a value definition
@@ -525,7 +525,7 @@ object of type $T$ which is is initialized by evaluating $c$. The
type of the expression is $T$.
A general instance creation expression is of the form
-`new $t$` for some [class template](#templates) $t$.
+`new $t$` for some [class template](07-classes-and-objects.html#templates) $t$.
Such an expression is equivalent to the block
```
@@ -584,7 +584,7 @@ undefined.
The type of a block `$s_1$; $\ldots$; $s_n$; $e$` is
`$T$ forSome {$\,Q\,$}`, where $T$ is the type of $e$ and $Q$
-contains [existential clauses](#existential-types)
+contains [existential clauses](05-types.html#existential-types)
for every value or type name which is free in $T$
and which is defined locally in one of the statements $s_1 , \ldots , s_n$.
We say the existential clause _binds_ the occurrence of the value or type name.
@@ -622,7 +622,7 @@ The block
{ class C extends B {$\ldots$} ; new C }
```
-simply has type `B`, because with the rules [here](#simplification-rules)
+simply has type `B`, because with the rules [here](05-types.html#simplification-rules)
the existentially quantified type
`_1 forSome { type _1 <: B }` can be simplified to `B`.
@@ -729,7 +729,7 @@ name.
### Assignment Operators
An assignment operator is an operator symbol (syntax category
-`op` in [Identifiers](#identifiers)) that ends in an equals character
+`op` in [Identifiers](03-lexical-syntax.html#identifiers)) that ends in an equals character
“`=`”, with the exception of operators for which one of
the following conditions holds:
@@ -789,7 +789,7 @@ Expr1 ::= PostfixExpr `:' Annotation {Annotation}
```
An annotated expression `$e$: @$a_1$ $\ldots$ @$a_n$`
-attaches [annotations](#user-defined-annotations) $a_1 , \ldots , a_n$ to the
+attaches [annotations](13-user-defined-annotations.html#user-defined-annotations) $a_1 , \ldots , a_n$ to the
expression $e$.
@@ -891,7 +891,7 @@ value of $e_1$. The condition $e_1$ is expected to
conform to type `Boolean`. The then-part $e_2$ and the
else-part $e_3$ are both expected to conform to the expected
type of the conditional expression. The type of the conditional
-expression is the [weak least upper bound](#weak-conformance)
+expression is the [weak least upper bound](05-types.html#weak-conformance)
of the types of $e_2$ and
$e_3$. A semicolon preceding the `else` symbol of a
conditional expression is ignored.
@@ -960,7 +960,7 @@ defined by translation to invocations of four methods: `map`,
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](#patterns)
+generator `$p$ <- $e$`, where $p$ is not [irrefutable](10-pattern-matching.html#patterns)
for the type of $e$ is replaced by
```
@@ -1166,7 +1166,7 @@ Let $\mathit{pt}$ be the expected type of the try expression. The block
$b$ is expected to conform to $\mathit{pt}$. The handler $h$
is expected conform to type
`scala.PartialFunction[scala.Throwable, $\mathit{pt}\,$]`. The
-type of the try expression is the [weak least upper bound](#weak-conformance)
+type of the try expression is the [weak least upper bound](05-types.html#weak-conformance)
of the type of $b$
and the result type of $h$.
@@ -1241,9 +1241,9 @@ In that case, a fresh name for the parameter is chosen arbitrarily.
A named parameter of an anonymous function may be optionally preceded
by an `implicit` modifier. In that case the parameter is
-labeled [`implicit`](#implicit-parameters-and-views); however the
+labeled [`implicit`](09-implicit-parameters-and-views.html#implicit-parameters-and-views); however the
parameter section itself does not count as an implicit parameter
-section in the sense defined [here](#implicit-parameters). Hence, arguments to
+section in the sense defined [here](09-implicit-parameters-and-views.html#implicit-parameters). Hence, arguments to
anonymous functions always have to be given explicitly.
###### Example
@@ -1314,13 +1314,13 @@ include at least the expressions of the following forms:
- A literal of a value class, such as an integer
- A string literal
-- A class constructed with [`Predef.classOf`](#the-predef-object)
+- A class constructed with [`Predef.classOf`](14-the-scala-standard-library.html#the-predef-object)
- An element of an enumeration from the underlying platform
- A literal array, of the form
`Array$(c_1 , \ldots , c_n)$`,
where all of the $c_i$'s are themselves constant expressions
- An identifier defined by a
- [constant value definition](#value-declarations-and-definitions).
+ [constant value definition](06-basic-declarations-and-definitions.html#value-declarations-and-definitions).
## Statements
@@ -1365,7 +1365,7 @@ available implicit conversions are given in the next two sub-sections.
We say, a type $T$ is _compatible_ to a type $U$ if $T$ weakly conforms
to $U$ after applying [eta-expansion](#eta-expansion) and
-[view applications](#views).
+[view applications](09-implicit-parameters-and-views.html#views).
### Value Conversions
@@ -1395,11 +1395,11 @@ implicitly embedding $e$ in the [type application](#type-applications)
`$e$[$T_1 , \ldots , T_n$]`.
_Numeric Widening_ \
-If $e$ has a primitive number type which [weakly conforms](#weak-conformance)
+If $e$ has a primitive number type which [weakly conforms](05-types.html#weak-conformance)
to the expected type, it is widened to
the expected type using one of the numeric conversion methods
`toShort`, `toChar`, `toInt`, `toLong`,
-`toFloat`, `toDouble` defined [here](#numeric-value-types).
+`toFloat`, `toDouble` defined [here](14-the-scala-standard-library.html#numeric-value-types).
_Numeric Literal Narrowing_ \
If the expected type is `Byte`, `Short` or `Char`, and
@@ -1414,7 +1414,7 @@ term `{ $e$; () }`.
_View Application_ \
If none of the previous conversions applies, and $e$'s type
does not conform to the expected type $\mathit{pt}$, it is attempted to convert
-$e$ to the expected type with a [view](#views).\bigskip
+$e$ to the expected type with a [view](09-implicit-parameters-and-views.html#views).\bigskip
_Dynamic Member Selection_ \
If none of the previous conversions applies, and $e$ is a prefix
@@ -1433,7 +1433,7 @@ type $T$ by evaluating the expression to which $m$ is bound.
_Implicit Application_ \
If the method takes only implicit parameters, implicit
- arguments are passed following the rules [here](#implicit-parameters).
+ arguments are passed following the rules [here](09-implicit-parameters-and-views.html#implicit-parameters).
_Eta Expansion_ \
Otherwise, if the method is not a constructor,
@@ -1610,7 +1610,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](#singleton-types)
+- None of inferred types $T_i$ is a [singleton type](05-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.\
@@ -1620,7 +1620,7 @@ It is a compile time error if no such substitution exists.
If several substitutions exist, local-type inference will choose for
each type variable $a_i$ a minimal or maximal type $T_i$ of the
solution space. A _maximal_ type $T_i$ will be chosen if the type
-parameter $a_i$ appears [contravariantly](#variance-annotations) in the
+parameter $a_i$ appears [contravariantly](06-basic-declarations-and-definitions.html#variance-annotations) in the
type $T$ of the expression. A _minimal_ type $T_i$ will be chosen
in all other situations, i.e.\ if the variable appears covariantly,
non-variantly or not at all in the type $T$. We call such a substitution
@@ -1647,12 +1647,12 @@ 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](#singleton-types)
+- None of inferred types $T_i$ is a [singleton type](05-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}$.
-- Each argument type [weakly conforms](#weak-conformance)
+- Each argument type [weakly conforms](05-types.html#weak-conformance)
to the corresponding formal parameter
type, i.e.\
$\sigma S_j <:_w \sigma R_j$ for $j = 1 , \ldots , m$.
@@ -1661,7 +1661,7 @@ It is a compile time error if no such substitution exists. If several
solutions exist, an optimal one for the type $T'$ is chosen.
All or parts of an expected type $\mathit{pt}$ may be undefined. The rules for
-[conformance](#conformance) are extended to this case by adding
+[conformance](05-types.html#conformance) are extended to this case by adding
the rule that for any type $T$ the following two statements are always
true: $\mathit{undefined} <: T$ and $T <: \mathit{undefined}$
diff --git a/09-implicit-parameters-and-views.md b/09-implicit-parameters-and-views.md
index 0dd81b89e8..6e662bf5f1 100644
--- a/09-implicit-parameters-and-views.md
+++ b/09-implicit-parameters-and-views.md
@@ -16,7 +16,7 @@ Template members and parameters labeled with an `implicit`
modifier can be passed to [implicit parameters](#implicit-parameters)
and can be used as implicit conversions called [views](#views).
The `implicit` modifier is illegal for all
-type members, as well as for [top-level objects](#packagings).
+type members, as well as for [top-level objects](11-top-level-definitions.html#packagings).
###### Example: `Monoid`
The following code defines an abstract class of monoids and
@@ -61,13 +61,13 @@ call without a prefix and that denote an
or an implicit parameter. An eligible
identifier may thus be a local name, or a member of an enclosing
template, or it may be have been made accessible without a prefix
-through an [import clause](#import-clauses). If there are no eligible
+through an [import clause](06-basic-declarations-and-definitions.html#import-clauses). If there are no eligible
identifiers under this rule, then, second, eligible are also all
`implicit` members of some object that belongs to the implicit
scope of the implicit parameter's type, $T$.
-The _implicit scope_ of a type $T$ consists of all [companion modules](#object-definitions) of classes that are associated with the implicit parameter's type.
-Here, we say a class $C$ is _associated_ with a type $T$ if it is a [base class](#class-linearization) of some part of $T$.
+The _implicit scope_ of a type $T$ consists of all [companion modules](07-classes-and-objects.html#object-definitions) of classes that are associated with the implicit parameter's type.
+Here, we say a class $C$ is _associated_ with a type $T$ if it is a [base class](07-classes-and-objects.html#class-linearization) of some part of $T$.
The _parts_ of a type $T$ are:
@@ -91,7 +91,7 @@ Thus, implicits defined in a package object are part of the implicit scope of a
If there are several eligible arguments which match the implicit
parameter's type, a most specific one will be chosen using the rules
-of static [overloading resolution](#overloading-resolution).
+of static [overloading resolution](08-expressions.html#overloading-resolution).
If the parameter has a default argument and no implicit argument can
be found the default argument is used.
@@ -118,7 +118,7 @@ be passed as implicit parameter.
This discussion also shows that implicit parameters are inferred after
-any type arguments are [inferred](#local-type-inference).
+any type arguments are [inferred](08-expressions.html#local-type-inference).
Implicit methods can themselves have implicit parameters. An example
is the following method from module `scala.List`, which injects
@@ -181,8 +181,8 @@ To prevent such infinite expansions, the compiler keeps track of
a stack of “open implicit types” for which implicit arguments are currently being
searched. Whenever an implicit argument for type $T$ is searched, the
“core type” of $T$ is added to the stack. Here, the _core type_
-of $T$ is $T$ with aliases expanded, top-level type [annotations](#user-defined-annotations) and
-[refinements](#compound-types) removed, and occurrences
+of $T$ is $T$ with aliases expanded, top-level type [annotations](13-user-defined-annotations.html#user-defined-annotations) and
+[refinements](05-types.html#compound-types) removed, and occurrences
of top-level existentially bound variables replaced by their upper
bounds. The core type is removed from the stack once the search for
the implicit argument either definitely fails or succeeds. Everytime a
@@ -190,7 +190,7 @@ core type is added to the stack, it is checked that this type does not
dominate any of the other types in the set.
Here, a core type $T$ _dominates_ a type $U$ if $T$ is
-[equivalent](#type-equivalence)
+[equivalent](05-types.html#type-equivalence)
to $U$, or if the top-level type constructors of $T$ and $U$ have a
common element and $T$ is more complex than $U$.
@@ -434,7 +434,7 @@ Then the following rules apply.
`Manifest.intersectionType[T]($ms$)` where $ms$ are the manifests
determined for $M[T_1] , \ldots , M[T_n]$.
Otherwise, if $M$ is trait `ClassManifest`,
- then a manifest is generated for the [intersection dominator](#type-erasure)
+ then a manifest is generated for the [intersection dominator](05-types.html#type-erasure)
of the types $T_1 , \ldots , T_n$.
1. If $T$ is some other type, then if $M$ is trait `OptManifest`,
a manifest is generated from the designator `scala.reflect.NoManifest`.
diff --git a/10-pattern-matching.md b/10-pattern-matching.md
index c9c4a733c2..9496ab6300 100644
--- a/10-pattern-matching.md
+++ b/10-pattern-matching.md
@@ -108,10 +108,10 @@ expected type of the pattern.
SimplePattern ::= StableId
```
-A stable identifier pattern is a [stable identifier](#paths) $r$.
+A stable identifier pattern is a [stable identifier](05-types.html#paths) $r$.
The type of $r$ must conform to the expected
type of the pattern. The pattern matches any value $v$ such that
-`$r$ == $v$` (see [here](#root-classes)).
+`$r$ == $v$` (see [here](14-the-scala-standard-library.html#root-classes)).
To resolve the syntactic overlap with a variable pattern, a
stable identifier pattern may not be a simple name starting with a lower-case
@@ -150,10 +150,10 @@ SimplePattern ::= StableId `(' [Patterns] `)
A constructor pattern is of the form $c(p_1 , \ldots , p_n)$ where $n
\geq 0$. It consists of a stable identifier $c$, followed by element
patterns $p_1 , \ldots , p_n$. The constructor $c$ is a simple or
-qualified name which denotes a [case class](#case-classes).
+qualified name which denotes a [case class](07-classes-and-objects.html#case-classes).
If the case class is monomorphic, then it
must conform to the expected type of the pattern, and the formal
-parameter types of $x$'s [primary constructor](#class-definitions)
+parameter types of $x$'s [primary constructor](07-classes-and-objects.html#class-definitions)
are taken as the expected types of the element patterns $p_1, \ldots ,
p_n$. If the case class is polymorphic, then its type parameters are
instantiated so that the instantiation of $c$ conforms to the expected
@@ -245,7 +245,7 @@ SimplePattern ::= StableId `(' [Patterns `,'] [varid `@'] `_' `*' `)'
```
A pattern sequence $p_1 , \ldots , p_n$ appears in two contexts.
-First, in a constructor pattern $c(q_1 , \ldots , q_m, p_1 , \ldots , p_n)$, where $c$ is a case class which has $m+1$ primary constructor parameters, ending in a [repeated parameter](#repeated-parameters) of type $S*$.
+First, in a constructor pattern $c(q_1 , \ldots , q_m, p_1 , \ldots , p_n)$, where $c$ is a case class which has $m+1$ primary constructor parameters, ending in a [repeated parameter](06-basic-declarations-and-definitions.html#repeated-parameters) of type $S*$.
Second, in an extractor pattern $x(q_1 , \ldots , q_m, p_1 , \ldots , p_n)$ if the extractor object $x$ does not have an `unapply` method,
but it does define an `unapplySeq` method with a result type conforming to `Option[(T_1, ... , T_m, Seq[S])]` (if `m = 0`, the type `Option[Seq[S]]` is also accepted). The expected type for the patterns $p_i$ is $S$.
@@ -268,7 +268,7 @@ p_n$.
An infix operation pattern $p;\mathit{op};q$ is a shorthand for the
constructor or extractor pattern $\mathit{op}(p, q)$. The precedence and
associativity of operators in patterns is the same as in
-[expressions](#prefix-infix-and-postfix-operations).
+[expressions](08-expressions.html#prefix-infix-and-postfix-operations).
An infix operation pattern $p;\mathit{op};(q_1 , \ldots , q_n)$ is a
shorthand for the constructor or extractor pattern $\mathit{op}(p, q_1
@@ -288,7 +288,7 @@ matches a value $v$ if at least one its alternatives matches $v$.
### XML Patterns
-XML patterns are treated [here](#xml-patterns).
+XML patterns are treated [here](12-xml-expressions-and-patterns.html#xml-patterns).
### Regular Expression Patterns
@@ -313,7 +313,7 @@ A pattern $p$ is _irrefutable_ for a type $T$, if one of the following applies:
1. $p$ is a variable pattern,
1. $p$ is a typed pattern $x: T'$, and $T <: T'$,
1. $p$ is a constructor pattern $c(p_1 , \ldots , p_n)$, the type $T$
- is an instance of class $c$, the [primary constructor](#class-definitions)
+ is an instance of class $c$, the [primary constructor](07-classes-and-objects.html#class-definitions)
of type $T$ has argument types $T_1 , \ldots , T_n$, and each $p_i$ is
irrefutable for $T_i$.
@@ -358,7 +358,7 @@ A type pattern $T$ is of one of the following forms:
Types which are not of one of the forms described above are also
accepted as type patterns. However, such type patterns will be translated to their
-[erasure](#type-erasure). The Scala
+[erasure](05-types.html#type-erasure). The Scala
compiler will issue an ``unchecked'' warning for these patterns to
flag the possible loss of type-safety.
@@ -491,7 +491,7 @@ x match {
Scala does not maintain information about type arguments at run-time,
so there is no way to check that `x` is a list of strings.
-Instead, the Scala compiler will [erase](#type-erasure) the
+Instead, the Scala compiler will [erase](05-types.html#type-erasure) the
pattern to `List[_]`; that is, it will only test whether the
top-level runtime-class of the value `x` conforms to
`List`, and the pattern match will succeed if it does. This
@@ -570,7 +570,7 @@ instead of $L_i$ and has upper bound $U'_i$ instead of $U_i$.
The expected type of every block $b_i$ is the expected type of the
whole pattern matching expression. The type of the pattern matching
-expression is then the [weak least upper bound](#weak-conformance)
+expression is then the [weak least upper bound](05-types.html#weak-conformance)
of the types of all blocks
$b_i$.
@@ -598,7 +598,7 @@ side effects in guards. However, it is guaranteed that a guard
expression is evaluated only if the pattern it guards matches.
If the selector of a pattern match is an instance of a
-[`sealed` class](#modifiers),
+[`sealed` class](07-classes-and-objects.html#modifiers),
the compilation of pattern matching can emit warnings which diagnose
that a given set of patterns is not exhaustive, i.e.\ that there is a
possibility of a `MatchError` being raised at run-time.
@@ -673,7 +673,7 @@ the expression is taken to be equivalent to the anonymous function:
```
Here, each $x_i$ is a fresh name.
-As was shown [here](#anonymous-functions), this anonymous function is in turn
+As was shown [here](08-expressions.html#anonymous-functions), this anonymous function is in turn
equivalent to the following instance creation expression, where
$T$ is the weak least upper bound of the types of all $b_i$.
diff --git a/11-top-level-definitions.md b/11-top-level-definitions.md
index eb379add6a..8d08081262 100644
--- a/11-top-level-definitions.md
+++ b/11-top-level-definitions.md
@@ -46,7 +46,7 @@ package $p_1$ { $\ldots$
Every compilation unit implicitly imports the following packages, in the given order:
1. the package `java.lang`,
2. the package `scala`, and
- 3. the object [`scala.Predef`](#the-predef-object), unless there is an explicit top-level import that references `scala.Predef`.
+ 3. the object [`scala.Predef`](14-the-scala-standard-library.html#the-predef-object), unless there is an explicit top-level import that references `scala.Predef`.
Members of a later import in that order hide members of an earlier import.
diff --git a/12-xml-expressions-and-patterns.md b/12-xml-expressions-and-patterns.md
index 78bd602d85..5290e9e6c5 100644
--- a/12-xml-expressions-and-patterns.md
+++ b/12-xml-expressions-and-patterns.md
@@ -15,7 +15,7 @@ changes being mandated by the possibility of embedding Scala code fragments.
XML expressions are expressions generated by the following production, where the
opening bracket `<` of the first element must be in a position to start the lexical
-[XML mode](#xml-mode).
+[XML mode](03-lexical-syntax.html#xml-mode).
```
XmlExpr ::= XmlContent {Element}
@@ -106,7 +106,7 @@ XNameStart ::= ‘_’ | BaseChar | Ideographic
XML patterns are patterns generated by the following production, where
the opening bracket `<` of the element patterns must be in a position
-to start the lexical [XML mode](#xml-mode).
+to start the lexical [XML mode](03-lexical-syntax.html#xml-mode).
```
XmlPattern ::= ElementPattern
@@ -118,7 +118,7 @@ An XML pattern has to be a single element pattern. It
matches exactly those runtime
representations of an XML tree
that have the same structure as described by the pattern.
-XML patterns may contain [Scala patterns](#pattern-matching-expressions).
+XML patterns may contain [Scala patterns](10-pattern-matching.html#pattern-matching-expressions).
Whitespace is treated the same way as in XML expressions.
diff --git a/13-user-defined-annotations.md b/13-user-defined-annotations.md
index e8c35fdba3..46d3f26bfc 100644
--- a/13-user-defined-annotations.md
+++ b/13-user-defined-annotations.md
@@ -114,7 +114,7 @@ Java platform, the following annotations have a standard meaning.
* `@uncheckedStable` \
When applied a value declaration or definition, it allows the defined
- value to appear in a path, even if its type is [volatile](#volatile-types).
+ value to appear in a path, even if its type is [volatile](05-types.html#volatile-types).
For instance, the following member definitions are legal:
```
diff --git a/14-the-scala-standard-library.md b/14-the-scala-standard-library.md
index 95904a4c12..066fdb1570 100644
--- a/14-the-scala-standard-library.md
+++ b/14-the-scala-standard-library.md
@@ -140,12 +140,12 @@ Byte - Short
`Byte` and `Short` are the lowest-ranked types in this order,
whereas `Double` is the highest-ranked. Ranking does _not_
-imply a [conformance relationship](#conformance); for
+imply a [conformance relationship](05-types.html#conformance); for
instance `Int` is not a subtype of `Long`. However, object
-[`Predef`](#the-predef-object) defines [views](#views)
+[`Predef`](#the-predef-object) defines [views](09-implicit-parameters-and-views.html#views)
from every numeric value type to all higher-ranked numeric value types.
Therefore, lower-ranked types are implicitly converted to higher-ranked types
-when required by the [context](#implicit-conversions).
+when required by the [context](08-expressions.html#implicit-conversions).
Given two numeric value types $S$ and $T$, the _operation type_ of
$S$ and $T$ is defined as follows: If both $S$ and $T$ are subrange
@@ -471,7 +471,7 @@ val ys: Array[Object] = xs.asInstanceOf[Array[Object]] // OK
The instantiation of an array with a polymorphic element type $T$ requires
information about type $T$ at runtime.
-This information is synthesized by adding a [context bound](#context-bounds-and-view-bounds)
+This information is synthesized by adding a [context bound](09-implicit-parameters-and-views.html#context-bounds-and-view-bounds)
of `scala.reflect.ClassTag` to type $T$.
An example is the
following implementation of method `mkArray`, which creates
@@ -502,7 +502,7 @@ will return a primitive array of `int`s, written as `int[]` in Java.
`Array`'s companion object provides various factory methods for the
instantiation of single- and multi-dimensional arrays, an extractor method
-[`unapplySeq`](#extractor-patterns) which enables pattern matching
+[`unapplySeq`](10-pattern-matching.html#extractor-patterns) which enables pattern matching
over arrays and additional utility methods:
```
@@ -763,7 +763,7 @@ object Predef {
The `Predef` object also contains a number of implicit definitions, which are available by default (because `Predef` is implicitly imported).
Implicit definitions come in two priorities. High-priority implicits are defined in the `Predef` class itself whereas low priority implicits are defined in a class inherited by `Predef`. The rules of
-static [overloading resolution](#overloading-resolution)
+static [overloading resolution](08-expressions.html#overloading-resolution)
stipulate that, all other things being equal, implicit resolution
prefers high-priority implicits over low-priority ones.